Пример #1
0
 public void ApplyData(ReductionData rd)
 {
     for (int i = 0; i < rd.triangleID.Count; i++)
     {
         if (triangles [rd.triangleID [i]] == rd.vertexV || triangles [rd.triangleID [i] + 1] == rd.vertexV || triangles [rd.triangleID [i] + 2] == rd.vertexV)
         {
             triangles [rd.triangleID [i]] = triangles [rd.triangleID [i] + 1] = triangles [rd.triangleID [i] + 2] = 0;
         }
         else
         {
             if (triangles [rd.triangleID [i]] == rd.vertexU)
             {
                 triangles [rd.triangleID [i]] = rd.vertexV;
                 continue;
             }
             if (triangles [rd.triangleID [i] + 1] == rd.vertexU)
             {
                 triangles [rd.triangleID [i] + 1] = rd.vertexV;
                 continue;
             }
             if (triangles [rd.triangleID [i] + 2] == rd.vertexU)
             {
                 triangles [rd.triangleID [i] + 2] = rd.vertexV;
                 continue;
             }
         }
     }
 }
Пример #2
0
        public void Collapse(PRVertex u, PRVertex v)
        {
            if (v == null)
            {
                Debug.Log("!!!");                 //prVertices [u.id] = null;
                return;
            }
            //Debug.Log (u.id.ToString()+"  "+v.id.ToString()+"  "+u.cost.ToString());
            int             i;
            List <PRVertex> tmp = new List <PRVertex> ();

            for (i = 0; i < u.neighbor.Count; i++)
            {
                tmp.Add(u.neighbor[i]);
            }
            ReductionData rd = new ReductionData();

            rd.vertexU = u.id;
            rd.vertexV = v.id;
            v.neighbor.Remove(u);
            for (i = u.face.Count - 1; i >= 0; i--)
            {
                u.face[i].ReplaceVertex(u, v);
            }
            for (int j = 0; j < u.face.Count; j++)
            {
                rd.triangleID.Add(u.face[j].id);
            }
            reductionData.Add(rd);
            ComputeEdgeCostAtVertex(v);
            //prVertices [u.id] = null;
            for (i = 0; i < tmp.Count; i++)
            {
                ComputeEdgeCostAtVertex(tmp[i]);
            }
            //prVertices [u.id] = null;
            u.cost = 10000000f;
        }
Пример #3
0
 public void BackData(ReductionData rd)
 {
 }