Update of /cvsroot/java-game-lib/LWJGL/src/native/win32
In directory usw-pr-cvs1:/tmp/cvs-serv15860
Modified Files:
org_lwjgl_Math_MatrixOpInvert_MatrixOpDirect.cpp
org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe.cpp
Log Message:
Fixed some bugs.
Index: org_lwjgl_Math_MatrixOpInvert_MatrixOpDirect.cpp
CVS Browser:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpInvert_MatrixOpDirect.cpp
===================================================================
RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpInvert_MatrixOpDirect.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- org_lwjgl_Math_MatrixOpInvert_MatrixOpDirect.cpp 28 Sep 2002 16:53:13 -0000 1.5
+++ org_lwjgl_Math_MatrixOpInvert_MatrixOpDirect.cpp 26 Oct 2002 18:54:54 -0000 1.6
@@ -98,48 +98,7 @@
#ifdef _DEBUG
printf("Matrix Determinant: %f\n", det);
printf("Matrix Determinant - 1 = %f\n", det -1);
- printf("FLOATING POINT ERROR: %f\n", FLOATING_POINT_ERROR);
-#endif
-
- // use approxEqual to avoid direct comparisons
- if (approxEqual(det, 1.0f) ||
- approxEqual(det, -1.0f))
- {
-
-#ifdef _DEBUG
- printf("Matrix is Orthogonal\n");
#endif
- /* this matrix is orthogonal
-
- since inv(M) * M = I
- when orthogonal
- trans(M) * M = I
-
- proper orthogonal
- inv(M) = trans(M)
- improper orthogonal
- inv(M) = -trans(M)
- */
-
- if (approxEqual(det, 1))
- {
- // proper orthogonal
- int srcIndex = 0;
- for (int col = 0; col < source.width; col++)
- for (int row = 0; row < source.height; row++)
- destMatrix[col + row * source.width] = srcMatrix[srcIndex++];
- }
- else
- {
- // improper orthogonal
- int srcIndex = 0;
- for (int col = 0; col < source.width; col++)
- for (int row = 0; row < source.height; row++)
- destMatrix[col + row * source.width] = -srcMatrix[srcIndex++];
- }
- }
- else
- {
float sign;
@@ -167,12 +126,10 @@
= (sign / det) * determinant(temp_matrix, temp_side);
// swap signs
- sign = (sign == 1) ? -1.0f : 1.0f;
+ sign *= -1.0f;
}
}
-
- }
dest.writeComplete();
}
}
Index: org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe.cpp
CVS Browser:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe.cpp
===================================================================
RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe.cpp 28 Sep 2002 16:53:13 -0000 1.5
+++ org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe.cpp 26 Oct 2002 18:54:54 -0000 1.6
@@ -98,49 +98,9 @@
#ifdef _DEBUG
printf("Matrix Determinant: %f\n", det);
printf("Matrix Determinant - 1: %f\n", det-1);
- printf("FLOATING POINT ERROR: %f\n", FLOATING_POINT_ERROR);
-#endif
-
- // use approxEqual to avoid direct comparisons
- if (approxEqual(det,1) || approxEqual(det, -1))
- {
-
-#ifdef _DEBUG
- printf("Matrix is Orthogonal\n");
#endif
- /* this matrix is orthogonal
- since inv(M) * M = I
- when orthogonal
- trans(M) * M = I
-
- proper orthogonal
- inv(M) = trans(M)
- improper orthogonal
- inv(M) = -trans(M)
- */
-
- if (approxEqual(det, 1))
- {
- // proper orthogonal
- int srcIndex = 0;
- for (int col = 0; col < source.width; col++)
- for (int row = 0; row < source.height; row++)
- destMatrix[col + row * source.width] = srcMatrix[srcIndex++];
- }
- else
- {
- // improper orthogonal
- int srcIndex = 0;
- for (int col = 0; col < source.width; col++)
- for (int row = 0; row < source.height; row++)
- destMatrix[col + row * source.width] = -srcMatrix[srcIndex++];
- }
- }
- else
- {
-
- float sign;
+ float sign;
for (int col = 0; col < source.width; col++)
{
@@ -166,11 +126,10 @@
= (sign / det) * determinant(temp_matrix, temp_side);
// swap signs
- sign = (sign == 1) ? -1.0f : 1.0f;
+ sign *= -1.0f;
}
}
- }
dest.writeComplete();
}
|