NetDEM v1.0
Loading...
Searching...
No Matches
netdem::SDFCalculator Class Reference

Class for computing signed distance fields from triangle meshes. More...

#include <sdf_calculator.hpp>

Public Member Functions

 SDFCalculator ()
 Default constructor.
 
void InitFromSTL (const VecXT< Vec3d > &vv, const VecXT< Vec3i > &ff)
 Initialize from a set of vertices and faces.
 
void InitFromSTL (STLModel const &stl_model)
 Initialize from an STL model.
 
void Init ()
 Initialize the SDFCalculator.
 
double SignedDistance (Vec3d const &pos) const
 Compute the signed distance at a point in space.
 
Vec3d SurfacePoint (Vec3d const &pos) const
 Find the surface point on the mesh closest to a given point.
 
int ClosestFacet (Vec3d const &pos) const
 Find the closest facet on the mesh to a given point.
 

Detailed Description

Class for computing signed distance fields from triangle meshes.

This class provides methods for computing signed distance fields (SDFs) from triangle meshes. It can be initialized from a set of vertices and faces or from an STLModel object, and can then be used to compute the signed distance at arbitrary points in space, find the closest facet to a point, and compute the surface point on the mesh closest to a given point.

Constructor & Destructor Documentation

◆ SDFCalculator()

netdem::SDFCalculator::SDFCalculator ( )

Default constructor.

This creates an empty SDFCalculator; it must be initialized before it can be used to compute signed distances.

Member Function Documentation

◆ ClosestFacet()

int netdem::SDFCalculator::ClosestFacet ( Vec3d const & pos) const

Find the closest facet on the mesh to a given point.

This method finds the closest facet on the mesh to a given point in space.

Parameters
posThe point for which to find the closest facet.
Returns
The index of the closest facet on the mesh.

◆ Init()

void netdem::SDFCalculator::Init ( )

Initialize the SDFCalculator.

This method initializes the SDFCalculator with an empty mesh and sets the maximum distance to 0. It is called automatically by the default constructor and can also be called after calling InitFromSTL to reset the SDFCalculator to an empty state.

◆ InitFromSTL() [1/2]

void netdem::SDFCalculator::InitFromSTL ( const VecXT< Vec3d > & vv,
const VecXT< Vec3i > & ff )

Initialize from a set of vertices and faces.

This method initializes the SDFCalculator from a set of vertices and faces. It builds the AABB tree used to accelerate the computation of signed distances.

Parameters
vvThe vertices of the mesh.
ffThe faces of the mesh.

◆ InitFromSTL() [2/2]

void netdem::SDFCalculator::InitFromSTL ( STLModel const & stl_model)

Initialize from an STL model.

This method initializes the SDFCalculator from an STL model object. It builds the AABB tree used to accelerate the computation of signed distances.

Parameters
stl_modelThe STL model object containing the mesh.

◆ SignedDistance()

double netdem::SDFCalculator::SignedDistance ( Vec3d const & pos) const

Compute the signed distance at a point in space.

This method computes the signed distance at a given point in space using the AABB tree built from the mesh. The sign of the distance indicates whether the point is inside or outside the mesh.

Parameters
posThe point at which to compute the signed distance.
Returns
The signed distance between the point and the mesh.

◆ SurfacePoint()

Vec3d netdem::SDFCalculator::SurfacePoint ( Vec3d const & pos) const

Find the surface point on the mesh closest to a given point.

This method finds the surface point on the mesh that is closest to a given point in space.

Parameters
posThe point for which to find the closest surface point.
Returns
The closest surface point on the mesh.

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