Exemple #1
0
        public void DeleteHalfEdge(HalfEdge edge)
        {
            if (edge.Origin.Edge == edge)
            {
                foreach (var temp in edge.Origin.Walk())
                {
                    if (temp == edge)
                    {
                        continue;
                    }
                    edge.Origin.SetEdge(temp);
                    break;
                }

                if (edge.Origin.Edge == edge)
                {
                    edge.Origin.SetEdge(null);
                }
            }

            if (edge.Twin.Origin.Edge == edge.Twin)
            {
                foreach (var temp in edge.Twin.Origin.Walk())
                {
                    if (temp == edge.Twin)
                    {
                        continue;
                    }
                    edge.Twin.Origin.SetEdge(temp);
                    break;
                }

                if (edge.Twin.Origin.Edge == edge)
                {
                    edge.Twin.Origin.SetEdge(null);
                }
            }


//            edge.Next.SetPrevious(edge.Previous);
//            edge.Twin.Next.SetPrevious(edge.Twin.Previous);

            HalfEdges.Remove(edge.Twin);
            HalfEdges.Remove(edge);

            edge.Twin.SetOrigin(null);
            edge.Twin.SetPolygon(null);
            edge.Twin.SetNext(null);
            edge.Twin.SetPrevious(null);
            edge.Twin.SetTwin(null);

            edge.SetPair(null);
            edge.Twin.SetPair(null);

            edge.SetOrigin(null);
            edge.SetPolygon(null);
            edge.SetNext(null);
            edge.SetPrevious(null);
            edge.SetTwin(null);
        }
Exemple #2
0
 public void SetPair(HalfEdge alpha)
 {
     if (OwnsEdges(alpha))
     {
         return;
     }
     Alpha = alpha;
     if (Alpha != null)
     {
         Alpha.SetPair(this);
     }
     if (Beta != null)
     {
         Beta.SetPair(this);
     }
 }