Beispiel #1
0
        static public bool IsIntersecting(this LineSegmentF2 item, LineF2 line)
        {
            float    distance;
            VectorF2 point;

            return(item.TryGetIntersection(line, out distance, out point));
        }
Beispiel #2
0
        static public bool IsTerminus(this LineSegmentF2 item, VectorF2 point)
        {
            if (item.p1 == point || item.p2 == point)
            {
                return(true);
            }

            return(false);
        }
Beispiel #3
0
        static public bool IsContinuation(this LineSegmentF2 item, LineSegmentF2 line_segment)
        {
            if (item.IsTerminus(line_segment.p1) || item.IsTerminus(line_segment.p2))
            {
                return(true);
            }

            return(false);
        }
Beispiel #4
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);
        }
Beispiel #5
0
        static public bool TryGetIntersectionPercent(this LineSegmentF2 item, LineSegmentF2 line_segment, out float percent, out VectorF2 point)
        {
            float distance;

            if (item.TryGetIntersection(line_segment, out distance, out point))
            {
                percent = distance / item.GetLength();

                return(true);
            }

            percent = 0.0f;
            return(false);
        }
Beispiel #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);
        }
Beispiel #7
0
 static public LineF2 GetLine(this LineSegmentF2 item)
 {
     return(new LineF2(item.p1, item.p1.GetDirection(item.p2)));
 }
Beispiel #8
0
 static public float GetLength(this LineSegmentF2 item)
 {
     return(item.p1.GetDistanceTo(item.p2));
 }
Beispiel #9
0
        static public bool TryGetIntersectionPercent(this LineSegmentF2 item, LineSegmentF2 line_segment, out float percent)
        {
            VectorF2 point;

            return(item.TryGetIntersectionPercent(line_segment, out percent, out point));
        }
Beispiel #10
0
        static public bool TryGetIntersection(this LineSegmentF2 item, LineSegmentF2 line_segment, out VectorF2 point)
        {
            float distance;

            return(item.TryGetIntersection(line_segment, out distance, out point));
        }
Beispiel #11
0
 static public VectorF2 GetPointAlong(this LineSegmentF2 item, float distance)
 {
     return(item.GetLine().GetPointAlong(distance));
 }
Beispiel #12
0
 static public VectorF2 GetPointInterpolate(this LineSegmentF2 item, float percent)
 {
     return(item.p1.GetInterpolate(item.p2, percent));
 }
Beispiel #13
0
 static public RectF2 GetRectF2(this LineSegmentF2 item)
 {
     return(new RectF2(item.p1, item.p2));
 }