MezzanineEngine 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Mezzanine::Ray Class Reference

This represents a line placed in 3D space and is used with spacial queries. More...

#include <ray.h>

+ Collaboration diagram for Mezzanine::Ray:

Public Types

typedef std::pair< Boolean, RayGeometryRayTestResult
 This is a type used for the return of a ray intersection test. More...
 
typedef std::pair< Boolean,
Vector3
PlaneRayTestResult
 This is a type used for the ray intersection tests performed on Planes. More...
 

Public Member Functions

 Ray ()
 Default constructor. More...
 
 Ray (const Ray &Other)
 Copy constructor. More...
 
 Ray (const Vector3 &To)
 Destination constructor. More...
 
 Ray (const Vector3 &From, const Vector3 &To)
 Descriptive constructor. More...
 
 Ray (const Ogre::Ray &InternalRay)
 Internal constructor. More...
 
 ~Ray ()
 Class destructor.
 
void ExtractOgreRay (const Ogre::Ray &InternalRay)
 Changes this Ray to match the Ogre Ray. More...
 
Vector3 GetDirection () const
 Gets the normal of this ray. More...
 
Ray GetNormal () const
 Gets a copy of this ray with a unit length of 1. More...
 
Ogre::Ray GetOgreRay () const
 Gets an Ogre::Ray that contains this Rays information. More...
 
PlaneRayTestResult Intersects (const Plane &ToCheck) const
 Checks to see if this ray intersects a plane. More...
 
GeometryRayTestResult Intersects (const Sphere &ToCheck) const
 Checks to see if this ray intersects a sphere. More...
 
GeometryRayTestResult Intersects (const AxisAlignedBox &ToCheck) const
 Checks to see if this ray intersects an AABB. More...
 
Real Length () const
 Measures the distance of this ray. More...
 
RayNormalize ()
 Reduces the length of this ray to 1 unit. More...
 
Boolean operator!= (const Ray &Other) const
 Inequality operator. More...
 
Ray operator* (const Real Factor) const
 Gets a Ray with a length longer than this one by the specified factor. More...
 
Rayoperator*= (const Real Factor)
 Increases the length of this Ray by the factor provided. More...
 
Ray operator/ (const Real Factor) const
 Gets a Ray with a length shorter than this one by the specified factor. More...
 
Rayoperator/= (const Real Factor)
 Decreases the length of this Ray by the factor provided. More...
 
void operator= (const Ray &Other)
 Assignment operator. More...
 
Boolean operator== (const Ray &Other) const
 Equality operator. More...
 
void ProtoDeSerialize (const XML::Node &SelfRoot)
 Take the data stored in an XML Node and overwrite this object with it. More...
 
void ProtoSerialize (XML::Node &ParentNode) const
 Convert this class to an XML::Node ready for serialization. More...
 

Static Public Member Functions

static String GetSerializableName ()
 Get the name of the the XML tag the proxy class will leave behind as its instances are serialized. More...
 

Public Attributes

Vector3 Destination
 The direction of this ray or end point of this ray depending on mode.
 
Vector3 Origin
 The origin point of the Vector.
 

Detailed Description

This represents a line placed in 3D space and is used with spacial queries.

Definition at line 60 of file ray.h.

Member Typedef Documentation

typedef std::pair<Boolean,Ray> Mezzanine::Ray::GeometryRayTestResult

This is a type used for the return of a ray intersection test.

This type provides more verbose return data that can be used for further tests.

Definition at line 68 of file ray.h.

typedef std::pair<Boolean,Vector3> Mezzanine::Ray::PlaneRayTestResult

This is a type used for the ray intersection tests performed on Planes.

This type provides more verbose return data that can be used for further tests.

Definition at line 65 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 57 of file ray.cpp.

Mezzanine::Ray::Ray ( const Ray Other)

Copy constructor.

Parameters
OtherThe other Ray to copy from.

Definition at line 62 of file ray.cpp.

Mezzanine::Ray::Ray ( const Vector3 To)

Destination constructor.

This keeps the origin at 0,0,0.

Parameters
ToThe destination vector for the ray.

Definition at line 67 of file ray.cpp.

Mezzanine::Ray::Ray ( const Vector3 From,
const Vector3 To 
)

Descriptive constructor.

Parameters
FromThe origin for the new Ray.
ToA point along the line for the destination line.

Definition at line 71 of file ray.cpp.

Mezzanine::Ray::Ray ( const Ogre::Ray &  InternalRay)
explicit

Internal constructor.

Parameters
InternalRayThis is the Ogre::Ray to copy from.

Definition at line 76 of file ray.cpp.

Member Function Documentation

void Mezzanine::Ray::ExtractOgreRay ( const Ogre::Ray &  InternalRay)

Changes this Ray to match the Ogre Ray.

Parameters
InternalRayThe Ogre::Ray to copy.

Definition at line 121 of file ray.cpp.

Vector3 Mezzanine::Ray::GetDirection ( ) const

Gets the normal of this ray.

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

Definition at line 88 of file ray.cpp.

Ray Mezzanine::Ray::GetNormal ( ) const

Gets a copy of this ray with a unit length of 1.

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

Definition at line 91 of file ray.cpp.

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

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

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

Definition at line 124 of file ray.cpp.

String Mezzanine::Ray::GetSerializableName ( )
static

Get the name of the the XML tag the proxy class will leave behind as its instances are serialized.

Returns
A string containing the name of this class.

Definition at line 168 of file ray.cpp.

Ray::PlaneRayTestResult Mezzanine::Ray::Intersects ( const Plane ToCheck) const

Checks to see if this ray intersects a plane.

Parameters
ToCheckThe plane to check for a hit.
Returns
Returns a std::pair containing whether or not the ray hit, and if it did the point in 3D space where it hit.

Definition at line 109 of file ray.cpp.

Ray::GeometryRayTestResult Mezzanine::Ray::Intersects ( const Sphere ToCheck) const

Checks to see if this ray intersects a sphere.

Parameters
ToCheckThe sphere to check for a hit.
Returns
Returns a std::pair containing whether or not the ray hit, and if it did the subsection of the ray that went through the sphere.

Definition at line 112 of file ray.cpp.

Ray::GeometryRayTestResult Mezzanine::Ray::Intersects ( const AxisAlignedBox ToCheck) const

Checks to see if this ray intersects an AABB.

Parameters
ToCheckThe AABB to check for a hit.
Returns
Returns a std::pair containing whether or not the ray hit, and if it did the subsection of the ray that went through the AABB.

Definition at line 115 of file ray.cpp.

Real Mezzanine::Ray::Length ( ) const

Measures the distance of this ray.

Returns
This returns a real value which contains the distance from the origin to the destination.

Definition at line 85 of file ray.cpp.

Ray & Mezzanine::Ray::Normalize ( )

Reduces the length of this ray to 1 unit.

Returns
Returns a reference to this.

Definition at line 100 of file ray.cpp.

Boolean Mezzanine::Ray::operator!= ( const Ray Other) const

Inequality operator.

Parameters
OtherThe other Ray to compare with.
Returns
Returns true if this Ray is not the same as the other provided Ray, false otherwise.

Definition at line 194 of file ray.cpp.

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

Gets a Ray with a length longer than this one by the specified factor.

Parameters
FactorThat factor by which to increase the length of this Ray.
Returns
Returns a new lengthened Ray.

Definition at line 179 of file ray.cpp.

Ray & Mezzanine::Ray::operator*= ( const Real  Factor)

Increases the length of this Ray by the factor provided.

Parameters
FactorThat factor by which to increase the length of this Ray.
Returns
Returns a reference to this.

Definition at line 185 of file ray.cpp.

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

Gets a Ray with a length shorter than this one by the specified factor.

Parameters
FactorThat factor by which to decrease the length of this Ray.
Returns
Returns a new lengthened Ray.

Definition at line 182 of file ray.cpp.

Ray & Mezzanine::Ray::operator/= ( const Real  Factor)

Decreases the length of this Ray by the factor provided.

Parameters
FactorThat factor by which to decrease the length of this Ray.
Returns
Returns a reference to this.

Definition at line 188 of file ray.cpp.

void Mezzanine::Ray::operator= ( const Ray Other)

Assignment operator.

Parameters
OtherThe other Ray to copy from.

Definition at line 176 of file ray.cpp.

Boolean Mezzanine::Ray::operator== ( const Ray Other) const

Equality operator.

Parameters
OtherThe other Ray to compare with.
Returns
Returns true if this Ray is the same as the other provided Ray, false otherwise.

Definition at line 191 of file ray.cpp.

void Mezzanine::Ray::ProtoDeSerialize ( const XML::Node SelfRoot)

Take the data stored in an XML Node and overwrite this object with it.

Parameters
SelfRootAn XML::Node containing the data to populate this class with.

Definition at line 148 of file ray.cpp.

void Mezzanine::Ray::ProtoSerialize ( XML::Node ParentNode) const

Convert this class to an XML::Node ready for serialization.

Parameters
ParentNodeThe point in the XML hierarchy that all this renderable should be appended to.

Definition at line 130 of file ray.cpp.


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