picrate 0.3.0-java → 0.4.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 +4 -4
- data/.mvn/extensions.xml +1 -1
- data/CHANGELOG.md +1 -2
- data/README.md +1 -1
- data/Rakefile +2 -2
- data/lib/picrate.rb +1 -0
- data/lib/picrate/app.rb +4 -4
- data/lib/picrate/helper_methods.rb +0 -4
- data/lib/picrate/version.rb +1 -1
- data/library/color_group/color_group.rb +27 -0
- data/picrate.gemspec +1 -1
- data/pom.rb +5 -5
- data/pom.xml +5 -5
- data/src/main/java/monkstone/ColorUtil.java +57 -32
- data/src/main/java/processing/awt/PShapeJava2D.java +33 -9
- data/src/main/java/processing/awt/PSurfaceAWT.java +169 -76
- data/src/main/java/processing/core/PApplet.java +15921 -13981
- data/src/main/java/processing/core/PConstants.java +981 -475
- data/src/main/java/processing/core/PFont.java +202 -50
- data/src/main/java/processing/core/PGraphics.java +8470 -7323
- data/src/main/java/processing/core/PImage.java +212 -42
- data/src/main/java/processing/core/PMatrix.java +160 -21
- data/src/main/java/processing/core/PMatrix2D.java +178 -18
- data/src/main/java/processing/core/PMatrix3D.java +324 -48
- data/src/main/java/processing/core/PShape.java +42 -20
- data/src/main/java/processing/core/PShapeOBJ.java +91 -16
- data/src/main/java/processing/core/PShapeSVG.java +253 -53
- data/src/main/java/processing/core/PStyle.java +179 -34
- data/src/main/java/processing/core/PSurface.java +94 -13
- data/src/main/java/processing/core/PSurfaceNone.java +140 -35
- data/src/main/java/processing/core/PVector.java +87 -10
- data/src/main/java/processing/data/JSONObject.java +2 -2
- data/src/main/java/processing/event/Event.java +69 -86
- data/src/main/java/processing/event/MouseEvent.java +102 -102
- data/src/main/java/processing/opengl/PJOGL.java +3 -0
- data/test/color_group_test.rb +33 -0
- data/vendors/Rakefile +1 -1
- metadata +7 -4
@@ -42,22 +42,106 @@ package processing.core;
|
|
42
42
|
*/
|
43
43
|
public final class PMatrix3D implements PMatrix /*, PConstants*/ {
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
45
|
+
/**
|
46
|
+
*
|
47
|
+
*/
|
48
|
+
public float m00,
|
49
|
+
|
50
|
+
/**
|
51
|
+
*
|
52
|
+
*/
|
53
|
+
m01,
|
54
|
+
|
55
|
+
/**
|
56
|
+
*
|
57
|
+
*/
|
58
|
+
m02,
|
59
|
+
|
60
|
+
/**
|
61
|
+
*
|
62
|
+
*/
|
63
|
+
m03;
|
64
|
+
|
65
|
+
/**
|
66
|
+
*
|
67
|
+
*/
|
68
|
+
public float m10,
|
69
|
+
|
70
|
+
/**
|
71
|
+
*
|
72
|
+
*/
|
73
|
+
m11,
|
74
|
+
|
75
|
+
/**
|
76
|
+
*
|
77
|
+
*/
|
78
|
+
m12,
|
79
|
+
|
80
|
+
/**
|
81
|
+
*
|
82
|
+
*/
|
83
|
+
m13;
|
84
|
+
|
85
|
+
/**
|
86
|
+
*
|
87
|
+
*/
|
88
|
+
public float m20,
|
89
|
+
|
90
|
+
/**
|
91
|
+
*
|
92
|
+
*/
|
93
|
+
m21,
|
94
|
+
|
95
|
+
/**
|
96
|
+
*
|
97
|
+
*/
|
98
|
+
m22, m23;
|
99
|
+
|
100
|
+
/**
|
101
|
+
*
|
102
|
+
*/
|
103
|
+
public float m30,
|
104
|
+
|
105
|
+
/**
|
106
|
+
*
|
107
|
+
*/
|
108
|
+
m31,
|
109
|
+
|
110
|
+
/**
|
111
|
+
*
|
112
|
+
*/
|
113
|
+
m32,
|
114
|
+
|
115
|
+
/**
|
116
|
+
*
|
117
|
+
*/
|
118
|
+
m33;
|
49
119
|
|
50
120
|
|
51
121
|
// locally allocated version to avoid creating new memory
|
52
|
-
protected PMatrix3D inverseCopy;
|
53
122
|
|
123
|
+
/**
|
124
|
+
*
|
125
|
+
*/
|
126
|
+
protected PMatrix3D inverseCopy;
|
54
127
|
|
55
|
-
|
128
|
+
/**
|
129
|
+
*
|
130
|
+
*/
|
131
|
+
public PMatrix3D() {
|
56
132
|
reset();
|
57
133
|
}
|
58
134
|
|
59
|
-
|
60
|
-
|
135
|
+
/**
|
136
|
+
*
|
137
|
+
* @param m00
|
138
|
+
* @param m01
|
139
|
+
* @param m02
|
140
|
+
* @param m10
|
141
|
+
* @param m11
|
142
|
+
* @param m12
|
143
|
+
*/
|
144
|
+
public PMatrix3D(float m00, float m01, float m02,
|
61
145
|
float m10, float m11, float m12) {
|
62
146
|
set(m00, m01, m02, 0,
|
63
147
|
m10, m11, m12, 0,
|
@@ -65,8 +149,26 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
|
|
65
149
|
0, 0, 0, 1);
|
66
150
|
}
|
67
151
|
|
68
|
-
|
69
|
-
|
152
|
+
/**
|
153
|
+
*
|
154
|
+
* @param m00
|
155
|
+
* @param m01
|
156
|
+
* @param m02
|
157
|
+
* @param m03
|
158
|
+
* @param m10
|
159
|
+
* @param m11
|
160
|
+
* @param m12
|
161
|
+
* @param m13
|
162
|
+
* @param m20
|
163
|
+
* @param m21
|
164
|
+
* @param m22
|
165
|
+
* @param m23
|
166
|
+
* @param m30
|
167
|
+
* @param m31
|
168
|
+
* @param m32
|
169
|
+
* @param m33
|
170
|
+
*/
|
171
|
+
public PMatrix3D(float m00, float m01, float m02, float m03,
|
70
172
|
float m10, float m11, float m12, float m13,
|
71
173
|
float m20, float m21, float m22, float m23,
|
72
174
|
float m30, float m31, float m32, float m33) {
|
@@ -76,8 +178,11 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
|
|
76
178
|
m30, m31, m32, m33);
|
77
179
|
}
|
78
180
|
|
79
|
-
|
80
|
-
|
181
|
+
/**
|
182
|
+
*
|
183
|
+
* @param matrix
|
184
|
+
*/
|
185
|
+
public PMatrix3D(PMatrix matrix) {
|
81
186
|
set(matrix);
|
82
187
|
}
|
83
188
|
|
@@ -92,6 +197,7 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
|
|
92
197
|
|
93
198
|
/**
|
94
199
|
* Returns a copy of this PMatrix.
|
200
|
+
* @return
|
95
201
|
*/
|
96
202
|
public PMatrix3D get() {
|
97
203
|
PMatrix3D outgoing = new PMatrix3D();
|
@@ -103,6 +209,8 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
|
|
103
209
|
/**
|
104
210
|
* Copies the matrix contents into a 16 entry float array.
|
105
211
|
* If target is null (or not the correct size), a new array will be created.
|
212
|
+
* @param target
|
213
|
+
* @return
|
106
214
|
*/
|
107
215
|
public float[] get(float[] target) {
|
108
216
|
if ((target == null) || (target.length != 16)) {
|
@@ -197,8 +305,12 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
|
|
197
305
|
this.m30 = m30; this.m31 = m31; this.m32 = m32; this.m33 = m33;
|
198
306
|
}
|
199
307
|
|
200
|
-
|
201
|
-
|
308
|
+
/**
|
309
|
+
*
|
310
|
+
* @param tx
|
311
|
+
* @param ty
|
312
|
+
*/
|
313
|
+
public void translate(float tx, float ty) {
|
202
314
|
translate(tx, ty, 0);
|
203
315
|
}
|
204
316
|
|
@@ -206,42 +318,65 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
|
|
206
318
|
// invTranslate(tx, ty, 0);
|
207
319
|
// }
|
208
320
|
|
209
|
-
|
210
|
-
|
321
|
+
/**
|
322
|
+
*
|
323
|
+
* @param tx
|
324
|
+
* @param ty
|
325
|
+
* @param tz
|
326
|
+
*/
|
327
|
+
public void translate(float tx, float ty, float tz) {
|
211
328
|
m03 += tx*m00 + ty*m01 + tz*m02;
|
212
329
|
m13 += tx*m10 + ty*m11 + tz*m12;
|
213
330
|
m23 += tx*m20 + ty*m21 + tz*m22;
|
214
331
|
m33 += tx*m30 + ty*m31 + tz*m32;
|
215
332
|
}
|
216
333
|
|
217
|
-
|
218
|
-
|
334
|
+
/**
|
335
|
+
*
|
336
|
+
* @param angle
|
337
|
+
*/
|
338
|
+
public void rotate(float angle) {
|
219
339
|
rotateZ(angle);
|
220
340
|
}
|
221
341
|
|
222
|
-
|
223
|
-
|
342
|
+
/**
|
343
|
+
*
|
344
|
+
* @param angle
|
345
|
+
*/
|
346
|
+
public void rotateX(float angle) {
|
224
347
|
float c = cos(angle);
|
225
348
|
float s = sin(angle);
|
226
349
|
apply(1, 0, 0, 0, 0, c, -s, 0, 0, s, c, 0, 0, 0, 0, 1);
|
227
350
|
}
|
228
351
|
|
229
|
-
|
230
|
-
|
352
|
+
/**
|
353
|
+
*
|
354
|
+
* @param angle
|
355
|
+
*/
|
356
|
+
public void rotateY(float angle) {
|
231
357
|
float c = cos(angle);
|
232
358
|
float s = sin(angle);
|
233
359
|
apply(c, 0, s, 0, 0, 1, 0, 0, -s, 0, c, 0, 0, 0, 0, 1);
|
234
360
|
}
|
235
361
|
|
236
|
-
|
237
|
-
|
362
|
+
/**
|
363
|
+
*
|
364
|
+
* @param angle
|
365
|
+
*/
|
366
|
+
public void rotateZ(float angle) {
|
238
367
|
float c = cos(angle);
|
239
368
|
float s = sin(angle);
|
240
369
|
apply(c, -s, 0, 0, s, c, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
|
241
370
|
}
|
242
371
|
|
243
|
-
|
244
|
-
|
372
|
+
/**
|
373
|
+
*
|
374
|
+
* @param angle
|
375
|
+
* @param v0
|
376
|
+
* @param v1
|
377
|
+
* @param v2
|
378
|
+
*/
|
379
|
+
public void rotate(float angle, float v0, float v1, float v2) {
|
245
380
|
float norm2 = v0 * v0 + v1 * v1 + v2 * v2;
|
246
381
|
if (norm2 < PConstants.EPSILON) {
|
247
382
|
// The vector is zero, cannot apply rotation.
|
@@ -266,20 +401,32 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
|
|
266
401
|
0, 0, 0, 1);
|
267
402
|
}
|
268
403
|
|
269
|
-
|
270
|
-
|
404
|
+
/**
|
405
|
+
*
|
406
|
+
* @param s
|
407
|
+
*/
|
408
|
+
public void scale(float s) {
|
271
409
|
//apply(s, 0, 0, 0, 0, s, 0, 0, 0, 0, s, 0, 0, 0, 0, 1);
|
272
410
|
scale(s, s, s);
|
273
411
|
}
|
274
412
|
|
275
|
-
|
276
|
-
|
413
|
+
/**
|
414
|
+
*
|
415
|
+
* @param sx
|
416
|
+
* @param sy
|
417
|
+
*/
|
418
|
+
public void scale(float sx, float sy) {
|
277
419
|
//apply(sx, 0, 0, 0, 0, sy, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
|
278
420
|
scale(sx, sy, 1);
|
279
421
|
}
|
280
422
|
|
281
|
-
|
282
|
-
|
423
|
+
/**
|
424
|
+
*
|
425
|
+
* @param x
|
426
|
+
* @param y
|
427
|
+
* @param z
|
428
|
+
*/
|
429
|
+
public void scale(float x, float y, float z) {
|
283
430
|
//apply(x, 0, 0, 0, 0, y, 0, 0, 0, 0, z, 0, 0, 0, 0, 1);
|
284
431
|
m00 *= x; m01 *= y; m02 *= z;
|
285
432
|
m10 *= x; m11 *= y; m12 *= z;
|
@@ -287,8 +434,11 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
|
|
287
434
|
m30 *= x; m31 *= y; m32 *= z;
|
288
435
|
}
|
289
436
|
|
290
|
-
|
291
|
-
|
437
|
+
/**
|
438
|
+
*
|
439
|
+
* @param angle
|
440
|
+
*/
|
441
|
+
public void shearX(float angle) {
|
292
442
|
float t = (float) Math.tan(angle);
|
293
443
|
apply(1, t, 0, 0,
|
294
444
|
0, 1, 0, 0,
|
@@ -296,8 +446,11 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
|
|
296
446
|
0, 0, 0, 1);
|
297
447
|
}
|
298
448
|
|
299
|
-
|
300
|
-
|
449
|
+
/**
|
450
|
+
*
|
451
|
+
* @param angle
|
452
|
+
*/
|
453
|
+
public void shearY(float angle) {
|
301
454
|
float t = (float) Math.tan(angle);
|
302
455
|
apply(1, 0, 0, 0,
|
303
456
|
t, 1, 0, 0,
|
@@ -374,6 +527,7 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
|
|
374
527
|
|
375
528
|
/**
|
376
529
|
* Apply the 3D equivalent of the 2D matrix supplied to the left of this one.
|
530
|
+
* @param left
|
377
531
|
*/
|
378
532
|
public void preApply(PMatrix2D left) {
|
379
533
|
preApply(left.m00, left.m01, 0, left.m02,
|
@@ -385,6 +539,7 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
|
|
385
539
|
|
386
540
|
/**
|
387
541
|
* Apply another matrix to the left of this one.
|
542
|
+
* @param source
|
388
543
|
*/
|
389
544
|
public void preApply(PMatrix source) {
|
390
545
|
if (source instanceof PMatrix2D) {
|
@@ -397,6 +552,7 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
|
|
397
552
|
|
398
553
|
/**
|
399
554
|
* Apply another matrix to the left of this one.
|
555
|
+
* @param left
|
400
556
|
*/
|
401
557
|
public void preApply(PMatrix3D left) {
|
402
558
|
preApply(left.m00, left.m01, left.m02, left.m03,
|
@@ -408,6 +564,12 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
|
|
408
564
|
|
409
565
|
/**
|
410
566
|
* Apply the 3D equivalent of the 2D matrix supplied to the left of this one.
|
567
|
+
* @param n00
|
568
|
+
* @param n01
|
569
|
+
* @param n10
|
570
|
+
* @param n02
|
571
|
+
* @param n11
|
572
|
+
* @param n12
|
411
573
|
*/
|
412
574
|
public void preApply(float n00, float n01, float n02,
|
413
575
|
float n10, float n11, float n12) {
|
@@ -420,6 +582,22 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
|
|
420
582
|
|
421
583
|
/**
|
422
584
|
* Apply another matrix to the left of this one.
|
585
|
+
* @param n00
|
586
|
+
* @param n01
|
587
|
+
* @param n03
|
588
|
+
* @param n02
|
589
|
+
* @param n32
|
590
|
+
* @param n10
|
591
|
+
* @param n12
|
592
|
+
* @param n23
|
593
|
+
* @param n20
|
594
|
+
* @param n11
|
595
|
+
* @param n21
|
596
|
+
* @param n13
|
597
|
+
* @param n31
|
598
|
+
* @param n22
|
599
|
+
* @param n30
|
600
|
+
* @param n33
|
423
601
|
*/
|
424
602
|
public void preApply(float n00, float n01, float n02, float n03,
|
425
603
|
float n10, float n11, float n12, float n13,
|
@@ -461,6 +639,9 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
|
|
461
639
|
* The result will be stored in target if target is non-null, and target
|
462
640
|
* will then be the matrix returned. This improves performance if you reuse
|
463
641
|
* target, so it's recommended if you call this many times in draw().
|
642
|
+
* @param source
|
643
|
+
* @param target
|
644
|
+
* @return
|
464
645
|
*/
|
465
646
|
public PVector mult(PVector source, PVector target) {
|
466
647
|
if (target == null) {
|
@@ -499,6 +680,9 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
|
|
499
680
|
* null or not length 3 or 4, a new float array (length 3) will be returned.
|
500
681
|
* Supplying and recycling a target array improves performance, so it's
|
501
682
|
* recommended if you call this many times in draw.
|
683
|
+
* @param source
|
684
|
+
* @param target
|
685
|
+
* @return
|
502
686
|
*/
|
503
687
|
public float[] mult(float[] source, float[] target) {
|
504
688
|
if (target == null || target.length < 3) {
|
@@ -529,6 +713,9 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
|
|
529
713
|
/**
|
530
714
|
* Returns the x-coordinate of the result of multiplying the point (x, y)
|
531
715
|
* by this matrix.
|
716
|
+
* @param x
|
717
|
+
* @param y
|
718
|
+
* @return
|
532
719
|
*/
|
533
720
|
public float multX(float x, float y) {
|
534
721
|
return m00*x + m01*y + m03;
|
@@ -538,6 +725,9 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
|
|
538
725
|
/**
|
539
726
|
* Returns the y-coordinate of the result of multiplying the point (x, y)
|
540
727
|
* by this matrix.
|
728
|
+
* @param x
|
729
|
+
* @param y
|
730
|
+
* @return
|
541
731
|
*/
|
542
732
|
public float multY(float x, float y) {
|
543
733
|
return m10*x + m11*y + m13;
|
@@ -547,6 +737,10 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
|
|
547
737
|
/**
|
548
738
|
* Returns the x-coordinate of the result of multiplying the point (x, y, z)
|
549
739
|
* by this matrix.
|
740
|
+
* @param x
|
741
|
+
* @param y
|
742
|
+
* @param z
|
743
|
+
* @return
|
550
744
|
*/
|
551
745
|
public float multX(float x, float y, float z) {
|
552
746
|
return m00*x + m01*y + m02*z + m03;
|
@@ -556,6 +750,10 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
|
|
556
750
|
/**
|
557
751
|
* Returns the y-coordinate of the result of multiplying the point (x, y, z)
|
558
752
|
* by this matrix.
|
753
|
+
* @param x
|
754
|
+
* @param y
|
755
|
+
* @param z
|
756
|
+
* @return
|
559
757
|
*/
|
560
758
|
public float multY(float x, float y, float z) {
|
561
759
|
return m10*x + m11*y + m12*z + m13;
|
@@ -565,6 +763,10 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
|
|
565
763
|
/**
|
566
764
|
* Returns the z-coordinate of the result of multiplying the point (x, y, z)
|
567
765
|
* by this matrix.
|
766
|
+
* @param x
|
767
|
+
* @param y
|
768
|
+
* @param z
|
769
|
+
* @return
|
568
770
|
*/
|
569
771
|
public float multZ(float x, float y, float z) {
|
570
772
|
return m20*x + m21*y + m22*z + m23;
|
@@ -574,6 +776,10 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
|
|
574
776
|
/**
|
575
777
|
* Returns the fourth element of the result of multiplying the vector
|
576
778
|
* (x, y, z) by this matrix. (Acts as if w = 1 was supplied.)
|
779
|
+
* @param x
|
780
|
+
* @param y
|
781
|
+
* @param z
|
782
|
+
* @return
|
577
783
|
*/
|
578
784
|
public float multW(float x, float y, float z) {
|
579
785
|
return m30*x + m31*y + m32*z + m33;
|
@@ -583,6 +789,11 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
|
|
583
789
|
/**
|
584
790
|
* Returns the x-coordinate of the result of multiplying the vector
|
585
791
|
* (x, y, z, w) by this matrix.
|
792
|
+
* @param x
|
793
|
+
* @param y
|
794
|
+
* @param z
|
795
|
+
* @param w
|
796
|
+
* @return
|
586
797
|
*/
|
587
798
|
public float multX(float x, float y, float z, float w) {
|
588
799
|
return m00*x + m01*y + m02*z + m03*w;
|
@@ -592,6 +803,11 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
|
|
592
803
|
/**
|
593
804
|
* Returns the y-coordinate of the result of multiplying the vector
|
594
805
|
* (x, y, z, w) by this matrix.
|
806
|
+
* @param x
|
807
|
+
* @param w
|
808
|
+
* @param y
|
809
|
+
* @param z
|
810
|
+
* @return
|
595
811
|
*/
|
596
812
|
public float multY(float x, float y, float z, float w) {
|
597
813
|
return m10*x + m11*y + m12*z + m13*w;
|
@@ -601,6 +817,11 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
|
|
601
817
|
/**
|
602
818
|
* Returns the z-coordinate of the result of multiplying the vector
|
603
819
|
* (x, y, z, w) by this matrix.
|
820
|
+
* @param x
|
821
|
+
* @param y
|
822
|
+
* @param z
|
823
|
+
* @param w
|
824
|
+
* @return
|
604
825
|
*/
|
605
826
|
public float multZ(float x, float y, float z, float w) {
|
606
827
|
return m20*x + m21*y + m22*z + m23*w;
|
@@ -610,6 +831,11 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
|
|
610
831
|
/**
|
611
832
|
* Returns the w-coordinate of the result of multiplying the vector
|
612
833
|
* (x, y, z, w) by this matrix.
|
834
|
+
* @param x
|
835
|
+
* @param y
|
836
|
+
* @param z
|
837
|
+
* @param w
|
838
|
+
* @return
|
613
839
|
*/
|
614
840
|
public float multW(float x, float y, float z, float w) {
|
615
841
|
return m30*x + m31*y + m32*z + m33*w;
|
@@ -738,6 +964,13 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
|
|
738
964
|
|
739
965
|
// These functions should not be used, as they will be removed in the future.
|
740
966
|
|
967
|
+
/**
|
968
|
+
*
|
969
|
+
* @param tx
|
970
|
+
* @param ty
|
971
|
+
* @param tz
|
972
|
+
*/
|
973
|
+
|
741
974
|
|
742
975
|
protected void invTranslate(float tx, float ty, float tz) {
|
743
976
|
preApply(1, 0, 0, -tx,
|
@@ -746,29 +979,44 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
|
|
746
979
|
0, 0, 0, 1);
|
747
980
|
}
|
748
981
|
|
749
|
-
|
750
|
-
|
982
|
+
/**
|
983
|
+
*
|
984
|
+
* @param angle
|
985
|
+
*/
|
986
|
+
protected void invRotateX(float angle) {
|
751
987
|
float c = cos(-angle);
|
752
988
|
float s = sin(-angle);
|
753
989
|
preApply(1, 0, 0, 0, 0, c, -s, 0, 0, s, c, 0, 0, 0, 0, 1);
|
754
990
|
}
|
755
991
|
|
756
|
-
|
757
|
-
|
992
|
+
/**
|
993
|
+
*
|
994
|
+
* @param angle
|
995
|
+
*/
|
996
|
+
protected void invRotateY(float angle) {
|
758
997
|
float c = cos(-angle);
|
759
998
|
float s = sin(-angle);
|
760
999
|
preApply(c, 0, s, 0, 0, 1, 0, 0, -s, 0, c, 0, 0, 0, 0, 1);
|
761
1000
|
}
|
762
1001
|
|
763
|
-
|
764
|
-
|
1002
|
+
/**
|
1003
|
+
*
|
1004
|
+
* @param angle
|
1005
|
+
*/
|
1006
|
+
protected void invRotateZ(float angle) {
|
765
1007
|
float c = cos(-angle);
|
766
1008
|
float s = sin(-angle);
|
767
1009
|
preApply(c, -s, 0, 0, s, c, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
|
768
1010
|
}
|
769
1011
|
|
770
|
-
|
771
|
-
|
1012
|
+
/**
|
1013
|
+
*
|
1014
|
+
* @param angle
|
1015
|
+
* @param v0
|
1016
|
+
* @param v1
|
1017
|
+
* @param v2
|
1018
|
+
*/
|
1019
|
+
protected void invRotate(float angle, float v0, float v1, float v2) {
|
772
1020
|
//TODO should make sure this vector is normalized
|
773
1021
|
|
774
1022
|
float c = cos(-angle);
|
@@ -781,13 +1029,37 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
|
|
781
1029
|
0, 0, 0, 1);
|
782
1030
|
}
|
783
1031
|
|
784
|
-
|
785
|
-
|
1032
|
+
/**
|
1033
|
+
*
|
1034
|
+
* @param x
|
1035
|
+
* @param y
|
1036
|
+
* @param z
|
1037
|
+
*/
|
1038
|
+
protected void invScale(float x, float y, float z) {
|
786
1039
|
preApply(1/x, 0, 0, 0, 0, 1/y, 0, 0, 0, 0, 1/z, 0, 0, 0, 0, 1);
|
787
1040
|
}
|
788
1041
|
|
789
|
-
|
790
|
-
|
1042
|
+
/**
|
1043
|
+
*
|
1044
|
+
* @param n00
|
1045
|
+
* @param n01
|
1046
|
+
* @param n02
|
1047
|
+
* @param n03
|
1048
|
+
* @param n10
|
1049
|
+
* @param n11
|
1050
|
+
* @param n12
|
1051
|
+
* @param n13
|
1052
|
+
* @param n20
|
1053
|
+
* @param n21
|
1054
|
+
* @param n22
|
1055
|
+
* @param n23
|
1056
|
+
* @param n30
|
1057
|
+
* @param n31
|
1058
|
+
* @param n32
|
1059
|
+
* @param n33
|
1060
|
+
* @return
|
1061
|
+
*/
|
1062
|
+
protected boolean invApply(float n00, float n01, float n02, float n03,
|
791
1063
|
float n10, float n11, float n12, float n13,
|
792
1064
|
float n20, float n21, float n22, float n23,
|
793
1065
|
float n30, float n31, float n32, float n33) {
|
@@ -808,6 +1080,10 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
|
|
808
1080
|
|
809
1081
|
//////////////////////////////////////////////////////////////
|
810
1082
|
|
1083
|
+
/**
|
1084
|
+
*
|
1085
|
+
*/
|
1086
|
+
|
811
1087
|
|
812
1088
|
public void print() {
|
813
1089
|
/*
|