Source/ThunderBeast/QuakeToon/game/q_shared.c
int BoxOnPlaneSide2 (vec3_t emins, vec3_t emaxs, struct cplane_s *p)
{
	int		i;
	float	dist1, dist2;
	int		sides;
	vec3_t	corners[2];

	for (i=0 ; i<3 ; i++)
	{
		if (p->normal[i] < 0)
		{
			corners[0][i] = emins[i];
			corners[1][i] = emaxs[i];
		}
		else
		{
			corners[1][i] = emins[i];
			corners[0][i] = emaxs[i];
		}
	}
	dist1 = DotProduct (p->normal, corners[0]) - p->dist;
	dist2 = DotProduct (p->normal, corners[1]) - p->dist;
	sides = 0;
	if (dist1 >= 0)
		sides = 1;
	if (dist2 < 0)
		sides |= 2;

	return sides;
}
// this is the slow, general version
this is the slow, general version
this is the slow general version
int BoxOnPlaneSide2 (vec3_t emins, vec3_t emaxs, struct cplane_s *p)
{
	int		i;
	float	dist1, dist2;
	int		sides;
	vec3_t	corners[2];
	for (i=0 ; i<3 ; i++)
	{
		if (p->normal[i] < 0)
		{
			corners[0][i] = emins[i];
			corners[1][i] = emaxs[i];
		}
		else
		{
			corners[1][i] = emins[i];
			corners[0][i] = emaxs[i];
		}
	}
	dist1 = DotProduct (p->normal, corners[0]) - p->dist;
	dist2 = DotProduct (p->normal, corners[1]) - p->dist;
	sides = 0;
	if (dist1 >= 0)
		sides = 1;
	if (dist2 < 0)
		sides |= 2;
	return sides;
}
int BoxOnPlaneSide2 ( vec3_t emins , vec3_t emaxs , struct cplane_s * p ) { int i ; float dist1 , dist2 ; int sides ; vec3_t corners [ 2 ] ; for ( i = 0 ; i < 3 ; i ++ ) { if ( p -> normal [ i ] < 0 ) { corners [ 0 ] [ i ] = emins [ i ] ; corners [ 1 ] [ i ] = emaxs [ i ] ; } else { corners [ 1 ] [ i ] = emins [ i ] ; corners [ 0 ] [ i ] = emaxs [ i ] ; } } dist1 = DotProduct ( p -> normal , corners [ 0 ] ) - p -> dist ; dist2 = DotProduct ( p -> normal , corners [ 1 ] ) - p -> dist ; sides = 0 ; if ( dist1 >= 0 ) sides = 1 ; if ( dist2 < 0 ) sides |= 2 ; return sides ; }
this is the slow, general version
this is the slow general version