Kanzi  3.9.9
Kanzi Engine C++ API
kanzi::Ray Class Reference

Ray can be mathematically defined as a point (the origin of the ray in space) and a direction. More...

#include <kanzi/core/math/ray.hpp>

Public Member Functions

Vector3 getDirection () const
 Gets the direction of a ray. More...
 
Vector3 getOrigin () const
 Gets the origin of a ray. More...
 
 Ray ()
 Default constructor. More...
 
 Ray (const Vector3 origin, const Vector3 direction)
 Constructor. More...
 
Ray transform (const Matrix4x4 &matrix) const
 Returns a transformed ray, using a 4x4 matrix. More...
 

Detailed Description

Ray can be mathematically defined as a point (the origin of the ray in space) and a direction.

Kanzi uses rays for resolving the input to find where in 3D space the user clicked.

Constructor & Destructor Documentation

kanzi::Ray::Ray ( )
inlineexplicit

Default constructor.

Initializes the ray components to identity, origin=(0,0,0) and direction=(0,0,0).

kanzi::Ray::Ray ( const Vector3  origin,
const Vector3  direction 
)
inlineexplicit

Constructor.

Constructs a ray from point and a direction vector. Normalizes the direction vector.

Parameters
originThe origin of the ray in 3D space.
directionThe direction of the ray. The method normalizes the value before storing the value.

Member Function Documentation

Vector3 kanzi::Ray::getOrigin ( ) const
inline

Gets the origin of a ray.

Returns
The origin of a ray.
Vector3 kanzi::Ray::getDirection ( ) const
inline

Gets the direction of a ray.

Returns
The normalized direction of a ray.
Ray kanzi::Ray::transform ( const Matrix4x4 matrix) const

Returns a transformed ray, using a 4x4 matrix.

Parameters
matrixTransform matrix.
Returns
The transformed ray.

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