Math v0.2.0
SIMD optimized C++ mathematics library
Loading...
Searching...
No Matches

Infinite ray structure. (In 3D space). More...

#include <ray.hpp>

Public Member Functions

 Ray (f32x4 origin, f32x4 direction, bool normalize=true) noexcept
 Creates a new ray structure. (In 3D space).
 Ray ()=default
 Creates a new empty ray structure.
f32x4 getDirection () const noexcept
 Returns ray direction vector in 3D space.
void setDirection (f32x4 direction, bool normalize=true) noexcept
 Sets ray direction vector in 3D space.
const u32x4 & getParallel () const noexcept
 Returns which of the ray direction axes are parallel.
void normalize () noexcept
 Normalizes ray direction vector.
Ray operator* (f32x4 v) const noexcept
Ray operator/ (f32x4 v) const noexcept
Ray operator+ (f32x4 v) const noexcept
Ray operator- (f32x4 v) const noexcept
Ray & operator*= (f32x4 v) noexcept
Ray & operator/= (f32x4 v) noexcept
Ray & operator+= (f32x4 v) noexcept
Ray & operator-= (f32x4 v) noexcept
bool operator== (const Ray &v) const noexcept
bool operator!= (const Ray &v) const noexcept

Public Attributes

f32x4 origin = f32x4::zero
 Ray origin point in 3D space.

Static Public Attributes

static const Ray left = Ray(f32x4::zero, f32x4(-1.0f, 0.0f, 0.0f, 0.0f), false)
static const Ray right = Ray(f32x4::zero, f32x4(1.0f, 0.0f, 0.0f, 0.0f), false)
static const Ray bottom = Ray(f32x4::zero, f32x4(0.0f, -1.0f, 0.0f, 0.0f), false)
static const Ray top = Ray(f32x4::zero, f32x4(0.0f, 1.0f, 0.0f, 0.0f), false)
static const Ray back = Ray(f32x4::zero, f32x4(0.0f, 0.0f, -1.0f, 0.0f), false)
static const Ray front = Ray(f32x4::zero, f32x4(0.0f, 0.0f, 1.0f, 0.0f), false)

Protected Attributes

f32x4 direction = f32x4::zero
u32x4 isParallel = u32x4::zero

Detailed Description

Infinite ray structure. (In 3D space).

Defined by an origin point and direction vector.

Constructor & Destructor Documentation

◆ Ray()

Ray ( f32x4 origin,
f32x4 direction,
bool normalize = true )
inlinenoexcept

Creates a new ray structure. (In 3D space).

Parameters
originray origin point in 3D space
directionray direction vector in 3D space
normalizeis direction vector should be normalized

Member Function Documentation

◆ setDirection()

void setDirection ( f32x4 direction,
bool normalize = true )
inlinenoexcept

Sets ray direction vector in 3D space.

Parameters
directiontarget ray direction vector
normalizeis direction vector should be normalized