Exemplo n.º 1
0
 public void FitEdge(ref Mesh mesh, Polyline pts, double tol)
 {
     MeshCreation mc = new MeshCreation();
     List<int> index = mc.MeshEdgeVerticeIndex(mesh);
     for (int i = 0; i < index.Count; i++)
     {
         Point3d pt = mesh.Vertices[index[i]];
         int sign = 0; double dist = double.MaxValue;
         for (int j = 0; j < pts.Count; j++)
         {
             double t = pts[j].DistanceTo(pt);
             if (t < dist) { dist = t; sign = j; }
         }
         mesh.Vertices.SetVertex(index[i], pts[sign]);
     }
     for (int i = 0; i < mesh.Vertices.Count; i++)
     {
         Point3d pt = mesh.Vertices[i];
         int sign = 0; double dist = double.MaxValue;
         for (int j = 0; j < pts.Count; j++)
         {
             double t = pts[j].DistanceTo(pt);
             if (t < dist) { dist = t; sign = j; }
         }
         if (dist < tol) mesh.Vertices.SetVertex(i, pts[sign]);
     }
 }
Exemplo n.º 2
0
 public MeshConvert()
 {
     mc = new MeshCreation();
 }