|  | overview |  | wiki |  | api reference |  | download

- Main Page
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Functions Variables Typedefs Enumerations Enumerator
Public Member Functions | Static Public Attributes
gameplay::Ray Class Reference

`#include <Ray.h>`

List of all members.

## Public Member Functions

| Ray ()
| Ray (const Vector3 &origin, const Vector3 &direction)
| Ray (float originX, float originY, float originZ, float dirX, float dirY, float dirZ)
| Ray (const Ray &copy)
| ~Ray ()
const Vector3 & | getOrigin () const
void | setOrigin (const Vector3 &origin)
void | setOrigin (float x, float y, float z)
const Vector3 & | getDirection () const
void | setDirection (const Vector3 &direction)
void | setDirection (float x, float y, float z)
float | intersects (const BoundingSphere &sphere) const
float | intersects (const BoundingBox &box) const
float | intersects (const Frustum &frustum) const
float | intersects (const Plane &plane) const
void | set (const Vector3 &origin, const Vector3 &direction)
void | set (const Ray &ray)
void | transform (const Matrix &matrix)
Ray & | operator*= (const Matrix &matrix)

## Static Public Attributes

static const int | INTERSECTS_NONE = -1

## Detailed Description

Defines a 3-dimensional ray.

Rays direction vector are always normalized.

## Constructor & Destructor Documentation

gameplay::Ray::Ray | ( |  | ) |

Constructs a new ray initialized to origin(0,0,0) and direction(0,0,1).

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

Constructs a new ray initialized to the specified values.

Parameters:

  origin | The ray's origin.
  direction | The ray's direction.

gameplay::Ray::Ray | ( | float | originX,
|  | float | originY,
|  | float | originZ,
|  | float | dirX,
|  | float | dirY,
|  | float | dirZ
| ) |  |

Constructs a new ray initialized to the specified values.

Parameters:

  originX | The x coordinate of the origin.
  originY | The y coordinate of the origin.
  originZ | The z coordinate of the origin.
  dirX | The x coordinate of the direction.
  dirY | The y coordinate of the direction.
  dirZ | The z coordinate of the direction.

gameplay::Ray::Ray | ( | const Ray & | copy | ) |

Constructs a new ray from the given ray.

Parameters:

  copy | The ray to copy.

gameplay::Ray::~Ray | ( |  | ) |

Destructor.

## Member Function Documentation

const Vector3& gameplay::Ray::getDirection | ( |  | ) | const

Gets the ray's direction.

Returns:
  The ray's direction.

const Vector3& gameplay::Ray::getOrigin | ( |  | ) | const

Gets the ray's origin.

Returns:
  The ray's origin.

float gameplay::Ray::intersects | ( | const BoundingSphere & | sphere | ) | const

Tests whether this ray intersects the specified bounding sphere.

Parameters:

  sphere | The bounding sphere to test intersection with.

Returns:
  The distance from the origin of this ray to the bounding object or INTERSECTS_NONE if this ray does not intersect the bounding object.

float gameplay::Ray::intersects | ( | const BoundingBox & | box | ) | const

Tests whether this ray intersects the specified bounding box.

Parameters:

  box | The bounding box to test intersection with.

Returns:
  The distance from the origin of this ray to the bounding object or INTERSECTS_NONE if this ray does not intersect the bounding object.

float gameplay::Ray::intersects | ( | const Frustum & | frustum | ) | const

Tests whether this ray intersects the specified frustum.

Parameters:

  frustum | The frustum to test intersection with.

Returns:
  The distance from the origin of this ray to the frustum or INTERSECTS_NONE if this ray does not intersect the frustum.

float gameplay::Ray::intersects | ( | const Plane & | plane | ) | const

Tests whether this ray intersects the specified plane and returns the distance from the origin of the ray to the plane.

Parameters:

  plane | The plane to test intersection with.

Returns:
  The distance from the origin of this ray to the plane or INTERSECTS_NONE if this ray does not intersect the plane.

Ray& gameplay::Ray::operator*= | ( | const Matrix & | matrix | ) | `[inline]`

Transforms this ray by the given matrix.

Parameters:

  matrix | The matrix to transform by.

Returns:
  This ray, after the transformation occurs.

void gameplay::Ray::set | ( | const Vector3 & | origin,
|  | const Vector3 & | direction
| ) |  |

Sets this ray to the specified values.

Parameters:

  origin | The ray's origin.
  direction | The ray's direction.

void gameplay::Ray::set | ( | const Ray & | ray | ) |

Sets this ray to the given ray.

Parameters:

  ray | The ray to copy.

void gameplay::Ray::setDirection | ( | const Vector3 & | direction | ) |

Sets the ray's direction to the given vector.

Parameters:

  direction | The new direction vector.

void gameplay::Ray::setDirection | ( | float | x,
|  | float | y,
|  | float | z
| ) |  |

Sets the ray's direction.

Parameters:

  x | The x coordinate of the direction.
  y | The y coordinate of the direction.
  z | The z coordinate of the direction.

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

Sets the ray's origin to the given point.

Parameters:

  origin | The new origin.

void gameplay::Ray::setOrigin | ( | float | x,
|  | float | y,
|  | float | z
| ) |  |

Sets the ray's origin.

Parameters:

  x | The x coordinate of the origin.
  y | The y coordinate of the origin.
  z | The z coordinate of the origin.

void gameplay::Ray::transform | ( | const Matrix & | matrix | ) |

Transforms this ray by the given transformation matrix.

Parameters:

  matrix | The transformation matrix to transform by.

## Member Data Documentation

const int gameplay::Ray::INTERSECTS_NONE = -1`[static]`

Represents when a 3D entity does not intersect a ray.

All Classes Functions Variables Typedefs Enumerations Enumerator