OpenVDB  7.1.0
Classes | Public Member Functions | List of all members
FastSweeping< SdfGridT, ExtValueT > Class Template Reference

Computes signed distance values from an initial iso-surface and optionally performs velocty extension at the same time. This is done by means of a novel sparse and parallel fast sweeping algorithm based on a first order Goudonov's scheme. More...

#include <FastSweeping.h>

Classes

struct  DilateKernel
 Private class of FastSweeping to perform multi-threaded initialization. More...
 
struct  InitSdf
 
struct  MinMaxKernel
 
struct  SweepingKernel
 Private class of FastSweeping to perform concurrent fast sweeping in two directions. More...
 

Public Member Functions

 FastSweeping ()
 Constructor. More...
 
 ~FastSweeping ()
 Destructor. More...
 
 FastSweeping (const FastSweeping &)=delete
 Disallow copy construction. More...
 
FastSweepingoperator= (const FastSweeping &)=delete
 Disallow copy assignment. More...
 
SdfGridT::Ptr sdfGrid ()
 Returns a shared pointer to the signed distance field computed by this class. More...
 
ExtGridT::Ptr extGrid ()
 Returns a shared pointer to the extension field computed by this class. More...
 
bool initSdf (const SdfGridT &sdfGrid, SdfValueT isoValue, bool isInputSdf)
 Initializer for input grids that are either a signed distance field or a scalar fog volume. More...
 
template<typename ExtOpT >
bool initExt (const SdfGridT &sdfGrid, const ExtOpT &op, const ExtValueT &background, SdfValueT isoValue, bool isInputSdf)
 Initializer used whenever velocity extension is performed in addition to the computation of signed distance fields. More...
 
bool initDilate (const SdfGridT &sdfGrid, int dilation, NearestNeighbors nn=NN_FACE)
 Initializer used when dilating an exsiting signed distance field. More...
 
template<typename MaskTreeT >
bool initMask (const SdfGridT &sdfGrid, const Grid< MaskTreeT > &mask, bool ignoreActiveTiles=false)
 Initializer used for the extamnsion of an exsiting signed distance field into the active values of an input mask of arbitrary value type. More...
 
void sweep (int nIter=1, bool finalize=true)
 Perform nIter iterations of the fast sweeping algorithm. More...
 
void clear ()
 Clears all the grids and counters so initializtion can be called again. More...
 
size_t sweepingVoxelCount () const
 Return the number of voxels that will be solved for. More...
 
size_t boundaryVoxelCount () const
 Return the number of voxels that defined the boundary condition. More...
 
bool isValid () const
 Return true if there are voxels and boundaries to solve for. More...
 
template<typename OpT >
bool initExt (const SdfGridT &fogGrid, const OpT &op, const ExtValueT &background, SdfValueT isoValue, bool isInputSdf)
 

Detailed Description

template<typename SdfGridT, typename ExtValueT = typename SdfGridT::ValueType>
class openvdb::v7_1::tools::FastSweeping< SdfGridT, ExtValueT >

Computes signed distance values from an initial iso-surface and optionally performs velocty extension at the same time. This is done by means of a novel sparse and parallel fast sweeping algorithm based on a first order Goudonov's scheme.

Solves: $|\nabla \phi|^2 = 1 $

Warning
Note, it is important to call one of the initialization methods before called the sweep function. Failure to do so will throw a RuntimeError. Consider instead call one of the many higher-level free-standing functions defined above!

Constructor & Destructor Documentation

Constructor.

~FastSweeping ( )
inline

Destructor.

FastSweeping ( const FastSweeping< SdfGridT, ExtValueT > &  )
delete

Disallow copy construction.

Member Function Documentation

size_t boundaryVoxelCount ( ) const
inline

Return the number of voxels that defined the boundary condition.

void clear ( )

Clears all the grids and counters so initializtion can be called again.

ExtGridT::Ptr extGrid ( )
inline

Returns a shared pointer to the extension field computed by this class.

Warning
This shared pointer might point to NULL if the grid has not been initialize (by one of the init methods) or computed (by the sweep method).
bool initDilate ( const SdfGridT &  sdfGrid,
int  dilation,
NearestNeighbors  nn = NN_FACE 
)

Initializer used when dilating an exsiting signed distance field.

Returns
True if the initialization succeeded.
Parameters
sdfGridInput signed distance field to to be dilated.
dilationNumer of voxels that the input SDF will be dilated.
nnStencil-pattern used for dilation

This, or any of ther other initilization methods, should be called before any call to sweep(). Failure to do so will throw a RuntimeError.

Warning
Note, if this method fails, i.e. returns false, a subsequent call to sweep will trow a RuntimeError. Instead call clear and try again.
bool initExt ( const SdfGridT &  sdfGrid,
const ExtOpT &  op,
const ExtValueT &  background,
SdfValueT  isoValue,
bool  isInputSdf 
)

Initializer used whenever velocity extension is performed in addition to the computation of signed distance fields.

Returns
True if the initialization succeeded.
Parameters
sdfGridInput scalar grid that represents an existing signed distance field or a fog volume (signified by isInputSdf).
opFunctor with signature [](const Vec3R &xyz)->ExtValueT that defines the Dirichlet boundary condition, on the iso-surface, of the field to be extended. Strictly the return type of this functor is only required to be convertible to ExtValueT!
backgroundBackground value of return grid with the extension field.
isoValueIso-value to be used for the boundary condition of the fast sweeping algorithm (typically 0 for sdfs and a positive value for fog volumes).
isInputSdfUsed to determine if sdfGrid is a sigend distance field (true) or a scalar fog volume (false).

This, or any of ther other initilization methods, should be called before any call to sweep(). Failure to do so will throw a RuntimeError.

Warning
Note, if this method fails, i.e. returns false, a subsequent call to sweep will trow a RuntimeError. Instead call clear and try again.
bool initExt ( const SdfGridT &  fogGrid,
const OpT &  op,
const ExtValueT &  background,
SdfValueT  isoValue,
bool  isInputSdf 
)
bool initMask ( const SdfGridT &  sdfGrid,
const Grid< MaskTreeT > &  mask,
bool  ignoreActiveTiles = false 
)

Initializer used for the extamnsion of an exsiting signed distance field into the active values of an input mask of arbitrary value type.

Returns
True if the initialization succeeded.
Parameters
sdfGridInput signed distance field to be extended into the mask.
maskMask used to idetify the topology of the output SDF. Note this mask is assume to overlap with the sdfGrid.
ignoreActiveTilesIf false, active tiles in the mask are treated as active voxels. Else they are ignored.

This, or any of ther other initilization methods, should be called before any call to sweep(). Failure to do so will throw a RuntimeError.

Warning
Note, if this method fails, i.e. returns false, a subsequent call to sweep will trow a RuntimeError. Instead call clear and try again.
bool initSdf ( const SdfGridT &  sdfGrid,
SdfValueT  isoValue,
bool  isInputSdf 
)

Initializer for input grids that are either a signed distance field or a scalar fog volume.

Returns
True if the initialization succeeded.
Parameters
sdfGridInput scalar grid that represents an existing signed distance field or a fog volume (signified by isInputSdf).
isoValueIso-value to be used to define the Dirichlet boundary condition of the fast sweeping algorithm (typically 0 for sdfs and a positive value for fog volumes).
isInputSdfUsed to determine if sdfGrid is a sigend distance field (true) or a scalar fog volume (false).

This, or any of ther other initilization methods, should be called before any call to sweep(). Failure to do so will throw a RuntimeError.

Warning
Note, if this method fails, i.e. returns false, a subsequent call to sweep will trow a RuntimeError. Instead call clear and try again.
bool isValid ( ) const
inline

Return true if there are voxels and boundaries to solve for.

FastSweeping& operator= ( const FastSweeping< SdfGridT, ExtValueT > &  )
delete

Disallow copy assignment.

SdfGridT::Ptr sdfGrid ( )
inline

Returns a shared pointer to the signed distance field computed by this class.

Warning
This shared pointer might point to NULL if the grid has not been initialize (by one of the init methods) or computed (by the sweep method).
void sweep ( int  nIter = 1,
bool  finalize = true 
)

Perform nIter iterations of the fast sweeping algorithm.

Parameters
nIterNumber of iterations of the fast sweeping algorithm. Each iteration performs 2^3 = 8 individual sweeps.
finalizeIf true the (possibly asymmetric) inside and outside values of the resulting signed distance field are properly set. Unless you're an expert this should remain true!
Exceptions
RuntimeErrorif sweepingVoxelCount() or boundaryVoxelCount() return zero. This might happen if none of the initialization methods above were called or if that initialization failed.
size_t sweepingVoxelCount ( ) const
inline

Return the number of voxels that will be solved for.


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