OpenVDB: Ray< RealT > Class Template Reference

OpenVDB 11.0.0

Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | List of all members
Ray< RealT > Class Template Reference

`#include <openvdb/math/Ray.h>`

## Classes
struct | TimeSpan

## Public Types
using | RealType = RealT
using | Vec3Type = Vec3< RealT >
using | Vec3T = Vec3Type

## Public Member Functions
| Ray (const Vec3Type &eye=Vec3Type(0, 0, 0), const Vec3Type &direction=Vec3Type(1, 0, 0), RealT t0=math::Delta< RealT >::value(), RealT t1=std::numeric_limits< RealT >::max())
void | setEye (const Vec3Type &eye)
void | setDir (const Vec3Type &dir)
void | setMinTime (RealT t0)
void | setMaxTime (RealT t1)
void | setTimes (RealT t0=math::Delta< RealT >::value(), RealT t1=std::numeric_limits< RealT >::max())
void | scaleTimes (RealT scale)
void | reset (const Vec3Type &eye, const Vec3Type &direction, RealT t0=math::Delta< RealT >::value(), RealT t1=std::numeric_limits< RealT >::max())
const Vec3T & | eye () const
const Vec3T & | dir () const
const Vec3T & | invDir () const
RealT | t0 () const
RealT | t1 () const
Vec3R | operator() (RealT time) const
| Return the position along the ray at the specified time.
Vec3R | start () const
| Return the starting point of the ray.
Vec3R | end () const
| Return the endpoint of the ray.
Vec3R | mid () const
| Return the midpoint of the ray.
bool | valid (RealT eps=math::Delta< float >::value()) const
| Return `true` if t1 is larger than t0 by at least eps.
bool | test (RealT time) const
| Return `true` if time is within t0 and t1, both inclusive.
template<typename MapType >
Ray | applyMap (const MapType &map) const
| Return a new Ray that is transformed with the specified map.
template<typename MapType >
Ray | applyInverseMap (const MapType &map) const
| Return a new Ray that is transformed with the inverse of the specified map.
template<typename GridType >
Ray | indexToWorld (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.
template<typename GridType >
Ray | worldToIndex (const GridType &grid) const
| Return a new ray in the index space of the specified grid, assuming the existing ray is represented in world space.
bool | intersects (const Vec3T &center, RealT radius, RealT &t0, RealT &t1) const
| Return true if this ray intersects the specified sphere.
bool | intersects (const Vec3T &center, RealT radius) const
| Return true if this ray intersects the specified sphere.
bool | clip (const Vec3T &center, RealT radius)
| Return true if this ray intersects the specified sphere.
template<typename BBoxT >
bool | intersects (const BBoxT &bbox, RealT &t0, RealT &t1) const
| Return true if the Ray intersects the specified axisaligned bounding box.
template<typename BBoxT >
bool | intersects (const BBoxT &bbox) const
| Return true if this ray intersects the specified bounding box.
template<typename BBoxT >
bool | clip (const BBoxT &bbox)
| Return true if this ray intersects the specified bounding box.
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.
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.

## Member Typedef Documentation

## ◆ RealType

template<typename RealT = double>

using RealType = RealT

## ◆ Vec3T

template<typename RealT = double>

using Vec3T = Vec3Type

## ◆ Vec3Type

template<typename RealT = double>

using Vec3Type = Vec3<RealT>

## Constructor & Destructor Documentation

## ◆ Ray()

template<typename RealT = double>

Ray | ( | const Vec3Type & | eye = `Vec3Type(0,0,0)`,
|  | const Vec3Type & | direction = `Vec3Type(1,0,0)`,
|  | RealT | t0 = `math::Delta<RealT>::value()`,
|  | RealT | t1 = `std::numeric_limits<RealT>::max()`
| ) |  |
| inline

## Member Function Documentation

## ◆ applyInverseMap()

template<typename RealT = double>
template<typename MapType >

Ray applyInverseMap | ( | const MapType & | map | ) | const
| inline

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

Parameters

  map | the 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.

## ◆ applyMap()

template<typename RealT = double>
template<typename MapType >

Ray applyMap | ( | const MapType & | map | ) | const
| inline

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

Parameters

  map | the 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.

## ◆ clip() [1/2]

template<typename RealT = double>
template<typename BBoxT >

bool clip | ( | const BBoxT & | bbox | ) |
| inline

Return true if this ray intersects the specified bounding box.

Note
  For intersection this ray is clipped to the two intersection points.

Parameters

  bbox | Axis-aligned bounding box in the same space as this ray.

## ◆ clip() [2/2]

template<typename RealT = double>

bool 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

  center | The center of the sphere in the same space as this ray.
  radius | The radius of the sphere in the same units as this ray.

## ◆ dir()

template<typename RealT = double>

const Vec3T & dir | ( |  | ) | const
| inline

## ◆ end()

template<typename RealT = double>

Vec3R end | ( |  | ) | const
| inline

Return the endpoint of the ray.

## ◆ eye()

template<typename RealT = double>

const Vec3T & eye | ( |  | ) | const
| inline

## ◆ indexToWorld()

template<typename RealT = double>
template<typename GridType >

Ray indexToWorld | ( | 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.

## ◆ intersects() [1/6]

template<typename RealT = double>
template<typename BBoxT >

bool intersects | ( | const BBoxT & | bbox | ) | const
| inline

Return true if this ray intersects the specified bounding box.

Parameters

  bbox | Axis-aligned bounding box in the same space as this ray.

## ◆ intersects() [2/6]

template<typename RealT = double>
template<typename BBoxT >

bool intersects | ( | const BBoxT & | bbox,
|  | RealT & | t0,
|  | RealT & | t1
| ) |  | const
| inline

Return true if the Ray intersects the specified axisaligned bounding box.

Parameters

  bbox | Axis-aligned bounding box in the same space as the Ray.
  t0 | If an intersection is detected this is assigned the time for the first intersection point.
  t1 | If an intersection is detected this is assigned the time for the second intersection point.

## ◆ intersects() [3/6]

template<typename RealT = double>

bool intersects | ( | const Vec3T & | center,
|  | RealT | radius
| ) |  | const
| inline

Return true if this ray intersects the specified sphere.

Parameters

  center | The center of the sphere in the same space as this ray.
  radius | The radius of the sphere in the same units as this ray.

## ◆ intersects() [4/6]

template<typename RealT = double>

bool intersects | ( | const Vec3T & | center,
|  | RealT | radius,
|  | RealT & | t0,
|  | RealT & | t1
| ) |  | const
| inline

Return true if this ray intersects the specified sphere.

Parameters

  center | The center of the sphere in the same space as this ray.
  radius | The radius of the sphere in the same units as this ray.
  t0 | The first intersection point if an intersection exists.
  t1 | The 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.

## ◆ intersects() [5/6]

template<typename RealT = double>

bool 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

  normal | Normal of the plane.
  point | Point in the plane.
  t | Time of intersection, if one exists.

## ◆ intersects() [6/6]

template<typename RealT = double>

bool 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

  normal | Normal of the plane.
  distance | Distance of the plane to the origin.
  t | Time of intersection, if one exists.

## ◆ invDir()

template<typename RealT = double>

const Vec3T & invDir | ( |  | ) | const
| inline

## ◆ mid()

template<typename RealT = double>

Vec3R mid | ( |  | ) | const
| inline

Return the midpoint of the ray.

## ◆ operator()()

template<typename RealT = double>

Vec3R operator() | ( | RealT | time | ) | const
| inline

Return the position along the ray at the specified time.

## ◆ reset()

template<typename RealT = double>

void reset | ( | const Vec3Type & | eye,
|  | const Vec3Type & | direction,
|  | RealT | t0 = `math::Delta<RealT>::value()`,
|  | RealT | t1 = `std::numeric_limits<RealT>::max()`
| ) |  |
| inline

## ◆ scaleTimes()

template<typename RealT = double>

void scaleTimes | ( | RealT | scale | ) |
| inline

## ◆ setDir()

template<typename RealT = double>

void setDir | ( | const Vec3Type & | dir | ) |
| inline

## ◆ setEye()

template<typename RealT = double>

void setEye | ( | const Vec3Type & | eye | ) |
| inline

## ◆ setMaxTime()

template<typename RealT = double>

void setMaxTime | ( | RealT | t1 | ) |
| inline

## ◆ setMinTime()

template<typename RealT = double>

void setMinTime | ( | RealT | t0 | ) |
| inline

## ◆ setTimes()

template<typename RealT = double>

void setTimes | ( | RealT | t0 = `math::Delta<RealT>::value()`,
|  | RealT | t1 = `std::numeric_limits<RealT>::max()`
| ) |  |
| inline

## ◆ start()

template<typename RealT = double>

Vec3R start | ( |  | ) | const
| inline

Return the starting point of the ray.

## ◆ t0()

template<typename RealT = double>

RealT t0 | ( |  | ) | const
| inline

## ◆ t1()

template<typename RealT = double>

RealT t1 | ( |  | ) | const
| inline

## ◆ test()

template<typename RealT = double>

bool test | ( | RealT | time | ) | const
| inline

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

## ◆ valid()

template<typename RealT = double>

bool valid | ( | RealT | eps = `math::Delta<float>::value()` | ) | const
| inline

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

## ◆ worldToIndex()

template<typename RealT = double>
template<typename GridType >

Ray worldToIndex | ( | const GridType & | grid | ) | const
| inline

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