omegalib  13.1
omicron::Ray Class Reference

Representation of a ray in space, i.e. More...

#include <Ray.h>

Public Member Functions

 Ray ()
 
 Ray (const Vector3f &origin, const Vector3f &direction)
 
void setOrigin (const Vector3f &origin)
 Sets the origin of the ray. More...
 
const Vector3fgetOrigin (void) const
 Gets the origin of the ray. More...
 
void setDirection (const Vector3f &dir)
 Sets the direction of the ray. More...
 
const Vector3fgetDirection (void) const
 Gets the direction of the ray. More...
 
Vector3f getPoint (float t) const
 Gets the position of a point t units along the ray. More...
 
Vector3f operator* (float t) const
 Gets the position of a point t units along the ray. More...
 
std::pair< bool, realintersects (const Plane &p) const
 Tests whether this ray intersects the given plane. More...
 
std::pair< bool, realintersects (const PlaneBoundedVolume &p) const
 Tests whether this ray intersects the given plane bounded volume. More...
 
std::pair< bool, realintersects (const Sphere &s) const
 Tests whether this ray intersects the given sphere. More...
 
std::pair< bool, realintersects (const AlignedBox3 &box) const
 Tests whether this ray intersects the given box. More...
 
Vector3f projectPoint (const Vector3f &point) const
 Computes the projection of a point. More...
 

Protected Attributes

Vector3f mOrigin
 
Vector3f mDirection
 

Detailed Description

Representation of a ray in space, i.e.

a line with an origin and direction.

Constructor & Destructor Documentation

omicron::Ray::Ray ( )
inline
omicron::Ray::Ray ( const Vector3f origin,
const Vector3f direction 
)
inline

Member Function Documentation

const Vector3f& omicron::Ray::getDirection ( void  ) const
inline

Gets the direction of the ray.

const Vector3f& omicron::Ray::getOrigin ( void  ) const
inline

Gets the origin of the ray.

Vector3f omicron::Ray::getPoint ( float  t) const
inline

Gets the position of a point t units along the ray.

std::pair<bool, real> omicron::Ray::intersects ( const Plane p) const
inline

Tests whether this ray intersects the given plane.

Returns
A pair structure where the first element indicates whether an intersection occurs, and if true, the second element will indicate the distance along the ray at which it intersects. This can be converted to a point in space by calling getPoint().
std::pair<bool, real> omicron::Ray::intersects ( const PlaneBoundedVolume p) const
inline

Tests whether this ray intersects the given plane bounded volume.

Returns
A pair structure where the first element indicates whether an intersection occurs, and if true, the second element will indicate the distance along the ray at which it intersects. This can be converted to a point in space by calling getPoint().
std::pair<bool, real> omicron::Ray::intersects ( const Sphere s) const
inline

Tests whether this ray intersects the given sphere.

Returns
A pair structure where the first element indicates whether an intersection occurs, and if true, the second element will indicate the distance along the ray at which it intersects. This can be converted to a point in space by calling getPoint().
std::pair<bool, real> omicron::Ray::intersects ( const AlignedBox3 box) const
inline

Tests whether this ray intersects the given box.

Returns
A pair structure where the first element indicates whether an intersection occurs, and if true, the second element will indicate the distance along the ray at which it intersects. This can be converted to a point in space by calling getPoint().
Vector3f omicron::Ray::operator* ( float  t) const
inline

Gets the position of a point t units along the ray.

Vector3f omicron::Ray::projectPoint ( const Vector3f point) const
inline

Computes the projection of a point.

Returns
the distance
void omicron::Ray::setDirection ( const Vector3f dir)
inline

Sets the direction of the ray.

void omicron::Ray::setOrigin ( const Vector3f origin)
inline

Sets the origin of the ray.

Member Data Documentation

Vector3f omicron::Ray::mDirection
protected
Vector3f omicron::Ray::mOrigin
protected

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