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