Example #1
0
        public static bool Test(SharpDX.Plane plane, Vector3 a, Vector3 b, Vector3 c)
        {
            var p1 = plane.Intersects(ref a);
            var p2 = plane.Intersects(ref b);
            var p3 = plane.Intersects(ref c);

            // if all three points are on same side and none of them are on the plane then there is no intersection
            return(!(p1 == p2 && p2 == p3 && p1 != PlaneIntersectionType.Intersecting));
        }
Example #2
0
        /// <summary>
        /// Checks whether a point lay inside, intersects or lay outside the frustum.
        /// </summary>
        /// <param name="point">The point.</param>
        /// <returns>Type of the containment</returns>
        public ContainmentType Contains(ref Vector3 point)
        {
            var result      = PlaneIntersectionType.Front;
            var planeResult = PlaneIntersectionType.Front;

            for (int i = 0; i < 6; i++)
            {
                switch (i)
                {
                case 0: planeResult = pNear.Intersects(ref point); break;

                case 1: planeResult = pFar.Intersects(ref point); break;

                case 2: planeResult = pLeft.Intersects(ref point); break;

                case 3: planeResult = pRight.Intersects(ref point); break;

                case 4: planeResult = pTop.Intersects(ref point); break;

                case 5: planeResult = pBottom.Intersects(ref point); break;
                }
                switch (planeResult)
                {
                case PlaneIntersectionType.Back:
                    return(ContainmentType.Disjoint);

                case PlaneIntersectionType.Intersecting:
                    result = PlaneIntersectionType.Intersecting;
                    break;
                }
            }
            switch (result)
            {
            case PlaneIntersectionType.Intersecting: return(ContainmentType.Intersects);

            default: return(ContainmentType.Contains);
            }
        }
Example #3
0
 public override bool Test(AxisAlignedBoundingBox other)
 {
     return(splane.Intersects(ref other.sbb) == PlaneIntersectionType.Intersecting);
 }