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

2D Ray More...

#include <ray_2d.h>

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

Public Member Functions

const TPoint & support () const
 return origin of ray.
 
TPoint & support ()
 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.
 
Side classify (const TPoint &iPoint) const
 Return on what side a point is located.
 
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 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, typename MMPAabb, typename NPRay, typename PPRay>
Result intersect (const Aabb2D< T, MMPAabb > &aabb, const Ray2D< T, NPRay, PPRay > &ray, const Vector2D< 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 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.
 

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

◆ support()

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

return origin of ray.

the origin is also the support point of the ray.

Definition at line 97 of file ray_2d.inl.

References support().

Referenced by intersect(), intersect(), intersect(), intersect(), lass::prim::SimplePolygon2D< T, NoDegenerate >::intersect(), lass::prim::Triangle2D< U >::intersect(), lass::spat::PlanarMesh::shoot(), support(), and support().

◆ point()

template<typename T, class NP, class PP>
const Ray2D< T, NP, PP >::TPoint lass::prim::Ray2D< T, NP, PP >::point ( TParam iT) const

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 156 of file ray_2d.inl.

References point().

Referenced by lass::spat::PlanarMesh::locate(), point(), and lass::spat::PlanarMesh::shoot().

◆ t()

template<typename T, class NP, class PP>
const Ray2D< T, NP, PP >::TValue lass::prim::Ray2D< T, NP, PP >::t ( const TPoint & iPoint) const

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 t().

Referenced by lass::spat::PlanarMesh::locate(), lass::spat::PlanarMesh::shoot(), and t().

Friends And Related Symbol Documentation

◆ intersect() [1/4]

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.

◆ intersect() [2/4]

template<typename T, typename MMPAabb, typename NPRay, typename PPRay>
Result intersect ( const Aabb2D< T, MMPAabb > & aabb,
const Ray2D< T, NPRay, PPRay > & ray,
const Vector2D< 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
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 132 of file aabb_2d_ray_2d.h.

◆ intersect() [3/4]

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.

◆ intersect() [4/4]

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.


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