Normand Briere
2019-10-06 ce660a4b6ba367bd162dd2cff26d02c80a34c912
LA.java
....@@ -88,6 +88,9 @@
8888
8989 static void vecCopy(cVector a, cVector b)
9090 {
91
+ Grafreed.Assert (a != null);
92
+ assert (b != null);
93
+
9194 b.x = a.x;
9295 b.y = a.y;
9396 b.z = a.z;
....@@ -160,6 +163,7 @@
160163
161164 static cVector xformDir(cVector v, double mat[][])
162165 {
166
+ new Exception().printStackTrace();
163167 System.exit(0);
164168 cVector temp = new cVector();
165169 xformDir(v, mat, temp);
....@@ -306,14 +310,15 @@
306310
307311 }
308312
309
- GrafreeD.Assert(Math.abs(src[0][3]) <= 1E-15);
310
- GrafreeD.Assert(Math.abs(src[1][3]) <= 1E-15);
311
- GrafreeD.Assert(Math.abs(src[2][3]) <= 1E-15);
312
- GrafreeD.Assert(Math.abs(src[3][3] - 1) <= 1E-15);
313
- GrafreeD.Assert(Math.abs(dst[0][3]) <= 1E-15);
314
- GrafreeD.Assert(Math.abs(dst[1][3]) <= 1E-15);
315
- GrafreeD.Assert(Math.abs(dst[2][3]) <= 1E-15);
316
- GrafreeD.Assert(Math.abs(dst[3][3] - 1) <= 1E-15);
313
+ // Last row should always be 0 0 0 1
314
+ Grafreed.Assert(Math.abs(src[0][3]) <= 1E-15);
315
+ Grafreed.Assert(Math.abs(src[1][3]) <= 1E-15);
316
+ Grafreed.Assert(Math.abs(src[2][3]) <= 1E-15);
317
+ Grafreed.Assert(Math.abs(src[3][3] - 1) <= 1E-15);
318
+ Grafreed.Assert(Math.abs(dst[0][3]) <= 1E-15);
319
+ Grafreed.Assert(Math.abs(dst[1][3]) <= 1E-15);
320
+ Grafreed.Assert(Math.abs(dst[2][3]) <= 1E-15);
321
+ Grafreed.Assert(Math.abs(dst[3][3] - 1) <= 1E-15);
317322 }
318323
319324 static double toRadians(double degrees)
....@@ -623,6 +628,7 @@
623628 private static int indxr[] = new int[4];
624629 private static int indxc[] = new int[4];
625630
631
+ static double[][] Identity = new double[4][4];
626632
627633 static int SIZE = 0; // 65536*64;
628634
....@@ -638,6 +644,8 @@
638644 costable[i] = Math.cos(PI2 * i/SIZE);
639645 sintable[i] = Math.sin(PI2 * i*i/SIZE/SIZE);
640646 }
647
+
648
+ LA.matIdentity(Identity);
641649 }
642650
643651 static double cos(double x0)