toxiclibs 0.9.1 → 0.9.2
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/.travis.yml +4 -4
- data/CHANGELOG.md +2 -0
- data/README.md +6 -4
- data/examples/boolean_shapes.rb +46 -0
- data/lib/toxiclibs/version.rb +1 -1
- data/pom.rb +2 -8
- data/pom.xml +2 -14
- data/src/BooleanShapes.java +66 -0
- data/src/toxi/color/ColorList.java +70 -60
- data/src/toxi/color/ColorTheme.java +1 -1
- data/src/toxi/color/Histogram.java +1 -0
- data/src/toxi/color/Hue.java +7 -7
- data/src/toxi/color/TColor.java +31 -24
- data/src/toxi/geom/AxisAlignedCylinder.java +1 -0
- data/src/toxi/geom/BezierCurve2D.java +1 -1
- data/src/toxi/geom/BezierCurve3D.java +1 -1
- data/src/toxi/geom/BooleanShapeBuilder.java +9 -7
- data/src/toxi/geom/Matrix3d.java +293 -381
- data/src/toxi/geom/Matrix4f.java +447 -568
- data/src/toxi/geom/Matrix4x4.java +42 -47
- data/src/toxi/geom/Quaternion.java +52 -71
- data/toxiclibs.gemspec +6 -8
- metadata +7 -28
- data/src/toxi/audio/AudioBuffer.java +0 -229
- data/src/toxi/audio/AudioSource.java +0 -288
- data/src/toxi/audio/DecompressInputStream.java +0 -159
- data/src/toxi/audio/IIRFilter.java +0 -197
- data/src/toxi/audio/JOALUtil.java +0 -388
- data/src/toxi/audio/MultiTimbralManager.java +0 -162
- data/src/toxi/audio/SoundListener.java +0 -154
- data/src/toxi/audio/SynthUtil.java +0 -109
data/src/toxi/geom/Matrix4f.java
CHANGED
@@ -28,7 +28,6 @@
|
|
28
28
|
* $Date: 2008-02-28 20:18:51 +0000 (Thu, 28 Feb 2008) $
|
29
29
|
* $State$
|
30
30
|
*/
|
31
|
-
|
32
31
|
package toxi.geom;
|
33
32
|
|
34
33
|
import toxi.math.MathUtils;
|
@@ -36,7 +35,7 @@ import toxi.math.MathUtils;
|
|
36
35
|
/**
|
37
36
|
* A single precision floating point 4 by 4 matrix. Primarily to support 3D
|
38
37
|
* rotations.
|
39
|
-
*
|
38
|
+
*
|
40
39
|
*/
|
41
40
|
public class Matrix4f implements java.io.Serializable, Cloneable {
|
42
41
|
|
@@ -51,7 +50,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
51
50
|
* "matrix2" in turn and treats it as the right-hand side of the matrix
|
52
51
|
* equation Ax = LUx = b. The solution vector replaces the original column
|
53
52
|
* of the matrix.
|
54
|
-
*
|
53
|
+
*
|
55
54
|
* If "matrix2" is the identity matrix, the procedure replaces its contents
|
56
55
|
* with the inverse of the matrix from which "matrix1" was originally
|
57
56
|
* derived.
|
@@ -234,39 +233,23 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
234
233
|
|
235
234
|
/**
|
236
235
|
* Constructs and initializes a Matrix4f from the specified 16 values.
|
237
|
-
*
|
238
|
-
* @param m00
|
239
|
-
*
|
240
|
-
* @param
|
241
|
-
*
|
242
|
-
* @param
|
243
|
-
*
|
244
|
-
* @param
|
245
|
-
*
|
246
|
-
* @param
|
247
|
-
*
|
248
|
-
* @param
|
249
|
-
*
|
250
|
-
* @param
|
251
|
-
*
|
252
|
-
* @param
|
253
|
-
*
|
254
|
-
* @param m20
|
255
|
-
* the [2][0] element
|
256
|
-
* @param m21
|
257
|
-
* the [2][1] element
|
258
|
-
* @param m22
|
259
|
-
* the [2][2] element
|
260
|
-
* @param m23
|
261
|
-
* the [2][3] element
|
262
|
-
* @param m30
|
263
|
-
* the [3][0] element
|
264
|
-
* @param m31
|
265
|
-
* the [3][1] element
|
266
|
-
* @param m32
|
267
|
-
* the [3][2] element
|
268
|
-
* @param m33
|
269
|
-
* the [3][3] element
|
236
|
+
*
|
237
|
+
* @param m00 the [0][0] element
|
238
|
+
* @param m01 the [0][1] element
|
239
|
+
* @param m02 the [0][2] element
|
240
|
+
* @param m03 the [0][3] element
|
241
|
+
* @param m10 the [1][0] element
|
242
|
+
* @param m11 the [1][1] element
|
243
|
+
* @param m12 the [1][2] element
|
244
|
+
* @param m13 the [1][3] element
|
245
|
+
* @param m20 the [2][0] element
|
246
|
+
* @param m21 the [2][1] element
|
247
|
+
* @param m22 the [2][2] element
|
248
|
+
* @param m23 the [2][3] element
|
249
|
+
* @param m30 the [3][0] element
|
250
|
+
* @param m31 the [3][1] element
|
251
|
+
* @param m32 the [3][2] element
|
252
|
+
* @param m33 the [3][3] element
|
270
253
|
*/
|
271
254
|
public Matrix4f(float m00, float m01, float m02, float m03, float m10,
|
272
255
|
float m11, float m12, float m13, float m20, float m21, float m22,
|
@@ -296,9 +279,8 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
296
279
|
/**
|
297
280
|
* Constructs and initializes a Matrix4f from the specified 16 element
|
298
281
|
* array. this.m00 =v[0], this.m01=v[1], etc.
|
299
|
-
*
|
300
|
-
* @param v
|
301
|
-
* the array of length 16 containing in order
|
282
|
+
*
|
283
|
+
* @param v the array of length 16 containing in order
|
302
284
|
*/
|
303
285
|
public Matrix4f(float[] v) {
|
304
286
|
this.m00 = v[0];
|
@@ -328,13 +310,10 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
328
310
|
* translation, and scale values; the scale is applied only to the
|
329
311
|
* rotational components of the matrix (upper 3x3) and not to the
|
330
312
|
* translational components of the matrix.
|
331
|
-
*
|
332
|
-
* @param m1
|
333
|
-
*
|
334
|
-
* @param
|
335
|
-
* the translational components of the matrix
|
336
|
-
* @param s
|
337
|
-
* the scale value applied to the rotational components
|
313
|
+
*
|
314
|
+
* @param m1 the rotation matrix representing the rotational components
|
315
|
+
* @param t1 the translational components of the matrix
|
316
|
+
* @param s the scale value applied to the rotational components
|
338
317
|
*/
|
339
318
|
public Matrix4f(Matrix3d m1, Vec3D t1, float s) {
|
340
319
|
this.m00 = (float) (m1.m00 * s);
|
@@ -361,9 +340,8 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
361
340
|
|
362
341
|
/**
|
363
342
|
* Constructs a new matrix with the same values as the Matrix4f parameter.
|
364
|
-
*
|
365
|
-
* @param m1
|
366
|
-
* the source matrix
|
343
|
+
*
|
344
|
+
* @param m1 the source matrix
|
367
345
|
*/
|
368
346
|
public Matrix4f(Matrix4f m1) {
|
369
347
|
this.m00 = m1.m00;
|
@@ -392,13 +370,10 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
392
370
|
* Constructs and initializes a Matrix4f from the quaternion, translation,
|
393
371
|
* and scale values; the scale is applied only to the rotational components
|
394
372
|
* of the matrix (upper 3x3) and not to the translational components.
|
395
|
-
*
|
396
|
-
* @param q1
|
397
|
-
*
|
398
|
-
* @param
|
399
|
-
* the translational component of the matrix
|
400
|
-
* @param s
|
401
|
-
* the scale value applied to the rotational components
|
373
|
+
*
|
374
|
+
* @param q1 the quaternion value representing the rotational component
|
375
|
+
* @param t1 the translational component of the matrix
|
376
|
+
* @param s the scale value applied to the rotational components
|
402
377
|
*/
|
403
378
|
public Matrix4f(Quaternion q1, Vec3D t1, float s) {
|
404
379
|
m00 = (float) (s * (1.0 - 2.0 * q1.y * q1.y - 2.0 * q1.z * q1.z));
|
@@ -426,9 +401,8 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
426
401
|
|
427
402
|
/**
|
428
403
|
* Adds a scalar to each component of this matrix.
|
429
|
-
*
|
430
|
-
* @param scalar
|
431
|
-
* the scalar adder
|
404
|
+
*
|
405
|
+
* @param scalar the scalar adder
|
432
406
|
*/
|
433
407
|
public final void add(float scalar) {
|
434
408
|
m00 += scalar;
|
@@ -452,11 +426,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
452
426
|
/**
|
453
427
|
* Adds a scalar to each component of the matrix m1 and places the result
|
454
428
|
* into this. Matrix m1 is not modified.
|
455
|
-
*
|
456
|
-
* @param scalar
|
457
|
-
*
|
458
|
-
* @param m1
|
459
|
-
* the original matrix values
|
429
|
+
*
|
430
|
+
* @param scalar the scalar adder
|
431
|
+
* @param m1 the original matrix values
|
460
432
|
*/
|
461
433
|
public final void add(float scalar, Matrix4f m1) {
|
462
434
|
this.m00 = m1.m00 + scalar;
|
@@ -479,9 +451,8 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
479
451
|
|
480
452
|
/**
|
481
453
|
* Sets the value of this matrix to the sum of itself and matrix m1.
|
482
|
-
*
|
483
|
-
* @param m1
|
484
|
-
* the other matrix
|
454
|
+
*
|
455
|
+
* @param m1 the other matrix
|
485
456
|
*/
|
486
457
|
public final void add(Matrix4f m1) {
|
487
458
|
this.m00 += m1.m00;
|
@@ -507,11 +478,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
507
478
|
|
508
479
|
/**
|
509
480
|
* Sets the value of this matrix to the matrix sum of matrices m1 and m2.
|
510
|
-
*
|
511
|
-
* @param m1
|
512
|
-
*
|
513
|
-
* @param m2
|
514
|
-
* the second matrix
|
481
|
+
*
|
482
|
+
* @param m1 the first matrix
|
483
|
+
* @param m2 the second matrix
|
515
484
|
*/
|
516
485
|
public final void add(Matrix4f m1, Matrix4f m2) {
|
517
486
|
this.m00 = m1.m00 + m2.m00;
|
@@ -537,10 +506,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
537
506
|
|
538
507
|
/**
|
539
508
|
* Creates a new object of the same class as this object.
|
540
|
-
*
|
509
|
+
*
|
541
510
|
* @return a clone of this instance.
|
542
|
-
* @exception OutOfMemoryError
|
543
|
-
* if there is not enough memory.
|
511
|
+
* @exception OutOfMemoryError if there is not enough memory.
|
544
512
|
* @see java.lang.Cloneable
|
545
513
|
* @since vecmath 1.3
|
546
514
|
*/
|
@@ -555,29 +523,27 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
555
523
|
//
|
556
524
|
// return m1;
|
557
525
|
// }
|
558
|
-
|
559
526
|
/**
|
560
527
|
* Computes the determinate of this matrix.
|
561
|
-
*
|
528
|
+
*
|
562
529
|
* @return the determinate of the matrix
|
563
530
|
*/
|
564
531
|
public final float determinant() {
|
565
532
|
float det;
|
566
533
|
|
567
534
|
// cofactor exapainsion along first row
|
568
|
-
|
569
535
|
det = m00
|
570
536
|
* (m11 * m22 * m33 + m12 * m23 * m31 + m13 * m21 * m32 - m13
|
571
|
-
|
537
|
+
* m22 * m31 - m11 * m23 * m32 - m12 * m21 * m33);
|
572
538
|
det -= m01
|
573
539
|
* (m10 * m22 * m33 + m12 * m23 * m30 + m13 * m20 * m32 - m13
|
574
|
-
|
540
|
+
* m22 * m30 - m10 * m23 * m32 - m12 * m20 * m33);
|
575
541
|
det += m02
|
576
542
|
* (m10 * m21 * m33 + m11 * m23 * m30 + m13 * m20 * m31 - m13
|
577
|
-
|
543
|
+
* m21 * m30 - m10 * m23 * m31 - m11 * m20 * m33);
|
578
544
|
det -= m03
|
579
545
|
* (m10 * m21 * m32 + m11 * m22 * m30 + m12 * m20 * m31 - m12
|
580
|
-
|
546
|
+
* m21 * m30 - m10 * m22 * m31 - m11 * m20 * m32);
|
581
547
|
|
582
548
|
return (det);
|
583
549
|
}
|
@@ -587,12 +553,10 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
587
553
|
* is less than or equal to the epsilon parameter, otherwise returns false.
|
588
554
|
* The L-infinite distance is equal to MAX[i=0,1,2,3 ; j=0,1,2,3 ;
|
589
555
|
* abs(this.m(i,j) - m1.m(i,j)]
|
590
|
-
*
|
591
|
-
* @param m1
|
592
|
-
*
|
593
|
-
* @
|
594
|
-
* the threshold value
|
595
|
-
* @return
|
556
|
+
*
|
557
|
+
* @param m1 the matrix to be compared to this matrix
|
558
|
+
* @param epsilon the threshold value
|
559
|
+
* @return
|
596
560
|
*/
|
597
561
|
public boolean epsilonEquals(Matrix4f m1, float epsilon) {
|
598
562
|
|
@@ -657,9 +621,8 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
657
621
|
/**
|
658
622
|
* Returns true if all of the data members of Matrix4f m1 are equal to the
|
659
623
|
* corresponding data members in this Matrix4f.
|
660
|
-
*
|
661
|
-
* @param m1
|
662
|
-
* the matrix with which the comparison is made.
|
624
|
+
*
|
625
|
+
* @param m1 the matrix with which the comparison is made.
|
663
626
|
* @return true or false
|
664
627
|
*/
|
665
628
|
public boolean equals(Matrix4f m1) {
|
@@ -682,9 +645,8 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
682
645
|
* Returns true if the Object t1 is of type Matrix4f and all of the data
|
683
646
|
* members of t1 are equal to the corresponding data members in this
|
684
647
|
* Matrix4f.
|
685
|
-
*
|
686
|
-
* @param t1
|
687
|
-
* the matrix with which the comparison is made.
|
648
|
+
*
|
649
|
+
* @param t1 the matrix with which the comparison is made.
|
688
650
|
* @return true or false
|
689
651
|
*/
|
690
652
|
@Override
|
@@ -733,9 +695,8 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
733
695
|
* Performs an SVD normalization of this matrix in order to acquire the
|
734
696
|
* normalized rotational component; the values are placed into the Matrix3d
|
735
697
|
* parameter.
|
736
|
-
*
|
737
|
-
* @param m1
|
738
|
-
* matrix into which the rotational component is placed
|
698
|
+
*
|
699
|
+
* @param m1 matrix into which the rotational component is placed
|
739
700
|
*/
|
740
701
|
public final void get(Matrix3d m1) {
|
741
702
|
|
@@ -762,11 +723,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
762
723
|
* Performs an SVD normalization of this matrix to calculate the rotation as
|
763
724
|
* a 3x3 matrix, the translation, and the scale. None of the matrix values
|
764
725
|
* are modified.
|
765
|
-
*
|
766
|
-
* @param m1
|
767
|
-
*
|
768
|
-
* @param t1
|
769
|
-
* the translation component
|
726
|
+
*
|
727
|
+
* @param m1 the normalized matrix representing the rotation
|
728
|
+
* @param t1 the translation component
|
770
729
|
* @return the scale component of this transform
|
771
730
|
*/
|
772
731
|
public final double get(Matrix3d m1, Vec3D t1) {
|
@@ -798,9 +757,8 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
798
757
|
* Performs an SVD normalization of this matrix in order to acquire the
|
799
758
|
* normalized rotational component; the values are placed into the Quat4f
|
800
759
|
* parameter.
|
801
|
-
*
|
802
|
-
* @param q1
|
803
|
-
* quaternion into which the rotation component is placed
|
760
|
+
*
|
761
|
+
* @param q1 quaternion into which the rotation component is placed
|
804
762
|
*/
|
805
763
|
public final void get(Quaternion q1) {
|
806
764
|
double[] tmp_rot = new double[9]; // scratch matrix
|
@@ -844,9 +802,8 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
844
802
|
|
845
803
|
/**
|
846
804
|
* Retrieves the translational components of this matrix.
|
847
|
-
*
|
848
|
-
* @param trans
|
849
|
-
* the vector that will receive the translational component
|
805
|
+
*
|
806
|
+
* @param trans the vector that will receive the translational component
|
850
807
|
*/
|
851
808
|
public final void get(Vec3D trans) {
|
852
809
|
trans.x = m03;
|
@@ -857,35 +814,38 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
857
814
|
/**
|
858
815
|
* Copies the matrix values in the specified column into the array
|
859
816
|
* parameter.
|
860
|
-
*
|
861
|
-
* @param column
|
862
|
-
*
|
863
|
-
* @param v
|
864
|
-
* the array into which the matrix row values will be copied
|
817
|
+
*
|
818
|
+
* @param column the matrix column
|
819
|
+
* @param v the array into which the matrix row values will be copied
|
865
820
|
*/
|
866
821
|
public final void getColumn(int column, float v[]) {
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
822
|
+
switch (column) {
|
823
|
+
case 0:
|
824
|
+
v[0] = m00;
|
825
|
+
v[1] = m10;
|
826
|
+
v[2] = m20;
|
827
|
+
v[3] = m30;
|
828
|
+
break;
|
829
|
+
case 1:
|
830
|
+
v[0] = m01;
|
831
|
+
v[1] = m11;
|
832
|
+
v[2] = m21;
|
833
|
+
v[3] = m31;
|
834
|
+
break;
|
835
|
+
case 2:
|
836
|
+
v[0] = m02;
|
837
|
+
v[1] = m12;
|
838
|
+
v[2] = m22;
|
839
|
+
v[3] = m32;
|
840
|
+
break;
|
841
|
+
case 3:
|
842
|
+
v[0] = m03;
|
843
|
+
v[1] = m13;
|
844
|
+
v[2] = m23;
|
845
|
+
v[3] = m33;
|
846
|
+
break;
|
847
|
+
default:
|
848
|
+
throw new ArrayIndexOutOfBoundsException();
|
889
849
|
}
|
890
850
|
|
891
851
|
}
|
@@ -893,46 +853,47 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
893
853
|
/**
|
894
854
|
* Copies the matrix values in the specified column into the vector
|
895
855
|
* parameter.
|
896
|
-
*
|
897
|
-
* @param column
|
898
|
-
*
|
899
|
-
* @param v
|
900
|
-
* the vector into which the matrix row values will be copied
|
856
|
+
*
|
857
|
+
* @param column the matrix column
|
858
|
+
* @param v the vector into which the matrix row values will be copied
|
901
859
|
*/
|
902
860
|
public final void getColumn(int column, Vec4D v) {
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
861
|
+
switch (column) {
|
862
|
+
case 0:
|
863
|
+
v.x = m00;
|
864
|
+
v.y = m10;
|
865
|
+
v.z = m20;
|
866
|
+
v.w = m30;
|
867
|
+
break;
|
868
|
+
case 1:
|
869
|
+
v.x = m01;
|
870
|
+
v.y = m11;
|
871
|
+
v.z = m21;
|
872
|
+
v.w = m31;
|
873
|
+
break;
|
874
|
+
case 2:
|
875
|
+
v.x = m02;
|
876
|
+
v.y = m12;
|
877
|
+
v.z = m22;
|
878
|
+
v.w = m32;
|
879
|
+
break;
|
880
|
+
case 3:
|
881
|
+
v.x = m03;
|
882
|
+
v.y = m13;
|
883
|
+
v.z = m23;
|
884
|
+
v.w = m33;
|
885
|
+
break;
|
886
|
+
default:
|
887
|
+
throw new ArrayIndexOutOfBoundsException();
|
925
888
|
}
|
926
889
|
|
927
890
|
}
|
928
891
|
|
929
892
|
/**
|
930
893
|
* Retrieves the value at the specified row and column of this matrix.
|
931
|
-
*
|
932
|
-
* @param row
|
933
|
-
*
|
934
|
-
* @param column
|
935
|
-
* the column number to be retrieved (zero indexed)
|
894
|
+
*
|
895
|
+
* @param row the row number to be retrieved (zero indexed)
|
896
|
+
* @param column the column number to be retrieved (zero indexed)
|
936
897
|
* @return the value at the indexed element
|
937
898
|
*/
|
938
899
|
public final float getElement(int row, int column) {
|
@@ -1004,9 +965,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
1004
965
|
|
1005
966
|
/**
|
1006
967
|
* Get the first matrix element in the first row.
|
1007
|
-
*
|
968
|
+
*
|
1008
969
|
* @return Returns the m00.
|
1009
|
-
*
|
970
|
+
*
|
1010
971
|
* @since vecmath 1.5
|
1011
972
|
*/
|
1012
973
|
public final float getM00() {
|
@@ -1015,9 +976,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
1015
976
|
|
1016
977
|
/**
|
1017
978
|
* Get the second matrix element in the first row.
|
1018
|
-
*
|
979
|
+
*
|
1019
980
|
* @return Returns the m01.
|
1020
|
-
*
|
981
|
+
*
|
1021
982
|
* @since vecmath 1.5
|
1022
983
|
*/
|
1023
984
|
public final float getM01() {
|
@@ -1026,9 +987,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
1026
987
|
|
1027
988
|
/**
|
1028
989
|
* Get the third matrix element in the first row.
|
1029
|
-
*
|
990
|
+
*
|
1030
991
|
* @return Returns the m02.
|
1031
|
-
*
|
992
|
+
*
|
1032
993
|
* @since vecmath 1.5
|
1033
994
|
*/
|
1034
995
|
public final float getM02() {
|
@@ -1037,9 +998,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
1037
998
|
|
1038
999
|
/**
|
1039
1000
|
* Get the fourth element of the first row.
|
1040
|
-
*
|
1001
|
+
*
|
1041
1002
|
* @return Returns the m03.
|
1042
|
-
*
|
1003
|
+
*
|
1043
1004
|
* @since vecmath 1.5
|
1044
1005
|
*/
|
1045
1006
|
public final float getM03() {
|
@@ -1048,9 +1009,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
1048
1009
|
|
1049
1010
|
/**
|
1050
1011
|
* Get first matrix element in the second row.
|
1051
|
-
*
|
1012
|
+
*
|
1052
1013
|
* @return Returns the m10.
|
1053
|
-
*
|
1014
|
+
*
|
1054
1015
|
* @since vecmath 1.5
|
1055
1016
|
*/
|
1056
1017
|
public final float getM10() {
|
@@ -1059,9 +1020,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
1059
1020
|
|
1060
1021
|
/**
|
1061
1022
|
* Get second matrix element in the second row.
|
1062
|
-
*
|
1023
|
+
*
|
1063
1024
|
* @return Returns the m11.
|
1064
|
-
*
|
1025
|
+
*
|
1065
1026
|
* @since vecmath 1.5
|
1066
1027
|
*/
|
1067
1028
|
public final float getM11() {
|
@@ -1070,9 +1031,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
1070
1031
|
|
1071
1032
|
/**
|
1072
1033
|
* Get the third matrix element in the second row.
|
1073
|
-
*
|
1034
|
+
*
|
1074
1035
|
* @return Returns the m12.
|
1075
|
-
*
|
1036
|
+
*
|
1076
1037
|
* @since vecmath 1.5
|
1077
1038
|
*/
|
1078
1039
|
public final float getM12() {
|
@@ -1081,9 +1042,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
1081
1042
|
|
1082
1043
|
/**
|
1083
1044
|
* Get the fourth element of the second row.
|
1084
|
-
*
|
1045
|
+
*
|
1085
1046
|
* @return Returns the m13.
|
1086
|
-
*
|
1047
|
+
*
|
1087
1048
|
* @since vecmath 1.5
|
1088
1049
|
*/
|
1089
1050
|
public final float getM13() {
|
@@ -1092,9 +1053,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
1092
1053
|
|
1093
1054
|
/**
|
1094
1055
|
* Get the first matrix element in the third row.
|
1095
|
-
*
|
1056
|
+
*
|
1096
1057
|
* @return Returns the m20.
|
1097
|
-
*
|
1058
|
+
*
|
1098
1059
|
* @since vecmath 1.5
|
1099
1060
|
*/
|
1100
1061
|
public final float getM20() {
|
@@ -1103,9 +1064,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
1103
1064
|
|
1104
1065
|
/**
|
1105
1066
|
* Get the second matrix element in the third row.
|
1106
|
-
*
|
1067
|
+
*
|
1107
1068
|
* @return Returns the m21.
|
1108
|
-
*
|
1069
|
+
*
|
1109
1070
|
* @since vecmath 1.5
|
1110
1071
|
*/
|
1111
1072
|
public final float getM21() {
|
@@ -1114,9 +1075,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
1114
1075
|
|
1115
1076
|
/**
|
1116
1077
|
* Get the third matrix element in the third row.
|
1117
|
-
*
|
1078
|
+
*
|
1118
1079
|
* @return Returns the m22.
|
1119
|
-
*
|
1080
|
+
*
|
1120
1081
|
* @since vecmath 1.5
|
1121
1082
|
*/
|
1122
1083
|
public final float getM22() {
|
@@ -1125,9 +1086,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
1125
1086
|
|
1126
1087
|
/**
|
1127
1088
|
* Get the fourth element of the third row.
|
1128
|
-
*
|
1089
|
+
*
|
1129
1090
|
* @return Returns the m23.
|
1130
|
-
*
|
1091
|
+
*
|
1131
1092
|
* @since vecmath 1.5
|
1132
1093
|
*/
|
1133
1094
|
public final float getM23() {
|
@@ -1136,9 +1097,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
1136
1097
|
|
1137
1098
|
/**
|
1138
1099
|
* Get the first element of the fourth row.
|
1139
|
-
*
|
1100
|
+
*
|
1140
1101
|
* @return Returns the m30.
|
1141
|
-
*
|
1102
|
+
*
|
1142
1103
|
* @since vecmath 1.5
|
1143
1104
|
*/
|
1144
1105
|
public final float getM30() {
|
@@ -1147,9 +1108,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
1147
1108
|
|
1148
1109
|
/**
|
1149
1110
|
* Get the second element of the fourth row.
|
1150
|
-
*
|
1111
|
+
*
|
1151
1112
|
* @return Returns the m31.
|
1152
|
-
*
|
1113
|
+
*
|
1153
1114
|
* @since vecmath 1.5
|
1154
1115
|
*/
|
1155
1116
|
public final float getM31() {
|
@@ -1158,9 +1119,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
1158
1119
|
|
1159
1120
|
/**
|
1160
1121
|
* Get the third element of the fourth row.
|
1161
|
-
*
|
1122
|
+
*
|
1162
1123
|
* @return Returns the m32.
|
1163
|
-
*
|
1124
|
+
*
|
1164
1125
|
* @since vecmath 1.5
|
1165
1126
|
*/
|
1166
1127
|
public final float getM32() {
|
@@ -1169,9 +1130,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
1169
1130
|
|
1170
1131
|
/**
|
1171
1132
|
* Get the fourth element of the fourth row.
|
1172
|
-
*
|
1133
|
+
*
|
1173
1134
|
* @return Returns the m33.
|
1174
|
-
*
|
1135
|
+
*
|
1175
1136
|
* @since vecmath 1.5
|
1176
1137
|
*/
|
1177
1138
|
public final float getM33() {
|
@@ -1181,9 +1142,8 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
1181
1142
|
/**
|
1182
1143
|
* Gets the upper 3x3 values of this matrix and places them into the matrix
|
1183
1144
|
* m1.
|
1184
|
-
*
|
1185
|
-
* @param m1
|
1186
|
-
* the matrix that will hold the values
|
1145
|
+
*
|
1146
|
+
* @param m1 the matrix that will hold the values
|
1187
1147
|
*/
|
1188
1148
|
public final void getRotationScale(Matrix3d m1) {
|
1189
1149
|
m1.m00 = m00;
|
@@ -1199,70 +1159,76 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
1199
1159
|
|
1200
1160
|
/**
|
1201
1161
|
* Copies the matrix values in the specified row into the array parameter.
|
1202
|
-
*
|
1203
|
-
* @param row
|
1204
|
-
*
|
1205
|
-
* @param v
|
1206
|
-
* the array into which the matrix row values will be copied
|
1162
|
+
*
|
1163
|
+
* @param row the matrix row
|
1164
|
+
* @param v the array into which the matrix row values will be copied
|
1207
1165
|
*/
|
1208
1166
|
public final void getRow(int row, float v[]) {
|
1209
|
-
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1167
|
+
switch (row) {
|
1168
|
+
case 0:
|
1169
|
+
v[0] = m00;
|
1170
|
+
v[1] = m01;
|
1171
|
+
v[2] = m02;
|
1172
|
+
v[3] = m03;
|
1173
|
+
break;
|
1174
|
+
case 1:
|
1175
|
+
v[0] = m10;
|
1176
|
+
v[1] = m11;
|
1177
|
+
v[2] = m12;
|
1178
|
+
v[3] = m13;
|
1179
|
+
break;
|
1180
|
+
case 2:
|
1181
|
+
v[0] = m20;
|
1182
|
+
v[1] = m21;
|
1183
|
+
v[2] = m22;
|
1184
|
+
v[3] = m23;
|
1185
|
+
break;
|
1186
|
+
case 3:
|
1187
|
+
v[0] = m30;
|
1188
|
+
v[1] = m31;
|
1189
|
+
v[2] = m32;
|
1190
|
+
v[3] = m33;
|
1191
|
+
break;
|
1192
|
+
default:
|
1193
|
+
throw new ArrayIndexOutOfBoundsException();
|
1231
1194
|
}
|
1232
1195
|
|
1233
1196
|
}
|
1234
1197
|
|
1235
1198
|
/**
|
1236
1199
|
* Copies the matrix values in the specified row into the vector parameter.
|
1237
|
-
*
|
1238
|
-
* @param row
|
1239
|
-
*
|
1240
|
-
* @param v
|
1241
|
-
* the vector into which the matrix row values will be copied
|
1200
|
+
*
|
1201
|
+
* @param row the matrix row
|
1202
|
+
* @param v the vector into which the matrix row values will be copied
|
1242
1203
|
*/
|
1243
1204
|
public final void getRow(int row, Vec4D v) {
|
1244
|
-
|
1245
|
-
|
1246
|
-
|
1247
|
-
|
1248
|
-
|
1249
|
-
|
1250
|
-
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1255
|
-
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1261
|
-
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1265
|
-
|
1205
|
+
switch (row) {
|
1206
|
+
case 0:
|
1207
|
+
v.x = m00;
|
1208
|
+
v.y = m01;
|
1209
|
+
v.z = m02;
|
1210
|
+
v.w = m03;
|
1211
|
+
break;
|
1212
|
+
case 1:
|
1213
|
+
v.x = m10;
|
1214
|
+
v.y = m11;
|
1215
|
+
v.z = m12;
|
1216
|
+
v.w = m13;
|
1217
|
+
break;
|
1218
|
+
case 2:
|
1219
|
+
v.x = m20;
|
1220
|
+
v.y = m21;
|
1221
|
+
v.z = m22;
|
1222
|
+
v.w = m23;
|
1223
|
+
break;
|
1224
|
+
case 3:
|
1225
|
+
v.x = m30;
|
1226
|
+
v.y = m31;
|
1227
|
+
v.z = m32;
|
1228
|
+
v.w = m33;
|
1229
|
+
break;
|
1230
|
+
default:
|
1231
|
+
throw new ArrayIndexOutOfBoundsException();
|
1266
1232
|
}
|
1267
1233
|
|
1268
1234
|
}
|
@@ -1272,7 +1238,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
1272
1238
|
* uniform scale factor. If the matrix has non-uniform scale factors, the
|
1273
1239
|
* largest of the x, y, and z scale factors will be returned. This matrix is
|
1274
1240
|
* not modified.
|
1275
|
-
*
|
1241
|
+
*
|
1276
1242
|
* @return the scale factor of this matrix
|
1277
1243
|
*/
|
1278
1244
|
public final float getScale() {
|
@@ -1305,31 +1271,30 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
1305
1271
|
* Matrix4f.equals returns true) will return the same hash code value. Two
|
1306
1272
|
* objects with different data members may return the same hash value,
|
1307
1273
|
* although this is not likely.
|
1308
|
-
*
|
1274
|
+
*
|
1309
1275
|
* @return the integer hash code value
|
1310
1276
|
*/
|
1311
1277
|
// @Override
|
1312
1278
|
// public int hashCode() {
|
1313
|
-
|
1314
|
-
|
1315
|
-
|
1316
|
-
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1324
|
-
|
1325
|
-
|
1326
|
-
|
1327
|
-
|
1328
|
-
|
1329
|
-
|
1330
|
-
|
1279
|
+
// long bits = 1L;
|
1280
|
+
// bits = 31L * bits + VecMathUtil.floatToIntBits(m00);
|
1281
|
+
// bits = 31L * bits + VecMathUtil.floatToIntBits(m01);
|
1282
|
+
// bits = 31L * bits + VecMathUtil.floatToIntBits(m02);
|
1283
|
+
// bits = 31L * bits + VecMathUtil.floatToIntBits(m03);
|
1284
|
+
// bits = 31L * bits + VecMathUtil.floatToIntBits(m10);
|
1285
|
+
// bits = 31L * bits + VecMathUtil.floatToIntBits(m11);
|
1286
|
+
// bits = 31L * bits + VecMathUtil.floatToIntBits(m12);
|
1287
|
+
// bits = 31L * bits + VecMathUtil.floatToIntBits(m13);
|
1288
|
+
// bits = 31L * bits + VecMathUtil.floatToIntBits(m20);
|
1289
|
+
// bits = 31L * bits + VecMathUtil.floatToIntBits(m21);
|
1290
|
+
// bits = 31L * bits + VecMathUtil.floatToIntBits(m22);
|
1291
|
+
// bits = 31L * bits + VecMathUtil.floatToIntBits(m23);
|
1292
|
+
// bits = 31L * bits + VecMathUtil.floatToIntBits(m30);
|
1293
|
+
// bits = 31L * bits + VecMathUtil.floatToIntBits(m31);
|
1294
|
+
// bits = 31L * bits + VecMathUtil.floatToIntBits(m32);
|
1295
|
+
// bits = 31L * bits + VecMathUtil.floatToIntBits(m33);
|
1296
|
+
// return (int) (bits ^ (bits >> 32));
|
1331
1297
|
// }
|
1332
|
-
|
1333
1298
|
/**
|
1334
1299
|
* Inverts this matrix in place.
|
1335
1300
|
*/
|
@@ -1340,9 +1305,8 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
1340
1305
|
/**
|
1341
1306
|
* Sets the value of this matrix to the matrix inverse of the passed (user
|
1342
1307
|
* declared) matrix m1.
|
1343
|
-
*
|
1344
|
-
* @param m1
|
1345
|
-
* the matrix to be inverted
|
1308
|
+
*
|
1309
|
+
* @param m1 the matrix to be inverted
|
1346
1310
|
*/
|
1347
1311
|
public final void invert(Matrix4f m1) {
|
1348
1312
|
|
@@ -1353,7 +1317,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
1353
1317
|
* General invert routine. Inverts m1 and places the result in "this". Note
|
1354
1318
|
* that this routine handles both the "this" version and the non-"this"
|
1355
1319
|
* version.
|
1356
|
-
*
|
1320
|
+
*
|
1357
1321
|
* Also note that since this routine is slow anyway, we won't worry about
|
1358
1322
|
* allocating a little bit of garbage.
|
1359
1323
|
*/
|
@@ -1365,7 +1329,6 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
1365
1329
|
|
1366
1330
|
// Use LU decomposition and backsubstitution code specifically
|
1367
1331
|
// for floating-point 4x4 matrices.
|
1368
|
-
|
1369
1332
|
// Copy source matrix to t1tmp
|
1370
1333
|
temp[0] = m1.m00;
|
1371
1334
|
temp[1] = m1.m01;
|
@@ -1427,9 +1390,8 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
1427
1390
|
|
1428
1391
|
/**
|
1429
1392
|
* Multiplies each element of this matrix by a scalar.
|
1430
|
-
*
|
1431
|
-
* @param scalar
|
1432
|
-
* the scalar multiplier.
|
1393
|
+
*
|
1394
|
+
* @param scalar the scalar multiplier.
|
1433
1395
|
*/
|
1434
1396
|
public final void mul(float scalar) {
|
1435
1397
|
m00 *= scalar;
|
@@ -1453,11 +1415,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
1453
1415
|
/**
|
1454
1416
|
* Multiplies each element of matrix m1 by a scalar and places the result
|
1455
1417
|
* into this. Matrix m1 is not modified.
|
1456
|
-
*
|
1457
|
-
* @param scalar
|
1458
|
-
*
|
1459
|
-
* @param m1
|
1460
|
-
* the original matrix.
|
1418
|
+
*
|
1419
|
+
* @param scalar the scalar multiplier.
|
1420
|
+
* @param m1 the original matrix.
|
1461
1421
|
*/
|
1462
1422
|
public final void mul(float scalar, Matrix4f m1) {
|
1463
1423
|
this.m00 = m1.m00 * scalar;
|
@@ -1481,16 +1441,15 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
1481
1441
|
/**
|
1482
1442
|
* Sets the value of this matrix to the result of multiplying itself with
|
1483
1443
|
* matrix m1.
|
1484
|
-
*
|
1485
|
-
* @param m1
|
1486
|
-
* the other matrix
|
1444
|
+
*
|
1445
|
+
* @param m1 the other matrix
|
1487
1446
|
*/
|
1488
1447
|
public final void mul(Matrix4f m1) {
|
1489
1448
|
float mm00, mm01, mm02, mm03, mm10, mm11, mm12, mm13, mm20, mm21, mm22, mm23, mm30, mm31, mm32, mm33; // vars
|
1490
|
-
|
1491
|
-
|
1492
|
-
|
1493
|
-
|
1449
|
+
// for
|
1450
|
+
// temp
|
1451
|
+
// result
|
1452
|
+
// matrix
|
1494
1453
|
|
1495
1454
|
mm00 = this.m00 * m1.m00 + this.m01 * m1.m10 + this.m02 * m1.m20
|
1496
1455
|
+ this.m03 * m1.m30;
|
@@ -1549,11 +1508,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
1549
1508
|
/**
|
1550
1509
|
* Sets the value of this matrix to the result of multiplying the two
|
1551
1510
|
* argument matrices together.
|
1552
|
-
*
|
1553
|
-
* @param m1
|
1554
|
-
*
|
1555
|
-
* @param m2
|
1556
|
-
* the second matrix
|
1511
|
+
*
|
1512
|
+
* @param m1 the first matrix
|
1513
|
+
* @param m2 the second matrix
|
1557
1514
|
*/
|
1558
1515
|
public final void mul(Matrix4f m1, Matrix4f m2) {
|
1559
1516
|
if (this != m1 && this != m2) {
|
@@ -1595,10 +1552,10 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
1595
1552
|
+ m1.m33 * m2.m33;
|
1596
1553
|
} else {
|
1597
1554
|
float mm00, mm01, mm02, mm03, mm10, mm11, mm12, mm13, mm20, mm21, mm22, mm23, mm30, mm31, mm32, mm33; // vars
|
1598
|
-
|
1599
|
-
|
1600
|
-
|
1601
|
-
|
1555
|
+
// for
|
1556
|
+
// temp
|
1557
|
+
// result
|
1558
|
+
// matrix
|
1602
1559
|
mm00 = m1.m00 * m2.m00 + m1.m01 * m2.m10 + m1.m02 * m2.m20 + m1.m03
|
1603
1560
|
* m2.m30;
|
1604
1561
|
mm01 = m1.m00 * m2.m01 + m1.m01 * m2.m11 + m1.m02 * m2.m21 + m1.m03
|
@@ -1657,11 +1614,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
1657
1614
|
/**
|
1658
1615
|
* Multiplies the transpose of matrix m1 times the transpose of matrix m2,
|
1659
1616
|
* and places the result into this.
|
1660
|
-
*
|
1661
|
-
* @param m1
|
1662
|
-
*
|
1663
|
-
* @param m2
|
1664
|
-
* the matrix on the right hand side of the multiplication
|
1617
|
+
*
|
1618
|
+
* @param m1 the matrix on the left hand side of the multiplication
|
1619
|
+
* @param m2 the matrix on the right hand side of the multiplication
|
1665
1620
|
*/
|
1666
1621
|
public final void mulTransposeBoth(Matrix4f m1, Matrix4f m2) {
|
1667
1622
|
if (this != m1 && this != m2) {
|
@@ -1702,11 +1657,11 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
1702
1657
|
+ m1.m33 * m2.m33;
|
1703
1658
|
} else {
|
1704
1659
|
float mm00, mm01, mm02, mm03, mm10, mm11, mm12, mm13, mm20, mm21, mm22, mm23, // vars
|
1705
|
-
|
1706
|
-
|
1707
|
-
|
1708
|
-
|
1709
|
-
|
1660
|
+
// for
|
1661
|
+
// temp
|
1662
|
+
// result
|
1663
|
+
// matrix
|
1664
|
+
mm30, mm31, mm32, mm33;
|
1710
1665
|
|
1711
1666
|
mm00 = m1.m00 * m2.m00 + m1.m10 * m2.m01 + m1.m20 * m2.m02 + m1.m30
|
1712
1667
|
* m2.m03;
|
@@ -1767,11 +1722,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
1767
1722
|
/**
|
1768
1723
|
* Multiplies the transpose of matrix m1 times matrix m2, and places the
|
1769
1724
|
* result into this.
|
1770
|
-
*
|
1771
|
-
* @param m1
|
1772
|
-
*
|
1773
|
-
* @param m2
|
1774
|
-
* the matrix on the right hand side of the multiplication
|
1725
|
+
*
|
1726
|
+
* @param m1 the matrix on the left hand side of the multiplication
|
1727
|
+
* @param m2 the matrix on the right hand side of the multiplication
|
1775
1728
|
*/
|
1776
1729
|
public final void mulTransposeLeft(Matrix4f m1, Matrix4f m2) {
|
1777
1730
|
if (this != m1 && this != m2) {
|
@@ -1812,11 +1765,11 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
1812
1765
|
+ m1.m33 * m2.m33;
|
1813
1766
|
} else {
|
1814
1767
|
float mm00, mm01, mm02, mm03, mm10, mm11, mm12, mm13, mm20, mm21, mm22, mm23, // vars
|
1815
|
-
|
1816
|
-
|
1817
|
-
|
1818
|
-
|
1819
|
-
|
1768
|
+
// for
|
1769
|
+
// temp
|
1770
|
+
// result
|
1771
|
+
// matrix
|
1772
|
+
mm30, mm31, mm32, mm33;
|
1820
1773
|
|
1821
1774
|
mm00 = m1.m00 * m2.m00 + m1.m10 * m2.m10 + m1.m20 * m2.m20 + m1.m30
|
1822
1775
|
* m2.m30;
|
@@ -1877,11 +1830,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
1877
1830
|
/**
|
1878
1831
|
* Multiplies matrix m1 times the transpose of matrix m2, and places the
|
1879
1832
|
* result into this.
|
1880
|
-
*
|
1881
|
-
* @param m1
|
1882
|
-
*
|
1883
|
-
* @param m2
|
1884
|
-
* the matrix on the right hand side of the multiplication
|
1833
|
+
*
|
1834
|
+
* @param m1 the matrix on the left hand side of the multiplication
|
1835
|
+
* @param m2 the matrix on the right hand side of the multiplication
|
1885
1836
|
*/
|
1886
1837
|
public final void mulTransposeRight(Matrix4f m1, Matrix4f m2) {
|
1887
1838
|
if (this != m1 && this != m2) {
|
@@ -1922,11 +1873,11 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
1922
1873
|
+ m1.m33 * m2.m33;
|
1923
1874
|
} else {
|
1924
1875
|
float mm00, mm01, mm02, mm03, mm10, mm11, mm12, mm13, mm20, mm21, mm22, mm23, // vars
|
1925
|
-
|
1926
|
-
|
1927
|
-
|
1928
|
-
|
1929
|
-
|
1876
|
+
// for
|
1877
|
+
// temp
|
1878
|
+
// result
|
1879
|
+
// matrix
|
1880
|
+
mm30, mm31, mm32, mm33;
|
1930
1881
|
|
1931
1882
|
mm00 = m1.m00 * m2.m00 + m1.m01 * m2.m01 + m1.m02 * m2.m02 + m1.m03
|
1932
1883
|
* m2.m03;
|
@@ -2009,9 +1960,8 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2009
1960
|
/**
|
2010
1961
|
* Sets the value of this matrix equal to the negation of of the Matrix4f
|
2011
1962
|
* parameter.
|
2012
|
-
*
|
2013
|
-
* @param m1
|
2014
|
-
* the source matrix
|
1963
|
+
*
|
1964
|
+
* @param m1 the source matrix
|
2015
1965
|
*/
|
2016
1966
|
public final void negate(Matrix4f m1) {
|
2017
1967
|
this.m00 = -m1.m00;
|
@@ -2035,9 +1985,8 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2035
1985
|
/**
|
2036
1986
|
* Sets the value of this matrix to a counter clockwise rotation about the x
|
2037
1987
|
* axis.
|
2038
|
-
*
|
2039
|
-
* @param angle
|
2040
|
-
* the angle to rotate about the X axis in radians
|
1988
|
+
*
|
1989
|
+
* @param angle the angle to rotate about the X axis in radians
|
2041
1990
|
*/
|
2042
1991
|
public final void rotX(float angle) {
|
2043
1992
|
float sinAngle, cosAngle;
|
@@ -2069,9 +2018,8 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2069
2018
|
/**
|
2070
2019
|
* Sets the value of this matrix to a counter clockwise rotation about the y
|
2071
2020
|
* axis.
|
2072
|
-
*
|
2073
|
-
* @param angle
|
2074
|
-
* the angle to rotate about the Y axis in radians
|
2021
|
+
*
|
2022
|
+
* @param angle the angle to rotate about the Y axis in radians
|
2075
2023
|
*/
|
2076
2024
|
public final void rotY(float angle) {
|
2077
2025
|
float sinAngle, cosAngle;
|
@@ -2103,9 +2051,8 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2103
2051
|
/**
|
2104
2052
|
* Sets the value of this matrix to a counter clockwise rotation about the z
|
2105
2053
|
* axis.
|
2106
|
-
*
|
2107
|
-
* @param angle
|
2108
|
-
* the angle to rotate about the Z axis in radians
|
2054
|
+
*
|
2055
|
+
* @param angle the angle to rotate about the Z axis in radians
|
2109
2056
|
*/
|
2110
2057
|
public final void rotZ(float angle) {
|
2111
2058
|
float sinAngle, cosAngle;
|
@@ -2137,9 +2084,8 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2137
2084
|
/**
|
2138
2085
|
* Sets the value of this matrix to a scale matrix with the the passed scale
|
2139
2086
|
* amount.
|
2140
|
-
*
|
2141
|
-
* @param scale
|
2142
|
-
* the scale factor for the matrix
|
2087
|
+
*
|
2088
|
+
* @param scale the scale factor for the matrix
|
2143
2089
|
*/
|
2144
2090
|
public final void set(float scale) {
|
2145
2091
|
this.m00 = scale;
|
@@ -2167,11 +2113,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2167
2113
|
* Sets the value of this transform to a scale and translation matrix; the
|
2168
2114
|
* scale is not applied to the translation and all of the matrix values are
|
2169
2115
|
* modified.
|
2170
|
-
*
|
2171
|
-
* @param scale
|
2172
|
-
*
|
2173
|
-
* @param t1
|
2174
|
-
* the translation amount
|
2116
|
+
*
|
2117
|
+
* @param scale the scale factor for the matrix
|
2118
|
+
* @param t1 the translation amount
|
2175
2119
|
*/
|
2176
2120
|
public final void set(float scale, Vec3D t1) {
|
2177
2121
|
this.m00 = scale;
|
@@ -2199,9 +2143,8 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2199
2143
|
* Sets the values in this Matrix4f equal to the row-major array parameter
|
2200
2144
|
* (ie, the first four elements of the array will be copied into the first
|
2201
2145
|
* row of this matrix, etc.).
|
2202
|
-
*
|
2203
|
-
* @param m
|
2204
|
-
* the single precision array of length 16
|
2146
|
+
*
|
2147
|
+
* @param m the single precision array of length 16
|
2205
2148
|
*/
|
2206
2149
|
public final void set(float[] m) {
|
2207
2150
|
m00 = m[0];
|
@@ -2227,9 +2170,8 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2227
2170
|
* values in the double precision Matrix3d argument; the other elements of
|
2228
2171
|
* this matrix are initialized as if this were an identity matrix (i.e.,
|
2229
2172
|
* affine matrix with no translational component).
|
2230
|
-
*
|
2231
|
-
* @param m1
|
2232
|
-
* the double-precision 3x3 matrix
|
2173
|
+
*
|
2174
|
+
* @param m1 the double-precision 3x3 matrix
|
2233
2175
|
*/
|
2234
2176
|
public final void set(Matrix3d m1) {
|
2235
2177
|
m00 = (float) m1.m00;
|
@@ -2254,13 +2196,10 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2254
2196
|
* Sets the value of this matrix from the rotation expressed by the rotation
|
2255
2197
|
* matrix m1, the translation t1, and the scale factor. The translation is
|
2256
2198
|
* not modified by the scale.
|
2257
|
-
*
|
2258
|
-
* @param m1
|
2259
|
-
*
|
2260
|
-
* @param
|
2261
|
-
* the translation component
|
2262
|
-
* @param scale
|
2263
|
-
* the scale factor
|
2199
|
+
*
|
2200
|
+
* @param m1 the rotation component
|
2201
|
+
* @param t1 the translation component
|
2202
|
+
* @param scale the scale factor
|
2264
2203
|
*/
|
2265
2204
|
public final void set(Matrix3d m1, Vec3D t1, double scale) {
|
2266
2205
|
this.m00 = (float) (m1.m00 * scale);
|
@@ -2286,9 +2225,8 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2286
2225
|
|
2287
2226
|
/**
|
2288
2227
|
* Sets the value of this matrix to a copy of the passed matrix m1.
|
2289
|
-
*
|
2290
|
-
* @param m1
|
2291
|
-
* the matrix to be copied
|
2228
|
+
*
|
2229
|
+
* @param m1 the matrix to be copied
|
2292
2230
|
*/
|
2293
2231
|
public final void set(Matrix4f m1) {
|
2294
2232
|
this.m00 = m1.m00;
|
@@ -2315,9 +2253,8 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2315
2253
|
/**
|
2316
2254
|
* Sets the value of this matrix to the matrix conversion of the single
|
2317
2255
|
* precision quaternion argument.
|
2318
|
-
*
|
2319
|
-
* @param q1
|
2320
|
-
* the quaternion to be converted
|
2256
|
+
*
|
2257
|
+
* @param q1 the quaternion to be converted
|
2321
2258
|
*/
|
2322
2259
|
public final void set(Quaternion q1) {
|
2323
2260
|
this.m00 = (1.0f - 2.0f * q1.y * q1.y - 2.0f * q1.z * q1.z);
|
@@ -2345,13 +2282,10 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2345
2282
|
/**
|
2346
2283
|
* Sets the value of this matrix from the rotation expressed by the
|
2347
2284
|
* quaternion q1, the translation t1, and the scale s.
|
2348
|
-
*
|
2349
|
-
* @param q1
|
2350
|
-
*
|
2351
|
-
* @param
|
2352
|
-
* the translation
|
2353
|
-
* @param s
|
2354
|
-
* the scale value
|
2285
|
+
*
|
2286
|
+
* @param q1 the rotation expressed as a quaternion
|
2287
|
+
* @param t1 the translation
|
2288
|
+
* @param s the scale value
|
2355
2289
|
*/
|
2356
2290
|
public final void set(Quaternion q1, Vec3D t1, double s) {
|
2357
2291
|
this.m00 = (float) (s * (1.0 - 2.0 * q1.y * q1.y - 2.0 * q1.z * q1.z));
|
@@ -2379,13 +2313,10 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2379
2313
|
/**
|
2380
2314
|
* Sets the value of this matrix from the rotation expressed by the
|
2381
2315
|
* quaternion q1, the translation t1, and the scale s.
|
2382
|
-
*
|
2383
|
-
* @param q1
|
2384
|
-
*
|
2385
|
-
* @param
|
2386
|
-
* the translation
|
2387
|
-
* @param s
|
2388
|
-
* the scale value
|
2316
|
+
*
|
2317
|
+
* @param q1 the rotation expressed as a quaternion
|
2318
|
+
* @param t1 the translation
|
2319
|
+
* @param s the scale value
|
2389
2320
|
*/
|
2390
2321
|
public final void set(Quaternion q1, Vec3D t1, float s) {
|
2391
2322
|
this.m00 = (s * (1.0f - 2.0f * q1.y * q1.y - 2.0f * q1.z * q1.z));
|
@@ -2413,9 +2344,8 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2413
2344
|
/**
|
2414
2345
|
* Sets the value of this matrix to a translate matrix with the passed
|
2415
2346
|
* translation value.
|
2416
|
-
*
|
2417
|
-
* @param v1
|
2418
|
-
* the translation amount
|
2347
|
+
*
|
2348
|
+
* @param v1 the translation amount
|
2419
2349
|
*/
|
2420
2350
|
public final void set(Vec3D v1) {
|
2421
2351
|
this.m00 = (float) 1.0;
|
@@ -2443,11 +2373,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2443
2373
|
* Sets the value of this transform to a scale and translation matrix; the
|
2444
2374
|
* translation is scaled by the scale factor and all of the matrix values
|
2445
2375
|
* are modified.
|
2446
|
-
*
|
2447
|
-
* @param t1
|
2448
|
-
*
|
2449
|
-
* @param scale
|
2450
|
-
* the scale factor for the matrix
|
2376
|
+
*
|
2377
|
+
* @param t1 the translation amount
|
2378
|
+
* @param scale the scale factor for the matrix
|
2451
2379
|
*/
|
2452
2380
|
public final void set(Vec3D t1, float scale) {
|
2453
2381
|
this.m00 = scale;
|
@@ -2473,11 +2401,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2473
2401
|
|
2474
2402
|
/**
|
2475
2403
|
* Sets the specified column of this matrix4f to the four values provided.
|
2476
|
-
*
|
2477
|
-
* @param column
|
2478
|
-
*
|
2479
|
-
* @param v
|
2480
|
-
* the replacement column
|
2404
|
+
*
|
2405
|
+
* @param column the column number to be modified (zero indexed)
|
2406
|
+
* @param v the replacement column
|
2481
2407
|
*/
|
2482
2408
|
public final void setColumn(int column, float v[]) {
|
2483
2409
|
switch (column) {
|
@@ -2516,17 +2442,12 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2516
2442
|
|
2517
2443
|
/**
|
2518
2444
|
* Sets the specified column of this matrix4f to the four values provided.
|
2519
|
-
*
|
2520
|
-
* @param column
|
2521
|
-
*
|
2522
|
-
* @param
|
2523
|
-
*
|
2524
|
-
* @param
|
2525
|
-
* the second row element
|
2526
|
-
* @param z
|
2527
|
-
* the third row element
|
2528
|
-
* @param w
|
2529
|
-
* the fourth row element
|
2445
|
+
*
|
2446
|
+
* @param column the column number to be modified (zero indexed)
|
2447
|
+
* @param x the first row element
|
2448
|
+
* @param y the second row element
|
2449
|
+
* @param z the third row element
|
2450
|
+
* @param w the fourth row element
|
2530
2451
|
*/
|
2531
2452
|
public final void setColumn(int column, float x, float y, float z, float w) {
|
2532
2453
|
switch (column) {
|
@@ -2565,11 +2486,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2565
2486
|
|
2566
2487
|
/**
|
2567
2488
|
* Sets the specified column of this matrix4f to the vector provided.
|
2568
|
-
*
|
2569
|
-
* @param column
|
2570
|
-
*
|
2571
|
-
* @param v
|
2572
|
-
* the replacement column
|
2489
|
+
*
|
2490
|
+
* @param column the column number to be modified (zero indexed)
|
2491
|
+
* @param v the replacement column
|
2573
2492
|
*/
|
2574
2493
|
public final void setColumn(int column, Vec4D v) {
|
2575
2494
|
switch (column) {
|
@@ -2608,13 +2527,10 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2608
2527
|
|
2609
2528
|
/**
|
2610
2529
|
* Sets the specified element of this matrix4f to the value provided.
|
2611
|
-
*
|
2612
|
-
* @param row
|
2613
|
-
*
|
2614
|
-
* @param
|
2615
|
-
* the column number to be modified (zero indexed)
|
2616
|
-
* @param value
|
2617
|
-
* the new value
|
2530
|
+
*
|
2531
|
+
* @param row the row number to be modified (zero indexed)
|
2532
|
+
* @param column the column number to be modified (zero indexed)
|
2533
|
+
* @param value the new value
|
2618
2534
|
*/
|
2619
2535
|
public final void setElement(int row, int column, float value) {
|
2620
2536
|
switch (row) {
|
@@ -2726,10 +2642,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2726
2642
|
|
2727
2643
|
/**
|
2728
2644
|
* Set the first matrix element in the first row.
|
2729
|
-
*
|
2730
|
-
* @param m00
|
2731
|
-
*
|
2732
|
-
*
|
2645
|
+
*
|
2646
|
+
* @param m00 The m00 to set.
|
2647
|
+
*
|
2733
2648
|
* @since vecmath 1.5
|
2734
2649
|
*/
|
2735
2650
|
public final void setM00(float m00) {
|
@@ -2738,10 +2653,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2738
2653
|
|
2739
2654
|
/**
|
2740
2655
|
* Set the second matrix element in the first row.
|
2741
|
-
*
|
2742
|
-
* @param m01
|
2743
|
-
*
|
2744
|
-
*
|
2656
|
+
*
|
2657
|
+
* @param m01 The m01 to set.
|
2658
|
+
*
|
2745
2659
|
* @since vecmath 1.5
|
2746
2660
|
*/
|
2747
2661
|
public final void setM01(float m01) {
|
@@ -2750,10 +2664,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2750
2664
|
|
2751
2665
|
/**
|
2752
2666
|
* Set the third matrix element in the first row.
|
2753
|
-
*
|
2754
|
-
* @param m02
|
2755
|
-
*
|
2756
|
-
*
|
2667
|
+
*
|
2668
|
+
* @param m02 The m02 to set.
|
2669
|
+
*
|
2757
2670
|
* @since vecmath 1.5
|
2758
2671
|
*/
|
2759
2672
|
public final void setM02(float m02) {
|
@@ -2762,10 +2675,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2762
2675
|
|
2763
2676
|
/**
|
2764
2677
|
* Set the fourth element of the first row.
|
2765
|
-
*
|
2766
|
-
* @param m03
|
2767
|
-
*
|
2768
|
-
*
|
2678
|
+
*
|
2679
|
+
* @param m03 The m03 to set.
|
2680
|
+
*
|
2769
2681
|
* @since vecmath 1.5
|
2770
2682
|
*/
|
2771
2683
|
public final void setM03(float m03) {
|
@@ -2774,10 +2686,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2774
2686
|
|
2775
2687
|
/**
|
2776
2688
|
* Set first matrix element in the second row.
|
2777
|
-
*
|
2778
|
-
* @param m10
|
2779
|
-
*
|
2780
|
-
*
|
2689
|
+
*
|
2690
|
+
* @param m10 The m10 to set.
|
2691
|
+
*
|
2781
2692
|
* @since vecmath 1.5
|
2782
2693
|
*/
|
2783
2694
|
public final void setM10(float m10) {
|
@@ -2786,10 +2697,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2786
2697
|
|
2787
2698
|
/**
|
2788
2699
|
* Set the second matrix element in the second row.
|
2789
|
-
*
|
2790
|
-
* @param m11
|
2791
|
-
*
|
2792
|
-
*
|
2700
|
+
*
|
2701
|
+
* @param m11 The m11 to set.
|
2702
|
+
*
|
2793
2703
|
* @since vecmath 1.5
|
2794
2704
|
*/
|
2795
2705
|
public final void setM11(float m11) {
|
@@ -2798,10 +2708,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2798
2708
|
|
2799
2709
|
/**
|
2800
2710
|
* Set the third matrix element in the second row.
|
2801
|
-
*
|
2802
|
-
* @param m12
|
2803
|
-
*
|
2804
|
-
*
|
2711
|
+
*
|
2712
|
+
* @param m12 The m12 to set.
|
2713
|
+
*
|
2805
2714
|
* @since vecmath 1.5
|
2806
2715
|
*/
|
2807
2716
|
public final void setM12(float m12) {
|
@@ -2810,10 +2719,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2810
2719
|
|
2811
2720
|
/**
|
2812
2721
|
* Set the fourth element of the second row.
|
2813
|
-
*
|
2814
|
-
* @param m13
|
2815
|
-
*
|
2816
|
-
*
|
2722
|
+
*
|
2723
|
+
* @param m13 The m13 to set.
|
2724
|
+
*
|
2817
2725
|
* @since vecmath 1.5
|
2818
2726
|
*/
|
2819
2727
|
public final void setM13(float m13) {
|
@@ -2822,10 +2730,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2822
2730
|
|
2823
2731
|
/**
|
2824
2732
|
* Set the first matrix element in the third row.
|
2825
|
-
*
|
2826
|
-
* @param m20
|
2827
|
-
*
|
2828
|
-
*
|
2733
|
+
*
|
2734
|
+
* @param m20 The m20 to set.
|
2735
|
+
*
|
2829
2736
|
* @since vecmath 1.5
|
2830
2737
|
*/
|
2831
2738
|
public final void setM20(float m20) {
|
@@ -2834,10 +2741,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2834
2741
|
|
2835
2742
|
/**
|
2836
2743
|
* Set the second matrix element in the third row.
|
2837
|
-
*
|
2838
|
-
* @param m21
|
2839
|
-
*
|
2840
|
-
*
|
2744
|
+
*
|
2745
|
+
* @param m21 The m21 to set.
|
2746
|
+
*
|
2841
2747
|
* @since vecmath 1.5
|
2842
2748
|
*/
|
2843
2749
|
public final void setM21(float m21) {
|
@@ -2846,10 +2752,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2846
2752
|
|
2847
2753
|
/**
|
2848
2754
|
* Set the third matrix element in the third row.
|
2849
|
-
*
|
2850
|
-
* @param m22
|
2851
|
-
*
|
2852
|
-
*
|
2755
|
+
*
|
2756
|
+
* @param m22 The m22 to set.
|
2757
|
+
*
|
2853
2758
|
* @since vecmath 1.5
|
2854
2759
|
*/
|
2855
2760
|
public final void setM22(float m22) {
|
@@ -2858,10 +2763,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2858
2763
|
|
2859
2764
|
/**
|
2860
2765
|
* Set the fourth element of the third row.
|
2861
|
-
*
|
2862
|
-
* @param m23
|
2863
|
-
*
|
2864
|
-
*
|
2766
|
+
*
|
2767
|
+
* @param m23 The m23 to set.
|
2768
|
+
*
|
2865
2769
|
* @since vecmath 1.5
|
2866
2770
|
*/
|
2867
2771
|
public final void setM23(float m23) {
|
@@ -2870,11 +2774,10 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2870
2774
|
|
2871
2775
|
/**
|
2872
2776
|
* Set the first element of the fourth row.
|
2873
|
-
*
|
2874
|
-
* @param m30
|
2875
|
-
*
|
2876
|
-
*
|
2877
|
-
*
|
2777
|
+
*
|
2778
|
+
* @param m30 The m30 to set.
|
2779
|
+
*
|
2780
|
+
*
|
2878
2781
|
* @since vecmath 1.5
|
2879
2782
|
*/
|
2880
2783
|
public final void setM30(float m30) {
|
@@ -2883,10 +2786,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2883
2786
|
|
2884
2787
|
/**
|
2885
2788
|
* Set the second element of the fourth row.
|
2886
|
-
*
|
2887
|
-
* @param m31
|
2888
|
-
*
|
2889
|
-
*
|
2789
|
+
*
|
2790
|
+
* @param m31 The m31 to set.
|
2791
|
+
*
|
2890
2792
|
* @since vecmath 1.5
|
2891
2793
|
*/
|
2892
2794
|
public final void setM31(float m31) {
|
@@ -2895,11 +2797,10 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2895
2797
|
|
2896
2798
|
/**
|
2897
2799
|
* Set the third element of the fourth row.
|
2898
|
-
*
|
2899
|
-
* @param m32
|
2900
|
-
*
|
2901
|
-
*
|
2902
|
-
*
|
2800
|
+
*
|
2801
|
+
* @param m32 The m32 to set.
|
2802
|
+
*
|
2803
|
+
*
|
2903
2804
|
* @since vecmath 1.5
|
2904
2805
|
*/
|
2905
2806
|
public final void setM32(float m32) {
|
@@ -2908,10 +2809,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2908
2809
|
|
2909
2810
|
/**
|
2910
2811
|
* Set the fourth element of the fourth row.
|
2911
|
-
*
|
2912
|
-
* @param m33
|
2913
|
-
*
|
2914
|
-
*
|
2812
|
+
*
|
2813
|
+
* @param m33 The m33 to set.
|
2814
|
+
*
|
2915
2815
|
* @since vecmath 1.5
|
2916
2816
|
*/
|
2917
2817
|
public final void setM33(float m33) {
|
@@ -2925,9 +2825,8 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2925
2825
|
* this object's upper 3x3 matrix to factor out the scale, then this
|
2926
2826
|
* object's upper 3x3 matrix components are replaced by the passed rotation
|
2927
2827
|
* components, and then the scale is reapplied to the rotational components.
|
2928
|
-
*
|
2929
|
-
* @param m1
|
2930
|
-
* double precision 3x3 matrix
|
2828
|
+
*
|
2829
|
+
* @param m1 double precision 3x3 matrix
|
2931
2830
|
*/
|
2932
2831
|
public final void setRotation(Matrix3d m1) {
|
2933
2832
|
double[] tmp_rot = new double[9];
|
@@ -2956,9 +2855,8 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2956
2855
|
* object's upper 3x3 matrix to factor out the scale, then this object's
|
2957
2856
|
* upper 3x3 matrix components are replaced by the matrix equivalent of the
|
2958
2857
|
* quaternion, and then the scale is reapplied to the rotational components.
|
2959
|
-
*
|
2960
|
-
* @param q1
|
2961
|
-
* the quaternion that specifies the rotation
|
2858
|
+
*
|
2859
|
+
* @param q1 the quaternion that specifies the rotation
|
2962
2860
|
*/
|
2963
2861
|
public final void setRotation(Quaternion q1) {
|
2964
2862
|
double[] tmp_rot = new double[9]; // scratch matrix
|
@@ -2982,9 +2880,8 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
2982
2880
|
/**
|
2983
2881
|
* Replaces the upper 3x3 matrix values of this matrix with the values in
|
2984
2882
|
* the matrix m1.
|
2985
|
-
*
|
2986
|
-
* @param m1
|
2987
|
-
* the matrix that will be the new upper 3x3
|
2883
|
+
*
|
2884
|
+
* @param m1 the matrix that will be the new upper 3x3
|
2988
2885
|
*/
|
2989
2886
|
public final void setRotationScale(Matrix3d m1) {
|
2990
2887
|
m00 = (float) m1.m00;
|
@@ -3001,11 +2898,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
3001
2898
|
/**
|
3002
2899
|
* Sets the specified row of this matrix4f to the four values provided in
|
3003
2900
|
* the passed array.
|
3004
|
-
*
|
3005
|
-
* @param row
|
3006
|
-
*
|
3007
|
-
* @param v
|
3008
|
-
* the replacement row
|
2901
|
+
*
|
2902
|
+
* @param row the row number to be modified (zero indexed)
|
2903
|
+
* @param v the replacement row
|
3009
2904
|
*/
|
3010
2905
|
public final void setRow(int row, float v[]) {
|
3011
2906
|
switch (row) {
|
@@ -3044,17 +2939,12 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
3044
2939
|
|
3045
2940
|
/**
|
3046
2941
|
* Sets the specified row of this matrix4f to the four values provided.
|
3047
|
-
*
|
3048
|
-
* @param row
|
3049
|
-
*
|
3050
|
-
* @param
|
3051
|
-
*
|
3052
|
-
* @param
|
3053
|
-
* the second column element
|
3054
|
-
* @param z
|
3055
|
-
* the third column element
|
3056
|
-
* @param w
|
3057
|
-
* the fourth column element
|
2942
|
+
*
|
2943
|
+
* @param row the row number to be modified (zero indexed)
|
2944
|
+
* @param x the first column element
|
2945
|
+
* @param y the second column element
|
2946
|
+
* @param z the third column element
|
2947
|
+
* @param w the fourth column element
|
3058
2948
|
*/
|
3059
2949
|
public final void setRow(int row, float x, float y, float z, float w) {
|
3060
2950
|
switch (row) {
|
@@ -3093,11 +2983,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
3093
2983
|
|
3094
2984
|
/**
|
3095
2985
|
* Sets the specified row of this matrix4f to the Vector provided.
|
3096
|
-
*
|
3097
|
-
* @param row
|
3098
|
-
*
|
3099
|
-
* @param v
|
3100
|
-
* the replacement row
|
2986
|
+
*
|
2987
|
+
* @param row the row number to be modified (zero indexed)
|
2988
|
+
* @param v the replacement row
|
3101
2989
|
*/
|
3102
2990
|
public final void setRow(int row, Vec4D v) {
|
3103
2991
|
switch (row) {
|
@@ -3138,9 +3026,8 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
3138
3026
|
* Sets the scale component of the current matrix by factoring out the
|
3139
3027
|
* current scale (by doing an SVD) from the rotational component and
|
3140
3028
|
* multiplying by the new scale.
|
3141
|
-
*
|
3142
|
-
* @param scale
|
3143
|
-
* the new scale amount
|
3029
|
+
*
|
3030
|
+
* @param scale the new scale amount
|
3144
3031
|
*/
|
3145
3032
|
public final void setScale(float scale) {
|
3146
3033
|
|
@@ -3165,9 +3052,8 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
3165
3052
|
/**
|
3166
3053
|
* Modifies the translational components of this matrix to the values of the
|
3167
3054
|
* Vector3f argument; the other values of this matrix are not modified.
|
3168
|
-
*
|
3169
|
-
* @param trans
|
3170
|
-
* the translational component
|
3055
|
+
*
|
3056
|
+
* @param trans the translational component
|
3171
3057
|
*/
|
3172
3058
|
public final void setTranslation(Vec3D trans) {
|
3173
3059
|
m03 = trans.x;
|
@@ -3200,9 +3086,8 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
3200
3086
|
/**
|
3201
3087
|
* Sets this matrix to the matrix difference of itself and matrix m1 (this =
|
3202
3088
|
* this - m1).
|
3203
|
-
*
|
3204
|
-
* @param m1
|
3205
|
-
* the other matrix
|
3089
|
+
*
|
3090
|
+
* @param m1 the other matrix
|
3206
3091
|
*/
|
3207
3092
|
public final void sub(Matrix4f m1) {
|
3208
3093
|
this.m00 -= m1.m00;
|
@@ -3229,11 +3114,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
3229
3114
|
/**
|
3230
3115
|
* Performs an element-by-element subtraction of matrix m2 from matrix m1
|
3231
3116
|
* and places the result into matrix this (this = m2 - m1).
|
3232
|
-
*
|
3233
|
-
* @param m1
|
3234
|
-
*
|
3235
|
-
* @param m2
|
3236
|
-
* the second matrix
|
3117
|
+
*
|
3118
|
+
* @param m1 the first matrix
|
3119
|
+
* @param m2 the second matrix
|
3237
3120
|
*/
|
3238
3121
|
public final void sub(Matrix4f m1, Matrix4f m2) {
|
3239
3122
|
this.m00 = m1.m00 - m2.m00;
|
@@ -3259,24 +3142,29 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
3259
3142
|
|
3260
3143
|
/**
|
3261
3144
|
* Returns a string that contains the values of this Matrix4f.
|
3262
|
-
*
|
3145
|
+
*
|
3263
3146
|
* @return the String representation
|
3264
3147
|
*/
|
3265
3148
|
@Override
|
3266
3149
|
public String toString() {
|
3267
|
-
return
|
3268
|
-
|
3269
|
-
|
3270
|
-
|
3271
|
-
|
3150
|
+
return String.join("\n",
|
3151
|
+
String.format("%d, %d, %d, %d",
|
3152
|
+
this.m00, this.m01, this.m02, this.m03),
|
3153
|
+
String.format("%d, %d, %d, %d",
|
3154
|
+
this.m10, this.m11, this.m12, this.m13),
|
3155
|
+
String.format("%d, %d, %d, %d",
|
3156
|
+
this.m20, this.m21, this.m22, this.m23),
|
3157
|
+
String.format("%d, %d, %d, %d",
|
3158
|
+
this.m30, this.m31, this.m32, this.m33),
|
3159
|
+
""
|
3160
|
+
);
|
3272
3161
|
}
|
3273
3162
|
|
3274
3163
|
/**
|
3275
3164
|
* Transform the vector vec using this Transform and place the result back
|
3276
3165
|
* into vec.
|
3277
|
-
*
|
3278
|
-
* @param vec
|
3279
|
-
* the single precision vector to be transformed
|
3166
|
+
*
|
3167
|
+
* @param vec the single precision vector to be transformed
|
3280
3168
|
*/
|
3281
3169
|
public final void transform(Vec4D vec) {
|
3282
3170
|
float x, y, z;
|
@@ -3293,11 +3181,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
3293
3181
|
/**
|
3294
3182
|
* Transform the vector vec using this Matrix4f and place the result into
|
3295
3183
|
* vecOut.
|
3296
|
-
*
|
3297
|
-
* @param vec
|
3298
|
-
*
|
3299
|
-
* @param vecOut
|
3300
|
-
* the vector into which the transformed values are placed
|
3184
|
+
*
|
3185
|
+
* @param vec the single precision vector to be transformed
|
3186
|
+
* @param vecOut the vector into which the transformed values are placed
|
3301
3187
|
*/
|
3302
3188
|
public final void transform(Vec4D vec, Vec4D vecOut) {
|
3303
3189
|
float x, y, z;
|
@@ -3314,9 +3200,8 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
3314
3200
|
* Transforms the point parameter with this Matrix4f and places the result
|
3315
3201
|
* back into point. The fourth element of the point input paramter is
|
3316
3202
|
* assumed to be one.
|
3317
|
-
*
|
3318
|
-
* @param point
|
3319
|
-
* the input point to be transformed.
|
3203
|
+
*
|
3204
|
+
* @param point the input point to be transformed.
|
3320
3205
|
*/
|
3321
3206
|
public final void transformOne(Vec3D point) {
|
3322
3207
|
float x, y;
|
@@ -3331,11 +3216,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
3331
3216
|
* Transforms the point parameter with this Matrix4f and places the result
|
3332
3217
|
* into pointOut. The fourth element of the point input paramter is assumed
|
3333
3218
|
* to be one.
|
3334
|
-
*
|
3335
|
-
* @param point
|
3336
|
-
*
|
3337
|
-
* @param pointOut
|
3338
|
-
* the transformed point
|
3219
|
+
*
|
3220
|
+
* @param point the input point to be transformed.
|
3221
|
+
* @param pointOut the transformed point
|
3339
3222
|
*/
|
3340
3223
|
public final void transformOne(Vec3D point, Vec3D pointOut) {
|
3341
3224
|
float x, y;
|
@@ -3349,9 +3232,8 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
3349
3232
|
/**
|
3350
3233
|
* Transforms the normal parameter by this transform and places the value
|
3351
3234
|
* back into normal. The fourth element of the normal is assumed to be zero.
|
3352
|
-
*
|
3353
|
-
* @param normal
|
3354
|
-
* the input normal to be transformed.
|
3235
|
+
*
|
3236
|
+
* @param normal the input normal to be transformed.
|
3355
3237
|
*/
|
3356
3238
|
public final void transformZero(Vec3D normal) {
|
3357
3239
|
float x, y;
|
@@ -3366,11 +3248,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
3366
3248
|
/**
|
3367
3249
|
* Transforms the normal parameter by this Matrix4f and places the value
|
3368
3250
|
* into normalOut. The fourth element of the normal is assumed to be zero.
|
3369
|
-
*
|
3370
|
-
* @param normal
|
3371
|
-
*
|
3372
|
-
* @param normalOut
|
3373
|
-
* the transformed normal
|
3251
|
+
*
|
3252
|
+
* @param normal the input normal to be transformed.
|
3253
|
+
* @param normalOut the transformed normal
|
3374
3254
|
*/
|
3375
3255
|
public final void transformZero(Vec3D normal, Vec3D normalOut) {
|
3376
3256
|
float x, y;
|
@@ -3414,9 +3294,8 @@ public class Matrix4f implements java.io.Serializable, Cloneable {
|
|
3414
3294
|
|
3415
3295
|
/**
|
3416
3296
|
* Sets the value of this matrix to the transpose of the argument matrix.
|
3417
|
-
*
|
3418
|
-
* @param m1
|
3419
|
-
* the matrix to be transposed
|
3297
|
+
*
|
3298
|
+
* @param m1 the matrix to be transposed
|
3420
3299
|
*/
|
3421
3300
|
public final void transpose(Matrix4f m1) {
|
3422
3301
|
if (this != m1) {
|