Axiom.SceneManagers.PortalConnected.Portal.closeTo C# (CSharp) Method

closeTo() public method

public closeTo ( Portal otherPortal ) : bool
otherPortal Portal
return bool
		public bool closeTo( Portal otherPortal )
		{
			// only portals of the same type can be "close to" each other.
			if ( mType != otherPortal.Type )
			{
				return false;
			}
			bool close = false;
			switch ( mType )
			{
				default:
				case PORTAL_TYPE.PORTAL_TYPE_QUAD:
					{
						// quad portals must be within 1/4 sphere of each other
						Sphere quarterSphere1 = mDerivedSphere;
						quarterSphere1.Radius = quarterSphere1.Radius * 0.25f;
						Sphere quarterSphere2 = otherPortal.getDerivedSphere();
						quarterSphere2.Radius = quarterSphere2.Radius * 0.25f;
						close = quarterSphere1.Intersects( quarterSphere2 );
					}
					break;
				case PORTAL_TYPE.PORTAL_TYPE_AABB:
					// NOTE: AABB's must match perfectly
					if ( mDerivedCP == otherPortal.getDerivedCP() &&
						mCorners[ 0 ] == otherPortal.getCorner( 0 ) &&
						mCorners[ 1 ] == otherPortal.getCorner( 1 ) )
					{
						close = true;
					}
					break;
				case PORTAL_TYPE.PORTAL_TYPE_SPHERE:
					// NOTE: Spheres must match perfectly
					if ( mDerivedCP == otherPortal.getDerivedCP() &&
						mRadius == otherPortal.getRadius() )
					{
						close = true;
					}
					break;
			}
			return close;
		}