From 73fba9e9e57bf8ea9c89a5305b6bcc61865e00cd Mon Sep 17 00:00:00 2001 From: David Coeurjolly Date: Tue, 2 Feb 2021 16:22:04 +0100 Subject: [PATCH] test GEL --- 3-modeling/python/testPyGEL.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 3-modeling/python/testPyGEL.py diff --git a/3-modeling/python/testPyGEL.py b/3-modeling/python/testPyGEL.py new file mode 100644 index 0000000..f2eea30 --- /dev/null +++ b/3-modeling/python/testPyGEL.py @@ -0,0 +1,31 @@ +import polyscope +import numpy as np +from pygel3d import hmesh + +m = hmesh.load("../cube.obj") +print(m.positions()) + +faces = m.faces() + +## Old school +allfaces=[] +for f in faces: + face=[] + for v in m.circulate_face(f): + face.append(v) + allfaces = allfaces + [face] + +## Fancy version +allfaces2 = [[v for v in m.circulate_face(f)] for f in faces] + +polyscope.init() + +#Display the vertices as point cloud +polyscope.register_point_cloud("data", m.positions()) + +#Display the vertices as mesh +polyscope.register_surface_mesh("data mesh", m.positions(), allfaces) +#Display the vertices as mesh +polyscope.register_surface_mesh("data mesh2", m.positions(), allfaces2) + +polyscope.show()