Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed point welding bug in map_mesh function.
- Changed example_isolines to work with the new compas_viewer.
- GA for cibuildwheel, bring back the tessagon test.
- Fixed planarize method to handle triangles.

### Removed

Expand Down
18 changes: 16 additions & 2 deletions src/compas_libigl/planarize.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,24 @@ def quadmesh_planarize(M, kmax=500, maxdev=0.005):

Notes
-----
The input mesh should consist primarily of quad faces for best results.
Non-quad faces may produce unexpected results.
The input mesh should consist of quad and triangle faces, else ValueError is raised.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add

"""
...

Raises
------
ValueError
    If the mesh contains faces with more than 4 vertices.
"""

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected in the push below.



Raises
-----
ValueError
If the input mesh contains faces other than quads or triangles.

"""

V, F = M

for f in F:
if len(f) == 3:
f.append(f[0])
elif len(f) != 4:
raise ValueError("All faces must be quads for planarization.")

V = np.asarray(V, dtype=np.float64)
F = np.asarray(F, dtype=np.int32)
return _planarize.planarize_quads(V, F, kmax, maxdev)
Loading