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

intersects() public method

public intersects ( PlaneBoundedVolume pbv ) : bool
pbv Axiom.Math.PlaneBoundedVolume
return bool
		public bool intersects( PlaneBoundedVolume pbv )
		{
			// Only check if portal is open
			if ( mOpen )
			{
				switch ( mType )
				{
					case PORTAL_TYPE.PORTAL_TYPE_QUAD:
						{
							// first check sphere of the portal
							if ( !pbv.Intersects( mDerivedSphere ) )
							{
								return false;
							}
							// if the portal corners are all outside one of the planes of the pbv,
							// then the portal does not intersect the pbv. (this can result in
							// some false positives, but it's the best I can do for now)
							foreach ( Plane plane in pbv.planes )
							{
								bool allOutside = true;
								for ( int i = 0; i < 4; i++ )
								{
									if ( plane.GetSide( mDerivedCorners[ i ] ) != pbv.outside )
									{
										allOutside = false;
									}
								}
								if ( allOutside )
								{
									return false;
								}

							}
						}
						break;
					case PORTAL_TYPE.PORTAL_TYPE_AABB:
						{
							AxisAlignedBox aabb = new AxisAlignedBox( mDerivedCorners[ 0 ], mDerivedCorners[ 1 ] );
							if ( !pbv.Intersects( aabb ) )
							{
								return false;
							}
						}
						break;
					case PORTAL_TYPE.PORTAL_TYPE_SPHERE:
						if ( !pbv.Intersects( mDerivedSphere ) )
						{
							return false;
						}
						break;
				}
			}
			return false;
		}

Same methods

Portal::intersects ( PCZSceneNode pczsn ) : PortalIntersectResult
Portal::intersects ( AxisAlignedBox aab ) : bool
Portal::intersects ( Ray ray ) : bool
Portal::intersects ( Sphere sphere ) : bool