Easy3D 2.5.3
SurfaceMeshGeodesic Class Reference

This class computes geodesic distance from a set of seed vertices. More...

#include <easy3d/algo/surface_mesh_geodesic.h>

Public Member Functions

 SurfaceMeshGeodesic (SurfaceMesh *mesh, bool use_virtual_edges=true)
 Construct from mesh. More...
 
unsigned int compute (const std::vector< SurfaceMesh::Vertex > &seed, float max_dist=FLT_MAX, unsigned int max_num=INT_MAX, std::vector< SurfaceMesh::Vertex > *neighbors=nullptr)
 Compute geodesic distances from specified seed points. More...
 
float operator() (SurfaceMesh::Vertex v) const
 Access the computed geodesic distance. More...
 
void distance_to_texture_coordinates ()
 Use the normalized distances as texture coordinates. More...
 

Detailed Description

This class computes geodesic distance from a set of seed vertices.

The method works by a Dykstra-like breadth first traversal from the seed vertices, implemented by a heap structure. See the following paper for more details:

  • Kimmel and Sethian. Computing geodesic paths on manifolds. Proceedings of the National Academy of Sciences, 95(15):8431–8435, 1998.

Constructor & Destructor Documentation

◆ SurfaceMeshGeodesic()

SurfaceMeshGeodesic ( SurfaceMesh mesh,
bool  use_virtual_edges = true 
)
explicit

Construct from mesh.

Parameters
meshThe mesh on which to compute the geodesic distances.
use_virtual_edgesA flag to control the use of virtual edges. Default: true.
See also
compute() to actually compute the geodesic distances.

Member Function Documentation

◆ compute()

unsigned int compute ( const std::vector< SurfaceMesh::Vertex > &  seed,
float  max_dist = FLT_MAX,
unsigned int  max_num = INT_MAX,
std::vector< SurfaceMesh::Vertex > *  neighbors = nullptr 
)

Compute geodesic distances from specified seed points.

The results are store as SurfaceMesh::VertexProperty<float> with a name "v:geodesic:distance".

Parameters
[in]seedThe vector of seed vertices.
[in]max_distThe maximum distance up to which to compute the geodesic distances.
[in]max_numThe maximum number of neighbors up to which to compute the geodesic distances.
[out]neighborsThe vector of neighbor vertices.
Returns
The number of neighbors that have been found.

◆ distance_to_texture_coordinates()

void distance_to_texture_coordinates ( )

Use the normalized distances as texture coordinates.

Stores the normalized distances in a vertex property of type TexCoord named "v:tex". Re-uses any existing vertex property of the same type and name.

◆ operator()()

float operator() ( SurfaceMesh::Vertex  v) const
inline

Access the computed geodesic distance.

Parameters
[in]vThe vertex for which to return the geodesic distance.
Returns
The geodesic distance of vertex v.
Precondition
The function compute() has been called before.
The vertex v needs to be a valid vertex handle of the mesh used during construction.

The documentation for this class was generated from the following files: