Spinning Topp Logo BlackTopp Studios
inc
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 MathTools::GeometryRayTestResult GeometryRayTestResult
 This is a type used for the return of a ray intersection test. More...
 
typedef std::pair< Boole, Vector3PlaneRayTestResult
 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 &Dir)
 Destination constructor. More...
 
 Ray (const Vector3 &From, const Vector3 &Dir)
 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...
 
const Vector3GetNormal () const
 Gets the normal of this Ray. More...
 
Ogre::Ray GetOgreRay () const
 Gets an Ogre::Ray that contains this Rays information. More...
 
const Vector3GetOrigin () const
 Gets the origin of this ray. More...
 
Vector3 GetPointAtDistance (const Real &Distance)
 Gets a point on the ray at a distance. 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...
 
Boole operator!= (const Ray &Other) const
 Inequality operator. More...
 
void operator= (const Ray &Other)
 Assignment operator. More...
 
Boole 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...
 
void SetNormal (const Vector3 &FreshNormal)
 Sets the normal of this Ray. More...
 
void SetOrigin (const Vector3 &FreshOrigin)
 Sets the origin of this ray. More...
 

Static Public Member Functions

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

Public Attributes

Vector3 Normal
 The direction this ray is pointing.
 
Vector3 Origin
 The origin point of the Vector.
 

Detailed Description

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

This is made of Two Vector3 instances. The Origin of a Ray can be thought of as its starting location. The Normal of the Ray will be another point defined as a Vector3 that is always 1 unit away, as mathematical precision allows. This normal is used to indicate direction and from the two points any other points on the Ray can be calculated.

Definition at line 67 of file ray.h.

Member Typedef Documentation

typedef MathTools::GeometryRayTestResult 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 76 of file ray.h.

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 72 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 Dir)

Destination constructor.

This keeps the origin at 0,0,0.

Parameters
DirThe direction this Ray is pointing in.

Definition at line 67 of file ray.cpp.

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

Descriptive constructor.

Parameters
FromThe origin for the new Ray.
DirThe direction this Ray is pointing in. This will be normalizedprior to use.

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 112 of file ray.cpp.

const Vector3 & Mezzanine::Ray::GetNormal ( ) const

Gets the normal of this Ray.

Returns
Returns a Vector3 that is the direction this ray is pointing.

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

const Vector3 & Mezzanine::Ray::GetOrigin ( ) const

Gets the origin of this ray.

Returns
Returns a Vector3 containing the origin of this Ray.

Definition at line 91 of file ray.cpp.

Vector3 Mezzanine::Ray::GetPointAtDistance ( const Real Distance)

Gets a point on the ray at a distance.

Parameters
DistanceThe distance from the origin to get the position of.
Returns
Returns a point in 3D space that is on the ray at the specified distance from the origin.

Definition at line 97 of file ray.cpp.

String Mezzanine::Ray::GetSerializableName ( )
static

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

Returns
A string containing the name of this class.

Definition at line 159 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 100 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 103 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 106 of file ray.cpp.

Boole 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 173 of file ray.cpp.

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

Assignment operator.

Parameters
OtherThe other Ray to copy from.

Definition at line 167 of file ray.cpp.

Boole 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 170 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 139 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 ray should be appended to.

Definition at line 121 of file ray.cpp.

void Mezzanine::Ray::SetNormal ( const Vector3 FreshNormal)

Sets the normal of this Ray.

Parameters
FreshNormalA Vector3 that will be normalized and is the direction this Ray is pointing.

Definition at line 88 of file ray.cpp.

void Mezzanine::Ray::SetOrigin ( const Vector3 FreshOrigin)

Sets the origin of this ray.

Parameters
FreshOriginA Vector3 that will become the origin of this Ray.

Definition at line 94 of file ray.cpp.


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