Defines a plane based on a normal vector and a distance along that vector from the origin.
Exemplo n.º 1
0
        private static Ray3D ComputeIntersectionLine(ref Plane3D p1, ref Plane3D p2)
        {
            Ray3D ray = new Ray3D
            {
                Direction = (Vector3D)Normal3D.Cross(p1.Normal, p2.Normal)
            };
            float num = ray.Direction.LengthSquared();

            ray.Origin = (Point3D)(Vector3D.Cross((-p1.D * p2.Normal) + (p2.D * p1.Normal), ray.Direction) / num);
            return(ray);
        }
Exemplo n.º 2
0
        public ContainmentType Contains(Point3D point)
        {
            // If a point is on the POSITIVE side of the plane, then the point is not contained within the frustum
            foreach (var plane in planes)
            {
                // Check the top
                Plane3D tempPlane = plane;
                float   val       = PlaneHelper.ClassifyPoint(ref point, ref tempPlane);
                if (val > 0)
                {
                    return(ContainmentType.Disjoint);
                }
            }

            // If we get here, it means that the point was on the correct side of each plane to be
            // contained. Therefore this point is contained
            return(ContainmentType.Contains);
        }
Exemplo n.º 3
0
        private static Point3D ComputeIntersection(ref Plane3D plane, ref Ray3D ray)
        {
            float num = (-plane.D - Vector3D.Dot(plane.Normal, (Vector3D)ray.Origin)) / Vector3D.Dot(plane.Normal, ray.Direction);

            return(ray.Origin + ray.Direction * num);
        }