Lagrange
Loading...
Searching...
No Matches
SmoothedMeshGradientField Class Reference

A world-space direction field obtained by Gaussian-filtering a winding-number signed distance field and differentiating the filtered scalar field. More...

#include <lagrange/volume/SmoothedMeshGradientField.h>

Public Types

using Grid = openvdb::Vec3SGrid
 
using Accessor = Grid::ConstAccessor
 

Public Member Functions

template<typename Scalar, typename Index>
 SmoothedMeshGradientField (const SurfaceMesh< Scalar, Index > &mesh, double voxel_size, double epsilon, double query_reach)
 Construct a smoothed gradient field for a triangle surface mesh.
 
Grid::ConstPtr grid () const
 Return a read-only shared handle to the underlying OpenVDB grid.
 
Accessor accessor () const
 Return a read-only accessor to the underlying OpenVDB grid.
 
bool sample_direction (const Eigen::Vector3d &position, Eigen::Vector3d &direction_out, Accessor *accessor=nullptr) const
 Sample and normalize the gradient at a world-space point.
 

Detailed Description

A world-space direction field obtained by Gaussian-filtering a winding-number signed distance field and differentiating the filtered scalar field.

Constructor & Destructor Documentation

◆ SmoothedMeshGradientField()

template<typename Scalar, typename Index>
SmoothedMeshGradientField ( const SurfaceMesh< Scalar, Index > & mesh,
double voxel_size,
double epsilon,
double query_reach )

Construct a smoothed gradient field for a triangle surface mesh.

Parameters
[in]meshInput mesh. Its winding-number sign defines the SDF interior.
[in]voxel_sizeGrid voxel size in world units; must be positive.
[in]epsilonGaussian smoothing scale in world units; must be positive.
[in]query_reachMaximum expected query distance from the surface in world units.
Template Parameters
ScalarMesh scalar type.
IndexMesh index type.

Member Function Documentation

◆ sample_direction()

bool sample_direction ( const Eigen::Vector3d & position,
Eigen::Vector3d & direction_out,
Accessor * accessor = nullptr ) const

Sample and normalize the gradient at a world-space point.

Parameters
[in]positionQuery position.
[out]direction_outOutward unit direction when sampling succeeds.
[in]accessorOptional grid accessor to cache repeated queries (one per thread).
Returns
True for a finite, non-degenerate in-band gradient; false when the caller should use an analytic fallback.

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