# trimesh.curvature#

## curvature.py#

Query mesh curvature.

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.

This is the sum of the vertex defects at all vertices within the radius for each point.

Parameters:
• points ((n, 3) float) – Points in space

• radius (float ,) – The sphere radius, which can be zero if vertices passed are points.

Returns:

gaussian_curvature – Discrete gaussian curvature measure.

Return type:

(n,) float

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.

This is the sum of the angle at all edges contained in the sphere for each point.

Parameters:
• points ((n, 3) float) – Points in space

• radius (float) – Sphere radius which should typically be greater than zero

Returns:

mean_curvature – Discrete mean curvature measure.

Return type:

(n,) float

trimesh.curvature.face_angles_sparse(mesh)#

A sparse matrix representation of the face angles.

Returns:

sparse – matrix is float shaped (len(vertices), len(faces))

Return type:

scipy.sparse.coo_matrix

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) –

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