From 623dc0fa8cbd9473830a1786f6d49fa808a09439 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Sun, 05 May 2019 14:06:12 -0400
Subject: [PATCH] Rename Grafreed

---
 LA.java |   47 ++++++++++++++++++++++++++++++-----------------
 1 files changed, 30 insertions(+), 17 deletions(-)

diff --git a/LA.java b/LA.java
index 9b85a39..35e7f0e 100644
--- a/LA.java
+++ b/LA.java
@@ -160,6 +160,7 @@
 
     static cVector xformDir(cVector v, double mat[][])
     {
+                    new Exception().printStackTrace();
         System.exit(0);
         cVector temp = new cVector();
         xformDir(v, mat, temp);
@@ -306,6 +307,14 @@
 
         }
 
+        Grafreed.Assert(Math.abs(src[0][3]) <= 1E-15);
+        Grafreed.Assert(Math.abs(src[1][3]) <= 1E-15);
+        Grafreed.Assert(Math.abs(src[2][3]) <= 1E-15);
+        Grafreed.Assert(Math.abs(src[3][3] - 1) <= 1E-15);
+        Grafreed.Assert(Math.abs(dst[0][3]) <= 1E-15);
+        Grafreed.Assert(Math.abs(dst[1][3]) <= 1E-15);
+        Grafreed.Assert(Math.abs(dst[2][3]) <= 1E-15);
+        Grafreed.Assert(Math.abs(dst[3][3] - 1) <= 1E-15);
     }
 
     static double toRadians(double degrees)
@@ -319,16 +328,16 @@
         //left = right;
         //right = tmp;
         
-        for (int i = 0; i < 4; i++)
+        for (int j = 0; j < 4; j++)
         {
-            double[] lefti = left[i];
-            double[] concati = concatTemp[i];
-            for (int j = 0; j < 4; j++)
+            double[] rightj = right[j];
+            double[] concat = concatTemp[j];
+            for (int i = 0; i < 4; i++)
             {
-                concati[j] = 0;
+                concat[i] = 0;
                 for (int k = 0; k < 4; k++)
                 {
-                    concati[j] += lefti[k] * right[k][j];
+                    concat[i] += left[k][i] * rightj[k];
                 }
             }
         }
@@ -345,7 +354,7 @@
         //xlateTemp[0][3] = dx;
         //xlateTemp[1][3] = dy;
         //xlateTemp[2][3] = dz;
-        matConcat(mat, xlateTemp, mat);
+        matConcat(xlateTemp, mat, mat);
     }
 
     static void matHomogene(double mat[][], double dx, double dy, double dz)
@@ -357,7 +366,7 @@
         //xlateTemp[0][3] = dx;
         //xlateTemp[1][3] = dy;
         //xlateTemp[2][3] = dz;
-        matConcat(mat, xlateTemp, mat);
+        matConcat(xlateTemp, mat, mat);
     }
 
     static void matTranslateInv(double mat[][], double dx, double dy, double dz)
@@ -369,7 +378,7 @@
         //xlateTemp[0][3] = dx;
         //xlateTemp[1][3] = dy;
         //xlateTemp[2][3] = dz;
-        matConcat(xlateTemp, mat, mat);
+        matConcat(mat, xlateTemp, mat);
     }
 
     static void matScale(double mat[][], double sx, double sy, double sz)
@@ -378,7 +387,8 @@
         xlateTemp[0][0] = sx;
         xlateTemp[1][1] = sy;
         xlateTemp[2][2] = sz;
-        matConcat(mat, xlateTemp, mat);
+        matConcat(xlateTemp, mat, mat);
+        //matConcat(mat, xlateTemp, mat);
     }
 
     static void matXRotate(double mat[][], double radians)
@@ -387,9 +397,9 @@
         rotTemp[1][1] = rotTemp[2][2] = (double) Math.cos(radians);
         rotTemp[2][1] = -(rotTemp[1][2] = (double) Math.sin(radians));
    //     if (CameraPane.LOCALTRANSFORM)
-   //         matConcat(rotTemp, mat, mat);
+            matConcat(rotTemp, mat, mat);
    //     else
-            matConcat(mat, rotTemp, mat);
+   //         matConcat(mat, rotTemp, mat);
     }
 
     static void matYRotate(double mat[][], double radians)
@@ -398,9 +408,9 @@
         rotTemp[0][0] = rotTemp[2][2] = (double) Math.cos(-radians);
         rotTemp[2][0] = -(rotTemp[0][2] = (double) Math.sin(-radians));
    //     if (CameraPane.LOCALTRANSFORM)
-   //         matConcat(rotTemp, mat, mat);
+            matConcat(rotTemp, mat, mat);
    //     else
-            matConcat(mat, rotTemp, mat);
+   //         matConcat(mat, rotTemp, mat);
     }
 
     static void matZRotate(double mat[][], double radians)
@@ -409,9 +419,9 @@
         rotTemp[0][0] = rotTemp[1][1] = (double) Math.cos(radians);
         rotTemp[1][0] = -(rotTemp[0][1] = (double) Math.sin(radians));
    //     if (CameraPane.LOCALTRANSFORM)
-   //         matConcat(rotTemp, mat, mat);
+            matConcat(rotTemp, mat, mat);
    //     else
-            matConcat(mat, rotTemp, mat);
+   //         matConcat(mat, rotTemp, mat);
     }
 
     // Project A onto B
@@ -614,8 +624,9 @@
     private static int indxr[] = new int[4];
     private static int indxc[] = new int[4];
     
+    static double[][] Identity = new double[4][4];
     
-    static int SIZE = 65536*64;
+    static int SIZE = 0; // 65536*64;
     
     static double[] costable = new double[SIZE];
     static double[] sintable = new double[SIZE];
@@ -629,6 +640,8 @@
             costable[i] = Math.cos(PI2 * i/SIZE);
             sintable[i] = Math.sin(PI2 * i*i/SIZE/SIZE);
         }
+        
+        LA.matIdentity(Identity);
     }
     
     static double cos(double x0)

--
Gitblit v1.6.2