Library of Assembled Shared Sources
lass::prim::Ray3D< T, NormalizingPolicy, ParameterPolicy > Class Template Reference

3D Ray More...

#include <ray_3d.h>

Inheritance diagram for lass::prim::Ray3D< T, NormalizingPolicy, ParameterPolicy >:

Public Member Functions

const TPointsupport () const
 return origin of ray.
 
TPointsupport ()
 access origin of ray the origin is also the support point of the ray.
 
const TVectordirection () const
 Return direction of ray.
 
void setDirection (const TVector &iDirection)
 Set direction and normalize it if that's the policy.
 
void lookAt (const TPoint &iLookAt)
 Set direction from origin to look-at point.
 
const TPoint point (TParam a_t) const
 Return point on ray by it's parameter.
 
const TValue t (const TPoint &iPoint) const
 Return parameter of point on the ray that is the projection of the given point.
 
const TVector project (const TVector &iVector) const
 Project vector on the axis of the ray.
 
const TVector reject (const TVector &iVector) const
 Reject vector against the axis of the ray.
 
const TVector reflect (const TVector &iVector) const
 Reflect vector against the axis of the ray.
 
const TPoint project (const TPoint &iPoint) const
 Project point on the axis of the ray.
 
const TVector reject (const TPoint &iPoint) const
 Reject point against the axis of the ray.
 
const TPoint reflect (const TPoint &iPoint) const
 Reject point against the axis of the ray.
 
bool isValid () const
 Return true if ray is valid (direction isn't a zero vector).
 

Related Symbols

(Note that these are not member symbols.)

template<typename T, typename MMPAabb, typename NPRay, typename PPRay>
Result intersect (const Aabb3D< T, MMPAabb > &aabb, const Ray3D< T, NPRay, PPRay > &ray, T &t, const T &tMin=T())
 Find the intersection of an AABB and ray by their parameter t on the ray.
 
template<typename T, typename MMPAabb, typename NPRay, typename PPRay>
Result intersect (const Aabb3D< T, MMPAabb > &aabb, const Ray3D< T, NPRay, PPRay > &ray, const Vector3D< T > &invDirection, T &t, const T &tMin=T())
 Find the intersection of an AABB and ray by their parameter t on the ray.
 
template<typename T, class EPPlane, class NPPlane, class NPRay, class PPRay>
Result intersect (const Plane3D< T, EPPlane, NPPlane > &plane, const Ray3D< T, NPRay, PPRay > &ray, T &t, const T &tMin=T())
 Find the intersection of a plane and ray by their parameter t on the ray.
 

Detailed Description

template<typename T, class NormalizingPolicy = Normalized, class ParameterPolicy = Bounded>
class lass::prim::Ray3D< T, NormalizingPolicy, ParameterPolicy >

3D Ray

Author
Bram de Greve [BdG]
Date
2003

Definition at line 78 of file ray_3d.h.

Member Function Documentation

◆ support()

template<typename T, class NP, class PP>
const Ray3D< T, NP, PP >::TPoint & lass::prim::Ray3D< T, NP, PP >::support ( ) const

◆ point()

template<typename T, class NP, class PP>
const Ray3D< T, NP, PP >::TPoint lass::prim::Ray3D< T, NP, PP >::point ( TParam t) const
inline

Return point on ray by it's parameter.

Exceptions
throwan error if parameter is out of range t >= 0, if Bounded is used as ParameterPolicy.
Returns
origin + t * direction

Definition at line 177 of file ray_3d.inl.

References point(), and t().

Referenced by lass::prim::SimplePolygon3D< U, PlaneEquationPolicy, PlaneNormalizingPolicy >::intersect(), point(), and t().

◆ t()

template<typename T, class NP, class PP>
const Ray3D< T, NP, PP >::TValue lass::prim::Ray3D< T, NP, PP >::t ( const TPoint & point) const
inline

Return parameter of point on the ray that is the projection of the given point.

Warning
it can return a (invalid) negative number even if you've used a bounded parameter policy.

Definition at line 190 of file ray_3d.inl.

References point(), and t().

Referenced by point(), and t().

Friends And Related Symbol Documentation

◆ intersect() [1/3]

template<typename T, typename MMPAabb, typename NPRay, typename PPRay>
Result intersect ( const Aabb3D< T, MMPAabb > & aabb,
const Ray3D< T, NPRay, PPRay > & ray,
T & t,
const T & tMin = T() )
related

Find the intersection of an AABB and ray by their parameter t on the ray.

Parameters
aabb[in] the AABB
ray[in] the ray
tMin[in] the minimum t that may be returned as valid intersection.
t[out] the parameter of the intersection point > tMin.
Returns
  • rNone no intersections with t > tMin found t is not assigned.
  • rOne a intersection with t > tMin is found t is assigned.

Definition at line 72 of file aabb_3d_ray_3d.h.

◆ intersect() [2/3]

template<typename T, typename MMPAabb, typename NPRay, typename PPRay>
Result intersect ( const Aabb3D< T, MMPAabb > & aabb,
const Ray3D< T, NPRay, PPRay > & ray,
const Vector3D< T > & invDirection,
T & t,
const T & tMin = T() )
related

Find the intersection of an AABB and ray by their parameter t on the ray.

This version accepts a precomputed reciprocal of the ray direction (1/x, 1/y, 1/z). This is useful when you do many intersections with the same ray, so the reciprocal needs only to be computed once.

Parameters
aabb[in] the AABB
ray[in] the ray
invDirection[in] the reciprocal of the ray direction
tMin[in] the minimum t that may be returned as valid intersection.
t[out] the parameter of the intersection point > tMin.
Returns
  • rNone no intersections with t > tMin found t is not assigned.
  • rOne a intersection with t > tMin is found t is assigned.

Definition at line 131 of file aabb_3d_ray_3d.h.

◆ intersect() [3/3]

template<typename T, class EPPlane, class NPPlane, class NPRay, class PPRay>
Result intersect ( const Plane3D< T, EPPlane, NPPlane > & plane,
const Ray3D< T, NPRay, PPRay > & ray,
T & t,
const T & tMin = T() )
related

Find the intersection of a plane and ray by their parameter t on the ray.

Parameters
plane[in] the plane
ray[in] the ray
t[out] the parameter of the intersection point > tMin.
tMin[in] the minimum t that may be returned as valid intersection.
Returns
  • rNone no intersections > tMin found t is not assigned.
  • rOne exactly one intersection > tMin found t represents it.
  • rInfinite infinite many intersections found (ray is coincident with plane), t is not assigned.
  • rInvalid plane or ray is invalid, no intersection. t is not assigned.

Definition at line 74 of file plane_3d_ray_3d.h.


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