My Project
Public Member Functions | Public Attributes | List of all members
ParaEngine::CShapeRay Class Reference

A ray is a half-line P(t) = mOrig + mDir * t, with 0 <= t <= +infinity. More...

#include <ShapeRay.h>

Public Member Functions

 CShapeRay (const Vector3 &orig, const Vector3 &dir)
 
 CShapeRay (const CShapeRay &ray)
 Copy constructor.
 
float SquareDistance (const Vector3 &point, float *t=NULL) const
 
float Distance (const Vector3 &point, float *t=NULL) const
 
std::pair< bool, float > intersects (const CShapeAABB &box, const Matrix4 *world=NULL) const
 Tests whether this ray intersects the given box. More...
 
int IntersectPlane (const Plane *plane, Vector3 *point, float *distance) const
 
int IntersectBox (const CShapeBox *box, Vector3 *point, float *distance) const
 

Public Attributes

Vector3 mOrig
 Ray origin.
 
Vector3 mDir
 Normalized direction.
 

Detailed Description

A ray is a half-line P(t) = mOrig + mDir * t, with 0 <= t <= +infinity.

Member Function Documentation

§ IntersectBox()

int CShapeRay::IntersectBox ( const CShapeBox box,
Vector3 point,
float *  distance 
) const
Parameters
pointcan be NULL
distancecan be NULL
Returns
:1 if intersected; 0 otherwise

§ IntersectPlane()

int CShapeRay::IntersectPlane ( const Plane plane,
Vector3 point,
float *  distance 
) const
Returns
: 1:intersected -1:The plane is parallel to the ray; -2:The plane is facing away from the ray so no intersection occurs. -3:The intersection occurs behind the ray's origin.

§ intersects()

std::pair< bool, float > CShapeRay::intersects ( const CShapeAABB box,
const Matrix4 world = NULL 
) const

Tests whether this ray intersects the given box.

Parameters
boxaabb box
worlda rotation transform applied to AABB. This can be NULL.
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.

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