vmmlib  1.10.0
Templatized C++ vector and matrix math library
vmml::Ray< T > Class Template Reference
+ Collaboration diagram for vmml::Ray< T >:

Public Types

typedef vector< 3, T > vec3
 
typedef vector< 4, T > vec4
 

Public Member Functions

 Ray (const vec3 &origin, const vec3 &direction)
 Constructor. More...
 
test (const vec4 &sphere) const
 Ray-Sphere Intersection. More...
 

Detailed Description

template<typename T>
class vmml::Ray< T >

Definition at line 47 of file ray.hpp.

Constructor & Destructor Documentation

template<typename T >
vmml::Ray< T >::Ray ( const vec3 origin,
const vec3 direction 
)
inline

Constructor.

Parameters
originRay origin
directionRay direction

Definition at line 59 of file ray.hpp.

Member Function Documentation

template<typename T >
T vmml::Ray< T >::test ( const vec4 sphere) const

Ray-Sphere Intersection.

Optimized solution from "Real-time Rendering 3rd Edition"

Parameters
centerSphere center
radiusSphere radius
distanceIntersection distance
Returns
The distance from the sphere center on intersection, or a negative value if there is no intersection.

Sphere behind the ray origin and ray origin outside the sphere

Squared distance from sphere center to the projection

Distance from the sphere center to the surface along the ray direction

Definition at line 86 of file ray.hpp.


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