Update of /cvsroot/jake2/jake2/src/jake2/util
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13207/src/jake2/util
Modified Files:
Math3D.java
Log Message:
small optimizations
Index: Math3D.java
===================================================================
RCS file: /cvsroot/jake2/jake2/src/jake2/util/Math3D.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Math3D.java 22 Sep 2004 19:22:13 -0000 1.7
--- Math3D.java 16 Jan 2005 17:04:50 -0000 1.8
***************
*** 175,184 ****
private static float tmpmat[][] = new float[3][3];
private static float zrot[][] = new float[3][3];
! public static void RotatePointAroundVector(float[] dst, float[] dir, float[] point, float degrees) {
!
! float[] vr = { 0.0f, 0.0f, 0.0f };
! float[] vup = { 0.0f, 0.0f, 0.0f };
! float[] vf = { 0.0f, 0.0f, 0.0f };
vf[0] = dir[0];
vf[1] = dir[1];
--- 175,185 ----
private static float tmpmat[][] = new float[3][3];
private static float zrot[][] = new float[3][3];
!
! // to reduce garbage
! private static final float[] vr = {0, 0, 0};
! private static final float[] vup = {0, 0, 0};
! private static final float[] vf = {0, 0, 0};
+ public static void RotatePointAroundVector(float[] dst, float[] dir, float[] point, float degrees) {
vf[0] = dir[0];
vf[1] = dir[1];
***************
*** 225,228 ****
--- 226,230 ----
}
}
+
public static void MakeNormalVectors(float[] forward, float[] right, float[] up) {
// this rotate and negat guarantees a vector
***************
*** 287,290 ****
--- 289,295 ----
dst[2] = p[2] - d * dst[2];
}
+
+ private static final float[][] PLANE_XYZ = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}};
+
/** assumes "src" is normalized */
public static void PerpendicularVector(float[] dst, float[] src) {
***************
*** 300,308 ****
}
}
- float tempvec[] = { 0.0f, 0.0f, 0.0f };
- tempvec[pos] = 1.0F;
-
// project the point onto the plane defined by src
! ProjectPointOnPlane(dst, tempvec, src);
//normalize the result
--- 305,310 ----
}
}
// project the point onto the plane defined by src
! ProjectPointOnPlane(dst, PLANE_XYZ[pos], src);
//normalize the result
|