Пример #1
0
        public void ReplaceVertex(PRVertex u, PRVertex v)
        {
            v.AddFace(this);
            if (vertex [0] == u)
            {
                vertex [0] = v;
            }
            if (vertex [1] == u)
            {
                vertex [1] = v;
            }
            if (vertex [2] == u)
            {
                vertex [2] = v;
            }
            for (int i = 0; i < 3; i++)
            {
                if (vertex [i].neighbor.Contains(u))
                {
                    vertex [i].neighbor.Remove(u);
                    vertex [i].AddNeighbor(v);
                }
                v.AddNeighbor(vertex [i]);
            }

            ComputeNormal();
        }
Пример #2
0
 //replace the point u in the triangle with v
 public void ReplaceVertex(PRVertex u, PRVertex v)
 {
     //add this face to v
     v.AddFace(this);
     //replace the point
     if (vertex[0] == u)
     {
         vertex[0] = v;
     }
     if (vertex[1] == u)
     {
         vertex[1] = v;
     }
     if (vertex[2] == u)
     {
         vertex[2] = v;
     }
     //delete the u
     //replace all the neighbours of the triangle containing u with v
     for (int i = 0; i < 3; i++)
     {
         if (vertex[i].neighbor.Contains(u))
         {
             vertex[i].neighbor.Remove(u);
             vertex[i].AddNeighbor(v);
         }
         v.AddNeighbor(vertex[i]);
     }
     //update the normal
     ComputeNormal();
 }