Loading...
Searching...
No Matches
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 <openvdb/tools/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.
const ValueT & | getIsoValue () const
| Return the iso-value used for ray-intersections.
bool | setIndexRay (const RayT &iRay)
| Return `false` if the ray misses the bbox of the grid.
bool | setWorldRay (const RayT &wRay)
| Return `false` if the ray misses the bbox of the grid.
void | getIndexPos (VecT &xyz) const
| Get the intersection point in index space.
void | getWorldPos (VecT &xyz) const
| Get the intersection point in world space.
void | getWorldPosAndNml (VecT &xyz, VecT &nml)
| Get the intersection point and normal in world space.
RealT | getIndexTime () const
| Return the time of intersection along the index ray.
RealT | getWorldTime () const
| Return the time of intersection along the world ray.

## Friends

template<typename, int>
struct | math::LevelSetHDDA

## Detailed Description

template<typename GridT, int Iterations, typename RealT>
class openvdb::v10_0::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.

## Member Typedef Documentation

## AccessorT

template<typename GridT, int Iterations, typename RealT>

using AccessorT = typename GridT::ConstAccessor

## RayT

template<typename GridT, int Iterations, typename RealT>

using RayT = math::Ray<RealT>

## StencilT

template<typename GridT, int Iterations, typename RealT>

using StencilT = math::BoxStencil<GridT>

## ValueT

template<typename GridT, int Iterations, typename RealT>

using ValueT = typename GridT::ValueType

## VecT

template<typename GridT, int Iterations, typename RealT>

using VecT = math::Vec3<RealT>

## Constructor & Destructor Documentation

## LinearSearchImpl()

template<typename GridT, int Iterations, typename RealT>

LinearSearchImpl | ( | const GridT & | grid,
|  | const ValueT & | isoValue = zeroVal<ValueT>() )

inline

Constructor from a grid.

Exceptions

  RunTimeError | if the grid is empty.
  ValueError | if the isoValue is not inside the narrow-band.

## Member Function Documentation

## getIndexPos()

template<typename GridT, int Iterations, typename RealT>

void getIndexPos | ( | VecT & | xyz | ) | const

inline

Get the intersection point in index space.

Parameters

  xyz | The position in index space of the intersection.

## getIndexTime()

template<typename GridT, int Iterations, typename RealT>

RealT getIndexTime | ( |  | ) | const

inline

Return the time of intersection along the index ray.

## getIsoValue()

template<typename GridT, int Iterations, typename RealT>

const ValueT & getIsoValue | ( |  | ) | const

inline

Return the iso-value used for ray-intersections.

## getWorldPos()

template<typename GridT, int Iterations, typename RealT>

void getWorldPos | ( | VecT & | xyz | ) | const

inline

Get the intersection point in world space.

Parameters

  xyz | The position in world space of the intersection.

## getWorldPosAndNml()

template<typename GridT, int Iterations, typename RealT>

void getWorldPosAndNml | ( | VecT & | xyz,
|  | VecT & | nml )

inline

Get the intersection point and normal in world space.

Parameters

  xyz | The position in world space of the intersection.
  nml | The surface normal in world space of the intersection.

## getWorldTime()

template<typename GridT, int Iterations, typename RealT>

RealT getWorldTime | ( |  | ) | const

inline

Return the time of intersection along the world ray.

## setIndexRay()

template<typename GridT, int Iterations, typename RealT>

bool setIndexRay | ( | const RayT & | iRay | ) |

inline

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

Parameters

  iRay | Ray represented in index space.

Warning
  Call this method before the ray traversal starts.

## setWorldRay()

template<typename GridT, int Iterations, typename RealT>

bool setWorldRay | ( | const RayT & | wRay | ) |

inline

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

Parameters

  wRay | Ray represented in world space.

Warning
  Call this method before the ray traversal starts.

## Friends And Related Symbol Documentation

## math::LevelSetHDDA

template<typename GridT, int Iterations, typename RealT>
template<typename, int>

friend struct math::LevelSetHDDA

friend