/
trimesh_geodistance.py
44 lines (32 loc) · 1.19 KB
/
trimesh_geodistance.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from compas.plugins import pluggable
@pluggable(category="trimesh")
def trimesh_geodistance(M, source, method="exact"):
"""Compute the geodesic distance from every vertex of the mesh to a source vertex.
Parameters
----------
M : tuple[sequence[[float, float, float] | :class:`compas.geometry.Point`], sequence[[int, int, int]]]
A mesh represented by a list of vertices and a list of faces.
source : int
The index of the vertex from where the geodesic distances should be calculated.
method : Literal['exact', 'heat'], optional
The method for calculating the distances.
Returns
-------
list[float]
A list of geodesic distances from the source vertex.
Raises
------
NotImplementedError
If `method` is not one of ``{'exact', 'heat'}``.
Examples
--------
>>>
"""
from .trimesh_geodistance_numpy import trimesh_geodesic_distances_numpy
if method == "exact":
raise NotImplementedError
return trimesh_geodesic_distances_numpy(M, [source])
trimesh_geodistance.__pluggable__ = True