OpenVDB 13.0.1
Loading...
Searching...
No Matches
PolySoupToLevelSet< GridType > Class Template Reference

Class that implements the actual shrink wrap algorithm. More...

#include <openvdb/tools/PolySoupToLevelSet.h>

Public Member Functions

 PolySoupToLevelSet (PolySoup &&poly, int dim, float width=float(LEVEL_SET_HALF_WIDTH))
 Constructor from a desired voxel dimension.
 PolySoupToLevelSet (PolySoup &&poly, float voxelSize, float width=float(LEVEL_SET_HALF_WIDTH))
 Constructor from a desired voxel size.
template<class ShrinkWrapT, class ProgressT>
void process (const ShrinkWrapT &D, ProgressT *progress, int mode=0)
 Performs the actual processing to generate the shrink wrap surfaces.
size_t gridCount () const
 Number of shrink wrap grids generated, i.e. depth of the LOD hierarchy.
GridType::Ptr grid (int n=0) const
 Returns a shared pointer to a particular shrink wrap grid.
std::vector< typename GridType::Ptr > grids () const
 Vector with shared pointers to all the shrink wrap grids.
const PolySoupmesh (int n=0, float adaptivity=0.005f, float isoValue=0.0f)
 Generate an adaptive polygon mesh from a particular shrink wrap SDF.
auto offset (float dx, int mode=0)
 Generates a dx-offset level set surface from the internal polygon soup.
float minVoxelSize () const
 Returns the finest/smallest voxel size, in world units, i.e. the voxel size of the final (highest-resolution) level set surface.
float maxVoxelSize () const
 Returns the coarsest/largest voxel size, in world units, used to initiate the coarse-to-fine shrink wrap algorithm.
float halfWidth () const
 Returns the half-width of the output narrow-band level set, in voxel units.

Static Public Member Functions

static math::BBox< Vec3fgetBBox (const std::vector< Vec3s > &vtx)
 Static method that computes the bounding box of a list of vertex coordinates.

Detailed Description

template<typename GridType>
class openvdb::v13_0::tools::PolySoupToLevelSet< GridType >

Class that implements the actual shrink wrap algorithm.

This class implements our shrink wrap algorithm. Normally the free-standing function called above should be used instead of this class.

Template Parameters
GridTypeTemplate parameter of the desired shrink wrap grids
GridTypeGrid type of the generated level set surfaces (defaults to FloatGrid)

Constructor & Destructor Documentation

◆ PolySoupToLevelSet() [1/2]

template<typename GridType>
PolySoupToLevelSet ( PolySoup && poly,
int dim,
float width = float(LEVEL_SET_HALF_WIDTH) )

Constructor from a desired voxel dimension.

Parameters
polyPolygon soup that will be moved to this instance.
dimDesired voxel dimension of the output level set.
widthHalf-width of the output narrow-band level set, in voxel units.

◆ PolySoupToLevelSet() [2/2]

template<typename GridType>
PolySoupToLevelSet ( PolySoup && poly,
float voxelSize,
float width = float(LEVEL_SET_HALF_WIDTH) )

Constructor from a desired voxel size.

Parameters
polyPolygon soup that will be moved to this instance.
voxelSizeDesired voxel size of the output level set in world units.
widthHalf-width of the output narrow-band level set, in voxel units.

Member Function Documentation

◆ getBBox()

template<typename GridType>
math::BBox< Vec3f > getBBox ( const std::vector< Vec3s > & vtx)
static

Static method that computes the bounding box of a list of vertex coordinates.

Parameters
vtxVector of vertex coordinates.

◆ grid()

template<typename GridType>
GridType::Ptr grid ( int n = 0) const
inline

Returns a shared pointer to a particular shrink wrap grid.

Parameters
nNumber of the shrink wrap grid, where n = 0 has the finest sampling and n = gridCount-1 is the coarsest voxel sampling.

◆ gridCount()

template<typename GridType>
size_t gridCount ( ) const
inline

Number of shrink wrap grids generated, i.e. depth of the LOD hierarchy.

◆ grids()

template<typename GridType>
std::vector< typename GridType::Ptr > grids ( ) const
inline

Vector with shared pointers to all the shrink wrap grids.

Note
The grids are arranged fine to coarse, grids()[0] is the finest.

◆ halfWidth()

template<typename GridType>
float halfWidth ( ) const
inline

Returns the half-width of the output narrow-band level set, in voxel units.

◆ maxVoxelSize()

template<typename GridType>
float maxVoxelSize ( ) const
inline

Returns the coarsest/largest voxel size, in world units, used to initiate the coarse-to-fine shrink wrap algorithm.

◆ mesh()

template<typename GridType>
const PolySoup & mesh ( int n = 0,
float adaptivity = 0.005f,
float isoValue = 0.0f )
inline

Generate an adaptive polygon mesh from a particular shrink wrap SDF.

Parameters
nNumber of the shrink wrap grid, where n = 0 has the finest sampling and n = gridCount-1 is the coarsest voxel sampling.
adaptivityOptional adaptivity parameter used for meshing. A value of zero means adaptivity is disabled, i.e. uniform quads are produced.
isoValueIso-value used for the mesh generation.
Returns
Reference to the internal PolySoup populated with the generated mesh.

◆ minVoxelSize()

template<typename GridType>
float minVoxelSize ( ) const
inline

Returns the finest/smallest voxel size, in world units, i.e. the voxel size of the final (highest-resolution) level set surface.

◆ offset()

template<typename GridType>
auto offset ( float dx,
int mode = 0 )

Generates a dx-offset level set surface from the internal polygon soup.

Parameters
dxVoxel size (world units) of the output level set.
mode0) old method (using mesh -> UDF -> mesh -> SDF), 1) Mihai's signed-flood-fill and 2) Greg's createLevelSetDilatedMesh
Returns
Shared pointer to the newly created level set grid.

◆ process()

template<typename GridType>
template<class ShrinkWrapT, class ProgressT>
void process ( const ShrinkWrapT & D,
ProgressT * progress,
int mode = 0 )

Performs the actual processing to generate the shrink wrap surfaces.

Template Parameters
ShrinkWrapTOptional template parameter of the functor controlling the number of constrained erosion steps (see our paper).
ProgressTTemplate parameter of the optional progress bar.
Parameters
DOptional functor controlling the number of constrained erosion steps and the closing threshold (see our paper).
progressOptional pointer to a progress bar.
modeEXPERIMENTAL parameter that will be removed in the near future. It should only be used by experts!