Om  1.0.0
A universal framework for multimedia simulation
Public Member Functions | Public Attributes | List of all members
om::math::Ray3D< T > Class Template Reference

A class that represents a ray in 3D space. More...

#include <omRay3D.h>

Public Member Functions

 Ray3D ()
 Create a ray starting at the origin pointing in the positive Z direction. More...
 
 Ray3D (const VectorND< T, 3 > &newOrigin, const VectorND< T, 3 > &newDirection)
 Create a ray with the specified origin and direction. More...
 
VectorND< T, 3 > getPositionAt (T parameter) const
 Get the position along the ray at the specified parameter value. More...
 
Ray3D< T > normalize () const
 Return a new ray with a unit-length direction vector. More...
 
Bool intersectsSphere (const VectorND< T, 3 > &position, T radius) const
 Return whether or not this ray intersects the specified sphere. More...
 
Bool intersectsSphere (const Sphere3D< T > &sphere) const
 Return whether or not this ray intersects the specified sphere. More...
 
Bool intersectsSphere (const VectorND< T, 3 > &position, T radius, T &distance) const
 Return whether or not this ray intersects the specified sphere. More...
 
Bool intersectsSphere (const Sphere3D< T > &sphere, T &distance) const
 Return whether or not this ray intersects the specified sphere. More...
 
Bool intersectsTriangle (const VectorND< T, 3 > &v1, const VectorND< T, 3 > &v2, const VectorND< T, 3 > &v3) const
 Return whether or not this ray intersects the specified triangle. More...
 
Bool intersectsTriangle (const VectorND< T, 3 > &v1, const VectorND< T, 3 > &v2, const VectorND< T, 3 > &v3, T &distance) const
 Return whether or not this ray intersects the specified triangle. More...
 
Bool intersectsTriangle (const VectorND< T, 3 > &v1, const VectorND< T, 3 > &v2, const VectorND< T, 3 > &v3, T &distance, T &u, T &v) const
 Return whether or not this ray intersects the specified triangle. More...
 
Bool intersectsCylinder (const VectorND< T, 3 > &p1, const VectorND< T, 3 > &axis, T height, T radius, T &distance) const
 Return whether or not this ray intersects a cylinder with the specified attributes. More...
 
Bool intersectsCylinder2 (const VectorND< T, 3 > &p1, const VectorND< T, 3 > &axis, T height, T radius1, T radius2, T &distance) const
 Return whether or not this ray intersects a cylinder with the specified attributes. More...
 
Bool intersectsCapsule (const VectorND< T, 3 > &p1, const VectorND< T, 3 > &axis, T height, T radius, T &distance) const
 Return whether or not this ray intersects a capsule with the specified attributes. More...
 
Bool intersectsCapsule2 (const VectorND< T, 3 > &p1, const VectorND< T, 3 > &axis, T height, T radius1, T radius2, T &distance) const
 Return whether or not this ray intersects a capsule with the specified attributes. More...
 

Public Attributes

VectorND< T, 3 > origin
 The origin of the ray in 3D space;. More...
 
VectorND< T, 3 > direction
 The direction of the ray in 3D space. More...
 

Detailed Description

template<typename T>
class om::math::Ray3D< T >

A class that represents a ray in 3D space.

This class contains two data members: origin and direction. Origin represents the starting position of the ray and direction represents the positively parameterized direction along the ray.

Constructor & Destructor Documentation

template<typename T >
om::math::Ray3D< T >::Ray3D ( )
inline

Create a ray starting at the origin pointing in the positive Z direction.

template<typename T >
om::math::Ray3D< T >::Ray3D ( const VectorND< T, 3 > &  newOrigin,
const VectorND< T, 3 > &  newDirection 
)
inline

Create a ray with the specified origin and direction.

Member Function Documentation

template<typename T >
VectorND<T,3> om::math::Ray3D< T >::getPositionAt ( parameter) const
inline

Get the position along the ray at the specified parameter value.

This position is calculated using the equation: position = origin + parameter*direction.

template<typename T >
Ray3D<T> om::math::Ray3D< T >::normalize ( ) const
inline

Return a new ray with a unit-length direction vector.

template<typename T >
Bool om::math::Ray3D< T >::intersectsSphere ( const VectorND< T, 3 > &  position,
radius 
) const
inline

Return whether or not this ray intersects the specified sphere.

template<typename T >
Bool om::math::Ray3D< T >::intersectsSphere ( const Sphere3D< T > &  sphere) const
inline

Return whether or not this ray intersects the specified sphere.

template<typename T >
Bool om::math::Ray3D< T >::intersectsSphere ( const VectorND< T, 3 > &  position,
radius,
T &  distance 
) const
inline

Return whether or not this ray intersects the specified sphere.

The distance along the ray where the intersection occured is placed in the output parameter.

template<typename T >
Bool om::math::Ray3D< T >::intersectsSphere ( const Sphere3D< T > &  sphere,
T &  distance 
) const
inline

Return whether or not this ray intersects the specified sphere.

The distance along the ray where the intersection occured is placed in the output parameter.

template<typename T >
Bool om::math::Ray3D< T >::intersectsTriangle ( const VectorND< T, 3 > &  v1,
const VectorND< T, 3 > &  v2,
const VectorND< T, 3 > &  v3 
) const
inline

Return whether or not this ray intersects the specified triangle.

template<typename T >
Bool om::math::Ray3D< T >::intersectsTriangle ( const VectorND< T, 3 > &  v1,
const VectorND< T, 3 > &  v2,
const VectorND< T, 3 > &  v3,
T &  distance 
) const
inline

Return whether or not this ray intersects the specified triangle.

The distance along the ray where the intersection occured is placed in the output parameter.

template<typename T >
Bool om::math::Ray3D< T >::intersectsTriangle ( const VectorND< T, 3 > &  v1,
const VectorND< T, 3 > &  v2,
const VectorND< T, 3 > &  v3,
T &  distance,
T &  u,
T &  v 
) const
inline

Return whether or not this ray intersects the specified triangle.

The distance along the ray where the intersection occured is placed in the output parameter, along with the first two barycentric coordinates.

template<typename T >
Bool om::math::Ray3D< T >::intersectsCylinder ( const VectorND< T, 3 > &  p1,
const VectorND< T, 3 > &  axis,
height,
radius,
T &  distance 
) const
inline

Return whether or not this ray intersects a cylinder with the specified attributes.

The distance along the ray where the intersection occured is placed in the output parameter.

The cylinder is specified by an endpoint, unit axis vector, height, and radius.

template<typename T >
Bool om::math::Ray3D< T >::intersectsCylinder2 ( const VectorND< T, 3 > &  p1,
const VectorND< T, 3 > &  axis,
height,
radius1,
radius2,
T &  distance 
) const
inline

Return whether or not this ray intersects a cylinder with the specified attributes.

The distance along the ray where the intersection occured is placed in the output parameter.

The cylinder is specified by an endpoint, unit axis vector, height, and radii. This method allows the cylinder endpoints to have different radii.

template<typename T >
Bool om::math::Ray3D< T >::intersectsCapsule ( const VectorND< T, 3 > &  p1,
const VectorND< T, 3 > &  axis,
height,
radius,
T &  distance 
) const
inline

Return whether or not this ray intersects a capsule with the specified attributes.

The distance along the ray where the intersection occured is placed in the output parameter.

The capsule is specified by an endpoint, unit axis vector, height, and radius.

template<typename T >
Bool om::math::Ray3D< T >::intersectsCapsule2 ( const VectorND< T, 3 > &  p1,
const VectorND< T, 3 > &  axis,
height,
radius1,
radius2,
T &  distance 
) const
inline

Return whether or not this ray intersects a capsule with the specified attributes.

The distance along the ray where the intersection occured is placed in the output parameter.

The capsule is specified by an endpoint, unit axis vector, height, and radii. This method allows the capsule endpoints to have different radii.

Member Data Documentation

template<typename T >
VectorND<T,3> om::math::Ray3D< T >::origin

The origin of the ray in 3D space;.

template<typename T >
VectorND<T,3> om::math::Ray3D< T >::direction

The direction of the ray in 3D space.


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