/* compare */
// We check equality of each component since we're using '<', not '<='
- // (the epsilons may be zero). We want to use '<' intead of '<=' to be
+ // (the epsilons may be zero). We want to use '<' instead of '<=' to be
// consistent with the true meaning of "epsilon", and also because other
// parts of the code uses this inequality.
if ( ( p->dist == dist || fabs( p->dist - dist ) < de ) &&
// normalized). The original SnapNormal() didn't snap such vectors - it
// only snapped vectors that were near a perfect axis.
+ //adjusting vectors, that were near a perfect axis, with bigger epsilon
+ //they cause precision errors
+
+ /*
+ if ( ( normal[0] != 0.0 || normal[1] != 0.0 ) && fabs(normal[0]) < 0.00025 && fabs(normal[1]) < 0.00025){
+ normal[0] = normal[1] = 0.0;
+ adjusted = qtrue;
+ }
+ else if ( ( normal[0] != 0.0 || normal[2] != 0.0 ) && fabs(normal[0]) < 0.00025 && fabs(normal[2]) < 0.00025){
+ normal[0] = normal[2] = 0.0;
+ adjusted = qtrue;
+ }
+ else if ( ( normal[2] != 0.0 || normal[1] != 0.0 ) && fabs(normal[2]) < 0.00025 && fabs(normal[1]) < 0.00025){
+ normal[2] = normal[1] = 0.0;
+ adjusted = qtrue;
+ }
+ */
+
+ /*
+ for ( i=0; i<30; i++ )
+ {
+ double x, y, z, length;
+ x=(double) 1.0;
+ y=(double) ( 0.00001 * i );
+ z=(double) 0.0;
+
+ Sys_Printf("(%6.18f %6.18f %6.18f)inNormal\n", x,y,z );
+
+ length = sqrt( ( x * x ) + ( y * y ) + ( z * z ) );
+ Sys_Printf("(%6.18f)length\n", length);
+ x = (vec_t) ( x / length );
+ y = (vec_t) ( y / length );
+ z = (vec_t) ( z / length );
+ Sys_Printf("(%6.18f %6.18f %6.18f)outNormal\n\n", x,y,z );
+ }
+ Error("vectorNormalize test completed");
+ */
+
for ( i = 0; i < 3; i++ )
{
if ( normal[i] != 0.0 && -normalEpsilon < normal[i] && normal[i] < normalEpsilon ) {
VectorCopy( innormal, normal );
#if Q3MAP2_EXPERIMENTAL_SNAP_PLANE_FIX
- if ( !doingModelClip ) {
- SnapPlaneImproved( normal, &dist, numPoints, (const vec3_t *) points );
- }
- if ( doingModelClip && snapModelClip ) {
- SnapPlane( normal, &dist );
- }
+ SnapPlaneImproved( normal, &dist, numPoints, (const vec3_t *) points );
#else
SnapPlane( normal, &dist );
#endif