Ejemplo n.º 1
0
        static public bool IsIntersecting(this LineSegmentF2 item, LineF2 line)
        {
            float    distance;
            VectorF2 point;

            return(item.TryGetIntersection(line, out distance, out point));
        }
Ejemplo n.º 2
0
        static public bool IsIntersecting(this LineF2 item, LineF2 line)
        {
            if (item.direction != line.direction)
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 3
0
        static public bool TryGetIntersection(this LineSegmentF2 item, LineF2 line, out float distance, out VectorF2 point)
        {
            if (item.GetLine().TryGetIntersection(line, out distance, out point))
            {
                if (item.GetRectF2().Contains(point))
                {
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 4
0
        static public bool TryGetIntersection(this LineF2 item, LineF2 line, out float distance, out VectorF2 point)
        {
            if (item.TryGetIntersection(line, out distance))
            {
                point = item.GetPointAlong(distance);

                return(true);
            }

            point = default(VectorF2);
            return(false);
        }
Ejemplo n.º 5
0
        static public bool TryGetIntersection(this LineF2 item, LineF2 line, out float distance)
        {
            VectorF2 offset = item.point - line.point;

            if (item.IsIntersecting(line))
            {
                distance = (line.direction.x * offset.y - line.direction.y * offset.x) /
                           (line.direction.y * item.direction.x - line.direction.x * item.direction.y);

                return(true);
            }

            distance = 0.0f;
            return(false);
        }
Ejemplo n.º 6
0
        static public bool TrySplit(this LineSegmentF2 item, LineF2 line, out LineSegmentF2 line_segment1, out LineSegmentF2 line_segment2)
        {
            VectorF2 point;

            if (item.TryGetIntersection(line, out point))
            {
                line_segment1 = new LineSegmentF2(item.p1, point);
                line_segment2 = new LineSegmentF2(point, item.p2);

                return(true);
            }

            line_segment1 = default(LineSegmentF2);
            line_segment2 = default(LineSegmentF2);
            return(false);
        }
Ejemplo n.º 7
0
 static public VectorF2 GetPointAlong(this LineF2 item, float distance)
 {
     return(item.point + item.direction * distance);
 }
Ejemplo n.º 8
0
        static public bool TryGetIntersection(this LineF2 item, LineF2 line, out VectorF2 point)
        {
            float distance;

            return(item.TryGetIntersection(line, out distance, out point));
        }