Esempio n. 1
0
        // If two lines intersect, they form two angles that face each other
        public static bool Intersects(this LineSegment a, LineSegment b)
        {
            if (a.Start == b.Start || a.Start == b.End ||
               a.End == b.Start || a.End == b.End)
            { return false; }// We don't count sharing a corner as intersecting

            return // else, draw some pretend triangles and see where they are pointing
                Orient(a.Start, a.End, b.Start) != Orient(a.Start, a.End, b.End)
                && Orient(b.Start, b.End, a.Start) != Orient(b.Start, b.End, a.End);
        }
Esempio n. 2
0
 // create new line segment from point to point, get angle
 public static double GetClockwise(this LineSegment active, LineSegment passive)
 {
     var anglea = active.Angle();
     var angleb = passive.Angle();
     return (angleb > anglea) ? angleb - anglea : (360 - anglea) + angleb;
 }