-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathdemo.py
More file actions
32 lines (24 loc) · 1.5 KB
/
demo.py
File metadata and controls
32 lines (24 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from pycompod import VertexGroup, PolyhedralComplex
# model = "sphere"
# file = "data/{}/convexes_refined/sphere-100K_planar_primitives_detection.vg".format(model)
model = "bunny"
file = "./data/{}/convexes_refined/file.npz".format(model)
vg = VertexGroup(file,verbosity=20,debug_export=True)
cc = PolyhedralComplex(vg,device='gpu',verbosity=20)
cc.construct_partition()
cc.add_bounding_box_planes()
cc.label_partition(mode="normals", regularization={"area": 0.8})
# ## needs compose extension
# cc.label_partition(mode="mesh",mesh_file="data/{}/surface/dense_mesh.off".format(model))
cc.simplify_partition_tree_based()
cc.save_partition("data/{}/partition/tree_simplified_partition.ply".format(model), export_boundary=True)
cc.save_partition_to_pickle("data/{}/partition".format(model))
cc.save_in_cells(out_file="data/{}/volumes/volume_mesh.ply".format(model))
cc.save_surface(out_file="data/{}/surface/complex_mesh.ply".format(model), triangulate=False)
# ## needs compose extension
# cc.save_simplified_surface(out_file="data/{}/surface/polygon_mesh.obj".format(model), triangulate=False, backend="wavefront")
# cc.save_simplified_surface(out_file="data/{}/surface/triangle_mesh.ply".format(model), triangulate=True)
# cc.save_wireframe(out_file="data/{}/surface/wireframe.obj".format(model))
# simplify with cell intersections allowed
cc.simplify_partition_graph_based(exact=False, only_inside=True, rtol=0.01, atol=0.001, dtol=0.00001)
cc.save_in_cells(out_file="data/{}/volumes/volume_mesh_simplified.ply".format(model))