library of assembled shared sources

http://lass.cocamware.com

lass::prim::Ray3D< T, NormalizingPolicy, ParameterPolicy > Class Template Reference

3D Ray More...

#include <ray_3d.h>

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

Collaboration graph
[legend]

Data Structures

struct  Rebind

Public Types

enum  { dimension = TPoint::dimension }
typedef Ray3D< T,
NormalizingPolicy,
ParameterPolicy > 
TSelf
typedef NormalizingPolicy TNormalizingPolicy
typedef ParameterPolicy TParameterPolicy
typedef Point3D< T > TPoint
typedef TPoint::TVector TVector
typedef TPoint::TValue TValue
typedef TPoint::TParam TParam
typedef TPoint::TReference TReference
typedef TPoint::TConstReference TConstReference
typedef TPoint::TNumTraits TNumTraits

Public Member Functions

 Ray3D ()
 Ray3D (const TPoint &iSupport, const TVector &iDirection)
 Ray3D (const TPoint &iSupport, const TVector &iNormalizedDirection, IsAlreadyNormalized)
 Ray3D (const TPoint &iSupport, const TPoint &iLookAt)
template<typename NP2 , typename PP2 >
 Ray3D (const Ray3D< T, NP2, PP2 > &iOther)
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.
const bool isValid () const
 Return true if ray is valid (direction isn't a zero vector).

Private Attributes

TPoint support_
TVector direction_

Related Functions

(Note that these are not member functions.)

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 , 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.
template<typename T , class NP >
std::ostream & operator<< (std::ostream &ioOStream, const Ray3D< T, NP > &iRay)
template<typename T , class NP >
io::XmlOStreamoperator<< (io::XmlOStream &ioOStream, const Ray3D< T, NP > &iRay)

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 Typedef Documentation

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

Definition at line 82 of file ray_3d.h.

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

Definition at line 83 of file ray_3d.h.

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

Definition at line 84 of file ray_3d.h.

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

Definition at line 86 of file ray_3d.h.

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

Definition at line 87 of file ray_3d.h.

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

Definition at line 89 of file ray_3d.h.

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

Definition at line 90 of file ray_3d.h.

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

Definition at line 91 of file ray_3d.h.

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

Definition at line 92 of file ray_3d.h.

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

Definition at line 93 of file ray_3d.h.


Member Enumeration Documentation

template<typename T , class NormalizingPolicy = Normalized, class ParameterPolicy = Bounded>
anonymous enum

Enumerator:
dimension 

Definition at line 95 of file ray_3d.h.


Constructor & Destructor Documentation

template<typename T , class NP , class PP >
lass::prim::Ray3D< T, NP, PP >::Ray3D (  )  [inline]

template<typename T , class NP , class PP >
lass::prim::Ray3D< T, NP, PP >::Ray3D ( const TPoint iSupport,
const TVector iDirection 
) [inline]

template<typename T , class NP , class PP >
lass::prim::Ray3D< T, NP, PP >::Ray3D ( const TPoint iSupport,
const TVector iNormalizedDirection,
IsAlreadyNormalized   
) [inline]

Definition at line 83 of file ray_3d.inl.

template<typename T , class NP , class PP >
lass::prim::Ray3D< T, NP, PP >::Ray3D ( const TPoint iSupport,
const TPoint iLookAt 
) [inline]

template<typename T , class NP , class PP >
template<class NP2 , class PP2 >
lass::prim::Ray3D< T, NP, PP >::Ray3D ( const Ray3D< T, NP2, PP2 > &  iOther  )  [inline]


Member Function Documentation

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

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

access origin of ray the origin is also the support point of the ray.

Definition at line 130 of file ray_3d.inl.

References lass::prim::Ray3D< T, NormalizingPolicy, ParameterPolicy >::support_.

template<typename T , class NP , class PP >
const Ray3D< T, NP, PP >::TVector & lass::prim::Ray3D< T, NP, PP >::direction (  )  const [inline]

template<typename T , class NP , class PP >
void lass::prim::Ray3D< T, NP, PP >::setDirection ( const TVector iDirection  )  [inline]

Set direction and normalize it if that's the policy.

Definition at line 151 of file ray_3d.inl.

References lass::prim::Ray3D< T, NormalizingPolicy, ParameterPolicy >::direction_.

template<typename T , class NP , class PP >
void lass::prim::Ray3D< T, NP, PP >::lookAt ( const TPoint iLookAt  )  [inline]

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

Return point on ray by it's parameter.

Exceptions:
throw an 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 lass::prim::Ray3D< T, NormalizingPolicy, ParameterPolicy >::direction_, lass::prim::Ray3D< T, NormalizingPolicy, ParameterPolicy >::support_, and lass::num::NumTraits< C >::zero.

Referenced by lass::prim::closestsPoints(), lass::prim::SimplePolygon3D< T, PlaneEquationPolicy, PlaneNormalizingPolicy >::intersect(), and lass::prim::squaredDistance().

template<typename T , class NP , class PP >
const Ray3D< T, NP, PP >::TValue lass::prim::Ray3D< T, NP, PP >::t ( const TPoint iPoint  )  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 lass::prim::Ray3D< T, NormalizingPolicy, ParameterPolicy >::direction_, lass::prim::dot(), and lass::prim::Ray3D< T, NormalizingPolicy, ParameterPolicy >::support_.

Referenced by lass::prim::closestsPoints(), and lass::prim::squaredDistance().

template<typename T , class NP , class PP >
const Ray3D< T, NP, PP >::TVector lass::prim::Ray3D< T, NP, PP >::project ( const TVector iVector  )  const [inline]

template<typename T , class NP , class PP >
const Ray3D< T, NP, PP >::TVector lass::prim::Ray3D< T, NP, PP >::reject ( const TVector iVector  )  const [inline]

Reject vector against the axis of the ray.

Definition at line 213 of file ray_3d.inl.

References lass::prim::Ray3D< T, NormalizingPolicy, ParameterPolicy >::project().

Referenced by lass::prim::Ray3D< T, NormalizingPolicy, ParameterPolicy >::reject().

template<typename T , class NP , class PP >
const Ray3D< T, NP, PP >::TVector lass::prim::Ray3D< T, NP, PP >::reflect ( const TVector iVector  )  const [inline]

Reflect vector against the axis of the ray.

Definition at line 224 of file ray_3d.inl.

References lass::prim::Ray3D< T, NormalizingPolicy, ParameterPolicy >::project().

Referenced by lass::prim::Ray3D< T, NormalizingPolicy, ParameterPolicy >::reflect().

template<typename T , class NP , class PP >
const Ray3D< T, NP, PP >::TPoint lass::prim::Ray3D< T, NP, PP >::project ( const TPoint iPoint  )  const [inline]

template<typename T , class NP , class PP >
const Ray3D< T, NP, PP >::TVector lass::prim::Ray3D< T, NP, PP >::reject ( const TPoint iPoint  )  const [inline]

template<typename T , class NP , class PP >
const Ray3D< T, NP, PP >::TPoint lass::prim::Ray3D< T, NP, PP >::reflect ( const TPoint iPoint  )  const [inline]

template<typename T , class NP , class PP >
const bool lass::prim::Ray3D< T, NP, PP >::isValid (  )  const [inline]

Return true if ray is valid (direction isn't a zero vector).

Definition at line 268 of file ray_3d.inl.

References lass::prim::Ray3D< T, NormalizingPolicy, ParameterPolicy >::direction_, and lass::prim::Vector3D< T >::isZero().

Referenced by lass::prim::Ray3D< T, NormalizingPolicy, ParameterPolicy >::intersect().


Friends And Related Function Documentation

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.

References lass::prim::Ray3D< T, NormalizingPolicy, ParameterPolicy >::direction(), lass::prim::impl::interectSlab(), lass::prim::Aabb3D< T, MinMaxPolicy >::isEmpty(), lass::prim::Aabb3D< T, MinMaxPolicy >::max(), lass::prim::Aabb3D< T, MinMaxPolicy >::min(), lass::prim::rNone, lass::prim::rOne, lass::prim::Ray3D< T, NormalizingPolicy, ParameterPolicy >::support(), and lass::stde::T.

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.

References lass::prim::Plane3D< T, EquationPolicy, NormalizingPolicy >::classify(), lass::prim::Ray3D< T, NormalizingPolicy, ParameterPolicy >::direction(), lass::prim::dot(), lass::prim::impl::Plane3DCartesian< T, NormalizingPolicy >::equation(), lass::num::isNaN(), lass::prim::Ray3D< T, NormalizingPolicy, ParameterPolicy >::isValid(), lass::prim::impl::Plane3DCartesian< T, NormalizingPolicy >::isValid(), LASS_ASSERT, lass::prim::impl::Plane3DCartesian< T, NormalizingPolicy >::normal(), lass::prim::rInfinite, lass::prim::rInvalid, lass::prim::rNone, lass::prim::rOne, lass::prim::sBack, lass::prim::sFront, lass::prim::sSurface, and lass::prim::Ray3D< T, NormalizingPolicy, ParameterPolicy >::support().

template<typename T , class NP >
std::ostream & operator<< ( std::ostream &  ioOStream,
const Ray3D< T, NP > &  iRay 
) [related]

Definition at line 278 of file ray_3d.inl.

References LASS_ENFORCE.

template<typename T , class NP >
io::XmlOStream & operator<< ( io::XmlOStream ioOStream,
const Ray3D< T, NP > &  iRay 
) [related]

Definition at line 289 of file ray_3d.inl.

References LASS_ENFORCE_STREAM.


Field Documentation

template<typename T , class NormalizingPolicy = Normalized, class ParameterPolicy = Bounded>
TPoint lass::prim::Ray3D< T, NormalizingPolicy, ParameterPolicy >::support_ [private]

template<typename T , class NormalizingPolicy = Normalized, class ParameterPolicy = Bounded>
TVector lass::prim::Ray3D< T, NormalizingPolicy, ParameterPolicy >::direction_ [private]


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

Generated on Mon Nov 10 14:22:14 2008 for Library of Assembled Shared Sources by doxygen 1.5.7.1
SourceForge.net Logo