level/map.c
/*	Returns a global plane number and the side that will be the front
*/
Returns a global plane number and the side that will be the front
Returns a global plane number and the side that will be the front
int	FindPlane( plane_t *dplane, int *side )
{
	int			i;
	plane_t		*dp, pl;
	vec_t		dot;
	pl = *dplane;
	NormalizePlane( &pl );
	if( DotProduct( pl.normal, dplane->normal ) > 0 )
		*side = 0;
	else
		*side = 1;
	for( i = 0, dp = mapplanes; i < nummapplanes; i++, dp++ )
		if( DotProduct( dp->normal, pl.normal ) > 1.0 - ANGLE_EPSILON && fabs( dp->dist - pl.dist ) < DIST_EPSILON )
			return i; 
	if( nummapplanes == BSP_MAX_PLANES )
		Error( "FindPlane: nummapplanes == BSP_MAX_PLANES" );
	dot = VectorLength( dplane->normal );
	if( dot < 1.0 - ANGLE_EPSILON || dot > 1.0 + ANGLE_EPSILON )
		Error( "FindPlane: normalization error (%f %f %f, length %f)", dplane->normal[0], dplane->normal[1], dplane->normal[2], dot );
	mapplanes[nummapplanes] = pl;
	return nummapplanes++;
}
int FindPlane ( plane_t * dplane , int * side ) { int i ; plane_t * dp , pl ; vec_t dot ; pl = * dplane ; NormalizePlane ( & pl ) ; if ( DotProduct ( pl . normal , dplane -> normal ) > 0 ) * side = 0 ; else * side = 1 ; for ( i = 0 , dp = mapplanes ; i < nummapplanes ; i ++ , dp ++ ) if ( DotProduct ( dp -> normal , pl . normal ) > 1.0 - ANGLE_EPSILON && fabs ( dp -> dist - pl . dist ) < DIST_EPSILON ) return i ; if ( nummapplanes == BSP_MAX_PLANES ) Error ( " " ) ; dot = VectorLength ( dplane -> normal ) ; if ( dot < 1.0 - ANGLE_EPSILON || dot > 1.0 + ANGLE_EPSILON ) Error ( " " , dplane -> normal [ 0 ] , dplane -> normal [ 1 ] , dplane -> normal [ 2 ] , dot ) ; mapplanes [ nummapplanes ] = pl ; return nummapplanes ++ ; }
Returns a global plane number and the side that will be the front
Returns a global plane number and the side that will be the front
// regular match