Exemplo n.º 1
0
        private CdtEdge FindEdge(PolylinePoint a, PolylinePoint b, Cdt cdt)
        {
            int aIsAboveB = Cdt.Above(a.Point, b.Point);

            System.Diagnostics.Debug.Assert(aIsAboveB != 0);
            if (aIsAboveB > 0)
            {
                foreach (var e in cdt.FindSite(a.Point).Edges)
                {
                    if (e.lowerSite.Point == b.Point)
                    {
                        return(e);
                    }
                }
            }
            else
            {
                foreach (var e in cdt.FindSite(b.Point).Edges)
                {
                    if (e.lowerSite.Point == a.Point)
                    {
                        return(e);
                    }
                }
            }

            throw new InvalidOperationException("cannot find an edge of a polyline in the tessellation");
        }
Exemplo n.º 2
0
 internal CdtEdge EdgeBetweenUpperSiteAndLowerSite(CdtSite b)
 {
     Debug.Assert(Cdt.Above(this, b) > 0);
     if (Edges != null)
     {
         foreach (var edge in Edges)
         {
             if (edge.lowerSite == b)
             {
                 return(edge);
             }
         }
     }
     return(null);
 }
Exemplo n.º 3
0
        ///<summary>
        ///</summary>
        ///<param name="a"></param>
        ///<param name="b"></param>
        public CdtEdge(CdtSite a, CdtSite b)
        {
            var above = Cdt.Above(a.Point, b.Point);

            if (above == 1)
            {
                upperSite = a;
                lowerSite = b;
            }
            else
            {
                Debug.Assert(above != 0);
                lowerSite = a;
                upperSite = b;
            }

            upperSite.AddEdgeToSite(this);
        }