Update of /cvsroot/jake2/jake2/src/jake2/util
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3109/src/jake2/util
Modified Files:
Math3D.java
Log Message:
profiling
Index: Math3D.java
===================================================================
RCS file: /cvsroot/jake2/jake2/src/jake2/util/Math3D.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Math3D.java 8 Jul 2004 20:56:54 -0000 1.4
--- Math3D.java 19 Jul 2004 19:32:12 -0000 1.5
***************
*** 316,334 ****
public static void ProjectPointOnPlane(float[] dst, float[] p, float[] normal) {
- float d;
- float[] n = { 0.0f, 0.0f, 0.0f };
- float inv_denom;
! inv_denom = 1.0F / Math3D.DotProduct(normal, normal);
! d = Math3D.DotProduct(normal, p) * inv_denom;
! n[0] = normal[0] * inv_denom;
! n[1] = normal[1] * inv_denom;
! n[2] = normal[2] * inv_denom;
! dst[0] = p[0] - d * n[0];
! dst[1] = p[1] - d * n[1];
! dst[2] = p[2] - d * n[2];
}
--- 316,331 ----
public static void ProjectPointOnPlane(float[] dst, float[] p, float[] normal) {
! float inv_denom = 1.0F / Math3D.DotProduct(normal, normal);
! float d = Math3D.DotProduct(normal, p) * inv_denom;
! dst[0] = normal[0] * inv_denom;
! dst[1] = normal[1] * inv_denom;
! dst[2] = normal[2] * inv_denom;
! dst[0] = p[0] - d * dst[0];
! dst[1] = p[1] - d * dst[1];
! dst[2] = p[2] - d * dst[2];
}
***************
*** 362,366 ****
durch Entfernung und Senkrechten-Normale gegeben ist.
erste Version mit vec3_t... */
-
public static final int BoxOnPlaneSide(float emins[], float emaxs[], cplane_t p) {
--- 359,362 ----
***************
*** 428,432 ****
return sides;
! }
// this is the slow, general version
--- 424,428 ----
return sides;
! }
// this is the slow, general version
***************
*** 457,473 ****
public static void AngleVectors(float[] angles, float[] forward, float[] right, float[] up) {
- float angle;
- float sr, sp, sy, cr, cp, cy;
! cr = 2.0f * piratio;
! angle = (float) (angles[Defines.YAW] * (cr));
! sy = (float) Math.sin(angle);
! cy = (float) Math.cos(angle);
angle = (float) (angles[Defines.PITCH] * (cr));
! sp = (float) Math.sin(angle);
! cp = (float) Math.cos(angle);
! angle = (float) (angles[Defines.ROLL] * (cr));
! sr = (float) Math.sin(angle);
! cr = (float) Math.cos(angle);
if (forward != null) {
--- 453,464 ----
public static void AngleVectors(float[] angles, float[] forward, float[] right, float[] up) {
! float cr = 2.0f * piratio;
! float angle = (float) (angles[Defines.YAW] * (cr));
! float sy = (float) Math.sin(angle);
! float cy = (float) Math.cos(angle);
angle = (float) (angles[Defines.PITCH] * (cr));
! float sp = (float) Math.sin(angle);
! float cp = (float) Math.cos(angle);
if (forward != null) {
***************
*** 476,488 ****
forward[2] = -sp;
}
! if (right != null) {
! right[0] = (-sr * sp * cy + cr * sy);
! right[1] = (-sr * sp * sy + -cr * cy);
! right[2] = -sr * cp;
! }
! if (up != null) {
! up[0] = (cr * sp * cy + -sr * -sy);
! up[1] = (cr * sp * sy + -sr * cy);
! up[2] = cr * cp;
}
}
--- 467,486 ----
forward[2] = -sp;
}
!
! if (right != null || up != null) {
! angle = (float) (angles[Defines.ROLL] * (cr));
! float sr = (float) Math.sin(angle);
! cr = (float) Math.cos(angle);
!
! if (right != null) {
! right[0] = (-sr * sp * cy + cr * sy);
! right[1] = (-sr * sp * sy + -cr * cy);
! right[2] = -sr * cp;
! }
! if (up != null) {
! up[0] = (cr * sp * cy + sr * sy);
! up[1] = (cr * sp * sy + -sr * cy);
! up[2] = cr * cp;
! }
}
}
|