Loading...
Searching...
No Matches
ParticlesToLevelSet< SdfGridT, AttributeT, InterrupterT > Class Template Reference

`#include <openvdb/tools/ParticlesToLevelSet.h>`

## Public Types

using | DisableT = typename std::is_void<AttributeT>::type
using | InterrupterType = InterrupterT
using | SdfGridType = SdfGridT
using | SdfType = typename SdfGridT::ValueType
using | AttType = typename std::conditional<DisableT::value, size_t, AttributeT>::type
using | AttGridType = typename SdfGridT::template ValueConverter<AttType>::Type

## Public Member Functions

| ParticlesToLevelSet (SdfGridT &grid, InterrupterT *interrupt=nullptr)
| Constructor using an existing boolean or narrow-band level set grid.
| ~ParticlesToLevelSet ()
void | finalize (bool prune=false)
| This method syncs up the level set and attribute grids and therefore needs to be called before any of those grids are used and after the last call to any of the rasterizer methods.
AttGridType::Ptr | attributeGrid ()
| Return a pointer to the grid containing the optional user-defined attribute.
Real | getVoxelSize () const
| Return the size of a voxel in world units.
Real | getHalfWidth () const
| Return the half-width of the narrow band in voxel units.
Real | getRmin () const
| Return the smallest radius allowed in voxel units.
void | setRmin (Real Rmin)
| Set the smallest radius allowed in voxel units.
Real | getRmax () const
| Return the largest radius allowed in voxel units.
void | setRmax (Real Rmax)
| Set the largest radius allowed in voxel units.
bool | ignoredParticles () const
| Return `true` if any particles were ignored due to their size.
size_t | getMinCount () const
| Return the number of particles that were ignored because they were smaller than the minimum radius.
size_t | getMaxCount () const
| Return the number of particles that were ignored because they were larger than the maximum radius.
int | getGrainSize () const
| Return the grain size used for threading.
void | setGrainSize (int grainSize)
| Set the grain size used for threading.
template<typename ParticleListT>
void | rasterizeSpheres (const ParticleListT &pa)
| Rasterize each particle as a sphere with the particle's position and radius.
template<typename ParticleListT>
void | rasterizeSpheres (const ParticleListT &pa, Real radius)
| Rasterize each particle as a sphere with the particle's position and a fixed radius.
template<typename ParticleListT>
void | rasterizeTrails (const ParticleListT &pa, Real delta=1.0)
| Rasterize each particle as a trail comprising the CSG union of spheres of decreasing radius.

## Static Public Attributes

static const bool | OutputIsMask = std::is_same<SdfType, bool>::value

## Member Typedef Documentation

## AttGridType

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>

using AttGridType = typename SdfGridT::template ValueConverter<AttType>::Type

## AttType

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>

using AttType = typename std::conditional<DisableT::value, size_t, AttributeT>::type

## DisableT

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>

using DisableT = typename std::is_void<AttributeT>::type

## InterrupterType

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>

using InterrupterType = InterrupterT

## SdfGridType

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>

using SdfGridType = SdfGridT

## SdfType

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>

using SdfType = typename SdfGridT::ValueType

## Constructor & Destructor Documentation

## ParticlesToLevelSet()

template<typename SdfGridT, typename AttributeT, typename InterrupterT>

ParticlesToLevelSet | ( | SdfGridT & | grid,
|  | InterrupterT * | interrupt = nullptr )

inline explicit

Constructor using an existing boolean or narrow-band level set grid.

Parameters

  grid | grid into which particles are rasterized
  interrupt | callback to interrupt a long-running process

If the input grid is already populated with signed distances, particles are unioned onto the existing level set surface.

The width in voxel units of the generated narrow band level set is given by 2×background/dx, where background is the background value stored in the grid and dx is the voxel size derived from the transform associated with the grid. Also note that −background corresponds to the constant value inside the generated narrow-band level set.

Note
  If attribute transfer is enabled, i.e., if `AttributeT` is not `void`, attributes are generated only for voxels that overlap with particles, not for any other preexisting voxels (for which no attributes exist!).

## ~ParticlesToLevelSet()

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>

~ParticlesToLevelSet | ( |  | ) |

inline

## Member Function Documentation

## attributeGrid()

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>

AttGridType::Ptr attributeGrid | ( |  | ) |

inline

Return a pointer to the grid containing the optional user-defined attribute.

Warning
  If attribute transfer is disabled (i.e., if `AttributeT` is `void`) or if finalize is not called, the pointer will be null.

## finalize()

template<typename SdfGridT, typename AttributeT, typename InterrupterT>

void finalize | ( | bool | prune = false | ) |

inline

This method syncs up the level set and attribute grids and therefore needs to be called before any of those grids are used and after the last call to any of the rasterizer methods.

It has no effect or overhead if attribute transfer is disabled (i.e., if `AttributeT` is `void`) and prune is `false`.

Note
  Avoid calling this method more than once, and call it only after all the particles have been rasterized.

## getGrainSize()

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>

int getGrainSize | ( |  | ) | const

inline

Return the grain size used for threading.

## getHalfWidth()

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>

Real getHalfWidth | ( |  | ) | const

inline

Return the half-width of the narrow band in voxel units.

## getMaxCount()

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>

size_t getMaxCount | ( |  | ) | const

inline

Return the number of particles that were ignored because they were larger than the maximum radius.

## getMinCount()

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>

size_t getMinCount | ( |  | ) | const

inline

Return the number of particles that were ignored because they were smaller than the minimum radius.

## getRmax()

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>

Real getRmax | ( |  | ) | const

inline

Return the largest radius allowed in voxel units.

## getRmin()

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>

Real getRmin | ( |  | ) | const

inline

Return the smallest radius allowed in voxel units.

## getVoxelSize()

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>

Real getVoxelSize | ( |  | ) | const

inline

Return the size of a voxel in world units.

## ignoredParticles()

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>

bool ignoredParticles | ( |  | ) | const

inline

Return `true` if any particles were ignored due to their size.

## rasterizeSpheres() [1/2]

template<typename SdfGridT, typename AttributeT, typename InterrupterT>
template<typename ParticleListT>

void rasterizeSpheres | ( | const ParticleListT & | pa | ) |

inline

Rasterize each particle as a sphere with the particle's position and radius.

For level set output, all spheres are CSG-unioned.

## rasterizeSpheres() [2/2]

template<typename SdfGridT, typename AttributeT, typename InterrupterT>
template<typename ParticleListT>

void rasterizeSpheres | ( | const ParticleListT & | pa,
|  | Real | radius )

inline

Rasterize each particle as a sphere with the particle's position and a fixed radius.

For level set output, all spheres are CSG-unioned.

Parameters

  pa | particles with positions
  radius | fixed sphere radius in world units.

## rasterizeTrails()

template<typename SdfGridT, typename AttributeT, typename InterrupterT>
template<typename ParticleListT>

void rasterizeTrails | ( | const ParticleListT & | pa,
|  | Real | delta = 1.0 )

inline

Rasterize each particle as a trail comprising the CSG union of spheres of decreasing radius.

Parameters

  pa | particles with position, radius and velocity.
  delta | controls the distance between sphere instances

Warning
  Be careful not to use too small values for delta, since this can lead to excessive computation per trail (which the interrupter can't stop).

Note
  The direction of a trail is opposite to that of the velocity vector, and its length is given by the magnitude of the velocity. The radius at the head of the trail is given by the radius of the particle, and the radius at the tail is Rmin voxel units, which has a default value of 1.5 corresponding to the Nyquist frequency!

## setGrainSize()

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>

void setGrainSize | ( | int | grainSize | ) |

inline

Set the grain size used for threading.

Note
  A grain size of zero or less disables threading.

## setRmax()

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>

void setRmax | ( | Real | Rmax | ) |

inline

Set the largest radius allowed in voxel units.

## setRmin()

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>

void setRmin | ( | Real | Rmin | ) |

inline

Set the smallest radius allowed in voxel units.

## Member Data Documentation

## OutputIsMask

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>

const bool OutputIsMask = std::is_same<SdfType, bool>::value

static