Beispiel #1
0
def test_orientation_functions():
    P = get_poly()
    print("Testing predicate functions...")
    # is_outward_oriented
    CGAL_Polygon_mesh_processing.is_outward_oriented(P)
    # reverse_face_orientations
    CGAL_Polygon_mesh_processing.reverse_face_orientations(P)
    flist = []
    for fh in P.facets():
        flist.append(fh)
    CGAL_Polygon_mesh_processing.reverse_face_orientations(flist, P)
    # orient_polygon_soup
    points = Point_3_Vector()
    points.reserve(3)
    points.append(Point_3(0, 0, 0))
    points.append(Point_3(0, 1, 0))
    points.append(Point_3(1, 0, 0))
    polygons = Polygon_Vector()
    polygon = Int_Vector()
    polygon.reserve(3)
    polygon.append(0)
    polygon.append(1)
    polygon.append(2)
    polygons.append(polygon)
    CGAL_Polygon_mesh_processing.orient_polygon_soup(points, polygons)
Beispiel #2
0
def test_orientation_functions():
  P=get_poly()
  print("Testing predicate functions...")
# is_outward_oriented
  CGAL_Polygon_mesh_processing.is_outward_oriented(P)
# reverse_face_orientations
  CGAL_Polygon_mesh_processing.reverse_face_orientations(P)
  flist = []
  for fh in P.facets():
    flist.append(fh)
  CGAL_Polygon_mesh_processing.reverse_face_orientations(flist,P)
# orient_polygon_soup
  points = Point_3_Vector()
  points.reserve(3)
  points.append( Point_3(0,0,0) )
  points.append( Point_3(0,1,0) )
  points.append( Point_3(1,0,0) )
  polygons = Polygon_Vector()
  polygon = Int_Vector()
  polygon.reserve(3)
  polygon.append(0)
  polygon.append(1)
  polygon.append(2)
  polygons.append(polygon)
  CGAL_Polygon_mesh_processing.orient_polygon_soup(points, polygons)
Beispiel #3
0
def test_combinatorial_repairing_functions():
    print("Testing combinarial repairing functions...")
    P = Polyhedron_3()
    P.make_triangle(Point_3(0, 0, 0), Point_3(1, 0, 0), Point_3(0, 1, 0))
    P.make_triangle(Point_3(1, 0, 0), Point_3(0, 0, 0), Point_3(0, -1, 0))
    # stitch_borders
    CGAL_Polygon_mesh_processing.stitch_borders(P)
    #
    P.clear()
    h1 = P.make_triangle(Point_3(0, 0, 0), Point_3(1, 0, 0), Point_3(0, 1, 0))
    h2 = P.make_triangle(Point_3(1, 0, 0), Point_3(0, 0, 0), Point_3(0, -1, 0))
    h1 = h1.opposite()
    while (h1.vertex().point() != Point_3(1, 0, 0)):
        h1 = h1.next()
    h2 = h2.opposite()
    while (h2.vertex().point() != Point_3(0, 0, 0)):
        h2 = h2.next()
    hpairs = []
    hpairs.append(Halfedge_pair(h1, h2))
    CGAL_Polygon_mesh_processing.stitch_borders(P, hpairs)

    # polygon_soup_to_polygon_mesh
    P = Polyhedron_3()
    points = Point_3_Vector()
    points.reserve(3)
    points.append(Point_3(0, 0, 0))
    points.append(Point_3(0, 1, 0))
    points.append(Point_3(1, 0, 0))
    polygons = Polygon_Vector()
    polygon = Int_Vector()
    polygon.reserve(3)
    polygon.append(0)
    polygon.append(1)
    polygon.append(2)
    polygons.append(polygon)
    CGAL_Polygon_mesh_processing.polygon_soup_to_polygon_mesh(
        points, polygons, P)
    assert (P.size_of_vertices() == 3)

    # remove_isolated_vertices (4.8)
    CGAL_Polygon_mesh_processing.remove_isolated_vertices(P)
Beispiel #4
0
def test_combinatorial_repairing_functions():
  print("Testing combinarial repairing functions...")
  P = Polyhedron_3()
  P.make_triangle(Point_3(0,0,0), Point_3(1,0,0), Point_3(0,1,0))
  P.make_triangle(Point_3(1,0,0), Point_3(0,0,0), Point_3(0,-1,0))
# stitch_borders
  CGAL_Polygon_mesh_processing.stitch_borders(P)
#
  P.clear()
  h1 = P.make_triangle(Point_3(0,0,0), Point_3(1,0,0), Point_3(0,1,0))
  h2 = P.make_triangle(Point_3(1,0,0), Point_3(0,0,0), Point_3(0,-1,0))
  h1=h1.opposite()
  while (h1.vertex().point()!=Point_3(1,0,0)):
    h1=h1.next()
  h2=h2.opposite()
  while (h2.vertex().point()!=Point_3(0,0,0)):
    h2=h2.next()
  hpairs = []
  hpairs.append( Halfedge_pair(h1,h2) )
  CGAL_Polygon_mesh_processing.stitch_borders(P, hpairs)

# polygon_soup_to_polygon_mesh
  P = Polyhedron_3()
  points = Point_3_Vector()
  points.reserve(3)
  points.append( Point_3(0,0,0) )
  points.append( Point_3(0,1,0) )
  points.append( Point_3(1,0,0) )
  polygons = Polygon_Vector()
  polygon = Int_Vector()
  polygon.reserve(3)
  polygon.append(0)
  polygon.append(1)
  polygon.append(2)
  polygons.append(polygon)
  CGAL_Polygon_mesh_processing.polygon_soup_to_polygon_mesh(points, polygons, P)
  assert(P.size_of_vertices()==3)

# remove_isolated_vertices (4.8)
  CGAL_Polygon_mesh_processing.remove_isolated_vertices(P)