public bool intersects( Sphere sphere )
{
// Only check if portal is open
if ( mOpen )
{
switch ( mType )
{
case PORTAL_TYPE.PORTAL_TYPE_QUAD:
// since ogre doesn't have built in support for a quad, just check
// if the sphere intersects both the sphere of the portal and the plane
// this can result in false positives, but they will be minimal
if ( !sphere.Intersects( mDerivedSphere ) )
{
return false;
}
if ( sphere.Intersects( mDerivedPlane ) )
{
return true;
}
break;
case PORTAL_TYPE.PORTAL_TYPE_AABB:
{
// aab to aab check
AxisAlignedBox aabb = new AxisAlignedBox( mDerivedCorners[ 0 ], mDerivedCorners[ 1 ] );
return ( aabb.Intersects( sphere ) );
}
case PORTAL_TYPE.PORTAL_TYPE_SPHERE:
return ( mDerivedSphere.Intersects( sphere ) );
}
}
return false;
}