geomerative 0.4.0-java → 2.0.0-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.
- 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 +25 -0
- data/COPYING.md +1 -1
- data/README.md +4 -2
- data/Rakefile +2 -15
- data/docs/.gitignore +6 -0
- data/docs/_config.yml +30 -0
- data/docs/_includes/footer.html +38 -0
- data/docs/_includes/head.html +16 -0
- data/docs/_includes/header.html +27 -0
- data/docs/_includes/icon-github.html +1 -0
- data/docs/_includes/icon-github.svg +3 -0
- data/docs/_includes/icon-twitter.html +1 -0
- data/docs/_includes/icon-twitter.svg +3 -0
- data/docs/_includes/navigation.html +24 -0
- data/docs/_layouts/default.html +20 -0
- data/docs/_layouts/page.html +14 -0
- data/docs/_layouts/post.html +15 -0
- data/docs/_posts/2015-11-21-getting_started.md +67 -0
- data/docs/_posts/2015-11-25-bubbles.md +111 -0
- data/docs/_posts/2015-11-26-extra_bright.md +103 -0
- data/docs/_posts/2015-11-26-text_merge.md +114 -0
- data/docs/_posts/2016-07-06-dymo.md +99 -0
- data/docs/_sass/_base.scss +206 -0
- data/docs/_sass/_layout.scss +242 -0
- data/docs/_sass/_syntax-highlighting.scss +71 -0
- data/docs/about.md +12 -0
- data/docs/assets/bright.png +0 -0
- data/docs/assets/bubbles.png +0 -0
- data/docs/assets/design.png +0 -0
- data/docs/assets/dymo.png +0 -0
- data/docs/assets/favicon.ico +0 -0
- data/docs/assets/fred.png +0 -0
- data/docs/assets/merge.png +0 -0
- data/docs/css/main.scss +38 -0
- data/docs/favicon.ico +0 -0
- data/docs/feed.xml +30 -0
- data/docs/index.html +38 -0
- 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/hello_svg_to_pdf.rb +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 -7
- data/lib/geomerative.rb +5 -4
- data/lib/geomerative/version.rb +1 -1
- data/mvnw +234 -0
- data/mvnw.cmd +145 -0
- data/pom.rb +19 -18
- data/pom.xml +14 -13
- 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/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 +47 -30
- data/.travis.yml +0 -14
|
@@ -1,397 +1,412 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
package geomerative ;
|
|
2
|
+
* Copyright 2004-2008 Ricard Marxer <email@ricardmarxer.com>
|
|
3
|
+
*
|
|
4
|
+
* This file is part of Geomerative.
|
|
5
|
+
*
|
|
6
|
+
* Geomerative is free software: you can redistribute it and/or modify it under
|
|
7
|
+
* the terms of the GNU General Public License as published by the Free Software
|
|
8
|
+
* Foundation, either version 3 of the License, or (at your option) any later
|
|
9
|
+
* version.
|
|
10
|
+
*
|
|
11
|
+
* Geomerative is distributed in the hope that it will be useful, but WITHOUT
|
|
12
|
+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
13
|
+
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
14
|
+
* details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU General Public License along with
|
|
17
|
+
* Geomerative. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
*/
|
|
19
|
+
package geomerative;
|
|
21
20
|
|
|
22
21
|
import processing.core.PApplet;
|
|
23
22
|
|
|
24
23
|
/**
|
|
25
|
-
* RMatrix is a very simple interface for creating, holding 3x3 matrices with
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
24
|
+
* RMatrix is a very simple interface for creating, holding 3x3 matrices with
|
|
25
|
+
* the most common 2D affine transformations such as translation, rotation,
|
|
26
|
+
* scaling and shearing. We only have access to the first to rows of the matrix
|
|
27
|
+
* the last row is considered a constant 0, 0, 1 in order to have better
|
|
28
|
+
* performance.
|
|
29
|
+
*
|
|
30
|
+
RMatrix
|
|
31
|
+
* Geometry
|
|
32
|
+
|
|
29
33
|
*/
|
|
30
|
-
public class RMatrix
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
public class RMatrix {
|
|
35
|
+
|
|
33
36
|
float m00 = 1F;
|
|
34
37
|
float m01 = 0F;
|
|
35
38
|
float m02 = 0F;
|
|
36
|
-
|
|
39
|
+
|
|
37
40
|
float m10 = 0F;
|
|
38
41
|
float m11 = 1F;
|
|
39
42
|
float m12 = 0F;
|
|
40
|
-
|
|
43
|
+
|
|
41
44
|
float m20 = 0F;
|
|
42
45
|
float m21 = 0F;
|
|
43
46
|
float m22 = 1F;
|
|
44
|
-
|
|
47
|
+
|
|
45
48
|
/**
|
|
46
49
|
* Create a new matrix given the coefficients.
|
|
47
|
-
*
|
|
48
|
-
|
|
49
|
-
* @param
|
|
50
|
-
* @param
|
|
51
|
-
* @param
|
|
52
|
-
* @param
|
|
53
|
-
* @param
|
|
54
|
-
* @
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
50
|
+
*
|
|
51
|
+
RMatrix
|
|
52
|
+
* @param m00 coefficient 00 of the matrix
|
|
53
|
+
* @param m01 coefficient 01 of the matrix
|
|
54
|
+
* @param m02 coefficient 02 of the matrix
|
|
55
|
+
* @param m10 coefficient 10 of the matrix
|
|
56
|
+
* @param m11 coefficient 11 of the matrix
|
|
57
|
+
* @param m12 coefficient 12 of the matrix
|
|
58
|
+
* Geometry
|
|
59
|
+
* apply ( )
|
|
60
|
+
* translate ( )
|
|
61
|
+
* rotate ( )
|
|
62
|
+
* scale ( )
|
|
63
|
+
* shear ( )
|
|
60
64
|
*/
|
|
61
65
|
public RMatrix(float m00, float m01, float m02,
|
|
62
|
-
|
|
63
|
-
{
|
|
66
|
+
float m10, float m11, float m12) {
|
|
64
67
|
set(m00, m01, m02,
|
|
65
|
-
|
|
68
|
+
m10, m11, m12);
|
|
66
69
|
}
|
|
67
70
|
|
|
68
71
|
/**
|
|
69
72
|
* Create a new identity matrix.
|
|
70
|
-
*
|
|
71
|
-
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
73
|
+
*
|
|
74
|
+
RMatrix
|
|
75
|
+
* Geometry
|
|
76
|
+
* apply ( )
|
|
77
|
+
* translate ( )
|
|
78
|
+
* rotate ( )
|
|
79
|
+
* scale ( )
|
|
80
|
+
* shear ( )
|
|
77
81
|
*/
|
|
78
|
-
public RMatrix()
|
|
79
|
-
{
|
|
82
|
+
public RMatrix() {
|
|
80
83
|
m00 = 1F;
|
|
81
84
|
m01 = 0F;
|
|
82
85
|
m02 = 0F;
|
|
83
|
-
|
|
86
|
+
|
|
84
87
|
m10 = 0F;
|
|
85
88
|
m11 = 1F;
|
|
86
89
|
m12 = 0F;
|
|
87
|
-
}
|
|
88
|
-
|
|
90
|
+
}
|
|
91
|
+
|
|
89
92
|
/**
|
|
90
93
|
* Copy a matrix.
|
|
91
|
-
*
|
|
92
|
-
|
|
93
|
-
* @
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
94
|
+
*
|
|
95
|
+
RMatrix
|
|
96
|
+
* @param src source matrix from where to copy the matrix
|
|
97
|
+
* Geometry
|
|
98
|
+
* apply ( )
|
|
99
|
+
* translate ( )
|
|
100
|
+
* rotate ( )
|
|
101
|
+
* scale ( )
|
|
102
|
+
* shear ( )
|
|
99
103
|
*/
|
|
100
|
-
public RMatrix(RMatrix src)
|
|
101
|
-
{
|
|
104
|
+
public RMatrix(RMatrix src) {
|
|
102
105
|
set(src.m00, src.m01, src.m02,
|
|
103
|
-
|
|
106
|
+
src.m10, src.m11, src.m12);
|
|
104
107
|
}
|
|
105
|
-
|
|
106
|
-
public RMatrix(String transformationString){
|
|
108
|
+
|
|
109
|
+
public RMatrix(String transformationString) {
|
|
107
110
|
String[] transfTokens = PApplet.splitTokens(transformationString, ")");
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
111
|
+
|
|
112
|
+
// Loop through all transformations
|
|
113
|
+
for (String transfToken : transfTokens) {
|
|
114
|
+
// Check the transformation and the parameters
|
|
115
|
+
String[] transf = PApplet.splitTokens(transfToken, "(");
|
|
116
|
+
String[] params = PApplet.splitTokens(transf[1], ", ");
|
|
117
|
+
float[] fparams = new float[params.length];
|
|
118
|
+
for (int j = 0; j < params.length; j++) {
|
|
119
|
+
fparams[j] = PApplet.parseFloat(params[j]);
|
|
120
|
+
}
|
|
121
|
+
transf[0] = PApplet.trim(transf[0]);
|
|
122
|
+
switch (transf[0]) {
|
|
123
|
+
case "translate":
|
|
124
|
+
if (params.length == 1) {
|
|
125
|
+
this.translate(fparams[0]);
|
|
126
|
+
|
|
127
|
+
} else if (params.length == 2) {
|
|
128
|
+
this.translate(fparams[0], fparams[1]);
|
|
129
|
+
|
|
130
|
+
}
|
|
131
|
+
break;
|
|
132
|
+
case "rotate":
|
|
133
|
+
if (params.length == 1) {
|
|
134
|
+
this.rotate(PApplet.radians(fparams[0]));
|
|
135
|
+
|
|
136
|
+
} else if (params.length == 3) {
|
|
137
|
+
this.rotate(PApplet.radians(fparams[0]), fparams[1], fparams[2]);
|
|
138
|
+
|
|
139
|
+
}
|
|
140
|
+
break;
|
|
141
|
+
case "scale":
|
|
142
|
+
if (params.length == 1) {
|
|
143
|
+
this.scale(fparams[0]);
|
|
144
|
+
|
|
145
|
+
} else if (params.length == 2) {
|
|
146
|
+
this.scale(fparams[0], fparams[1]);
|
|
147
|
+
}
|
|
148
|
+
break;
|
|
149
|
+
case "skewX":
|
|
150
|
+
this.skewX(PApplet.radians(fparams[0]));
|
|
151
|
+
break;
|
|
152
|
+
case "skewY":
|
|
153
|
+
this.skewY(PApplet.radians(fparams[0]));
|
|
154
|
+
break;
|
|
155
|
+
case "matrix":
|
|
156
|
+
this.apply(fparams[0], fparams[2], fparams[4], fparams[1], fparams[3], fparams[5]);
|
|
157
|
+
break;
|
|
158
|
+
default:
|
|
159
|
+
throw new RuntimeException("Transformation unknown. '" + transf[0] + "'");
|
|
154
160
|
}
|
|
161
|
+
}
|
|
155
162
|
}
|
|
156
|
-
|
|
163
|
+
|
|
157
164
|
private void set(float m00, float m01, float m02,
|
|
158
|
-
|
|
159
|
-
{
|
|
165
|
+
float m10, float m11, float m12) {
|
|
160
166
|
this.m00 = m00;
|
|
161
167
|
this.m01 = m01;
|
|
162
168
|
this.m02 = m02;
|
|
163
|
-
|
|
169
|
+
|
|
164
170
|
this.m10 = m10;
|
|
165
171
|
this.m11 = m11;
|
|
166
172
|
this.m12 = m12;
|
|
167
173
|
}
|
|
168
|
-
|
|
174
|
+
|
|
169
175
|
/**
|
|
170
|
-
* Multiply the matrix with another matrix.
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
|
|
174
|
-
* @param
|
|
175
|
-
* @param
|
|
176
|
-
* @param
|
|
177
|
-
* @param
|
|
178
|
-
* @
|
|
179
|
-
* @
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
|
|
176
|
+
* Multiply the matrix with another matrix. This is mostly use to chain
|
|
177
|
+
* transformations.
|
|
178
|
+
*
|
|
179
|
+
RMatrix_apply
|
|
180
|
+
* @param n00 coefficient 00 of the matrix to be applied
|
|
181
|
+
* @param n01 coefficient 01 of the matrix to be applied
|
|
182
|
+
* @param n02 coefficient 02 of the matrix to be applied
|
|
183
|
+
* @param n10 coefficient 10 of the matrix to be applied
|
|
184
|
+
* @param n11 coefficient 11 of the matrix to be applied
|
|
185
|
+
* @param n12 coefficient 12 of the matrix to be applied
|
|
186
|
+
* Geometry
|
|
187
|
+
* translate ( )
|
|
188
|
+
* rotate ( )
|
|
189
|
+
* scale ( )
|
|
190
|
+
* shear ( )
|
|
191
|
+
*/
|
|
184
192
|
public final void apply(float n00, float n01, float n02,
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
float r00 = m00*n00 + m01*n10;
|
|
188
|
-
float r01 = m00*n01 + m01*n11;
|
|
189
|
-
float r02 = m00*n02 + m01*n12 + m02;
|
|
190
|
-
|
|
191
|
-
float r10 = m10*n00 + m11*n10;
|
|
192
|
-
float r11 = m10*n01 + m11*n11
|
|
193
|
-
float r12 = m10*n02 + m11*n12 + m12;
|
|
194
|
-
|
|
195
|
-
m00 = r00;
|
|
196
|
-
|
|
193
|
+
float n10, float n11, float n12) {
|
|
194
|
+
|
|
195
|
+
float r00 = m00 * n00 + m01 * n10;
|
|
196
|
+
float r01 = m00 * n01 + m01 * n11;
|
|
197
|
+
float r02 = m00 * n02 + m01 * n12 + m02;
|
|
198
|
+
|
|
199
|
+
float r10 = m10 * n00 + m11 * n10;
|
|
200
|
+
float r11 = m10 * n01 + m11 * n11;
|
|
201
|
+
float r12 = m10 * n02 + m11 * n12 + m12;
|
|
202
|
+
|
|
203
|
+
m00 = r00;
|
|
204
|
+
m01 = r01;
|
|
205
|
+
m02 = r02;
|
|
206
|
+
m10 = r10;
|
|
207
|
+
m11 = r11;
|
|
208
|
+
m12 = r12;
|
|
197
209
|
}
|
|
198
210
|
|
|
199
211
|
/**
|
|
200
|
-
* Multiply the matrix with another matrix.
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
|
|
204
|
-
* @
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
212
|
+
* Multiply the matrix with another matrix. This is mostly use to chain
|
|
213
|
+
* transformations.
|
|
214
|
+
*
|
|
215
|
+
RMatrix_apply
|
|
216
|
+
* @param rhs right hand side matrix
|
|
217
|
+
* Geometry
|
|
218
|
+
* translate ( )
|
|
219
|
+
* rotate ( )
|
|
220
|
+
* scale ( )
|
|
221
|
+
* shear ( )
|
|
208
222
|
*/
|
|
209
223
|
public void apply(RMatrix rhs) {
|
|
210
224
|
apply(rhs.m00, rhs.m01, rhs.m02,
|
|
211
|
-
|
|
212
|
-
}
|
|
225
|
+
rhs.m10, rhs.m11, rhs.m12);
|
|
226
|
+
}
|
|
213
227
|
|
|
214
228
|
/**
|
|
215
229
|
* Apply a translation to the matrix, given the coordinates.
|
|
216
|
-
*
|
|
217
|
-
|
|
218
|
-
* @param
|
|
219
|
-
* @
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
230
|
+
*
|
|
231
|
+
RMatrix_translate
|
|
232
|
+
* @param tx x coordinate translation
|
|
233
|
+
* @param ty y coordinate translation
|
|
234
|
+
* Geometry
|
|
235
|
+
* rotate ( )
|
|
236
|
+
* scale ( )
|
|
237
|
+
* shear ( )
|
|
223
238
|
*/
|
|
224
|
-
public final void translate(float tx, float ty)
|
|
225
|
-
{
|
|
239
|
+
public final void translate(float tx, float ty) {
|
|
226
240
|
apply(1, 0, tx, 0, 1, ty);
|
|
227
241
|
}
|
|
228
242
|
|
|
229
|
-
public final void translate(float tx)
|
|
230
|
-
{
|
|
243
|
+
public final void translate(float tx) {
|
|
231
244
|
translate(tx, 0);
|
|
232
245
|
}
|
|
233
|
-
|
|
246
|
+
|
|
234
247
|
/**
|
|
235
248
|
* Apply a translation to the matrix, given a point.
|
|
236
|
-
*
|
|
237
|
-
|
|
238
|
-
* @
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
249
|
+
*
|
|
250
|
+
RMatrix_translate
|
|
251
|
+
* @param t vector translation
|
|
252
|
+
* Geometry
|
|
253
|
+
* rotate ( )
|
|
254
|
+
* scale ( )
|
|
255
|
+
* shear ( )
|
|
242
256
|
*/
|
|
243
|
-
public void translate(RPoint t)
|
|
244
|
-
{
|
|
257
|
+
public void translate(RPoint t) {
|
|
245
258
|
translate(t.x, t.y);
|
|
246
259
|
}
|
|
247
|
-
|
|
260
|
+
|
|
248
261
|
/**
|
|
249
|
-
* Apply a rotation to the matrix, given an angle and optionally a rotation
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
|
|
253
|
-
*
|
|
254
|
-
* @param
|
|
255
|
-
* @
|
|
256
|
-
* @
|
|
257
|
-
*
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
+
* Apply a rotation to the matrix, given an angle and optionally a rotation
|
|
263
|
+
* center.
|
|
264
|
+
*
|
|
265
|
+
RPoint_rotate
|
|
266
|
+
* Geometry
|
|
267
|
+
* @param angle the angle of rotation to be applied
|
|
268
|
+
* @param vx the x coordinate of the center of rotation
|
|
269
|
+
* @param vy the y coordinate of the center of rotation
|
|
270
|
+
* transform ( )
|
|
271
|
+
* translate ( )
|
|
272
|
+
* scale ( )
|
|
273
|
+
*/
|
|
274
|
+
public final void rotate(float angle, float vx, float vy) {
|
|
275
|
+
translate(vx, vy);
|
|
262
276
|
rotate(angle);
|
|
263
|
-
translate(-vx
|
|
277
|
+
translate(-vx, -vy);
|
|
264
278
|
}
|
|
265
279
|
|
|
266
|
-
public final void rotate(float angle)
|
|
267
|
-
|
|
268
|
-
float
|
|
269
|
-
|
|
270
|
-
apply(c, -s, 0, s, c, 0);
|
|
280
|
+
public final void rotate(float angle) {
|
|
281
|
+
float c = (float) Math.cos(angle);
|
|
282
|
+
float s = (float) Math.sin(angle);
|
|
283
|
+
apply(c, -s, 0, s, c, 0);
|
|
271
284
|
}
|
|
272
285
|
|
|
273
286
|
/**
|
|
274
|
-
* Apply a rotation to the matrix, given an angle and optionally a rotation
|
|
275
|
-
*
|
|
276
|
-
*
|
|
277
|
-
|
|
278
|
-
*
|
|
279
|
-
* @
|
|
280
|
-
* @
|
|
281
|
-
*
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
287
|
+
* Apply a rotation to the matrix, given an angle and optionally a rotation
|
|
288
|
+
* center.
|
|
289
|
+
*
|
|
290
|
+
RPoint_rotate
|
|
291
|
+
* Geometry
|
|
292
|
+
* @param angle the angle of rotation to be applied
|
|
293
|
+
* @param v the position vector of the center of rotation
|
|
294
|
+
* transform ( )
|
|
295
|
+
* translate ( )
|
|
296
|
+
* scale ( )
|
|
297
|
+
*/
|
|
298
|
+
public void rotate(float angle, RPoint v) {
|
|
285
299
|
rotate(angle, v.x, v.y);
|
|
286
300
|
}
|
|
287
|
-
|
|
301
|
+
|
|
288
302
|
/**
|
|
289
|
-
* Apply a scale to the matrix, given scaling factors and optionally a scaling
|
|
290
|
-
*
|
|
291
|
-
*
|
|
292
|
-
|
|
293
|
-
*
|
|
294
|
-
* @param
|
|
295
|
-
* @param
|
|
296
|
-
* @
|
|
297
|
-
* @
|
|
298
|
-
*
|
|
303
|
+
* Apply a scale to the matrix, given scaling factors and optionally a scaling
|
|
304
|
+
* center.
|
|
305
|
+
*
|
|
306
|
+
RPoint_scale
|
|
307
|
+
* Geometry
|
|
308
|
+
* @param sx the scaling coefficient over the x axis
|
|
309
|
+
* @param sy the scaling coefficient over the y axis
|
|
310
|
+
* @param x x coordinate of the position vector of the center of the scaling
|
|
311
|
+
* @param y y coordinate of the position vector of the center of the scaling
|
|
312
|
+
* transform ( )
|
|
313
|
+
* translate ( )
|
|
314
|
+
* rotate ( )
|
|
299
315
|
*/
|
|
300
|
-
public void scale(float sx, float sy, float x, float y)
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
translate(-x,-y);
|
|
316
|
+
public void scale(float sx, float sy, float x, float y) {
|
|
317
|
+
translate(x, y);
|
|
318
|
+
scale(sx, sy);
|
|
319
|
+
translate(-x, -y);
|
|
305
320
|
}
|
|
306
321
|
|
|
307
|
-
public final void scale(float sx, float sy)
|
|
308
|
-
|
|
309
|
-
apply(sx, 0, 0, 0, sy, 0);
|
|
322
|
+
public final void scale(float sx, float sy) {
|
|
323
|
+
apply(sx, 0, 0, 0, sy, 0);
|
|
310
324
|
}
|
|
311
|
-
|
|
325
|
+
|
|
312
326
|
/**
|
|
313
|
-
* Apply a scale to the matrix, given scaling factors and optionally a scaling
|
|
314
|
-
*
|
|
315
|
-
*
|
|
316
|
-
|
|
317
|
-
*
|
|
318
|
-
* @param
|
|
319
|
-
* @
|
|
320
|
-
* @
|
|
321
|
-
*
|
|
327
|
+
* Apply a scale to the matrix, given scaling factors and optionally a scaling
|
|
328
|
+
* center.
|
|
329
|
+
*
|
|
330
|
+
RPoint_scale
|
|
331
|
+
* Geometry
|
|
332
|
+
* @param s the scaling coefficient for a uniform scaling
|
|
333
|
+
* @param x x coordinate of the position vector of the center of the scaling
|
|
334
|
+
* @param y y coordinate of the position vector of the center of the scaling
|
|
335
|
+
* transform ( )
|
|
336
|
+
* translate ( )
|
|
337
|
+
* rotate ( )
|
|
322
338
|
*/
|
|
323
|
-
public void scale(float s, float x, float y)
|
|
324
|
-
{
|
|
339
|
+
public void scale(float s, float x, float y) {
|
|
325
340
|
scale(s, s, x, y);
|
|
326
341
|
}
|
|
327
|
-
|
|
342
|
+
|
|
328
343
|
/**
|
|
329
|
-
* Apply a scale to the matrix, given scaling factors and optionally a scaling
|
|
330
|
-
*
|
|
331
|
-
*
|
|
332
|
-
|
|
333
|
-
*
|
|
334
|
-
* @param
|
|
335
|
-
* @
|
|
336
|
-
* @
|
|
337
|
-
*
|
|
344
|
+
* Apply a scale to the matrix, given scaling factors and optionally a scaling
|
|
345
|
+
* center.
|
|
346
|
+
*
|
|
347
|
+
RPoint_scale
|
|
348
|
+
* Geometry
|
|
349
|
+
* @param sx the scaling coefficient over the x axis
|
|
350
|
+
* @param sy the scaling coefficient over the y axis
|
|
351
|
+
* @param p the position vector of the center of the scaling
|
|
352
|
+
* transform ( )
|
|
353
|
+
* translate ( )
|
|
354
|
+
* rotate ( )
|
|
338
355
|
*/
|
|
339
|
-
public void scale(float sx, float sy, RPoint p)
|
|
340
|
-
{
|
|
356
|
+
public void scale(float sx, float sy, RPoint p) {
|
|
341
357
|
scale(sx, sy, p.x, p.y);
|
|
342
358
|
}
|
|
343
359
|
|
|
344
360
|
/**
|
|
345
|
-
* Apply a scale to the matrix, given scaling factors and optionally a scaling
|
|
346
|
-
*
|
|
347
|
-
*
|
|
348
|
-
|
|
349
|
-
*
|
|
350
|
-
* @
|
|
351
|
-
* @
|
|
352
|
-
*
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
361
|
+
* Apply a scale to the matrix, given scaling factors and optionally a scaling
|
|
362
|
+
* center.
|
|
363
|
+
*
|
|
364
|
+
RPoint_scale
|
|
365
|
+
* Geometry
|
|
366
|
+
* @param s the scaling coefficient for a uniform scaling
|
|
367
|
+
* @param p the position vector of the center of the scaling
|
|
368
|
+
* transform ( )
|
|
369
|
+
* translate ( )
|
|
370
|
+
* rotate ( )
|
|
371
|
+
*/
|
|
372
|
+
public void scale(float s, RPoint p) {
|
|
356
373
|
scale(s, s, p.x, p.y);
|
|
357
374
|
}
|
|
358
|
-
|
|
359
|
-
public final void scale(float s)
|
|
360
|
-
{
|
|
375
|
+
|
|
376
|
+
public final void scale(float s) {
|
|
361
377
|
scale(s, s);
|
|
362
378
|
}
|
|
363
379
|
|
|
364
380
|
/**
|
|
365
381
|
* Use this to apply a skewing to the matrix.
|
|
366
|
-
*
|
|
367
|
-
|
|
368
|
-
* @
|
|
369
|
-
*
|
|
370
|
-
*
|
|
371
|
-
*
|
|
382
|
+
*
|
|
383
|
+
RMatrix_skewing
|
|
384
|
+
* @param angle skewing angle
|
|
385
|
+
* Geometry
|
|
386
|
+
* rotate ( )
|
|
387
|
+
* scale ( )
|
|
388
|
+
* translate ( )
|
|
372
389
|
*/
|
|
373
|
-
public final void skewX(float angle)
|
|
374
|
-
|
|
375
|
-
apply(1, (float)Math.tan(angle), 0, 0, 1, 0);
|
|
390
|
+
public final void skewX(float angle) {
|
|
391
|
+
apply(1, (float) Math.tan(angle), 0, 0, 1, 0);
|
|
376
392
|
}
|
|
377
|
-
|
|
378
|
-
public final void skewY(float angle)
|
|
379
|
-
|
|
380
|
-
apply(1, 0, 0, (float)Math.tan(angle), 1, 0);
|
|
393
|
+
|
|
394
|
+
public final void skewY(float angle) {
|
|
395
|
+
apply(1, 0, 0, (float) Math.tan(angle), 1, 0);
|
|
381
396
|
}
|
|
382
|
-
|
|
397
|
+
|
|
383
398
|
/**
|
|
384
399
|
* Use this to apply a shearing to the matrix.
|
|
385
|
-
*
|
|
386
|
-
|
|
387
|
-
* @param
|
|
388
|
-
* @
|
|
389
|
-
*
|
|
390
|
-
*
|
|
391
|
-
*
|
|
400
|
+
*
|
|
401
|
+
RMatrix_translate
|
|
402
|
+
* @param shx x coordinate shearing
|
|
403
|
+
* @param shy y coordinate shearing
|
|
404
|
+
* Geometry
|
|
405
|
+
* rotate ( )
|
|
406
|
+
* scale ( )
|
|
407
|
+
* translate ( )
|
|
392
408
|
*/
|
|
393
|
-
public void shear(float shx, float shy)
|
|
394
|
-
|
|
395
|
-
apply(1, -shx, 0, shy, 1, 0);
|
|
409
|
+
public void shear(float shx, float shy) {
|
|
410
|
+
apply(1, -shx, 0, shy, 1, 0);
|
|
396
411
|
}
|
|
397
412
|
}
|