overview wiki api reference download
 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 Vector3getOrigin () const
void setOrigin (const Vector3 &origin)
void setOrigin (float x, float y, float z)
const Vector3getDirection () 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)
Rayoperator*= (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

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:
originThe ray's origin.
directionThe 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:
originXThe x coordinate of the origin.
originYThe y coordinate of the origin.
originZThe z coordinate of the origin.
dirXThe x coordinate of the direction.
dirYThe y coordinate of the direction.
dirZThe z coordinate of the direction.
gameplay::Ray::Ray ( const Ray copy)

Constructs a new ray from the given ray.

Parameters:
copyThe ray to copy.

Destructor.


Member Function Documentation

Gets the ray's direction.

Returns:
The ray's direction.

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:
sphereThe 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:
boxThe 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:
frustumThe 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:
planeThe 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:
matrixThe 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:
originThe ray's origin.
directionThe ray's direction.
void gameplay::Ray::set ( const Ray ray)

Sets this ray to the given ray.

Parameters:
rayThe ray to copy.
void gameplay::Ray::setDirection ( const Vector3 direction)

Sets the ray's direction to the given vector.

Parameters:
directionThe new direction vector.
void gameplay::Ray::setDirection ( float  x,
float  y,
float  z 
)

Sets the ray's direction.

Parameters:
xThe x coordinate of the direction.
yThe y coordinate of the direction.
zThe z coordinate of the direction.
void gameplay::Ray::setOrigin ( const Vector3 origin)

Sets the ray's origin to the given point.

Parameters:
originThe new origin.
void gameplay::Ray::setOrigin ( float  x,
float  y,
float  z 
)

Sets the ray's origin.

Parameters:
xThe x coordinate of the origin.
yThe y coordinate of the origin.
zThe z coordinate of the origin.
void gameplay::Ray::transform ( const Matrix matrix)

Transforms this ray by the given transformation matrix.

Parameters:
matrixThe 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