public NavSegmentOverlap(int plane, int depth, GraphDirection dir, NavSegment seg)
 {
     this.plane     = plane;
     this.depth     = depth;
     this.direction = dir;
     this.segment   = seg;
 }
 public NavSegment overlap(NavSegment other)
 {
     return(new NavSegment()
     {
         min = Utility.Max(min, other.min), max = Utility.Min(max, other.max)
     });
 }
Beispiel #3
0
 public void AddSegmentY(int y, NavSegment seg)
 {
     if (ySegments[y] == null)
     {
         ySegments[y] = new List <NavSegment>();
     }
     ySegments[y].Add(seg);
 }
Beispiel #4
0
        public void AddSegmentX(int x, NavSegment seg)
        {
            if (xSegments[x] == null)
            {
                xSegments[x] = new List <NavSegment>();
            }

            xSegments[x].Add(seg);
        }
Beispiel #5
0
 public IEnumerable <NavSegment> getOverlapsY(int y, NavSegment seg)
 {
     if (y >= 0 && y < ySegments.Length - 1)
     {
         var segments = ySegments[y];
         foreach (var ySeg in segments)
         {
             if (ySeg.isOverlapping(seg))
             {
                 yield return(ySeg);
             }
         }
     }
 }
Beispiel #6
0
 public IEnumerable <NavSegment> getOverlapsX(int x, NavSegment seg)
 {
     if (x >= 0 && x < xSegments.Length - 1)
     {
         var segments = xSegments[x];
         foreach (var xSeg in segments)
         {
             if (xSeg.isOverlapping(seg))
             {
                 yield return(xSeg);
             }
         }
     }
 }
Beispiel #7
0
        public bool getPartitionX(int x, int y, out NavSegment seg)
        {
            if (x >= 0 && x < xSegments.Length && y >= 0 && y < ySegments.Length)
            {
                var segments = xSegments[x];
                var test     = new NavSegment(y, y);
                for (var i = 0; i < segments.Count; i++)
                {
                    if (segments[i].isOverlapping(test))
                    {
                        seg = segments[i];
                        return(true);
                    }
                }
            }

            seg = new NavSegment();
            return(false);
        }
 public bool isOverlapping(NavSegment other)
 {
     return((other.min >= min && other.min <= max) || (other.max >= min && other.max <= max) ||
            (min >= other.min && min <= other.max) || (max >= other.min && max <= other.max));
 }