HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
nanovdb::Ray< RealT > Class Template Reference

#include <Ray.h>

Classes

struct  TimeSpan
 

Public Types

using RealType = RealT
 
using Vec3Type = Vec3< RealT >
 
using Vec3T = Vec3Type
 

Public Member Functions

__hostdev__ Ray (const Vec3Type &eye=Vec3Type(0, 0, 0), const Vec3Type &direction=Vec3Type(1, 0, 0), RealT t0=Delta< RealT >::value(), RealT t1=Maximum< RealT >::value())
 
__hostdev__ RayoffsetEye (RealT offset)
 
__hostdev__ RaysetEye (const Vec3Type &eye)
 
__hostdev__ RaysetDir (const Vec3Type &dir)
 
__hostdev__ RaysetMinTime (RealT t0)
 
__hostdev__ RaysetMaxTime (RealT t1)
 
__hostdev__ RaysetTimes (RealT t0=Delta< RealT >::value(), RealT t1=Maximum< RealT >::value())
 
__hostdev__ RayscaleTimes (RealT scale)
 
__hostdev__ Rayreset (const Vec3Type &eye, const Vec3Type &direction, RealT t0=Delta< RealT >::value(), RealT t1=Maximum< RealT >::value())
 
__hostdev__ const Vec3Teye () const
 
__hostdev__ const Vec3Tdir () const
 
__hostdev__ const Vec3TinvDir () const
 
__hostdev__ RealT t0 () const
 
__hostdev__ RealT t1 () const
 
__hostdev__ int sign (int i) const
 
__hostdev__ Vec3T operator() (RealT time) const
 Return the position along the ray at the specified time. More...
 
__hostdev__ Vec3T start () const
 Return the starting point of the ray. More...
 
__hostdev__ Vec3T end () const
 Return the endpoint of the ray. More...
 
__hostdev__ Vec3T mid () const
 Return the midpoint of the ray. More...
 
__hostdev__ bool valid (RealT eps=Delta< float >::value()) const
 Return true if t1 is larger than t0 by at least eps. More...
 
__hostdev__ bool test (RealT time) const
 Return true if time is within t0 and t1, both inclusive. More...
 
template<typename MapType >
__hostdev__ Ray applyMap (const MapType &map) const
 Return a new Ray that is transformed with the specified map. More...
 
template<typename MapType >
__hostdev__ Ray applyMapF (const MapType &map) const
 
template<typename MapType >
__hostdev__ Ray applyInverseMap (const MapType &map) const
 Return a new Ray that is transformed with the inverse of the specified map. More...
 
template<typename MapType >
__hostdev__ Ray applyInverseMapF (const MapType &map) const
 
template<typename GridType >
__hostdev__ Ray indexToWorldF (const GridType &grid) const
 Return a new ray in world space, assuming the existing ray is represented in the index space of the specified grid. More...
 
template<typename GridType >
__hostdev__ Ray worldToIndexF (const GridType &grid) const
 Return a new ray in index space, assuming the existing ray is represented in the world space of the specified grid. More...
 
__hostdev__ bool intersects (const Vec3T &center, RealT radius, RealT &t0, RealT &t1) const
 Return true if this ray intersects the specified sphere. More...
 
__hostdev__ bool intersects (const Vec3T &center, RealT radius) const
 Return true if this ray intersects the specified sphere. More...
 
__hostdev__ bool clip (const Vec3T &center, RealT radius)
 Return true if this ray intersects the specified sphere. More...
 
__hostdev__ bool intersects (const CoordBBox &bbox, RealT &t0, RealT &t1) const
 Returns true if this ray intersects an index bounding box. If the return value is true t0 and t1 are set to the intersection times along the ray. More...
 
template<typename OtherVec3T >
__hostdev__ bool intersects (const BBox< OtherVec3T > &bbox, RealT &t0, RealT &t1) const
 Returns true if this ray intersects a floating-point bounding box. If the return value is true t0 and t1 are set to the intersection times along the ray. More...
 
template<typename BBoxT >
__hostdev__ bool intersects (const BBoxT &bbox) const
 Return true if this ray intersects the specified bounding box. More...
 
template<typename BBoxT >
__hostdev__ bool clip (const BBoxT &bbox)
 Return true if this ray intersects the specified bounding box. More...
 
__hostdev__ bool intersects (const Vec3T &normal, RealT distance, RealT &t) const
 Return true if the Ray intersects the plane specified by a normal and distance from the origin. More...
 
__hostdev__ bool intersects (const Vec3T &normal, const Vec3T &point, RealT &t) const
 Return true if the Ray intersects the plane specified by a normal and point. More...
 

Detailed Description

template<typename RealT>
class nanovdb::Ray< RealT >

Definition at line 18 of file Ray.h.

Member Typedef Documentation

template<typename RealT >
using nanovdb::Ray< RealT >::RealType = RealT

Definition at line 21 of file Ray.h.

template<typename RealT >
using nanovdb::Ray< RealT >::Vec3T = Vec3Type

Definition at line 23 of file Ray.h.

template<typename RealT >
using nanovdb::Ray< RealT >::Vec3Type = Vec3<RealT>

Definition at line 22 of file Ray.h.

Constructor & Destructor Documentation

template<typename RealT >
__hostdev__ nanovdb::Ray< RealT >::Ray ( const Vec3Type eye = Vec3Type(0, 0, 0),
const Vec3Type direction = Vec3Type(1, 0, 0),
RealT  t0 = Delta<RealT>::value(),
RealT  t1 = Maximum<RealT>::value() 
)
inline

Definition at line 63 of file Ray.h.

Member Function Documentation

template<typename RealT >
template<typename MapType >
__hostdev__ Ray nanovdb::Ray< RealT >::applyInverseMap ( const MapType &  map) const
inline

Return a new Ray that is transformed with the inverse of the specified map.

Parameters
mapthe map from which to construct the new Ray by inverse mapping.
Warning
Assumes a linear map and a normalized direction.

The requirement that the direction is normalized follows from the transformation of t0 and t1 - and that fact that we want applyMap and applyInverseMap to be inverse operations.

Definition at line 223 of file Ray.h.

template<typename RealT >
template<typename MapType >
__hostdev__ Ray nanovdb::Ray< RealT >::applyInverseMapF ( const MapType &  map) const
inline

Definition at line 231 of file Ray.h.

template<typename RealT >
template<typename MapType >
__hostdev__ Ray nanovdb::Ray< RealT >::applyMap ( const MapType &  map) const
inline

Return a new Ray that is transformed with the specified map.

Parameters
mapthe map from which to construct the new Ray.
Warning
Assumes a linear map and a normalized direction.

The requirement that the direction is normalized follows from the transformation of t0 and t1 - and that fact that we want applyMap and applyInverseMap to be inverse operations.

Definition at line 189 of file Ray.h.

template<typename RealT >
template<typename MapType >
__hostdev__ Ray nanovdb::Ray< RealT >::applyMapF ( const MapType &  map) const
inline

Definition at line 201 of file Ray.h.

template<typename RealT >
__hostdev__ bool nanovdb::Ray< RealT >::clip ( const Vec3T center,
RealT  radius 
)
inline

Return true if this ray intersects the specified sphere.

Note
For intersection this ray is clipped to the two intersection points.
Parameters
centerThe center of the sphere in the same space as this ray.
radiusThe radius of the sphere in the same units as this ray.

Definition at line 324 of file Ray.h.

template<typename RealT >
template<typename BBoxT >
__hostdev__ bool nanovdb::Ray< RealT >::clip ( const BBoxT &  bbox)
inline

Return true if this ray intersects the specified bounding box.

Parameters
bboxAxis-aligned bounding box in the same space as this ray.
Warning
If bbox is of the type CoordBBox it is converted to a floating-point bounding box, which imples that the max is padded with one voxel, i.e. bbox.max += 1! This avoids gaps between neighboring CoordBBox'es, say from neighboring tree nodes.
Note
For intersection this ray is clipped to the two intersection points.

Definition at line 506 of file Ray.h.

template<typename RealT >
__hostdev__ const Vec3T& nanovdb::Ray< RealT >::dir ( ) const
inline

Definition at line 142 of file Ray.h.

template<typename RealT >
__hostdev__ Vec3T nanovdb::Ray< RealT >::end ( void  ) const
inline

Return the endpoint of the ray.

Definition at line 168 of file Ray.h.

template<typename RealT >
__hostdev__ const Vec3T& nanovdb::Ray< RealT >::eye ( ) const
inline

Definition at line 140 of file Ray.h.

template<typename RealT >
template<typename GridType >
__hostdev__ Ray nanovdb::Ray< RealT >::indexToWorldF ( const GridType grid) const
inline

Return a new ray in world space, assuming the existing ray is represented in the index space of the specified grid.

Definition at line 242 of file Ray.h.

template<typename RealT >
__hostdev__ bool nanovdb::Ray< RealT >::intersects ( const Vec3T center,
RealT  radius,
RealT &  t0,
RealT &  t1 
) const
inline

Return true if this ray intersects the specified sphere.

Parameters
centerThe center of the sphere in the same space as this ray.
radiusThe radius of the sphere in the same units as this ray.
t0The first intersection point if an intersection exists.
t1The second intersection point if an intersection exists.
Note
If the return value is true, i.e. a hit, and t0 = this->t0() or t1 == this->t1() only one true intersection exist.

Definition at line 278 of file Ray.h.

template<typename RealT >
__hostdev__ bool nanovdb::Ray< RealT >::intersects ( const Vec3T center,
RealT  radius 
) const
inline

Return true if this ray intersects the specified sphere.

Parameters
centerThe center of the sphere in the same space as this ray.
radiusThe radius of the sphere in the same units as this ray.

Definition at line 312 of file Ray.h.

template<typename RealT >
__hostdev__ bool nanovdb::Ray< RealT >::intersects ( const CoordBBox bbox,
RealT &  t0,
RealT &  t1 
) const
inline

Returns true if this ray intersects an index bounding box. If the return value is true t0 and t1 are set to the intersection times along the ray.

Warning
Intersection with a CoordBBox internally converts to a floating-point bbox which imples that the max is padded with one voxel, i.e. bbox.max += 1! This avoids gaps between neighboring CoordBBox'es, say from neighboring tree nodes.

Definition at line 397 of file Ray.h.

template<typename RealT >
template<typename OtherVec3T >
__hostdev__ bool nanovdb::Ray< RealT >::intersects ( const BBox< OtherVec3T > &  bbox,
RealT &  t0,
RealT &  t1 
) const
inline

Returns true if this ray intersects a floating-point bounding box. If the return value is true t0 and t1 are set to the intersection times along the ray.

Definition at line 428 of file Ray.h.

template<typename RealT >
template<typename BBoxT >
__hostdev__ bool nanovdb::Ray< RealT >::intersects ( const BBoxT &  bbox) const
inline

Return true if this ray intersects the specified bounding box.

Parameters
bboxAxis-aligned bounding box in the same space as this ray.
Warning
If bbox is of the type CoordBBox it is converted to a floating-point bounding box, which imples that the max is padded with one voxel, i.e. bbox.max += 1! This avoids gaps between neighboring CoordBBox'es, say from neighboring tree nodes.

Definition at line 467 of file Ray.h.

template<typename RealT >
__hostdev__ bool nanovdb::Ray< RealT >::intersects ( const Vec3T normal,
RealT  distance,
RealT &  t 
) const
inline

Return true if the Ray intersects the plane specified by a normal and distance from the origin.

Parameters
normalNormal of the plane.
distanceDistance of the plane to the origin.
tTime of intersection, if one exists.

Definition at line 522 of file Ray.h.

template<typename RealT >
__hostdev__ bool nanovdb::Ray< RealT >::intersects ( const Vec3T normal,
const Vec3T point,
RealT &  t 
) const
inline

Return true if the Ray intersects the plane specified by a normal and point.

Parameters
normalNormal of the plane.
pointPoint in the plane.
tTime of intersection, if one exists.

Definition at line 538 of file Ray.h.

template<typename RealT >
__hostdev__ const Vec3T& nanovdb::Ray< RealT >::invDir ( ) const
inline

Definition at line 144 of file Ray.h.

template<typename RealT >
__hostdev__ Vec3T nanovdb::Ray< RealT >::mid ( ) const
inline

Return the midpoint of the ray.

Definition at line 171 of file Ray.h.

template<typename RealT >
__hostdev__ Ray& nanovdb::Ray< RealT >::offsetEye ( RealT  offset)
inline

Definition at line 75 of file Ray.h.

template<typename RealT >
__hostdev__ Vec3T nanovdb::Ray< RealT >::operator() ( RealT  time) const
inline

Return the position along the ray at the specified time.

Definition at line 153 of file Ray.h.

template<typename RealT >
__hostdev__ Ray& nanovdb::Ray< RealT >::reset ( const Vec3Type eye,
const Vec3Type direction,
RealT  t0 = Delta<RealT>::value(),
RealT  t1 = Maximum<RealT>::value() 
)
inline

Definition at line 128 of file Ray.h.

template<typename RealT >
__hostdev__ Ray& nanovdb::Ray< RealT >::scaleTimes ( RealT  scale)
inline

Definition at line 122 of file Ray.h.

template<typename RealT >
__hostdev__ Ray& nanovdb::Ray< RealT >::setDir ( const Vec3Type dir)
inline

Definition at line 89 of file Ray.h.

template<typename RealT >
__hostdev__ Ray& nanovdb::Ray< RealT >::setEye ( const Vec3Type eye)
inline

Definition at line 83 of file Ray.h.

template<typename RealT >
__hostdev__ Ray& nanovdb::Ray< RealT >::setMaxTime ( RealT  t1)
inline

Definition at line 107 of file Ray.h.

template<typename RealT >
__hostdev__ Ray& nanovdb::Ray< RealT >::setMinTime ( RealT  t0)
inline

Definition at line 101 of file Ray.h.

template<typename RealT >
__hostdev__ Ray& nanovdb::Ray< RealT >::setTimes ( RealT  t0 = Delta<RealT>::value(),
RealT  t1 = Maximum<RealT>::value() 
)
inline

Definition at line 113 of file Ray.h.

template<typename RealT >
__hostdev__ int nanovdb::Ray< RealT >::sign ( int  i) const
inline

Definition at line 150 of file Ray.h.

template<typename RealT >
__hostdev__ Vec3T nanovdb::Ray< RealT >::start ( ) const
inline

Return the starting point of the ray.

Definition at line 165 of file Ray.h.

template<typename RealT >
__hostdev__ RealT nanovdb::Ray< RealT >::t0 ( ) const
inline

Definition at line 146 of file Ray.h.

template<typename RealT >
__hostdev__ RealT nanovdb::Ray< RealT >::t1 ( ) const
inline

Definition at line 148 of file Ray.h.

template<typename RealT >
__hostdev__ bool nanovdb::Ray< RealT >::test ( RealT  time) const
inline

Return true if time is within t0 and t1, both inclusive.

Definition at line 177 of file Ray.h.

template<typename RealT >
__hostdev__ bool nanovdb::Ray< RealT >::valid ( RealT  eps = Delta<float>::value()) const
inline

Return true if t1 is larger than t0 by at least eps.

Definition at line 174 of file Ray.h.

template<typename RealT >
template<typename GridType >
__hostdev__ Ray nanovdb::Ray< RealT >::worldToIndexF ( const GridType grid) const
inline

Return a new ray in index space, assuming the existing ray is represented in the world space of the specified grid.

Definition at line 257 of file Ray.h.


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