Index: trunk/code/qcommon/q_math.c =================================================================== --- trunk/code/qcommon/q_math.c (revision 1432) +++ trunk/code/qcommon/q_math.c (working copy) @@ -439,27 +439,10 @@ VectorCopy( in[2], out[2] ); } -void ProjectPointOnPlane( vec3_t dst, const vec3_t p, const vec3_t normal ) +void ProjectPointOnPlane( vec3_t dst, const vec3_t point, const vec3_t normal ) { - float d; - vec3_t n; - float inv_denom; - - inv_denom = DotProduct( normal, normal ); -#ifndef Q3_VM - assert( Q_fabs(inv_denom) != 0.0f ); // zero vectors get here -#endif - inv_denom = 1.0f / inv_denom; - - d = 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]; + float d = -DotProduct( point, normal ); + VectorMA( point, d, normal, dst ); } /* Index: trunk/code/qcommon/q_shared.h =================================================================== --- trunk/code/qcommon/q_shared.h (revision 1432) +++ trunk/code/qcommon/q_shared.h (working copy) @@ -588,7 +588,7 @@ float AngleDelta ( float angle1, float angle2 ); qboolean PlaneFromPoints( vec4_t plane, const vec3_t a, const vec3_t b, const vec3_t c ); -void ProjectPointOnPlane( vec3_t dst, const vec3_t p, const vec3_t normal ); +void ProjectPointOnPlane( vec3_t dst, const vec3_t point, const vec3_t normal ); void RotatePointAroundVector( vec3_t dst, const vec3_t dir, const vec3_t point, float degrees ); void RotateAroundDirection( vec3_t axis[3], float yaw ); void MakeNormalVectors( const vec3_t forward, vec3_t right, vec3_t up );