OpenVDB
12.1.0
|
Base class used to generate a grid of type GridType
containing a narrow-band level set representation of a convex region.
More...
#include <openvdb/tools/impl/ConvexVoxelizer.h>
Classes | |
class | XYRangeData |
Class that stores endpoints of a y range for each x value within a specified range and step size. More... | |
Public Member Functions | |
ConvexVoxelizer (GridPtr &grid, const bool &threaded=false, InterruptType *interrupter=nullptr) | |
Constructor. More... | |
virtual | ~ConvexVoxelizer ()=default |
ValueT | voxelSize () const |
Return the voxel size of the grid. More... | |
ValueT | halfWidth () const |
Return the half width of the narrow-band level set. More... | |
Protected Types | |
using | ValueT = typename GridType::ValueType |
using | Vec3T = math::Vec3< ValueT > |
using | Vec2T = math::Vec2< ValueT > |
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. More... | |
void | setXYRangeData (const Index &) |
Determines the x bounds in index space of the convex region dilated by the half width. For each x value in index space, the y range in index space of the dilated region is computed. This function should store the data in mXYData . More... | |
bool | tileCanFit (const Index &) const |
Checks if the tile of a given dimension can possibly fit within the region. More... | |
ValueT | signedDistance (const Vec3T &) const |
Computes the signed distance from a point to the convex region in index space. More... | |
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 . More... | |
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. More... | |
template<typename T > | |
static ValueT | tileCeil (const ValueT &x, const T &step) |
Rounds an input scalar up to the nearest valid ordinate of tile of a specified size. More... | |
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. More... | |
template<typename T > | |
static ValueT | tileFloor (const ValueT &x, const T &step) |
Rounds an input scalar down to the nearest valid ordinate of tile of a specified size. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
XYRangeData | mXYData |
Base class used to generate a grid of type GridType
containing a narrow-band level set representation of a convex region.
GridType::ValueType
must be a floating-point scalar. Derived
is the derived class that implements the base class (curiously recurring template pattern).
|
protected |
|
protected |
|
protected |
|
inline |
Constructor.
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. |
|
virtualdefault |
|
inlinestaticprotected |
Computes the bottom y-coordinate of a circle at a given x position.
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. |
|
inlinestaticprotected |
Computes the top y-coordinate of a circle at a given x position.
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. |
|
inline |
Return the half width of the narrow-band level set.
|
inlineprotected |
The function the derived class calls to create the level set, working in index space other than setting signed distance values.
|
inlineprotected |
Determines the x bounds in index space of the convex region dilated by the half width. For each x value in index space, the y range in index space of the dilated region is computed. This function should store the data in mXYData
.
step | The step size for setting the XY range data, defaults to 1. |
iterate()
. Computes the signed distance from a point to the convex region in index space.
p | The point in 3D space for which to compute the signed distance. |
|
inlinestaticprotected |
Computes the bottom z-coordinate of a sphere at a given (x, y) position.
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. |
|
inlinestaticprotected |
Computes the top z-coordinate of a sphere at a given (x, y) position.
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. |
Checks if the tile of a given dimension can possibly fit within the region.
The derived class does not need to implement it if the default behavior is acceptable, which assumes a tile can always possibly fit.
dim | The dimension of the tile in which to check if the tile fits. |
iterate
will not try to populate the level set with background tiles of this dimension. Rounds an input scalar up to the nearest valid ordinate of tile of a specified size.
x | Input value. |
step | Tile step size. |
Rounds an input scalar up to the nearest valid ordinate of tile of a specified size.
T | Any integral type (int, unsigned int, size_t, etc.) |
x | Input value. |
step | Tile step size. |
Rounds an input scalar down to the nearest valid ordinate of tile of a specified size.
x | Input value. |
step | Tile step size. |
Rounds an input scalar down to the nearest valid ordinate of tile of a specified size.
T | Any integral type (int, unsigned int, size_t, etc.) |
x | Input value. |
step | Tile step size. |
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
.
p | The point at the center of the tile in 3D space. |
|
inline |
Return the voxel size of the grid.
Find where a vertical infinite line intersects a convex region dilated by the half width.
[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 infinte line. |
[in] | y | The y ordinate of the infinte line. |
|
protected |