Example #1
0
        private MyPlaneIntersectionType PlaneIntersectsPoints(ref MyPlane plane, MyVector3[] points)
        {
            var result = MyCollision.PlaneIntersectsPoint(ref plane, ref points[0]);

            for (int i = 1; i < points.Length; i++)
            {
                if (MyCollision.PlaneIntersectsPoint(ref plane, ref points[i]) != result)
                {
                    return(MyPlaneIntersectionType.Intersecting);
                }
            }
            return(result);
        }
Example #2
0
        /// <summary>
        /// Determines the intersection relationship between the frustum and a bounding box.
        /// </summary>
        /// <param name="box">The box.</param>
        /// <returns>Type of the containment</returns>
        public MyContainmentType Contains(ref MyBoundingBox box)
        {
            MyVector3 p, n;
            MyPlane   plane;
            var       result = MyContainmentType.Contains;

            for (int i = 0; i < 6; i++)
            {
                plane = GetPlane(i);
                GetBoxToPlanePVertexNVertex(ref box, ref plane.Normal, out p, out n);
                if (MyCollision.PlaneIntersectsPoint(ref plane, ref p) == MyPlaneIntersectionType.Back)
                {
                    return(MyContainmentType.Disjoint);
                }

                if (MyCollision.PlaneIntersectsPoint(ref plane, ref n) == MyPlaneIntersectionType.Back)
                {
                    result = MyContainmentType.Intersects;
                }
            }
            return(result);
        }
Example #3
0
 /// <summary>
 /// Determines if there is an intersection between the current object and a point.
 /// </summary>
 /// <param name="point">The point to test.</param>
 /// <returns>Whether the two objects intersected.</returns>
 public MyPlaneIntersectionType Intersects(ref MyVector3 point)
 {
     return(MyCollision.PlaneIntersectsPoint(ref this, ref point));
 }