sandbox
Loading...
Searching...
No Matches
sbx::math::ray Class Reference

3D ray with normalized direction. More...

#include <ray.hpp>

Public Member Functions

 ray ()
 Constructs a default ray. More...
 
 ray (const vector3 &origin, const vector3 &direction)
 Constructs a ray from an origin and a direction. More...
 
auto origin () const -> const vector3 &
 Returns the ray origin. More...
 
auto direction () const -> const vector3 &
 Returns the ray direction. More...
 
auto point_at (const std::float_t t) const -> vector3
 Computes a point along the ray at parameter t. More...
 

Detailed Description

3D ray with normalized direction.

A ray is defined by an origin and a direction. The direction is normalized upon construction to guarantee a unit-length direction vector.

Constructor & Destructor Documentation

◆ ray() [1/2]

sbx::math::ray::ray ( )

Constructs a default ray.

Returns
Ray with origin at zero and direction pointing forward.

◆ ray() [2/2]

sbx::math::ray::ray ( const vector3 origin,
const vector3 direction 
)

Constructs a ray from an origin and a direction.

Parameters
originRay origin.
directionRay direction (normalized internally).
Returns
Constructed ray.

Member Function Documentation

◆ direction()

auto sbx::math::ray::direction ( ) const -> const vector3&

Returns the ray direction.

Returns
Reference to the normalized direction.

◆ origin()

auto sbx::math::ray::origin ( ) const -> const vector3&

Returns the ray origin.

Returns
Reference to the origin.

◆ point_at()

auto sbx::math::ray::point_at ( const std::float_t  t) const -> vector3

Computes a point along the ray at parameter t.

Parameters
tRay parameter.
Returns
Point at origin + direction * t.

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