library of assembled shared sources

http://lass.cocamware.com

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

2D Ray More...

#include <ray_2d.h>

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

Collaboration graph
[legend]

Data Structures

struct  Rebind

Public Types

enum  { dimension = TPoint::dimension }
typedef Ray2D< T,
NormalizingPolicy,
ParameterPolicy > 
TSelf
typedef NormalizingPolicy TNormalizingPolicy
typedef ParameterPolicy TParameterPolicy
typedef Point2D< 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

 Ray2D ()
 Ray2D (const TPoint &iSupport, const TVector &iDirection)
 Ray2D (const TPoint &iSupport, const TPoint &iLookAt)
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 Side classify (const TPoint &iPoint) const
 Return on what side a point is located.
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 Aabb2D< T, MMPAabb > &aabb, const Ray2D< 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 EP1 , class NP1 , class NP2 , class PP2 >
Result intersect (const Line2D< T, EP1, NP1 > &line, const Ray2D< T, NP2, PP2 > &ray, T &t, const T &tMin=T())
 Find the intersection of a line and ray by their parameter t on the ray.
template<typename T , class PP1 , class NP2 , class PP2 >
Result intersect (const LineSegment2D< T, PP1 > &lineSegment, const Ray2D< T, NP2, PP2 > &ray, T &t, const T &tMin=T())
 Find the intersection of a ray and a line segment by parameter t on the ray.
template<typename T , class NP >
std::ostream & operator<< (std::ostream &ioOStream, const Ray2D< T, NP > &iRay)
template<typename T , class NP >
io::XmlOStreamoperator<< (io::XmlOStream &ioOStream, const Ray2D< T, NP > &iRay)

Detailed Description

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

2D Ray

Author:
Bram de Greve [BdG]
Date:
2003

Definition at line 77 of file ray_2d.h.


Member Typedef Documentation

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

Definition at line 81 of file ray_2d.h.

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

Definition at line 82 of file ray_2d.h.

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

Definition at line 83 of file ray_2d.h.

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

Definition at line 85 of file ray_2d.h.

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

Definition at line 86 of file ray_2d.h.

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

Definition at line 88 of file ray_2d.h.

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

Definition at line 89 of file ray_2d.h.

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

Definition at line 90 of file ray_2d.h.

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

Definition at line 91 of file ray_2d.h.

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

Definition at line 92 of file ray_2d.h.


Member Enumeration Documentation

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

Enumerator:
dimension 

Definition at line 94 of file ray_2d.h.


Constructor & Destructor Documentation

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

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

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


Member Function Documentation

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

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

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

Definition at line 109 of file ray_2d.inl.

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

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

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

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

Definition at line 130 of file ray_2d.inl.

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

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

template<typename T , class NP , class PP >
const Ray2D< T, NP, PP >::TPoint lass::prim::Ray2D< 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 156 of file ray_2d.inl.

References lass::prim::Ray2D< T, NormalizingPolicy, ParameterPolicy >::direction_, lass::prim::Ray2D< T, NormalizingPolicy, ParameterPolicy >::support_, and lass::num::NumTraits< C >::zero.

Referenced by lass::spat::impl::BrutePointLocator::findEdge(), lass::spat::PlanarMesh::locate(), lass::spat::PlanarMesh::pointShoot(), and lass::spat::PlanarMesh::shoot().

template<typename T , class NP , class PP >
const Ray2D< T, NP, PP >::TValue lass::prim::Ray2D< 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 169 of file ray_2d.inl.

References lass::prim::Ray2D< T, NormalizingPolicy, ParameterPolicy >::direction_, lass::prim::dot(), and lass::prim::Ray2D< T, NormalizingPolicy, ParameterPolicy >::support_.

Referenced by lass::spat::impl::BrutePointLocator::findEdge(), lass::spat::PlanarMesh::locate(), lass::spat::PlanarMesh::pointShoot(), lass::spat::PlanarMesh::safeSplitEdge(), and lass::spat::PlanarMesh::shoot().

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

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

Reject vector against the axis of the ray.

Definition at line 191 of file ray_2d.inl.

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

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

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

Reflect vector against the axis of the ray.

Definition at line 202 of file ray_2d.inl.

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

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

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

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

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

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

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

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

Definition at line 260 of file ray_2d.inl.

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

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


Friends And Related Function Documentation

template<typename T , typename MMPAabb , typename NPRay , typename PPRay >
Result intersect ( const Aabb2D< T, MMPAabb > &  aabb,
const Ray2D< 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
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 with t > tMin found t is not assigned.
  • rOne a intersection with t > tMin is found t is assigned.

Definition at line 70 of file aabb_2d_ray_2d.h.

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

template<typename T , class EP1 , class NP1 , class NP2 , class PP2 >
Result intersect ( const Line2D< T, EP1, NP1 > &  line,
const Ray2D< T, NP2, PP2 > &  ray,
T &  t,
const T &  tMin = T() 
) [related]

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

Parameters:
line [in] the line
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 iPlane or ray is invalid, no intersection. t is not assigned.

Definition at line 74 of file line_2d_ray_2d.h.

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

template<typename T , class PP1 , class NP2 , class PP2 >
Result intersect ( const LineSegment2D< T, PP1 > &  lineSegment,
const Ray2D< T, NP2, PP2 > &  ray,
T &  t,
const T &  tMin = T() 
) [related]

Find the intersection of a ray and a line segment by parameter t on the ray.

Parameters:
lineSegment [in] the line segment
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 with t > tMin found t is not assigned.
  • rOne a intersection with t > tMin is found t is assigned.

Definition at line 70 of file line_segment_2d_ray_2d.h.

References lass::prim::Ray2D< T, NormalizingPolicy, ParameterPolicy >::direction(), lass::prim::LineSegment2D< T, ParameterPolicy >::head(), lass::prim::impl::intersectEdge2D(), lass::prim::rNone, lass::prim::rOne, lass::prim::Ray2D< T, NormalizingPolicy, ParameterPolicy >::support(), and lass::prim::LineSegment2D< T, ParameterPolicy >::tail().

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

Definition at line 270 of file ray_2d.inl.

References LASS_ENFORCE.

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

Definition at line 281 of file ray_2d.inl.

References LASS_ENFORCE_STREAM.


Field Documentation

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

template<typename T , class NormalizingPolicy = Normalized, class ParameterPolicy = Bounded>
TVector lass::prim::Ray2D< 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