Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Mesh m = Sample.GetSampleMesh2(100);

            PlyManager.Output(m, "D://VTKproj//sample.ply");
            ECMesh ecm = ECMesh.GetECMesh(m);
            List <EdgeAndWeight> edgeWeights = new List <EdgeAndWeight>(ecm.Edges.Count);
            Random r = new Random();

            for (int i = 0; i < ecm.Edges.Count; i++)
            {
                EdgeAndWeight ew = new EdgeAndWeight();
                ew.edgeID = i;
                ew.weight = r.Next(0, 10000);
                edgeWeights.Add(ew);
            }
            edgeWeights.Sort();
            int deciCount = ecm.Edges.Count / 10;
            int index     = 0;

            while (deciCount != 0)
            {
                if (index == edgeWeights.Count)
                {
                    break;
                }
                EdgeAndWeight ew   = edgeWeights[index];
                ECEdge        edge = ecm.Edges[ew.edgeID];
                if (edge.IsValid() && edge.OrgV().Type == VertexType.INTERIOR && edge.DestV().Type == VertexType.INTERIOR)
                {
                    ECVertex v0  = edge.OrgV();
                    ECVertex v1  = edge.DestV();
                    Point3d  mid = new Point3d(v0.X / 2 + v1.X / 2, v0.Y / 2 + v1.Y / 2, v0.Z / 2 + v1.Z / 2);
                    ecm.Contract(v0, v1, mid);
                    deciCount--;
                    index++;
                }
                else
                {
                    index++;
                    continue;
                }
            }
            m = ecm.GetMesh();
            PlyManager.Output(m, "test2.ply");
            Console.WriteLine("\nCMP!");
            Console.Read();
        }
Exemplo n.º 2
0
 public ECFace(ECEdge e0, ECEdge e1, ECEdge e2)
 {
     AdjEdges    = new ECEdge[3];
     AdjEdges[0] = e0;
     AdjEdges[1] = e1;
     AdjEdges[2] = e2;
     AdjEdges[0].LinkFace(this);
     AdjEdges[1].LinkFace(this);
     AdjEdges[2].LinkFace(this);
     P   = new Plane(e0.OrgV(), e1.OrgV(), e2.OrgV());
     tag = false;
 }
Exemplo n.º 3
0
 public ECVertex DestV()
 {
     return(twin.OrgV());
 }