This class provides the public API for intersecting a ray with a generic (e.g. density) volume.
More...
#include <RayIntersector.h>
|
| BOOST_STATIC_ASSERT (NodeLevel >=0 &&NodeLevel< int(TreeT::DEPTH)-1) |
|
| VolumeRayIntersector (const GridT &grid) |
| Constructor. More...
|
|
bool | setIndexRay (const RayT &iRay) |
| Return false if the index ray misses the bbox of the grid. More...
|
|
bool | setWorldRay (const RayT &wRay) |
| Return false if the world ray misses the bbox of the grid. More...
|
|
int | march (Real &t0, Real &t1) |
| Return 0 if not hit was detected. A return value of 1 means it hit an active tile, and a return value of 2 means it hit a LeafNode. Only when a hit is detected are t0 and t1 updated with the corresponding entry and exit times along the INDEX ray! More...
|
|
Vec3R | getIndexPos (Real time) const |
| Return the floating-point index position along the current index ray at the specified time. More...
|
|
Vec3R | getWorldPos (Real time) const |
| Return the floating-point world position along the current index ray at the specified time. More...
|
|
template<typename GridT, int NodeLevel = GridT::TreeType::RootNodeType::ChildNodeType::LEVEL, typename RayT = math::Ray<Real>>
class openvdb::v2_0_0::tools::VolumeRayIntersector< GridT, NodeLevel, RayT >
This class provides the public API for intersecting a ray with a generic (e.g. density) volume.
Internally it performs the actual hierarchical tree node traversal.
- Warning
- Use the (default) copy-constructor to make sure each computational thread has their own instance of this class. This is important since it contains a ValueAccessor that is not thread-safe and a CoordBBox of the active voxels that should not be re-computed for each thread. However copying is very efficient.
- Example:
*
*
*
*
* iter.setIndexRay(ray);
*
* iter.setWorldRay(ray);
*
* double t0=0, t1=0;
* while ( int n = inter.march(t0, t1) ) {
* if (n == 1) {
* } else {
* }}
*
typedef GridT::TreeType TreeT |
Constructor.
- Parameters
-
grid | Generic grid to intersect rays against. |
- Warning
- In the near future we will add support for grids with frustrum transforms.
Return the floating-point index position along the current index ray at the specified time.
Return the floating-point world position along the current index ray at the specified time.
Return 0 if not hit was detected. A return value of 1 means it hit an active tile, and a return value of 2 means it hit a LeafNode. Only when a hit is detected are t0 and t1 updated with the corresponding entry and exit times along the INDEX ray!
- Parameters
-
t0 | If the return value > 0 this is the time of the first hit. |
t1 | If the return value > 0 this is the time of the second hit. |
- Warning
- t0 and t1 are computed with repect to the ray represented in index space of the current grid, not world space!
bool setIndexRay |
( |
const RayT & |
iRay | ) |
|
|
inline |
Return false
if the index ray misses the bbox of the grid.
- Parameters
-
iRay | Ray represented in index space. |
- Warning
- Call this method (or setWorldRay) before the ray traversal starts and use the return value to decide if further marching is required.
bool setWorldRay |
( |
const RayT & |
wRay | ) |
|
|
inline |
Return false
if the world ray misses the bbox of the grid.
- Parameters
-
wRay | Ray represented in world space. |
- Warning
- Call this method (or setIndexRay) before the ray traversal starts and use the return value to decide if further marching is required.
Since hit times are computed with repect to the ray represented in index space of the current grid, it is recommended that either the client code uses getIndexPos to compute index position from hit times or alternatively keeps an instance of the index ray and instead uses setIndexRay to initialize the ray.
The documentation for this class was generated from the following file: