HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
openvdb::OPENVDB_VERSION_NAME::tools::LinearSearchImpl< GridT, Iterations, RealT > Class Template Reference

Implements linear iterative search for an iso-value of the level set along the direction of the ray. More...

#include <RayIntersector.h>

Public Types

using RayT = math::Ray< RealT >
 
using VecT = math::Vec3< RealT >
 
using ValueT = typename GridT::ValueType
 
using AccessorT = typename GridT::ConstAccessor
 
using StencilT = math::BoxStencil< GridT >
 

Public Member Functions

 LinearSearchImpl (const GridT &grid, const ValueT &isoValue=zeroVal< ValueT >())
 Constructor from a grid. More...
 
const ValueTgetIsoValue () const
 Return the iso-value used for ray-intersections. More...
 
bool setIndexRay (const RayT &iRay)
 Return false if the ray misses the bbox of the grid. More...
 
bool setWorldRay (const RayT &wRay)
 Return false if the ray misses the bbox of the grid. More...
 
void getIndexPos (VecT &xyz) const
 Get the intersection point in index space. More...
 
void getWorldPos (VecT &xyz) const
 Get the intersection point in world space. More...
 
void getWorldPosAndNml (VecT &xyz, VecT &nml)
 Get the intersection point and normal in world space. More...
 
RealT getIndexTime () const
 Return the time of intersection along the index ray. More...
 
RealT getWorldTime () const
 Return the time of intersection along the world ray. More...
 

Friends

template<typename , int >
struct math::LevelSetHDDA
 

Detailed Description

template<typename GridT, int Iterations = 0, typename RealT = double>
class openvdb::OPENVDB_VERSION_NAME::tools::LinearSearchImpl< GridT, Iterations, RealT >

Implements linear iterative search for an iso-value of the level set along the direction of the ray.

Note
Since this class is used internally in LevelSetRayIntersector (define above) and LevelSetHDDA (defined below) client code should never interact directly with its API. This also explains why we are not concerned with the fact that several of its methods are unsafe to call unless roots were already detected.

It is approximate due to the limited number of iterations which can can be defined with a template parameter. However the default value has proven surprisingly accurate and fast. In fact more iterations are not guaranteed to give significantly better results.

Warning
Since the root-searching algorithm is approximate (first-order) it is possible to miss intersections if the iso-value is too close to the inside or outside of the narrow band (typically a distance less than a voxel unit).
Since this class internally stores a ValueAccessor it is NOT thread-safe, so make sure to give each thread its own instance. This of course also means that the cost of allocating an instance should (if possible) be amortized over as many ray intersections as possible.

Definition at line 55 of file RayIntersector.h.

Member Typedef Documentation

template<typename GridT , int Iterations = 0, typename RealT = double>
using openvdb::OPENVDB_VERSION_NAME::tools::LinearSearchImpl< GridT, Iterations, RealT >::AccessorT = typename GridT::ConstAccessor

Definition at line 518 of file RayIntersector.h.

template<typename GridT , int Iterations = 0, typename RealT = double>
using openvdb::OPENVDB_VERSION_NAME::tools::LinearSearchImpl< GridT, Iterations, RealT >::RayT = math::Ray<RealT>

Definition at line 515 of file RayIntersector.h.

template<typename GridT , int Iterations = 0, typename RealT = double>
using openvdb::OPENVDB_VERSION_NAME::tools::LinearSearchImpl< GridT, Iterations, RealT >::StencilT = math::BoxStencil<GridT>

Definition at line 519 of file RayIntersector.h.

template<typename GridT , int Iterations = 0, typename RealT = double>
using openvdb::OPENVDB_VERSION_NAME::tools::LinearSearchImpl< GridT, Iterations, RealT >::ValueT = typename GridT::ValueType

Definition at line 517 of file RayIntersector.h.

template<typename GridT , int Iterations = 0, typename RealT = double>
using openvdb::OPENVDB_VERSION_NAME::tools::LinearSearchImpl< GridT, Iterations, RealT >::VecT = math::Vec3<RealT>

Definition at line 516 of file RayIntersector.h.

Constructor & Destructor Documentation

template<typename GridT , int Iterations = 0, typename RealT = double>
openvdb::OPENVDB_VERSION_NAME::tools::LinearSearchImpl< GridT, Iterations, RealT >::LinearSearchImpl ( const GridT &  grid,
const ValueT isoValue = zeroVal<ValueT>() 
)
inline

Constructor from a grid.

Exceptions
RunTimeErrorif the grid is empty.
ValueErrorif the isoValue is not inside the narrow-band.

Definition at line 524 of file RayIntersector.h.

Member Function Documentation

template<typename GridT , int Iterations = 0, typename RealT = double>
void openvdb::OPENVDB_VERSION_NAME::tools::LinearSearchImpl< GridT, Iterations, RealT >::getIndexPos ( VecT xyz) const
inline

Get the intersection point in index space.

Parameters
xyzThe position in index space of the intersection.

Definition at line 563 of file RayIntersector.h.

template<typename GridT , int Iterations = 0, typename RealT = double>
RealT openvdb::OPENVDB_VERSION_NAME::tools::LinearSearchImpl< GridT, Iterations, RealT >::getIndexTime ( ) const
inline

Return the time of intersection along the index ray.

Definition at line 582 of file RayIntersector.h.

template<typename GridT , int Iterations = 0, typename RealT = double>
const ValueT& openvdb::OPENVDB_VERSION_NAME::tools::LinearSearchImpl< GridT, Iterations, RealT >::getIsoValue ( ) const
inline

Return the iso-value used for ray-intersections.

Definition at line 541 of file RayIntersector.h.

template<typename GridT , int Iterations = 0, typename RealT = double>
void openvdb::OPENVDB_VERSION_NAME::tools::LinearSearchImpl< GridT, Iterations, RealT >::getWorldPos ( VecT xyz) const
inline

Get the intersection point in world space.

Parameters
xyzThe position in world space of the intersection.

Definition at line 567 of file RayIntersector.h.

template<typename GridT , int Iterations = 0, typename RealT = double>
void openvdb::OPENVDB_VERSION_NAME::tools::LinearSearchImpl< GridT, Iterations, RealT >::getWorldPosAndNml ( VecT xyz,
VecT nml 
)
inline

Get the intersection point and normal in world space.

Parameters
xyzThe position in world space of the intersection.
nmlThe surface normal in world space of the intersection.

Definition at line 572 of file RayIntersector.h.

template<typename GridT , int Iterations = 0, typename RealT = double>
RealT openvdb::OPENVDB_VERSION_NAME::tools::LinearSearchImpl< GridT, Iterations, RealT >::getWorldTime ( ) const
inline

Return the time of intersection along the world ray.

Definition at line 585 of file RayIntersector.h.

template<typename GridT , int Iterations = 0, typename RealT = double>
bool openvdb::OPENVDB_VERSION_NAME::tools::LinearSearchImpl< GridT, Iterations, RealT >::setIndexRay ( const RayT iRay)
inline

Return false if the ray misses the bbox of the grid.

Parameters
iRayRay represented in index space.
Warning
Call this method before the ray traversal starts.

Definition at line 546 of file RayIntersector.h.

template<typename GridT , int Iterations = 0, typename RealT = double>
bool openvdb::OPENVDB_VERSION_NAME::tools::LinearSearchImpl< GridT, Iterations, RealT >::setWorldRay ( const RayT wRay)
inline

Return false if the ray misses the bbox of the grid.

Parameters
wRayRay represented in world space.
Warning
Call this method before the ray traversal starts.

Definition at line 555 of file RayIntersector.h.

Friends And Related Function Documentation

template<typename GridT , int Iterations = 0, typename RealT = double>
template<typename , int >
friend struct math::LevelSetHDDA
friend

Definition at line 656 of file RayIntersector.h.


The documentation for this class was generated from the following file: