-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvisualization.py
44 lines (35 loc) · 956 Bytes
/
visualization.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
import polyscope as ps
import openmesh as om
import argparse
from implementation import *
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--file", type=str, default="Meshes/Geometry/cube.off", help="Nombre del archivo")
parser.add_argument("--iter", type=int, default=1, help="Numero de iteraciones")
args = parser.parse_args()
filename = args.file
iterations = args.iter
mesh = om.read_polymesh(filename)
new_mesh = catmull_clark_iter(mesh, iterations)
ps.init()
_ = ps.register_surface_mesh(
"mesh_original",
mesh.points(),
mesh.face_vertex_indices(),
transparency=0.5,
enabled=False
)
_ = ps.register_point_cloud(
"point_cloud",
new_mesh.points(),
radius=0.01,
enabled=False
)
_ = ps.register_surface_mesh(
"new_mesh",
new_mesh.points(),
new_mesh.face_vertex_indices(),
edge_width=1,
)
ps.show()
if __name__ == "__main__": main()