Ogre::Ray Class Reference
Core » Math

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

`#include <OgreRay.h>`

## Public Member Functions

| Ray ()
| Ray (const Vector3 &origin, const Vector3 &direction)
const Vector3 & | getDirection (void) const
| Gets the direction of the ray. More...
const Vector3 & | getOrigin (void) const
| Gets the origin of the ray. More...
Vector3 | getPoint (Real t) const
| Gets the position of a point t units along the ray. More...
std::pair< bool, Real > | intersects (const Plane &p) const
| Tests whether this ray intersects the given plane. More...
std::pair< bool, Real > | intersects (const PlaneBoundedVolume &p) const
| Tests whether this ray intersects the given plane bounded volume. More...
std::pair< bool, Real > | intersects (const Sphere &s) const
| Tests whether this ray intersects the given sphere. More...
std::pair< bool, Real > | intersects (const AxisAlignedBox &box) const
| Tests whether this ray intersects the given box. More...
Vector3 | operator* (Real t) const
| Gets the position of a point t units along the ray. More...
void | setDirection (const Vector3 &dir)
| Sets the direction of the ray. More...
void | setOrigin (const Vector3 &origin)
| Sets the origin of the ray. More...

## Protected Attributes

Vector3 | mDirection
Vector3 | mOrigin

## Detailed Description

Representation of a ray in space, i.e.

a line with an origin and direction.

Definition at line 46 of file OgreRay.h.

## Constructor & Destructor Documentation

## Ray() [1/2]

Ogre::Ray::Ray | ( |  | ) |

Definition at line 52 of file OgreRay.h.

## Ray() [2/2]

Ogre::Ray::Ray | ( | const Vector3 & | origin,
|  | const Vector3 & | direction
| ) |  |

Definition at line 53 of file OgreRay.h.

## Member Function Documentation

## getDirection()

const Vector3& Ogre::Ray::getDirection | ( | void |  | ) | const

Gets the direction of the ray.

Definition at line 64 of file OgreRay.h.

## getOrigin()

const Vector3& Ogre::Ray::getOrigin | ( | void |  | ) | const

Gets the origin of the ray.

Definition at line 59 of file OgreRay.h.

## getPoint()

Vector3 Ogre::Ray::getPoint | ( | Real | t | ) | const

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

Definition at line 67 of file OgreRay.h.

## intersects() [1/4]

std::pair<bool, Real> Ogre::Ray::intersects | ( | const Plane & | p | ) | const

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().

Definition at line 82 of file OgreRay.h.

References Ogre::Math::intersects().

## intersects() [2/4]

std::pair<bool, Real> Ogre::Ray::intersects | ( | const PlaneBoundedVolume & | p | ) | const

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().

Definition at line 92 of file OgreRay.h.

References Ogre::Math::intersects(), Ogre::PlaneBoundedVolume::outside, Ogre::PlaneBoundedVolume::planes, and Ogre::Plane::POSITIVE_SIDE.

## intersects() [3/4]

std::pair<bool, Real> Ogre::Ray::intersects | ( | const Sphere & | s | ) | const

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().

Definition at line 102 of file OgreRay.h.

References Ogre::Math::intersects().

## intersects() [4/4]

std::pair<bool, Real> Ogre::Ray::intersects | ( | const AxisAlignedBox & | box | ) | const

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().

Definition at line 112 of file OgreRay.h.

References Ogre::Math::intersects().

## operator*()

Vector3 Ogre::Ray::operator* | ( | Real | t | ) | const

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

Definition at line 72 of file OgreRay.h.

## setDirection()

void Ogre::Ray::setDirection | ( | const Vector3 & | dir | ) |

Sets the direction of the ray.

Definition at line 62 of file OgreRay.h.

## setOrigin()

void Ogre::Ray::setOrigin | ( | const Vector3 & | origin | ) |

Sets the origin of the ray.

Definition at line 57 of file OgreRay.h.

## Member Data Documentation

## mDirection

Vector3 Ogre::Ray::mDirection

protected

Definition at line 50 of file OgreRay.h.

## mOrigin

Vector3 Ogre::Ray::mOrigin

protected

Definition at line 49 of file OgreRay.h.

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

- OgreRay.h

Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.