OpenVDB  12.1.0
Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
OpenTriangularPrismVoxelizer< GridType, InterruptT > Class Template Reference

Class used to generate a grid of type GridType containing a narrow-band level set representation of an open prism. The only parts of the level set populated are along both normals of the triangle. Negative background tiles that fit inside the closed dilated triangle are also populated. More...

#include <openvdb/tools/impl/LevelSetDilatedMeshImpl.h>

Inherits ConvexVoxelizer< GridType, OpenTriangularPrismVoxelizer< GridType, InterruptT >, InterruptT >.

Public Member Functions

 OpenTriangularPrismVoxelizer (GridPtr &grid, const bool &threaded=false, InterruptT *interrupter=nullptr)
 Constructor. More...
 
template<typename ScalarType >
void operator() (const math::Vec3< ScalarType > &pt1, const math::Vec3< ScalarType > &pt2, const math::Vec3< ScalarType > &pt3, const ScalarType &radius)
 Create an open prism. More...
 
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 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...
 
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...
 
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...
 
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
 

Friends

class ConvexVoxelizer< GridType, OpenTriangularPrismVoxelizer< GridType, InterruptT >, InterruptT >
 

Detailed Description

template<typename GridType, typename InterruptT = util::NullInterrupter>
class openvdb::v12_1::tools::lvlset::OpenTriangularPrismVoxelizer< GridType, InterruptT >

Class used to generate a grid of type GridType containing a narrow-band level set representation of an open prism. The only parts of the level set populated are along both normals of the triangle. Negative background tiles that fit inside the closed dilated triangle are also populated.

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

Member Typedef Documentation

using Vec2T = math::Vec2<ValueT>
protectedinherited

Constructor & Destructor Documentation

OpenTriangularPrismVoxelizer ( GridPtr &  grid,
const bool threaded = false,
InterruptT *  interrupter = nullptr 
)
inline

Constructor.

Parameters
gridscalar grid to populate the level set in
threadedcenter of the sphere in world units
interrupterpointer 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

static ValueT circleBottom ( const ValueT x0,
const ValueT y0,
const ValueT r,
const ValueT x 
)
inlinestaticprotectedinherited

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

Parameters
x0X-coordinate of the circle's center.
y0Y-coordinate of the circle's center.
rRadius of the circle.
xX-coordinate for which to compute the bottom y-coordinate.
Returns
The y-coordinate at the bottom of the circle for the given x position.
static ValueT circleTop ( const ValueT x0,
const ValueT y0,
const ValueT r,
const ValueT x 
)
inlinestaticprotectedinherited

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

Parameters
x0X-coordinate of the circle's center.
y0Y-coordinate of the circle's center.
rRadius of the circle.
xX-coordinate for which to compute the top y-coordinate.
Returns
The y-coordinate at the top of the circle for the given x position.
ValueT halfWidth ( ) const
inlineinherited

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

void iterate ( )
inlineprotectedinherited

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.
void operator() ( const math::Vec3< ScalarType > &  pt1,
const math::Vec3< ScalarType > &  pt2,
const math::Vec3< ScalarType > &  pt3,
const ScalarType &  radius 
)
inline

Create an open prism.

Parameters
pt1point 1 of the triangle in world units
pt2point 2 of the triangle in world units
pt3point 3 of the triangle in world units
radiusradius of the open prism in world units
ValueT signedDistance ( const Vec3T ) const
inlineprotectedinherited

Computes the signed distance from a point to the convex region in index space.

Parameters
pThe point in 3D space for which to compute the signed distance.
static ValueT sphereBottom ( const ValueT x0,
const ValueT y0,
const ValueT z0,
const ValueT r,
const ValueT x,
const ValueT y 
)
inlinestaticprotectedinherited

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

Parameters
x0X-coordinate of the sphere's center.
y0Y-coordinate of the sphere's center.
z0Z-coordinate of the sphere's center.
rRadius of the sphere.
xX-coordinate for which to compute the bottom z-coordinate.
yY-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.
static ValueT sphereTop ( const ValueT x0,
const ValueT y0,
const ValueT z0,
const ValueT r,
const ValueT x,
const ValueT y 
)
inlinestaticprotectedinherited

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

Parameters
x0X-coordinate of the sphere's center.
y0Y-coordinate of the sphere's center.
z0Z-coordinate of the sphere's center.
rRadius of the sphere.
xX-coordinate for which to compute the top z-coordinate.
yY-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.
static ValueT tileCeil ( const ValueT x,
const ValueT step 
)
inlinestaticprotectedinherited

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

Parameters
xInput value.
stepTile step size.
Returns
The ceiling of the value based on the tile size.
static ValueT tileCeil ( const ValueT x,
const T &  step 
)
inlinestaticprotectedinherited

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

Template Parameters
TAny integral type (int, unsigned int, size_t, etc.)
Parameters
xInput value.
stepTile step size.
Returns
The ceiling of the value based on the tile size.
static ValueT tileFloor ( const ValueT x,
const ValueT step 
)
inlinestaticprotectedinherited

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

Parameters
xInput value.
stepTile step size.
Returns
The ceiling of the value based on the tile size.
static ValueT tileFloor ( const ValueT x,
const T &  step 
)
inlinestaticprotectedinherited

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

Template Parameters
TAny integral type (int, unsigned int, size_t, etc.)
Parameters
xInput value.
stepTile step size.
Returns
The ceiling of the value based on the tile size.
ValueT tilePointSignedDistance ( const Vec3T p) const
inlineprotectedinherited

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
pThe 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.
ValueT voxelSize ( ) const
inlineinherited

Return the voxel size of the grid.

Friends And Related Function Documentation

friend class ConvexVoxelizer< GridType, OpenTriangularPrismVoxelizer< GridType, InterruptT >, InterruptT >
friend

Member Data Documentation

std::function<bool(ValueT&, ValueT&, const ValueT&, const ValueT&)> bottomTop
protectedinherited

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

Parameters
[out]zbReference to the z ordinate where the bottom intersection occurs.
[out]ztReference to the z ordinate where the top intersection occurs.
[in]xThe x ordinate of the infinte line.
[in]yThe y ordinate of the infinte line.
Returns
true if an intersection occurs; otherwise false.
Note
The derived class can override this lambda to implement different behavior for degenerate cases.
XYRangeData mXYData
protectedinherited