All pastes #926288 Raw Edit

bibi.skuk

public cpp v1 · immutable
·published 2008-03-03 17:21 UTC
rendered paste body
Plane::Side AABB::intersect(const Plane& p) const { 	const Vec3 n = p.getNormal();	const Real d = p.getOrigoDistance();	const Vec3 bmax = getMax();	const Vec3 bmin = getMin();	Vec3 vmin;	Vec3 vmax;	// find min/max points	for (int i = 0; i < 3; i++) 	{ 		if (n[i] >= 0) 		{ 			vmin[i] = bmin[i];			vmax[i] = bmax[i];		}		else 		{ 			vmin[i] = bmax[i];			vmax[i] = bmin[i];		}	}	if ((n*vmin - d) > 0) return Plane::POSITIVE_SIDE;	if ((n*vmax - d) < 0) return Plane::NEGATIVE_SIDE;	return Plane::ON_PLANE; // intersection!}