NetDEM v1.0
|
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. | |
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.
netdem::SDFCalculator::SDFCalculator | ( | ) |
Default constructor.
This creates an empty SDFCalculator; it must be initialized before it can be used to compute signed distances.
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.
pos | The point for which to find the closest facet. |
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.
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.
vv | The vertices of the mesh. |
ff | The faces of the mesh. |
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.
stl_model | The STL model object containing the mesh. |
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.
pos | The point at which to compute the signed distance. |
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.
pos | The point for which to find the closest surface point. |