/// <summary> /// Plane/Box intersection test. /// </summary> /// <param name="plane"></param> /// <param name="box"></param> /// <returns>True if there was an intersection, false otherwise.</returns> public static bool Intersects(Plane plane, AxisAlignedBox box) { if (box.IsNull) { return(false); } // Get corners of the box Vector3[] corners = box.Corners; // Test which side of the plane the corners are // Intersection occurs when at least one corner is on the // opposite side to another AwManaged.Math.PlaneSide lastSide = plane.GetSide(corners[0]); for (int corner = 1; corner < 8; corner++) { if (plane.GetSide(corners[corner]) != lastSide) { return(true); } } return(false); }
/// <summary> /// Constructor. /// </summary> /// <param name="outside">Side of the plane to be considered 'outside'.</param> public PlaneBoundedVolume(AwManaged.Math.PlaneSide outside) { this.outside = outside; }