Beispiel #1
0
 public static int Compare(EndPoint a, EndPoint b)
 {
     //return ShadowMathUtils.Approximately(a, b);
     // Traverse in angle order
     if (a.Angle > b.Angle) return 1;
     if (a.Angle < b.Angle) return -1;
     // But for ties (common), we want Begin nodes before End nodes
     if (!a.Begin && b.Begin) return 1;
     if (a.Begin && !b.Begin) return -1;
     return 0;
 }
Beispiel #2
0
        private void InsertPoint(EndPoint p)
        {
            if (p.Begin)
            {
                bool inserted = false;
                for (int index = 0; index < Open.Count; index++)
                {
                    Segment test = Open[index];
                    if (Segment.IsInFrontOf(p.Segment, test, Center) != Segment.IntersectionResult.InFront)
                    {
                        Open.Insert(index, p.Segment);
                        inserted = true;
                        break;
                    }
                }

                if (!inserted)
                {
                    Open.Add(p.Segment);
                }
            }
            else
            {
                Open.Remove(p.Segment);
            }
        }
Beispiel #3
0
 public Segment(Vector2 start, Vector2 end)
 {
     Start = new EndPoint(start, this);
     End = new EndPoint(end, this);
     Slope = (end - start).normalized;
 }