Skip to content

Commit bde39d1

Browse files
FIX planaraize method to handle triangles.
1 parent 12987e9 commit bde39d1

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/compas_libigl/planarize.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,17 @@ def quadmesh_planarize(M, kmax=500, maxdev=0.005):
3030
3131
Notes
3232
-----
33-
The input mesh should consist primarily of quad faces for best results.
34-
Non-quad faces may produce unexpected results.
33+
The input mesh should consist of quad and triangle faces, else ValueError is raised.
3534
"""
35+
3636
V, F = M
37+
38+
for f in F:
39+
if len(f) == 3:
40+
f.append(f[0])
41+
elif len(f) != 4:
42+
raise ValueError("All faces must be quads for planarization.")
43+
3744
V = np.asarray(V, dtype=np.float64)
3845
F = np.asarray(F, dtype=np.int32)
3946
return _planarize.planarize_quads(V, F, kmax, maxdev)

0 commit comments

Comments
 (0)