trimesh.curvature module

curvature.py

Query mesh curvature.

Functions

discrete_gaussian_curvature_measure(mesh, …)

Return the discrete gaussian curvature measure of a sphere centered at a point as detailed in ‘Restricted Delaunay triangulations and normal cycle’, Cohen-Steiner and Morvan.

discrete_mean_curvature_measure(mesh, …)

Return the discrete mean curvature measure of a sphere centered at a point as detailed in ‘Restricted Delaunay triangulations and normal cycle’, Cohen-Steiner and Morvan.

face_angles_sparse(mesh)

A sparse matrix representation of the face angles.

line_ball_intersection(start_points, …)

Compute the length of the intersection of a line segment with a ball.

sphere_ball_intersection(R, r)

Compute the surface area of the intersection of sphere of radius R centered at (0, 0, 0) with a ball of radius r centered at (R, 0, 0).

vertex_defects(mesh)

Return the vertex defects, or (2*pi) minus the sum of the angles of every face that includes that vertex.

trimesh.curvature.discrete_gaussian_curvature_measure(mesh, points, radius)

Return the discrete gaussian curvature measure of a sphere centered at a point as detailed in ‘Restricted Delaunay triangulations and normal cycle’, Cohen-Steiner and Morvan.

Parameters
  • points ((n,3) float, list of points in space) –

  • radius (float, the sphere radius) –

Returns

gaussian_curvature

Return type

(n,) float, discrete gaussian curvature measure.

trimesh.curvature.discrete_mean_curvature_measure(mesh, points, radius)

Return the discrete mean curvature measure of a sphere centered at a point as detailed in ‘Restricted Delaunay triangulations and normal cycle’, Cohen-Steiner and Morvan.

Parameters
  • points ((n,3) float, list of points in space) –

  • radius (float, the sphere radius) –

Returns

mean_curvature

Return type

(n,) float, discrete mean curvature measure.

trimesh.curvature.face_angles_sparse(mesh)

A sparse matrix representation of the face angles.

Returns

sparse – dtype: float shape: (len(mesh.vertices), len(mesh.faces))

Return type

scipy.sparse.coo_matrix with:

trimesh.curvature.line_ball_intersection(start_points, end_points, center, radius)

Compute the length of the intersection of a line segment with a ball.

Parameters
  • start_points ((n,3) float, list of points in space) –

  • end_points ((n,3) float, list of points in space) –

  • center ((3,) float, the sphere center) –

  • radius (float, the sphere radius) –

Returns

lengths

Return type

(n,) float, the lengths.

trimesh.curvature.sphere_ball_intersection(R, r)

Compute the surface area of the intersection of sphere of radius R centered at (0, 0, 0) with a ball of radius r centered at (R, 0, 0).

Parameters
  • R (float, sphere radius) –

  • r (float, ball radius) –

Returns

area

Return type

float, the surface are.

trimesh.curvature.vertex_defects(mesh)

Return the vertex defects, or (2*pi) minus the sum of the angles of every face that includes that vertex.

If a vertex is only included by coplanar triangles, this will be zero. For convex regions this is positive, and concave negative.

Returns

vertex_defect – Vertex defect at the every vertex

Return type

(len(self.vertices), ) float