geomerative 0.4.3-java → 2.1.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +2 -0
- data/.mvn/extensions.xml +1 -1
- data/.mvn/wrapper/maven-wrapper.properties +1 -1
- data/CHANGELOG.md +19 -1
- data/COPYING.md +1 -1
- data/README.md +2 -2
- data/Rakefile +2 -15
- data/docs/_config.yml +8 -0
- data/docs/_includes/head.html +7 -6
- data/docs/_includes/header.html +6 -6
- data/docs/_includes/icon-github.svg +3 -1
- data/docs/_includes/icon-twitter.svg +3 -1
- data/docs/_includes/navigation.html +24 -0
- data/docs/_sass/_base.scss +79 -79
- data/docs/_sass/_layout.scss +137 -137
- data/docs/_sass/_syntax-highlighting.scss +64 -64
- data/docs/index.html +18 -18
- data/examples/README.md +1 -1
- data/examples/data/bot1.svg +1 -1
- data/examples/data/lion.svg +156 -156
- data/examples/data/ruby.svg +1 -1
- data/examples/jruby_merge.rb +1 -1
- data/examples/{f_agent.rb → library/f_agent/f_agent.rb} +0 -0
- data/examples/{font_agent.rb → library/font_agent/font_agent.rb} +2 -1
- data/examples/text_on_geomerative_path.rb +3 -2
- data/examples/typo_deform.rb +2 -2
- data/examples/typo_extra_bright.rb +1 -1
- data/geomerative.gemspec +3 -6
- data/lib/geomerative/version.rb +1 -1
- data/lib/geomerative.jar +0 -0
- data/lib/geomerative.rb +10 -10
- data/mvnw +234 -0
- data/mvnw.cmd +145 -0
- data/pom.rb +14 -16
- data/pom.xml +13 -19
- data/src/geomerative/FastRClip.java +2050 -2334
- data/src/geomerative/RClip.java +2237 -2539
- data/src/geomerative/RClosest.java +33 -31
- data/src/geomerative/RCommand.java +1750 -1758
- data/src/geomerative/RContour.java +290 -292
- data/src/geomerative/RFont.java +277 -246
- data/src/geomerative/RG.java +722 -727
- data/src/geomerative/RGeomElem.java +967 -962
- data/src/geomerative/RGroup.java +508 -467
- data/src/geomerative/RMatrix.java +304 -289
- data/src/geomerative/RMesh.java +241 -229
- data/src/geomerative/RPath.java +924 -926
- data/src/geomerative/RPoint.java +391 -391
- data/src/geomerative/RPolygon.java +1017 -1013
- data/src/geomerative/RRectangle.java +43 -52
- data/src/geomerative/RSVG.java +480 -516
- data/src/geomerative/RShape.java +1767 -1777
- data/src/geomerative/RStrip.java +173 -176
- data/src/geomerative/RStyle.java +197 -194
- data/src/module-info.java +4 -0
- data/src/org/apache/batik/svggen/font/Font.java +141 -142
- data/src/org/apache/batik/svggen/font/Glyph.java +102 -71
- data/src/org/apache/batik/svggen/font/Point.java +12 -12
- data/src/org/apache/batik/svggen/font/RandomAccessFileEmulator.java +14 -12
- data/src/org/apache/batik/svggen/font/table/ClassDef.java +12 -12
- data/src/org/apache/batik/svggen/font/table/ClassDefFormat1.java +27 -24
- data/src/org/apache/batik/svggen/font/table/ClassDefFormat2.java +20 -17
- data/src/org/apache/batik/svggen/font/table/CmapFormat.java +43 -43
- data/src/org/apache/batik/svggen/font/table/CmapFormat0.java +33 -26
- data/src/org/apache/batik/svggen/font/table/CmapFormat2.java +25 -20
- data/src/org/apache/batik/svggen/font/table/CmapFormat4.java +106 -96
- data/src/org/apache/batik/svggen/font/table/CmapFormat6.java +36 -32
- data/src/org/apache/batik/svggen/font/table/CmapIndexEntry.java +69 -49
- data/src/org/apache/batik/svggen/font/table/CmapTable.java +50 -50
- data/src/org/apache/batik/svggen/font/table/Coverage.java +19 -19
- data/src/org/apache/batik/svggen/font/table/CoverageFormat1.java +30 -27
- data/src/org/apache/batik/svggen/font/table/CoverageFormat2.java +26 -24
- data/src/org/apache/batik/svggen/font/table/CvtTable.java +16 -16
- data/src/org/apache/batik/svggen/font/table/Device.java +32 -32
- data/src/org/apache/batik/svggen/font/table/DirectoryEntry.java +39 -39
- data/src/org/apache/batik/svggen/font/table/Feature.java +26 -23
- data/src/org/apache/batik/svggen/font/table/FeatureList.java +37 -35
- data/src/org/apache/batik/svggen/font/table/FeatureRecord.java +22 -22
- data/src/org/apache/batik/svggen/font/table/FeatureTags.java +4 -3
- data/src/org/apache/batik/svggen/font/table/FpgmTable.java +9 -9
- data/src/org/apache/batik/svggen/font/table/GlyfCompositeComp.java +134 -132
- data/src/org/apache/batik/svggen/font/table/GlyfCompositeDescript.java +123 -122
- data/src/org/apache/batik/svggen/font/table/GlyfDescript.java +44 -44
- data/src/org/apache/batik/svggen/font/table/GlyfSimpleDescript.java +110 -109
- data/src/org/apache/batik/svggen/font/table/GlyfTable.java +46 -46
- data/src/org/apache/batik/svggen/font/table/GlyphDescription.java +25 -13
- data/src/org/apache/batik/svggen/font/table/GposTable.java +26 -23
- data/src/org/apache/batik/svggen/font/table/GsubTable.java +85 -82
- data/src/org/apache/batik/svggen/font/table/HeadTable.java +131 -131
- data/src/org/apache/batik/svggen/font/table/HheaTable.java +80 -80
- data/src/org/apache/batik/svggen/font/table/HmtxTable.java +50 -49
- data/src/org/apache/batik/svggen/font/table/KernSubtable.java +29 -27
- data/src/org/apache/batik/svggen/font/table/KernSubtableFormat0.java +35 -32
- data/src/org/apache/batik/svggen/font/table/KernSubtableFormat2.java +28 -26
- data/src/org/apache/batik/svggen/font/table/KernTable.java +36 -31
- data/src/org/apache/batik/svggen/font/table/KerningPair.java +27 -23
- data/src/org/apache/batik/svggen/font/table/LangSys.java +28 -26
- data/src/org/apache/batik/svggen/font/table/LangSysRecord.java +22 -22
- data/src/org/apache/batik/svggen/font/table/Ligature.java +24 -24
- data/src/org/apache/batik/svggen/font/table/LigatureSet.java +24 -24
- data/src/org/apache/batik/svggen/font/table/LigatureSubst.java +9 -9
- data/src/org/apache/batik/svggen/font/table/LigatureSubstFormat1.java +30 -30
- data/src/org/apache/batik/svggen/font/table/LocaTable.java +37 -37
- data/src/org/apache/batik/svggen/font/table/Lookup.java +41 -40
- data/src/org/apache/batik/svggen/font/table/LookupList.java +34 -34
- data/src/org/apache/batik/svggen/font/table/LookupSubtableFactory.java +7 -5
- data/src/org/apache/batik/svggen/font/table/MaxpTable.java +96 -96
- data/src/org/apache/batik/svggen/font/table/NameRecord.java +64 -65
- data/src/org/apache/batik/svggen/font/table/NameTable.java +33 -33
- data/src/org/apache/batik/svggen/font/table/Os2Table.java +196 -196
- data/src/org/apache/batik/svggen/font/table/Panose.java +14 -12
- data/src/org/apache/batik/svggen/font/table/PostTable.java +338 -338
- data/src/org/apache/batik/svggen/font/table/PrepTable.java +9 -9
- data/src/org/apache/batik/svggen/font/table/Program.java +15 -15
- data/src/org/apache/batik/svggen/font/table/RangeRecord.java +26 -25
- data/src/org/apache/batik/svggen/font/table/Script.java +38 -38
- data/src/org/apache/batik/svggen/font/table/ScriptList.java +42 -42
- data/src/org/apache/batik/svggen/font/table/ScriptRecord.java +22 -22
- data/src/org/apache/batik/svggen/font/table/ScriptTags.java +2 -1
- data/src/org/apache/batik/svggen/font/table/SingleSubst.java +15 -16
- data/src/org/apache/batik/svggen/font/table/SingleSubstFormat1.java +33 -33
- data/src/org/apache/batik/svggen/font/table/SingleSubstFormat2.java +32 -32
- data/src/org/apache/batik/svggen/font/table/Table.java +171 -170
- data/src/org/apache/batik/svggen/font/table/TableDirectory.java +55 -55
- data/src/org/apache/batik/svggen/font/table/TableFactory.java +92 -93
- metadata +18 -19
- data/.travis.yml +0 -10
- data/calculate_torsional_angle.rb +0 -17
data/src/geomerative/RStrip.java
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* Copyright 2004-2008 Ricard Marxer <email@ricardmarxer.com>
|
3
3
|
*
|
4
|
-
|
4
|
+
* This file is part of Geomerative.
|
5
5
|
*
|
6
6
|
* Geomerative is free software: you can redistribute it and/or modify it under
|
7
7
|
* the terms of the GNU General Public License as published by the Free Software
|
@@ -18,208 +18,205 @@
|
|
18
18
|
*/
|
19
19
|
package geomerative;
|
20
20
|
|
21
|
-
|
22
|
-
|
23
21
|
import processing.core.PConstants;
|
24
22
|
import processing.core.PGraphics;
|
25
23
|
|
26
|
-
|
27
24
|
/**
|
28
25
|
* RStrip is a reduced interface for creating, holding and drawing triangle
|
29
26
|
* strips. Triangle strips are ordered lists of points (RPoint) which define the
|
30
27
|
* vertices of a mesh.
|
31
28
|
*
|
32
|
-
|
33
|
-
*
|
34
|
-
*
|
35
|
-
*
|
36
|
-
|
29
|
+
RStrip
|
30
|
+
* Geometry
|
31
|
+
* RPoint
|
32
|
+
* RMesh
|
33
|
+
|
37
34
|
*/
|
38
35
|
public class RStrip {
|
39
36
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
/**
|
46
|
-
* Array of RPoint objects holding the vertices of the strip.
|
47
|
-
*
|
48
|
-
* @eexample vertices
|
49
|
-
* @related RPoint
|
50
|
-
* @related countVertices ( )
|
51
|
-
* @related addVertex ( )
|
52
|
-
*/
|
53
|
-
public RPoint vertices[];
|
54
|
-
|
55
|
-
// ----------------------
|
56
|
-
// --- Public Methods ---
|
57
|
-
// ----------------------
|
58
|
-
/**
|
59
|
-
* Use this method to create a new strip.
|
60
|
-
*
|
61
|
-
* @eexample RStrip ( )
|
62
|
-
* @related addVertex ( )
|
63
|
-
* @param s the object of which to make a copy
|
64
|
-
*/
|
65
|
-
public RStrip(RStrip s) {
|
66
|
-
for (int i = 0; i < s.countVertices(); i++) {
|
67
|
-
this.append(new RPoint(s.vertices[i]));
|
68
|
-
}
|
69
|
-
}
|
70
|
-
|
71
|
-
public RStrip() {
|
72
|
-
vertices = null;
|
73
|
-
}
|
37
|
+
/**
|
38
|
+
*
|
39
|
+
*/
|
40
|
+
public int type = RGeomElem.TRISTRIP;
|
74
41
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
}
|
85
|
-
|
86
|
-
return this.vertices.length;
|
87
|
-
}
|
42
|
+
/**
|
43
|
+
* Array of RPoint objects holding the vertices of the strip.
|
44
|
+
*
|
45
|
+
vertices
|
46
|
+
* RPoint
|
47
|
+
* countVertices ( )
|
48
|
+
* addVertex ( )
|
49
|
+
*/
|
50
|
+
public RPoint vertices[];
|
88
51
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
52
|
+
// ----------------------
|
53
|
+
// --- Public Methods ---
|
54
|
+
// ----------------------
|
55
|
+
/**
|
56
|
+
* Use this method to create a new strip.
|
57
|
+
*
|
58
|
+
RStrip ( )
|
59
|
+
* addVertex ( )
|
60
|
+
* @param s the object of which to make a copy
|
61
|
+
*/
|
62
|
+
public RStrip(RStrip s) {
|
63
|
+
for (int i = 0; i < s.countVertices(); i++) {
|
64
|
+
this.append(new RPoint(s.vertices[i]));
|
102
65
|
}
|
66
|
+
}
|
103
67
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
* @param p
|
108
|
-
* @eexample addVertex ( )
|
109
|
-
*/
|
110
|
-
public void addVertex(RPoint p) {
|
111
|
-
this.append(p);
|
112
|
-
}
|
68
|
+
public RStrip() {
|
69
|
+
vertices = null;
|
70
|
+
}
|
113
71
|
|
114
|
-
|
115
|
-
|
72
|
+
/**
|
73
|
+
* Use this method to count the number of vertices in the strip.
|
74
|
+
*
|
75
|
+
countVertices
|
76
|
+
* @return int, the number vertices in the strip
|
77
|
+
*/
|
78
|
+
public int countVertices() {
|
79
|
+
if (this.vertices == null) {
|
80
|
+
return 0;
|
116
81
|
}
|
117
82
|
|
118
|
-
|
119
|
-
|
120
|
-
*
|
121
|
-
* @eexample getBounds
|
122
|
-
* @return RContour, the bounding box of the strip in the form of a
|
123
|
-
* four-point contour
|
124
|
-
* @related draw ( )
|
125
|
-
*/
|
126
|
-
public RContour getBounds() {
|
127
|
-
float xmin = Float.MAX_VALUE;
|
128
|
-
float ymin = Float.MAX_VALUE;
|
129
|
-
float xmax = -Float.MAX_VALUE;
|
130
|
-
float ymax = -Float.MAX_VALUE;
|
131
|
-
|
132
|
-
for (int i = 0; i < this.countVertices(); i++) {
|
133
|
-
float x = this.vertices[i].x;
|
134
|
-
float y = this.vertices[i].y;
|
135
|
-
if (x < xmin) {
|
136
|
-
xmin = x;
|
137
|
-
}
|
138
|
-
if (x > xmax) {
|
139
|
-
xmax = x;
|
140
|
-
}
|
141
|
-
if (y < ymin) {
|
142
|
-
ymin = y;
|
143
|
-
}
|
144
|
-
if (y > ymax) {
|
145
|
-
ymax = y;
|
146
|
-
}
|
147
|
-
}
|
148
|
-
|
149
|
-
RContour c = new RContour();
|
150
|
-
c.addPoint(xmin, ymin);
|
151
|
-
c.addPoint(xmin, ymax);
|
152
|
-
c.addPoint(xmax, ymax);
|
153
|
-
c.addPoint(xmax, ymin);
|
154
|
-
return c;
|
155
|
-
}
|
83
|
+
return this.vertices.length;
|
84
|
+
}
|
156
85
|
|
157
|
-
|
158
|
-
|
159
|
-
* array of RPoint.
|
160
|
-
*
|
161
|
-
* @eexample RStrip_getHandles
|
162
|
-
* @return RPoint[], the vertices returned in an array.
|
86
|
+
/**
|
87
|
+
* Use this method to draw the strip.
|
163
88
|
*
|
164
|
-
|
165
|
-
|
166
|
-
|
89
|
+
drawStrip
|
90
|
+
* @param g PGraphics, the graphics object on which to draw the strip
|
91
|
+
*/
|
92
|
+
public void draw(PGraphics g) {
|
93
|
+
int numVertices = countVertices();
|
94
|
+
g.beginShape(PConstants.TRIANGLE_STRIP);
|
95
|
+
for (int i = 0; i < numVertices; i++) {
|
96
|
+
g.vertex(vertices[i].x, vertices[i].y);
|
167
97
|
}
|
98
|
+
g.endShape();
|
99
|
+
}
|
168
100
|
|
169
|
-
|
170
|
-
|
171
|
-
* array of RPoint.
|
172
|
-
*
|
173
|
-
* @eexample RStrip_getPoints
|
174
|
-
* @return RPoint[], the vertices returned in an array.
|
101
|
+
/**
|
102
|
+
* Use this method to add new vertices to the strip.
|
175
103
|
*
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
104
|
+
* @param p
|
105
|
+
addVertex ( )
|
106
|
+
*/
|
107
|
+
public void addVertex(RPoint p) {
|
108
|
+
this.append(p);
|
109
|
+
}
|
110
|
+
|
111
|
+
public void addVertex(float x, float y) {
|
112
|
+
this.append(new RPoint(x, y));
|
113
|
+
}
|
114
|
+
|
115
|
+
/**
|
116
|
+
* Use this method to get the bounding box of the strip.
|
117
|
+
*
|
118
|
+
getBounds
|
119
|
+
* @return RContour, the bounding box of the strip in the form of a four-point
|
120
|
+
* contour
|
121
|
+
* draw ( )
|
122
|
+
*/
|
123
|
+
public RContour getBounds() {
|
124
|
+
float xmin = Float.MAX_VALUE;
|
125
|
+
float ymin = Float.MAX_VALUE;
|
126
|
+
float xmax = -Float.MAX_VALUE;
|
127
|
+
float ymax = -Float.MAX_VALUE;
|
128
|
+
|
129
|
+
for (int i = 0; i < this.countVertices(); i++) {
|
130
|
+
float x = this.vertices[i].x;
|
131
|
+
float y = this.vertices[i].y;
|
132
|
+
if (x < xmin) {
|
133
|
+
xmin = x;
|
134
|
+
}
|
135
|
+
if (x > xmax) {
|
136
|
+
xmax = x;
|
137
|
+
}
|
138
|
+
if (y < ymin) {
|
139
|
+
ymin = y;
|
140
|
+
}
|
141
|
+
if (y > ymax) {
|
142
|
+
ymax = y;
|
143
|
+
}
|
199
144
|
}
|
200
145
|
|
201
|
-
|
202
|
-
|
203
|
-
|
146
|
+
RContour c = new RContour();
|
147
|
+
c.addPoint(xmin, ymin);
|
148
|
+
c.addPoint(xmin, ymax);
|
149
|
+
c.addPoint(xmax, ymax);
|
150
|
+
c.addPoint(xmax, ymin);
|
151
|
+
return c;
|
152
|
+
}
|
153
|
+
|
154
|
+
/**
|
155
|
+
* Use this to get the vertices of the strip. It returns the points as an
|
156
|
+
* array of RPoint.
|
157
|
+
*
|
158
|
+
RStrip_getHandles
|
159
|
+
* @return RPoint[], the vertices returned in an array.
|
160
|
+
*
|
161
|
+
*/
|
162
|
+
public RPoint[] getHandles() {
|
163
|
+
return vertices;
|
164
|
+
}
|
165
|
+
|
166
|
+
/**
|
167
|
+
* Use this to get the vertices of the strip. It returns the points as an
|
168
|
+
* array of RPoint.
|
169
|
+
*
|
170
|
+
RStrip_getPoints
|
171
|
+
* @return RPoint[], the vertices returned in an array.
|
172
|
+
*
|
173
|
+
*/
|
174
|
+
public RPoint[] getPoints() {
|
175
|
+
return vertices;
|
176
|
+
}
|
204
177
|
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
178
|
+
/**
|
179
|
+
* Use this method to transform the strip.
|
180
|
+
*
|
181
|
+
transformStrip
|
182
|
+
* @param m RMatrix, the matrix of the affine transformation to apply to the
|
183
|
+
* strip
|
184
|
+
*/
|
185
|
+
public void transform(RMatrix m) {
|
186
|
+
int numVertices = countVertices();
|
187
|
+
if (numVertices != 0) {
|
188
|
+
for (int i = 0; i < numVertices; i++) {
|
189
|
+
vertices[i].transform(m);
|
190
|
+
}
|
210
191
|
}
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
192
|
+
}
|
193
|
+
|
194
|
+
void add(RPoint p) {
|
195
|
+
this.append(p);
|
196
|
+
}
|
197
|
+
|
198
|
+
void add(float x, float y) {
|
199
|
+
this.append(new RPoint(x, y));
|
200
|
+
}
|
201
|
+
|
202
|
+
/**
|
203
|
+
* Remove all of the points. Creates an empty polygon.
|
204
|
+
*/
|
205
|
+
void clear() {
|
206
|
+
this.vertices = null;
|
207
|
+
}
|
208
|
+
|
209
|
+
final void append(RPoint nextvertex) {
|
210
|
+
RPoint[] newvertices;
|
211
|
+
if (vertices == null) {
|
212
|
+
newvertices = new RPoint[1];
|
213
|
+
newvertices[0] = nextvertex;
|
214
|
+
} else {
|
215
|
+
newvertices = new RPoint[this.vertices.length + 1];
|
216
|
+
System.arraycopy(this.vertices, 0, newvertices, 0, this.vertices.length);
|
217
|
+
newvertices[this.vertices.length] = nextvertex;
|
223
218
|
}
|
219
|
+
this.vertices = newvertices;
|
220
|
+
}
|
224
221
|
|
225
222
|
}
|