MezzanineEngine March 18, 2012

Mezzanine::Ray Class Reference

This is used to indicate a line with one end. More...

#include <ray.h>

List of all members.

Public Member Functions

 Ray ()
 Default constructor.
 Ray (Vector3 From_, Vector3 To_)
 Thorough constructor.
 Ray (Ogre::Ray Ray2)
 Compatibily constructor.
Vector3 GetDirection () const
 Gets the direction of this ray.
Ray GetNormal () const
 This returns a normalized copy of this ray.
Ogre::Ray GetOgreRay () const
 Gets an Ogre::Ray that contains this Rays information.
Real Length () const
 Measures the distance distance of this ray.
void Normalize ()
 Turns this Ray into its own normal.
Ray operator* (const Real &scalar) const
 This returns a ray lengthened by the given multiple.
void operator*= (const Real &scalar)
 This lengthens the Ray by the given multiple.
Ray operator/ (const Real &scalar) const
 This returns a ray scaled by the given divisor.
void operator/= (const Real &scalar)
 This scales the Ray by the given divisor.

Public Attributes

Vector3 From
 The origin point of the Vector.
Vector3 To
 A point on the line of the ray.

Detailed Description

This is used to indicate a line with one end.

Currently this is just a collection of two vector3s with a couple of constructors.

Definition at line 60 of file ray.h.


Constructor & Destructor Documentation

Mezzanine::Ray::Ray ( )

Default constructor.

This create a ray starting at 0,0,0 pointing to 0,1,0,

Definition at line 58 of file ray.cpp.

Mezzanine::Ray::Ray ( Vector3  From_,
Vector3  To_ 
)

Thorough constructor.

This accepts 2 Vector3s and uses them to build the ray.

Parameters:
From_The origin fo the new Ray.
To_A point along the line for the destination line.

Definition at line 63 of file ray.cpp.

Mezzanine::Ray::Ray ( Ogre::Ray  Ray2)

Compatibily constructor.

This accepts an Ogre Ray, (graphics subsystem) to make ray.

Parameters:
Ray2This is the Ogre::Ray.

Definition at line 69 of file ray.cpp.


Member Function Documentation

Vector3 Mezzanine::Ray::GetDirection ( ) const

Gets the direction of this ray.

Returns:
Returns a vector3 that is the direction from it's origin to it's destination.

Definition at line 97 of file ray.cpp.

Ray Mezzanine::Ray::GetNormal ( ) const

This returns a normalized copy of this ray.

This will get a ray that is 1 unit in length with the same From point as this ray, pointing in the same direction as this ray.

Returns:
Returns a ray that is a normalized copy of this array.

Todo:
discuss the merits throwing an error here.

Definition at line 104 of file ray.cpp.

Ogre::Ray Mezzanine::Ray::GetOgreRay ( ) const

Gets an Ogre::Ray that contains this Rays information.

Used to aid interopability, this will return afresh Ogre::Ray with the same data as this Ray.

Returns:
This returns an Ogre::Ray that contains the same information as this rays information.

Definition at line 78 of file ray.cpp.

Real Mezzanine::Ray::Length ( ) const

Measures the distance distance of this ray.

This uses the distance method of Vector3 to determine the current length of this ray.

Returns:
This returns a real value which contains the length.

Definition at line 92 of file ray.cpp.

void Mezzanine::Ray::Normalize ( )

Turns this Ray into its own normal.

This will change the ray to be exactly 1 unit long, but pointing the same direction.

Definition at line 117 of file ray.cpp.

Ray Mezzanine::Ray::operator* ( const Real scalar) const

This returns a ray lengthened by the given multiple.

This returns a ray changed in length by the amount in the scalar. Specifically this subracts the From value out of the To value, then multiplies the To value by the scalar, then adds the from value back in.

Returns:
This returns a copy of the ray scaled by the requested amount.
Parameters:
scalarThe amount to multiply by.

Definition at line 131 of file ray.cpp.

void Mezzanine::Ray::operator*= ( const Real scalar)

This lengthens the Ray by the given multiple.

This ray ischanged in length by the amount in the scalar. Specifically this subracts the From value out of the To value, then multiplies the To value by the scalar, then adds the from value back in.

Parameters:
scalarThe amount to multiply by.

Definition at line 147 of file ray.cpp.

Ray Mezzanine::Ray::operator/ ( const Real scalar) const

This returns a ray scaled by the given divisor.

This returns an ray divided in length by the amount in the scalar. Specifically this subracts the From value out of the To value, then divides the To value by the scalar, then adds the from value back in.

Returns:
This returns a copy of the ray scaled by the requested amount.
Parameters:
scalarThe amount to divide by.

Definition at line 139 of file ray.cpp.

void Mezzanine::Ray::operator/= ( const Real scalar)

This scales the Ray by the given divisor.

This ray is divided in length by the amount in the scalar. Specifically this subracts the From value out of the To value, then divides the To value by the scalar, then adds the from value back in.

Parameters:
scalarThe amount to divide by.

Definition at line 152 of file ray.cpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines