Ejemplo n.º 1
0
        // ----------------------------------------------------------------------------------------------
        // -- Cylinder ----------------------------------------------------------------------------------
        // ----------------------------------------------------------------------------------------------

        public static bool Intersect(Bounding.Cylinder a, Bounding.Line b, out object intersection) // CylHeight implemented
        {
            intersection = null;
            Vector3         v = b.P1 - b.P0;
            RayIntersection rOut;

            return(Intersect(a, new Ray(b.P0, Vector3.Normalize(v)), out rOut) && rOut.Distance <= v.Length());
        }
Ejemplo n.º 2
0
        public static bool Intersect(Bounding.Box a, Bounding.Line b, out object intersection)
        {
            intersection = null;

            Vector3         v    = b.P1 - b.P0;
            RayIntersection rOut = new RayIntersection();

            return(Intersect(a, new Ray(b.P0, Vector3.Normalize(v)), out rOut) && rOut.Distance < v.Length());
        }
Ejemplo n.º 3
0
        public static bool Intersect(BoundingBox a, Bounding.Line b, out object intersection)
        {
            intersection = null;

            float   d;
            Vector3 v = b.P1 - b.P0;

            return(BoundingBox.Intersects(a, new Ray(b.P0, Vector3.Normalize(v)), out d) && d <= v.Length());
        }
        //public static RSpatialRelation Relation(BoundingBox a, System.Drawing.RectangleF b)
        //{
        //    return Relation(a, Boundings.BoundingToBox(b));
        //}
        public static RSpatialRelation Relation(BoundingBox a, Bounding.Line b)
        {
            float   d;
            Vector3 v = b.P1 - b.P0;

            if (!BoundingBox.Intersects(a, new Ray(b.P0, Vector3.Normalize(v)), out d) || d > v.Length())
            {
                return(RSpatialRelation.Outside);
            }
            else if (Relation(a, b.P0) == RSpatialRelation.BInsideA && Relation(a, b.P1) == RSpatialRelation.BInsideA)
            {
                return(RSpatialRelation.BInsideA);
            }
            else
            {
                return(RSpatialRelation.Intersect);
            }
        }
        // ----------------------------------------------------------------------------------------------
        // -- RectangleF --------------------------------------------------------------------------------
        // ----------------------------------------------------------------------------------------------

        public static RSpatialRelation Relation(RectangleF a, Bounding.Line b)
        {
            return(Relation(new BoundingBox(new Vector3(a.X, a.Y, float.MinValue), new Vector3(a.X + a.Width, a.Y + a.Height, float.MaxValue)), b));
        }