Ray Class Reference

A 2D Ray. More...

#include <Math/MathCommon.h>

List of all members.

Public Member Functions

 Ray ()
 Default constructor. The ray should not be used until after setting the directions.
 Ray (const Point2f &s, const Vector2f &d)
 Constructs a specific ray.
 Ray (const Line &l)
 Constructs a ray from a line segment directed from the start of the line to the end.
void Set (const Point2f &p)
 Sets the starting position of the Ray.
void Set (const Vector2f &v)
 Sets the direction of the Ray.
void Set (const Point2f &p, const Vector2f &v)
 Sets the starting position and the direction of the ray.
Point2f PointOnLine (float t) const
 Computes the point on the Ray at some given time.

Public Attributes

Point2f start
Vector2f dir

Detailed Description

A 2D Ray.


Constructor & Destructor Documentation

Ray::Ray ( const Point2f s,
const Vector2f d 
) [inline]

Constructs a specific ray.

Parameters:
[in] s the starting position.
[in] d the direction (should never be the zero vector), does not have to be normalized.
Ray::Ray ( const Line l  )  [inline]

Constructs a ray from a line segment directed from the start of the line to the end.

Parameters:
[in] l the line to construct the Ray from. NOTE: l.a should not equal l.b

Member Function Documentation

Point2f Ray::PointOnLine ( float  t  )  const

Computes the point on the Ray at some given time.

Parameters:
[in] t the time.
Returns:
The point on the Ray at time t.

NOTE: A fair number of the collision related functions have been adapted from the book "Real-Time Collision Detection" by Christer Ericson. I note the page numbers where applicable in the code. Its a great referance material and comes highly recommended.

void Ray::Set ( const Point2f p,
const Vector2f v 
) [inline]

Sets the starting position and the direction of the ray.

Parameters:
[in] p the new starting position.
[in] v the new direction (should never be the zero vector), does not have to be normalized.
void Ray::Set ( const Vector2f v  )  [inline]

Sets the direction of the Ray.

Parameters:
[in] v the new direction (should never be the zero vector), does not have to be normalized.
void Ray::Set ( const Point2f p  )  [inline]

Sets the starting position of the Ray.

Parameters:
[in] p the new starting position.

Member Data Documentation

Direction of the ray. Must always be normalized.

Starting position for the ray.


The documentation for this class was generated from the following files:
Generated on Mon Apr 5 19:08:06 2010 for BrickOut |ReDuX| by  doxygen 1.6.3