Skip to content

Updated integral_mean_curvature function #2416

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 11, 2025
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
added face_adjacency_angles_with_sign and corrected integral_mean_cur…
…vature
  • Loading branch information
yajushikhurana committed Jun 10, 2025
commit 30ff9c053796f0e67e07efc595a21c80043cc066
17 changes: 16 additions & 1 deletion trimesh/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1437,6 +1437,21 @@ def face_adjacency_angles(self) -> NDArray[float64]:
# find the angle between the pairs of vectors
angles = geometry.vector_angle(pairs)
return angles

@cache_decorator
def face_adjacency_angles_with_sign(self) -> NDArray[float64]:
"""
Return the signed angle between adjacent faces

Returns
--------
adjacency_angle : (n, ) float
Angle between adjacent faces
Each value corresponds with self.face_adjacency
"""
# find the angle between the pairs of vectors
angles = geometry.vector_angle_with_sign(self)
return angles

@cache_decorator
def face_adjacency_projections(self) -> NDArray[float64]:
Expand Down Expand Up @@ -1523,7 +1538,7 @@ def integral_mean_curvature(self) -> float64:
edges_length = np.linalg.norm(
np.subtract(*self.vertices[self.face_adjacency_edges.T]), axis=1
)
return (self.face_adjacency_angles * edges_length).sum() * 0.5
return (self.face_adjacency_angles_with_sign * edges_length).sum() * 0.5

@cache_decorator
def vertex_adjacency_graph(self) -> Graph:
Expand Down