Normand Briere
2018-07-01 89c1ad67bc65d24ceadfa9e95f8c5515283f1e97
LA.java
....@@ -306,6 +306,14 @@
306306
307307 }
308308
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);
309317 }
310318
311319 static double toRadians(double degrees)
....@@ -321,14 +329,14 @@
321329
322330 for (int j = 0; j < 4; j++)
323331 {
324
- double[] leftj = left[j];
332
+ double[] rightj = right[j];
325333 double[] concat = concatTemp[j];
326334 for (int i = 0; i < 4; i++)
327335 {
328336 concat[i] = 0;
329337 for (int k = 0; k < 4; k++)
330338 {
331
- concat[i] += leftj[k] * right[k][i];
339
+ concat[i] += left[k][i] * rightj[k];
332340 }
333341 }
334342 }
....@@ -345,7 +353,7 @@
345353 //xlateTemp[0][3] = dx;
346354 //xlateTemp[1][3] = dy;
347355 //xlateTemp[2][3] = dz;
348
- matConcat(mat, xlateTemp, mat);
356
+ matConcat(xlateTemp, mat, mat);
349357 }
350358
351359 static void matHomogene(double mat[][], double dx, double dy, double dz)
....@@ -357,7 +365,7 @@
357365 //xlateTemp[0][3] = dx;
358366 //xlateTemp[1][3] = dy;
359367 //xlateTemp[2][3] = dz;
360
- matConcat(mat, xlateTemp, mat);
368
+ matConcat(xlateTemp, mat, mat);
361369 }
362370
363371 static void matTranslateInv(double mat[][], double dx, double dy, double dz)
....@@ -369,7 +377,7 @@
369377 //xlateTemp[0][3] = dx;
370378 //xlateTemp[1][3] = dy;
371379 //xlateTemp[2][3] = dz;
372
- matConcat(xlateTemp, mat, mat);
380
+ matConcat(mat, xlateTemp, mat);
373381 }
374382
375383 static void matScale(double mat[][], double sx, double sy, double sz)
....@@ -378,7 +386,8 @@
378386 xlateTemp[0][0] = sx;
379387 xlateTemp[1][1] = sy;
380388 xlateTemp[2][2] = sz;
381
- matConcat(mat, xlateTemp, mat);
389
+ matConcat(xlateTemp, mat, mat);
390
+ //matConcat(mat, xlateTemp, mat);
382391 }
383392
384393 static void matXRotate(double mat[][], double radians)
....@@ -387,9 +396,9 @@
387396 rotTemp[1][1] = rotTemp[2][2] = (double) Math.cos(radians);
388397 rotTemp[2][1] = -(rotTemp[1][2] = (double) Math.sin(radians));
389398 // if (CameraPane.LOCALTRANSFORM)
390
- // matConcat(rotTemp, mat, mat);
399
+ matConcat(rotTemp, mat, mat);
391400 // else
392
- matConcat(mat, rotTemp, mat);
401
+ // matConcat(mat, rotTemp, mat);
393402 }
394403
395404 static void matYRotate(double mat[][], double radians)
....@@ -398,9 +407,9 @@
398407 rotTemp[0][0] = rotTemp[2][2] = (double) Math.cos(-radians);
399408 rotTemp[2][0] = -(rotTemp[0][2] = (double) Math.sin(-radians));
400409 // if (CameraPane.LOCALTRANSFORM)
401
- // matConcat(rotTemp, mat, mat);
410
+ matConcat(rotTemp, mat, mat);
402411 // else
403
- matConcat(mat, rotTemp, mat);
412
+ // matConcat(mat, rotTemp, mat);
404413 }
405414
406415 static void matZRotate(double mat[][], double radians)
....@@ -409,9 +418,9 @@
409418 rotTemp[0][0] = rotTemp[1][1] = (double) Math.cos(radians);
410419 rotTemp[1][0] = -(rotTemp[0][1] = (double) Math.sin(radians));
411420 // if (CameraPane.LOCALTRANSFORM)
412
- // matConcat(rotTemp, mat, mat);
421
+ matConcat(rotTemp, mat, mat);
413422 // else
414
- matConcat(mat, rotTemp, mat);
423
+ // matConcat(mat, rotTemp, mat);
415424 }
416425
417426 // Project A onto B