Skip to content

The heat method for distance computation

Given a surface mesh, the heat method solves a heat diffusion problem to compute geodesic distances to prescribed source points.

Usage

heat_solver = M.processing.HeatMethodDistance(mesh)
distance = heat_solver.get_distance(source_points_list)

See a full example here.

The distance from a point on the stanford bunny, computed using the heat method

The distance from a point on the stanford bunny, computed using the heat method

HeatMethodDistance(mesh, save_on_mesh=True, diffuse_coeff=1.0, verbose=False, **kwargs)

Bases: Logger

Computation of distances from a set of points on a surface mesh, using the heat method.

References

[1] The Heat Method for Distance Computation, Crane et al. (2017)

Example

https://github.com/GCoiffier/mouette/blob/main/examples/heat_method_distance.py

Parameters:

Name Type Description Default
mesh SurfaceMesh

The input surface mesh

required
diffuse_coeff float

Coefficient used in the diffusion computation of the heat. Higher coefficient leads to more regular but less precise results. This coefficient is multiplied by the mean edge length squared to account for global scaling. Defaults to 1.

1.0
verbose bool

verbose output. Defaults to False.

False

Other Parameters:

Name Type Description
custom_connection SurfaceConnectionFaces

custom local bases provided to the solver. If not provided, bases will be computed automatically. Defaults to None.

Attributes:

Name Type Description
conn SurfaceConnectionFaces

the local bases used to compute gradients and differential operators

Raises:

Type Description
AssertionError

Fails if the input mesh is not triangular

get_distance(source_points, return_gradients=False)

Runs the heat method solve to compute distances to points given.

Parameters:

Name Type Description Default
source_points list

a list of points for which the distance will be zero.

required
return_gradients bool

whether to also return gradients per face. Defaults to False.

False

Returns:

Type Description
ndarray

np.ndarray: a array of size |V| containing the distance to the source points for each vertex. If return_gradients is True, will also return the gradients as a complex value per face.

get_distance_to_boundary(return_gradients=False)

Computes the distance to the boundary for each vertex of the mesh. A shortcut for get_distance(mesh.boundary_vertices)

Parameters:

Name Type Description Default
return_gradients bool

whether to also return gradients per face. Defaults to False.

False

Raises:

Type Description
Exception

Fails if the mesh has no boundary

Returns:

Type Description
ndarray

np.ndarray: a array of size |V| containing the distance to the source points for each vertex. If return_gradients is True, will also return the gradients as a complex value per face.