Skip to content

Commit

Permalink
Merge pull request #2228 from lucagrementieri/main
Browse files Browse the repository at this point in the history
more flexible facet computation
  • Loading branch information
mikedh authored May 14, 2024
2 parents 371e4b9 + fb330b3 commit 8e9bf9e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions trimesh/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,16 +281,18 @@ def shared_edges(faces_a, faces_b):
return shared


def facets(mesh, engine=None):
def facets(mesh, engine=None, facet_threshold=tol.facet_threshold):
"""
Find the list of parallel adjacent faces.
Parameters
-----------
mesh : trimesh.Trimesh
mesh : trimesh.Trimesh
engine : str
Which graph engine to use:
('scipy', 'networkx')
Which graph engine to use:
('scipy', 'networkx')
facet_threshold : float
Threshold for two facets to be considered coplanar
Returns
---------
Expand All @@ -314,7 +316,7 @@ def facets(mesh, engine=None):
# if span is zero we know faces are small/parallel
nonzero = np.abs(span) > tol.zero
# faces with a radii/span ratio larger than a threshold pass
parallel[nonzero] = (radii[nonzero] / span[nonzero]) ** 2 > tol.facet_threshold
parallel[nonzero] = (radii[nonzero] / span[nonzero]) ** 2 > facet_threshold

# run connected components on the parallel faces to group them
components = connected_components(
Expand Down

0 comments on commit 8e9bf9e

Please sign in to comment.