geomerative 0.4.3-java → 1.0.2-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -125,7 +125,6 @@ public class RPath extends RGeomElem {
125
125
  lastPoint = commands[i].endPoint;
126
126
  }
127
127
  }
128
-
129
128
  closed = s.closed;
130
129
  setStyle(s);
131
130
  }
@@ -18,11 +18,7 @@
18
18
  */
19
19
  package geomerative;
20
20
 
21
- //import processing.core.*;
22
-
23
- import processing.core.PApplet;
24
- import processing.core.PGraphics;
25
-
21
+ import processing.core.*;
26
22
 
27
23
  /**
28
24
  * RPolygon is a reduced interface for creating, holding and drawing complex
@@ -61,7 +57,7 @@ public class RPolygon extends RGeomElem {
61
57
  public RContour[] contours;
62
58
  int currentContour = 0;
63
59
 
64
- // ----------------------
60
+ // ----------------------
65
61
  // --- Public Methods ---
66
62
  // ----------------------
67
63
  /**
@@ -126,8 +122,8 @@ public class RPolygon extends RGeomElem {
126
122
  double radiansPerStep = 2 * Math.PI / detail;
127
123
  for (int i = 0; i < detail; i++) {
128
124
  points[i] = new RPoint(
129
- radius * Math.cos(i * radiansPerStep) + x,
130
- radius * Math.sin(i * radiansPerStep) + y
125
+ radius * Math.cos(i * radiansPerStep) + x,
126
+ radius * Math.sin(i * radiansPerStep) + y
131
127
  );
132
128
  }
133
129
  return new RPolygon(points);
@@ -186,12 +182,12 @@ public class RPolygon extends RGeomElem {
186
182
  double radiansPerStep = Math.PI / spikes;
187
183
  for (int i = 0; i < numPoints; i += 2) {
188
184
  points[i] = new RPoint(
189
- radiusBig * Math.cos(i * radiansPerStep) + x,
190
- radiusBig * Math.sin(i * radiansPerStep) + y
185
+ radiusBig * Math.cos(i * radiansPerStep) + x,
186
+ radiusBig * Math.sin(i * radiansPerStep) + y
191
187
  );
192
188
  points[i + 1] = new RPoint(
193
- radiusSmall * Math.cos(i * radiansPerStep) + x,
194
- radiusSmall * Math.sin(i * radiansPerStep) + y
189
+ radiusSmall * Math.cos(i * radiansPerStep) + x,
190
+ radiusSmall * Math.sin(i * radiansPerStep) + y
195
191
  );
196
192
  }
197
193
  return new RPolygon(points);
@@ -218,12 +214,12 @@ public class RPolygon extends RGeomElem {
218
214
  double radiansPerStep = 2 * Math.PI / detail;
219
215
  for (int i = 0; i < detail; i++) {
220
216
  inner[i] = new RPoint(
221
- radiusSmall * Math.cos(i * radiansPerStep) + x,
222
- radiusSmall * Math.sin(i * radiansPerStep) + y
217
+ radiusSmall * Math.cos(i * radiansPerStep) + x,
218
+ radiusSmall * Math.sin(i * radiansPerStep) + y
223
219
  );
224
220
  outer[i] = new RPoint(
225
- radiusBig * Math.cos(i * radiansPerStep) + x,
226
- radiusBig * Math.sin(i * radiansPerStep) + y
221
+ radiusBig * Math.cos(i * radiansPerStep) + x,
222
+ radiusBig * Math.sin(i * radiansPerStep) + y
227
223
  );
228
224
  }
229
225
  RPolygon ring = new RPolygon();
@@ -440,7 +436,7 @@ public class RPolygon extends RGeomElem {
440
436
  * points to form a triangle at least. This is useful to avoid the clipping
441
437
  * algorithm from breaking.
442
438
  *
443
- * @return
439
+ * @return
444
440
  * @invisible
445
441
  */
446
442
  protected RPolygon removeOpenContours() {
@@ -455,7 +451,8 @@ public class RPolygon extends RGeomElem {
455
451
  }
456
452
 
457
453
  /**
458
- * @return @invisible
454
+ * @return
455
+ * @invisible
459
456
  */
460
457
  @Override
461
458
  public RPolygon toPolygon() {
@@ -463,7 +460,8 @@ public class RPolygon extends RGeomElem {
463
460
  }
464
461
 
465
462
  /**
466
- * @return @invisible
463
+ * @return
464
+ * @invisible
467
465
  */
468
466
  @Override
469
467
  public RShape toShape() {
@@ -508,7 +506,7 @@ public class RPolygon extends RGeomElem {
508
506
  }
509
507
 
510
508
  RPoint[] result = null;
511
- RPoint[] newresult;
509
+ RPoint[] newresult = null;
512
510
  for (int i = 0; i < numContours; i++) {
513
511
  RPoint[] newPoints = contours[i].getHandles();
514
512
  if (newPoints != null) {
@@ -542,7 +540,7 @@ public class RPolygon extends RGeomElem {
542
540
  }
543
541
 
544
542
  RPoint[] result = null;
545
- RPoint[] newresult;
543
+ RPoint[] newresult = null;
546
544
  for (int i = 0; i < numContours; i++) {
547
545
  RPoint[] newPoints = contours[i].getPoints();
548
546
  if (newPoints != null) {
@@ -566,7 +564,6 @@ public class RPolygon extends RGeomElem {
566
564
  * @eexample RPolygon_getType
567
565
  * @return int, will allways return RGeomElem.POLYGON
568
566
  */
569
- @Override
570
567
  public int getType() {
571
568
  return type;
572
569
  }
@@ -617,19 +614,19 @@ public class RPolygon extends RGeomElem {
617
614
 
618
615
  // Check whether to draw the fill or not
619
616
  if (g.fill) {
620
- // Since we are drawing the different tristrips we must turn off the stroke or make it the same color as the fill
617
+ // Since we are drawing the different tristrips we must turn off the stroke or make it the same color as the fill
621
618
  // NOTE: there's currently no way of drawing the outline of a mesh, since no information is kept about what vertices are at the edge
622
619
 
623
620
  // Save the information about the current stroke color and turn off
624
621
  boolean stroking = g.stroke;
625
622
  g.noStroke();
626
623
 
627
- // Save smoothing state and turn off
628
- // boolean smoothing = g.smooth;
624
+ // Save smoothing state and turn off
625
+ int smoothing = g.smooth;
629
626
  try {
630
-
631
- g.noSmooth();
632
-
627
+ if (smoothing > 0) {
628
+ g.noSmooth();
629
+ }
633
630
  } catch (Exception e) {
634
631
  }
635
632
 
@@ -641,6 +638,13 @@ public class RPolygon extends RGeomElem {
641
638
  g.stroke(g.strokeColor);
642
639
  }
643
640
 
641
+ // Restore the old smoothing state
642
+ try {
643
+ if (smoothing > 0) {
644
+ g.smooth();
645
+ }
646
+ } catch (Exception e) {
647
+ }
644
648
  }
645
649
 
646
650
  // Check whether to draw the stroke or not
@@ -657,10 +661,6 @@ public class RPolygon extends RGeomElem {
657
661
  }
658
662
  }
659
663
 
660
- /**
661
- *
662
- * @param g
663
- */
664
664
  @Override
665
665
  public void draw(PApplet g) {
666
666
  int numContours = countContours();
@@ -673,13 +673,22 @@ public class RPolygon extends RGeomElem {
673
673
 
674
674
  // Check whether to draw the fill or not
675
675
  if (g.g.fill) {
676
- // Since we are drawing the different tristrips we must turn off the stroke or make it the same color as the fill
676
+ // Since we are drawing the different tristrips we must turn off the stroke or make it the same color as the fill
677
677
  // NOTE: there's currently no way of drawing the outline of a mesh, since no information is kept about what vertices are at the edge
678
678
 
679
679
  // Save the information about the current stroke color and turn off
680
680
  boolean stroking = g.g.stroke;
681
681
  g.noStroke();
682
682
 
683
+ // Save smoothing state and turn off
684
+ int smoothing = g.g.smooth;
685
+ try {
686
+ if (smoothing > 0) {
687
+ g.noSmooth();
688
+ }
689
+ } catch (Exception e) {
690
+ }
691
+
683
692
  RMesh tempMesh = this.toMesh();
684
693
  if (tempMesh != null) {
685
694
  tempMesh.draw(g);
@@ -690,6 +699,13 @@ public class RPolygon extends RGeomElem {
690
699
  g.stroke(g.g.strokeColor);
691
700
  }
692
701
 
702
+ // Restore the old smoothing state
703
+ try {
704
+ if (smoothing > 0) {
705
+ g.smooth();
706
+ }
707
+ } catch (Exception e) {
708
+ }
693
709
  }
694
710
 
695
711
  // Check whether to draws the stroke or not
@@ -795,11 +811,6 @@ public class RPolygon extends RGeomElem {
795
811
  return null;
796
812
  }
797
813
 
798
- /**
799
- *
800
- * @param t
801
- * @return
802
- */
803
814
  @Override
804
815
  public RPoint getTangent(float t) {
805
816
  PApplet.println("Feature not yet implemented for this class.");
@@ -816,10 +827,6 @@ public class RPolygon extends RGeomElem {
816
827
  return null;
817
828
  }
818
829
 
819
- /**
820
- *
821
- * @return
822
- */
823
830
  @Override
824
831
  public RPoint[][] getPointsInPaths() {
825
832
  PApplet.println("Feature not yet implemented for this class.");
@@ -852,16 +859,16 @@ public class RPolygon extends RGeomElem {
852
859
  * polygon
853
860
  */
854
861
  /*
855
- public void transform(RMatrix m){
856
- int numContours = countContours();
857
- if(numContours!=0){
858
- for(int i=0;i<numContours;i++){
859
- contours[i].transform(m);
860
- }
861
- }
862
- }
862
+ public void transform(RMatrix m){
863
+ int numContours = countContours();
864
+ if(numContours!=0){
865
+ for(int i=0;i<numContours;i++){
866
+ contours[i].transform(m);
867
+ }
868
+ }
869
+ }
863
870
  */
864
- // ----------------------
871
+ // ----------------------
865
872
  // --- Private Methods ---
866
873
  // ----------------------
867
874
  /**
@@ -873,7 +880,6 @@ public class RPolygon extends RGeomElem {
873
880
 
874
881
  /**
875
882
  * Add a point to the first inner polygon.
876
- *
877
883
  * @param x
878
884
  * @param y
879
885
  */
@@ -886,7 +892,6 @@ public class RPolygon extends RGeomElem {
886
892
 
887
893
  /**
888
894
  * Add a point to the first inner polygon.
889
- *
890
895
  * @param p
891
896
  */
892
897
  protected void add(RPoint p) {
@@ -899,13 +904,12 @@ public class RPolygon extends RGeomElem {
899
904
  /**
900
905
  * Add an inner polygon to this polygon - assumes that adding polygon does
901
906
  * not have any inner polygons.
902
- *
903
907
  * @param p
904
908
  */
905
909
  protected void add(RPolygon p) {
906
910
  /*if (this.contours.length > 0 && this.isHole){
907
- throw new IllegalStateException("Cannot add polys to something designated as a hole.");
908
- }*/
911
+ throw new IllegalStateException("Cannot add polys to something designated as a hole.");
912
+ }*/
909
913
  RContour c = new RContour();
910
914
  for (int i = 0; i < p.getNumPoints(); i++) {
911
915
  c.addPoint(p.getX(i), p.getY(i));
@@ -916,20 +920,18 @@ public class RPolygon extends RGeomElem {
916
920
  /**
917
921
  * Add an inner polygon to this polygon - assumes that adding polygon does
918
922
  * not have any inner polygons.
919
- *
920
923
  * @param c
921
924
  */
922
925
  protected void add(RContour c) {
923
926
  /*if (this.contours.length > 0 && this.isHole){
924
- throw new IllegalStateException("Cannot add polys to something designated as a hole.");
925
- }*/
927
+ throw new IllegalStateException("Cannot add polys to something designated as a hole.");
928
+ }*/
926
929
  this.append(c);
927
930
  }
928
931
 
929
932
  /**
930
933
  * Return true if the polygon is empty
931
- *
932
- * @return
934
+ * @return
933
935
  */
934
936
  protected boolean isEmpty() {
935
937
  return (this.contours == null);
@@ -937,8 +939,7 @@ public class RPolygon extends RGeomElem {
937
939
 
938
940
  /**
939
941
  * Returns the bounding box of the polygon.
940
- *
941
- * @return
942
+ * @return
942
943
  */
943
944
  protected RRectangle getBBox() {
944
945
  if (this.contours == null) {
@@ -979,9 +980,8 @@ public class RPolygon extends RGeomElem {
979
980
 
980
981
  /**
981
982
  * Returns the polygon at this index.
982
- *
983
983
  * @param polyIndex
984
- * @return
984
+ * @return
985
985
  */
986
986
  protected RPolygon getInnerPoly(int polyIndex) {
987
987
  return new RPolygon(this.contours[polyIndex]);
@@ -990,8 +990,7 @@ public class RPolygon extends RGeomElem {
990
990
  /**
991
991
  * Returns the number of inner polygons - inner polygons are assumed to
992
992
  * return one here.
993
- *
994
- * @return
993
+ * @return
995
994
  */
996
995
  protected int getNumInnerPoly() {
997
996
  if (this.contours == null) {
@@ -1002,8 +1001,7 @@ public class RPolygon extends RGeomElem {
1002
1001
 
1003
1002
  /**
1004
1003
  * Return the number points of the first inner polygon
1005
- *
1006
- * @return
1004
+ * @return
1007
1005
  */
1008
1006
  protected int getNumPoints() {
1009
1007
  if (this.contours == null) {
@@ -1017,9 +1015,8 @@ public class RPolygon extends RGeomElem {
1017
1015
 
1018
1016
  /**
1019
1017
  * Return the X value of the point at the index in the first inner polygon
1020
- *
1021
1018
  * @param index
1022
- * @return
1019
+ * @return
1023
1020
  */
1024
1021
  protected float getX(int index) {
1025
1022
  if (this.contours == null) {
@@ -1030,9 +1027,8 @@ public class RPolygon extends RGeomElem {
1030
1027
 
1031
1028
  /**
1032
1029
  * Return the Y value of the point at the index in the first inner polygon
1033
- *
1034
1030
  * @param index
1035
- * @return
1031
+ * @return
1036
1032
  */
1037
1033
  protected float getY(int index) {
1038
1034
  if (this.contours == null) {
@@ -1045,7 +1041,7 @@ public class RPolygon extends RGeomElem {
1045
1041
  * Return true if this polygon is a hole. Holes are assumed to be inner
1046
1042
  * polygons of a more complex polygon.
1047
1043
  *
1048
- * @return
1044
+ * @return
1049
1045
  * @throws IllegalStateException if called on a complex polygon.
1050
1046
  */
1051
1047
  public boolean isHole() {
@@ -1072,9 +1068,8 @@ public class RPolygon extends RGeomElem {
1072
1068
  /**
1073
1069
  * Return true if the given inner polygon is contributing to the set
1074
1070
  * operation. This method should NOT be used outside the Clip algorithm.
1075
- *
1076
1071
  * @param polyIndex
1077
- * @return
1072
+ * @return
1078
1073
  */
1079
1074
  protected boolean isContributing(int polyIndex) {
1080
1075
  return this.contours[polyIndex].isContributing;
@@ -1083,16 +1078,15 @@ public class RPolygon extends RGeomElem {
1083
1078
  /**
1084
1079
  * Set whether or not this inner polygon is constributing to the set
1085
1080
  * operation. This method should NOT be used outside the Clip algorithm.
1086
- *
1087
1081
  * @param polyIndex
1088
1082
  * @param contributes
1089
1083
  */
1090
1084
  protected void setContributing(int polyIndex, boolean contributes) {
1091
1085
  /*
1092
- if( this.contours.length != 1 )
1093
- {
1094
- throw new IllegalStateException( "Only applies to polys of size 1" );
1095
- }
1086
+ if( this.contours.length != 1 )
1087
+ {
1088
+ throw new IllegalStateException( "Only applies to polys of size 1" );
1089
+ }
1096
1090
  */
1097
1091
  this.contours[polyIndex].isContributing = contributes;
1098
1092
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geomerative
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 1.0.2
5
5
  platform: java
6
6
  authors:
7
7
  - Ricard Marxer
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-04-26 00:00:00.000000000 Z
12
+ date: 2018-05-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '12'
20
+ version: '12.3'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '12'
27
+ version: '12.3'
28
28
  description: |2
29
29
  Geomerative java library wrapped in a rubygem. Updated to use String switch
30
30
  etc available since jdk8.
@@ -46,7 +46,6 @@ files:
46
46
  - LICENSE.md
47
47
  - README.md
48
48
  - Rakefile
49
- - calculate_torsional_angle.rb
50
49
  - docs/.gitignore
51
50
  - docs/_config.yml
52
51
  - docs/_includes/footer.html
@@ -56,6 +55,7 @@ files:
56
55
  - docs/_includes/icon-github.svg
57
56
  - docs/_includes/icon-twitter.html
58
57
  - docs/_includes/icon-twitter.svg
58
+ - docs/_includes/navigation.html
59
59
  - docs/_layouts/default.html
60
60
  - docs/_layouts/page.html
61
61
  - docs/_layouts/post.html
@@ -88,12 +88,12 @@ files:
88
88
  - examples/data/bot1.svg
89
89
  - examples/data/lion.svg
90
90
  - examples/data/ruby.svg
91
- - examples/f_agent.rb
92
- - examples/font_agent.rb
93
91
  - examples/hello_polygonize.rb
94
92
  - examples/hello_svg_to_pdf.rb
95
93
  - examples/hello_world.rb
96
94
  - examples/jruby_merge.rb
95
+ - examples/library/f_agent/f_agent.rb
96
+ - examples/library/font_agent/font_agent.rb
97
97
  - examples/physics_type.rb
98
98
  - examples/rotate_first_letter.rb
99
99
  - examples/text_on_geomerative_path.rb
@@ -218,10 +218,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
218
218
  requirements:
219
219
  - A decent graphics card
220
220
  - java runtime >= 1.8+
221
- - processing = 3.3.2+
222
- - jruby_art = 1.2+
221
+ - processing = 3.3.7+
223
222
  rubyforge_project:
224
- rubygems_version: 2.6.11
223
+ rubygems_version: 2.7.6
225
224
  signing_key:
226
225
  specification_version: 4
227
226
  summary: Updated geomerative library for JRubyArt