ContainmentResult TestSphereOCylinder   ( Sphere const & A, OrientedCylinder const & B )
{
	Vector localCenter = B.transformToLocal(A.getCenter());

	Sphere localSphere(localCenter,A.getRadius());

	return Test( localSphere, B.getLocalShape() );
}
示例#2
0
//===========================================================
bool CSegRemanenceShape::clip(const std::vector<CPlane>	&pyramid, const CMatrix &worldMatrix)
{
	// Speed Clip: clip just the sphere.
	NLMISC::CBSphere	localSphere(_BBox.getCenter(), _BBox.getRadius());
	NLMISC::CBSphere	worldSphere;

	// transform the sphere in WorldMatrix (with nearly good scale info).
	localSphere.applyTransform(worldMatrix, worldSphere);

	// if out of only plane, entirely out.
	for(sint i=0;i<(sint)pyramid.size();i++)
	{
		// We are sure that pyramid has normalized plane normals.
		// if SpherMax OUT return false.
		float	d= pyramid[i]*worldSphere.Center;
		if(d>worldSphere.Radius)
			return false;
	}
	return true;
}