Beispiel #1
0
def test_meshing_functions():
    print("Testing meshing functions...")
    P = get_poly()
    vlist = []
    for vh in P.vertices():
        vlist.append(vh)
    del vlist[-1]
    # fair
    CGAL_Polygon_mesh_processing.fair(P, vlist)
    P = get_poly()
    vlist = []
    for vh in P.vertices():
        vlist.append(vh)
    del vlist[-1]
    CGAL_Polygon_mesh_processing.fair(P, vlist, 2)
    # refine
    P = get_poly()
    flist = []
    for fh in P.facets():
        flist.append(fh)
    outf = []
    outv = []
    CGAL_Polygon_mesh_processing.refine(P, flist, outf, outv)
    flist = []
    for fh in P.facets():
        flist.append(fh)
    CGAL_Polygon_mesh_processing.refine(P, flist, outf, outv, 1.41)
    #  triangulate_faces
    CGAL_Polygon_mesh_processing.triangulate_faces(P)
    # // isotropic_remeshing (4.8)
    P = get_poly()
    hlist = []
    for hh in P.halfedges():
        hlist.append(hh)
    flist = []
    for fh in P.facets():
        flist.append(fh)
    CGAL_Polygon_mesh_processing.isotropic_remeshing(flist, 0.25, P, 3, hlist,
                                                     False)
    P.write_to_file("iso_remesh.off")
    flist = []
    for fh in P.facets():
        flist.append(fh)
    CGAL_Polygon_mesh_processing.isotropic_remeshing(flist, 0.25, P, 3)
    flist = []
    for fh in P.facets():
        flist.append(fh)
    CGAL_Polygon_mesh_processing.isotropic_remeshing(flist, 0.25, P)
    # split_long_edges
    hlist = []
    for hh in P.halfedges():
        hlist.append(hh)
    CGAL_Polygon_mesh_processing.split_long_edges(hlist, 0.1, P)
Beispiel #2
0
def test_meshing_functions():
  print("Testing meshing functions...")
  P=get_poly()
  vlist = []
  for vh in P.vertices():
    vlist.append(vh)
  del vlist[-1]
# fair
  CGAL_Polygon_mesh_processing.fair(P, vlist)
  P=get_poly();
  vlist=[]
  for vh in P.vertices():
    vlist.append(vh)
  del vlist[-1]
  CGAL_Polygon_mesh_processing.fair(P, vlist, 2)
# refine
  P=get_poly();
  flist = []
  for fh in P.facets():
    flist.append(fh)
  outf = []
  outv = []
  CGAL_Polygon_mesh_processing.refine(P, flist, outf, outv)
  flist = []
  for fh in P.facets():
    flist.append(fh)
  CGAL_Polygon_mesh_processing.refine(P, flist, outf, outv,1.41)
#  triangulate_faces
  CGAL_Polygon_mesh_processing.triangulate_faces(P)
# // isotropic_remeshing (4.8)
  P=get_poly()
  hlist = []
  for hh in P.halfedges():
    hlist.append(hh)
  flist = []
  for fh in P.facets():
    flist.append(fh)
  CGAL_Polygon_mesh_processing.isotropic_remeshing(flist, 0.25, P, 3, hlist, False)
  P.write_to_file("iso_remesh.off")
  flist = []
  for fh in P.facets():
    flist.append(fh)
  CGAL_Polygon_mesh_processing.isotropic_remeshing(flist, 0.25, P, 3)
  flist = []
  for fh in P.facets():
    flist.append(fh)
  CGAL_Polygon_mesh_processing.isotropic_remeshing(flist, 0.25, P)
# split_long_edges
  hlist = []
  for hh in P.halfedges():
    hlist.append(hh)
  CGAL_Polygon_mesh_processing.split_long_edges(hlist,0.1,P)
    def refine_mesh(self):  
        filepath_in = self.name + ".off" 
        a = self.name + "_Refine"
        self.name = a
        filepath_out = self.name + ".off"

        P=Polyhedron_3(filepath_in)

        flist = []
        for fh in P.facets():
            flist.append(fh)
        outf = []
        outv = []
        CGAL_Polygon_mesh_processing.refine(P, flist, outf, outv)

        P.write_to_file(filepath_out)
        return P