OpenVDB 13.0.0

Loading...
Searching...
No Matches
CapsuleVoxelizer< GridType, InterruptT > Class Template Reference

Class used to generate a grid of type `GridType` containing a narrow-band level set representation of a capsule. More...

`#include <openvdb/tools/impl/LevelSetTubesImpl.h>`

Inheritance diagram for CapsuleVoxelizer< GridType, InterruptT >:

## Public Member Functions
| CapsuleVoxelizer (GridPtr &grid, const bool &threaded=true, InterruptT *interrupter=nullptr)
| Constructor.
template<typename ScalarType>
void | operator() (const math::Vec3< ScalarType > &pt1, const math::Vec3< ScalarType > &pt2, const ScalarType &r)
| Create a capsule.
ValueT | voxelSize () const
| Return the voxel size of the grid.
ValueT | halfWidth () const
| Return the half width of the narrow-band level set.

## Protected Member Functions
void | iterate ()
| The function the derived class calls to create the level set, working in index space other than setting signed distance values.
ValueT | tilePointSignedDistance (const Vec3T &p) const
| Computes the signed distance for tiles in index space, considering the center of the tile. This method is optional to override and defaults to `signedDistance`.

## Static Protected Member Functions
static ValueT | tileCeil (const ValueT &x, const ValueT &step)
| Rounds an input scalar up to the nearest valid ordinate of tile of a specified size.
static ValueT | tileFloor (const ValueT &x, const ValueT &step)
| Rounds an input scalar down to the nearest valid ordinate of tile of a specified size.
static ValueT | circleBottom (const ValueT &x0, const ValueT &y0, const ValueT &r, const ValueT &x)
| Computes the bottom y-coordinate of a circle at a given x position.
static ValueT | circleTop (const ValueT &x0, const ValueT &y0, const ValueT &r, const ValueT &x)
| Computes the top y-coordinate of a circle at a given x position.
static ValueT | sphereBottom (const ValueT &x0, const ValueT &y0, const ValueT &z0, const ValueT &r, const ValueT &x, const ValueT &y)
| Computes the bottom z-coordinate of a sphere at a given (x, y) position.
static ValueT | sphereTop (const ValueT &x0, const ValueT &y0, const ValueT &z0, const ValueT &r, const ValueT &x, const ValueT &y)
| Computes the top z-coordinate of a sphere at a given (x, y) position.

## Protected Attributes
std::function< bool(ValueT &, ValueT &, const ValueT &, const ValueT &)> | bottomTop
| Find where a vertical infinite line intersects a convex region dilated by the half width.

## Friends
class | ConvexVoxelizer< GridType, CapsuleVoxelizer< GridType, InterruptT >, InterruptT >

## Detailed Description

template<typename GridType, typename InterruptT = util::NullInterrupter>
class openvdb::v13_0::tools::lvlset::CapsuleVoxelizer< GridType, InterruptT >

Class used to generate a grid of type `GridType` containing a narrow-band level set representation of a capsule.

Note
  `GridType::ValueType` must be a floating-point scalar.

## Constructor & Destructor Documentation

## ◆ CapsuleVoxelizer()

template<typename GridType, typename InterruptT = util::NullInterrupter>

CapsuleVoxelizer | ( | GridPtr & | grid,
|  | const bool & | threaded = true,
|  | InterruptT * | interrupter = nullptr )
| inline

Constructor.

Parameters

  grid | scalar grid to populate the level set in
  threaded | center of the sphere in world units
  interrupter | pointer to optional interrupter. Use template argument util::NullInterrupter if no interruption is desired.

Note
  The voxel size and half width are determined from the input grid, meaning the voxel size and background value need to be set prior to voxelization

## Member Function Documentation

## ◆ circleBottom()

ValueT circleBottom | ( | const ValueT & | x0,
|  | const ValueT & | y0,
|  | const ValueT & | r,
|  | const ValueT & | x )
| inline static protected inherited

Computes the bottom y-coordinate of a circle at a given x position.

Parameters

  x0 | X-coordinate of the circle's center.
  y0 | Y-coordinate of the circle's center.
  r | Radius of the circle.
  x | X-coordinate for which to compute the bottom y-coordinate.

Returns
  The y-coordinate at the bottom of the circle for the given x position.

## ◆ circleTop()

ValueT circleTop | ( | const ValueT & | x0,
|  | const ValueT & | y0,
|  | const ValueT & | r,
|  | const ValueT & | x )
| inline static protected inherited

Computes the top y-coordinate of a circle at a given x position.

Parameters

  x0 | X-coordinate of the circle's center.
  y0 | Y-coordinate of the circle's center.
  r | Radius of the circle.
  x | X-coordinate for which to compute the top y-coordinate.

Returns
  The y-coordinate at the top of the circle for the given x position.

## ◆ halfWidth()

ValueT halfWidth | ( |  | ) | const
| inline inherited

Return the half width of the narrow-band level set.

## ◆ iterate()

void iterate | ( |  | ) |
| inline protected inherited

The function the derived class calls to create the level set, working in index space other than setting signed distance values.

Note
  This function handles both parallel and serial iterations. If running in serial mode, it flood fills the tile topology immediately; otherwise, it avoids duplicating nontrivial tree topology over multiple threads. This method also checks for background tiles that are too thin to fit and delegates accordingly.

## ◆ operator()()

template<typename GridType, typename InterruptT = util::NullInterrupter>
template<typename ScalarType>

void operator() | ( | const math::Vec3< ScalarType > & | pt1,
|  | const math::Vec3< ScalarType > & | pt2,
|  | const ScalarType & | r )
| inline

Create a capsule.

Parameters

  pt1 | first endpoint of the capsule in world units
  pt2 | second endpoint of the capsule in world units
  radius | radius of the capsule in world units

## ◆ sphereBottom()

ValueT sphereBottom | ( | const ValueT & | x0,
|  | const ValueT & | y0,
|  | const ValueT & | z0,
|  | const ValueT & | r,
|  | const ValueT & | x,
|  | const ValueT & | y )
| inline static protected inherited

Computes the bottom z-coordinate of a sphere at a given (x, y) position.

Parameters

  x0 | X-coordinate of the sphere's center.
  y0 | Y-coordinate of the sphere's center.
  z0 | Z-coordinate of the sphere's center.
  r | Radius of the sphere.
  x | X-coordinate for which to compute the bottom z-coordinate.
  y | Y-coordinate for which to compute the bottom z-coordinate.

Returns
  The z-coordinate at the bottom of the sphere for the given (x, y) position.

## ◆ sphereTop()

ValueT sphereTop | ( | const ValueT & | x0,
|  | const ValueT & | y0,
|  | const ValueT & | z0,
|  | const ValueT & | r,
|  | const ValueT & | x,
|  | const ValueT & | y )
| inline static protected inherited

Computes the top z-coordinate of a sphere at a given (x, y) position.

Parameters

  x0 | X-coordinate of the sphere's center.
  y0 | Y-coordinate of the sphere's center.
  z0 | Z-coordinate of the sphere's center.
  r | Radius of the sphere.
  x | X-coordinate for which to compute the top z-coordinate.
  y | Y-coordinate for which to compute the top z-coordinate.

Returns
  The z-coordinate at the top of the sphere for the given (x, y) position.

## ◆ tileCeil()

ValueT tileCeil | ( | const ValueT & | x,
|  | const ValueT & | step )
| inline static protected inherited

Rounds an input scalar up to the nearest valid ordinate of tile of a specified size.

Parameters

  x | Input value.
  step | Tile step size.

Returns
  The ceiling of the value based on the tile size.

## ◆ tileFloor()

ValueT tileFloor | ( | const ValueT & | x,
|  | const ValueT & | step )
| inline static protected inherited

Rounds an input scalar down to the nearest valid ordinate of tile of a specified size.

Parameters

  x | Input value.
  step | Tile step size.

Returns
  The ceiling of the value based on the tile size.

## ◆ tilePointSignedDistance()

ValueT tilePointSignedDistance | ( | const Vec3T & | p | ) | const
| inline protected inherited

Computes the signed distance for tiles in index space, considering the center of the tile. This method is optional to override and defaults to `signedDistance`.

Parameters

  p | The point at the center of the tile in 3D space.

Note
  This can be useful for cases that build objects from multiple primitives, e.g. dilated mesh is built by constructing and unioning open prisms and open tube wedges. A tile might not fully fit in an open prism but might fit in the union of a prism and wedge, and so in this case it might make sense to use the sdf for an offset triangle on tiles during the open prism scan.

## ◆ voxelSize()

ValueT voxelSize | ( |  | ) | const
| inline inherited

Return the voxel size of the grid.

## Friends And Related Symbol Documentation

## ◆ ConvexVoxelizer< GridType, CapsuleVoxelizer< GridType, InterruptT >, InterruptT >

template<typename GridType, typename InterruptT = util::NullInterrupter>

friend class ConvexVoxelizer< GridType, CapsuleVoxelizer< GridType, InterruptT >, InterruptT >
| friend

## Member Data Documentation

## ◆ bottomTop

std::function<bool(ValueT&, ValueT&, const ValueT&, const ValueT&)> bottomTop
| protected inherited

Find where a vertical infinite line intersects a convex region dilated by the half width.

Parameters

  [out] | zb | Reference to the z ordinate where the bottom intersection occurs.
  [out] | zt | Reference to the z ordinate where the top intersection occurs.
  [in] | x | The x ordinate of the infinite line.
  [in] | y | The y ordinate of the infinite line.

Returns
  true if an intersection occurs; otherwise false.

Note
  The derived class can override this lambda to implement different behavior for degenerate cases.