Public Member Functions | Public Attributes

gmtl::Ray< DATA_TYPE > Class Template Reference

Describes a ray. More...

#include <Ray.h>

Inheritance diagram for gmtl::Ray< DATA_TYPE >:
Inheritance graph
[legend]
Collaboration diagram for gmtl::Ray< DATA_TYPE >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Ray ()
 Constructs a ray at the origin with a zero vector.
 Ray (const Point< DATA_TYPE, 3 > &origin, const Vec< DATA_TYPE, 3 > &dir)
 Constructs a ray with the given origin and vector.
 Ray (const Ray &lineseg)
 Constructs an exact duplicate of the given ray.
const Point< DATA_TYPE, 3 > & getOrigin () const
 Gets the origin of the ray.
void setOrigin (const Point< DATA_TYPE, 3 > &origin)
 Sets the origin point for this ray.
const Vec< DATA_TYPE, 3 > & getDir () const
 Gets the vector describing the direction and length of the ray.
void setDir (const Vec< DATA_TYPE, 3 > &dir)
 Sets the vector describing the direction and length of the ray.

Public Attributes

Point< DATA_TYPE, 3 > mOrigin
 The origin of the ray.
Vec< DATA_TYPE, 3 > mDir
 The vector along which the ray lies.

Detailed Description

template<class DATA_TYPE>
class gmtl::Ray< DATA_TYPE >

Describes a ray.

This is represented by a point origin O and a normalized vector direction. Any point on the ray can be described as

P(s) = O + Vs

where 0 <= s <= 1

Parameters:
DATA_TYPE the internal type used for the point and vector

Definition at line 26 of file Ray.h.


Constructor & Destructor Documentation

template<class DATA_TYPE>
gmtl::Ray< DATA_TYPE >::Ray (  )  [inline]

Constructs a ray at the origin with a zero vector.

Definition at line 32 of file Ray.h.

   {}

template<class DATA_TYPE>
gmtl::Ray< DATA_TYPE >::Ray ( const Point< DATA_TYPE, 3 > &  origin,
const Vec< DATA_TYPE, 3 > &  dir 
) [inline]

Constructs a ray with the given origin and vector.

Parameters:
origin the point at which the ray starts
dir the vector describing the direction and length of the ray starting at origin

Definition at line 42 of file Ray.h.

      : mOrigin( origin ), mDir( dir )
   {}

template<class DATA_TYPE>
gmtl::Ray< DATA_TYPE >::Ray ( const Ray< DATA_TYPE > &  lineseg  )  [inline]

Constructs an exact duplicate of the given ray.

Parameters:
lineseg the ray to copy

Definition at line 53 of file Ray.h.

   {
      mOrigin = lineseg.mOrigin;
      mDir = lineseg.mDir;
   }


Member Function Documentation

template<class DATA_TYPE>
const Vec<DATA_TYPE, 3>& gmtl::Ray< DATA_TYPE >::getDir (  )  const [inline]

Gets the vector describing the direction and length of the ray.

Returns:
the ray's vector

Definition at line 84 of file Ray.h.

   {
      return mDir;
   }

template<class DATA_TYPE>
const Point<DATA_TYPE, 3>& gmtl::Ray< DATA_TYPE >::getOrigin (  )  const [inline]

Gets the origin of the ray.

Returns:
the point at the beginning of the line

Definition at line 64 of file Ray.h.

   {
      return mOrigin;
   }

template<class DATA_TYPE>
void gmtl::Ray< DATA_TYPE >::setDir ( const Vec< DATA_TYPE, 3 > &  dir  )  [inline]

Sets the vector describing the direction and length of the ray.

Parameters:
dir the ray's vector

Definition at line 94 of file Ray.h.

   {
      mDir = dir;
   }

template<class DATA_TYPE>
void gmtl::Ray< DATA_TYPE >::setOrigin ( const Point< DATA_TYPE, 3 > &  origin  )  [inline]

Sets the origin point for this ray.

Parameters:
origin the point at which the ray starts

Definition at line 74 of file Ray.h.

   {
      mOrigin = origin;
   }


Member Data Documentation

template<class DATA_TYPE>
Vec<DATA_TYPE, 3> gmtl::Ray< DATA_TYPE >::mDir

The vector along which the ray lies.

Definition at line 108 of file Ray.h.

template<class DATA_TYPE>
Point<DATA_TYPE, 3> gmtl::Ray< DATA_TYPE >::mOrigin

The origin of the ray.

Definition at line 103 of file Ray.h.


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