From f2b6a33fdf84a06b958f9cb9d667a2eff3063d8b Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Wed, 24 Jul 2019 23:50:40 -0400 Subject: [PATCH] Camera global inverse. --- LA.java | 24 ++++++++++++++++-------- 1 files changed, 16 insertions(+), 8 deletions(-) diff --git a/LA.java b/LA.java index 20a9211..154bebd 100644 --- a/LA.java +++ b/LA.java @@ -88,6 +88,9 @@ static void vecCopy(cVector a, cVector b) { + Grafreed.Assert (a != null); + assert (b != null); + b.x = a.x; b.y = a.y; b.z = a.z; @@ -160,6 +163,7 @@ static cVector xformDir(cVector v, double mat[][]) { + new Exception().printStackTrace(); System.exit(0); cVector temp = new cVector(); xformDir(v, mat, temp); @@ -306,14 +310,15 @@ } - 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); + // Last row should always be 0 0 0 1 + 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) @@ -623,6 +628,7 @@ private static int indxr[] = new int[4]; private static int indxc[] = new int[4]; + static double[][] Identity = new double[4][4]; static int SIZE = 0; // 65536*64; @@ -638,6 +644,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