Math v0.0.1
float3

Floating point 3 component vector structure. More...

#include <float.hpp>

Public Member Functions

constexpr float3 (float xyz=0.0f) noexcept
 Creates a new floating point 3 component vector structure.
 
constexpr float3 (float x, float y, float z) noexcept
 Creates a new floating point 3 component vector structure.
 
constexpr float3 (float2 xy, float z) noexcept
 Creates a new floating point 3 component vector structure.
 
constexpr float3 (float x, float2 yz) noexcept
 Creates a new floating point 3 component vector structure.
 
constexpr float3 (uint3 xyz) noexcept
 Creates a new floating point 3 component vector structure.
 
constexpr float3 (int3 xyz) noexcept
 Creates a new floating point 3 component vector structure.
 
float & operator[] (psize i) noexcept
 Returns vector component by index.
 
float operator[] (psize i) const noexcept
 Returns vector component by index.
 
constexpr operator int3 () const noexcept
 Returns as 3 component signed integer vector. (xyz)
 
constexpr operator uint3 () const noexcept
 Returns as 3 component unsigned integer vector. (xyz)
 
constexpr operator int2 () const noexcept
 Returns as 2 component signed integer vector. (xy)
 
constexpr operator uint2 () const noexcept
 Returns as 2 component unsigned integer vector. (xy)
 
constexpr operator uint32 () const noexcept
 Returns first vector component as unsigned integer. (x)
 
constexpr operator int32 () const noexcept
 Returns first vector component as signed integer. (x)
 
constexpr operator float2 () const noexcept
 Returns as 2 component floating point vector. (xy)
 
constexpr operator float () const noexcept
 Returns first vector component value. (x)
 
constexpr float3 operator+ (float3 v) const noexcept
 
constexpr float3 operator- (float3 v) const noexcept
 
constexpr float3 operator* (float3 v) const noexcept
 
constexpr float3 operator/ (float3 v) const noexcept
 
constexpr float3 operator+ (float n) const noexcept
 
constexpr float3 operator- (float n) const noexcept
 
constexpr float3 operator* (float n) const noexcept
 
constexpr float3 operator/ (float n) const noexcept
 
constexpr float3 operator- () const noexcept
 
float3operator+= (float3 v) noexcept
 
float3operator-= (float3 v) noexcept
 
float3operator*= (float3 v) noexcept
 
float3operator/= (float3 v) noexcept
 
float3operator+= (float n) noexcept
 
float3operator-= (float n) noexcept
 
float3operator*= (float n) noexcept
 
float3operator/= (float n) noexcept
 
float3operator= (float n) noexcept
 
constexpr bool operator== (float3 v) const noexcept
 
constexpr bool operator!= (float3 v) const noexcept
 
constexpr uint3 operator< (float3 v) const noexcept
 
constexpr uint3 operator> (float3 v) const noexcept
 
constexpr uint3 operator<= (float3 v) const noexcept
 
constexpr uint3 operator>= (float3 v) const noexcept
 
constexpr bool operator== (float n) const noexcept
 
constexpr bool operator!= (float n) const noexcept
 
constexpr uint3 operator< (float n) const noexcept
 
constexpr uint3 operator> (float n) const noexcept
 
constexpr uint3 operator<= (float n) const noexcept
 
constexpr uint3 operator>= (float n) const noexcept
 

Public Attributes

float x
 
float y
 
float z
 

Static Public Attributes

static const float3 zero = float3(0.0f)
 
static const float3 one = float3(1.0f)
 
static const float3 minusOne = float3(-1.0f)
 
static const float3 min = float3(FLT_MIN)
 
static const float3 minusMin = float3(-FLT_MIN)
 
static const float3 max = float3(FLT_MAX)
 
static const float3 minusMax = float3(-FLT_MAX)
 
static const float3 epsilon = float3(FLT_EPSILON)
 
static const float3 inf = float3(INFINITY)
 
static const float3 minusInf = float3(-INFINITY)
 
static const float3 nan = float3(NAN)
 
static const float3 left = float3(-1.0f, 0.0f, 0.0f)
 
static const float3 right = float3(1.0f, 0.0f, 0.0f)
 
static const float3 bottom = float3(0.0f, -1.0f, 0.0f)
 
static const float3 top = float3(0.0f, 1.0f, 0.0f)
 
static const float3 back = float3(0.0f, 0.0f, -1.0f)
 
static const float3 front = float3(0.0f, 0.0f, 1.0f)
 

Detailed Description

Floating point 3 component vector structure.

Commonly used to represent: points, positions, directions, velocities, etc.

Constructor & Destructor Documentation

◆ float3() [1/6]

constexpr float3 ( float xyz = 0.0f)
inlineexplicitconstexprnoexcept

Creates a new floating point 3 component vector structure.

Parameters
xyztarget value for all vector components

◆ float3() [2/6]

constexpr float3 ( float x,
float y,
float z )
inlineconstexprnoexcept

Creates a new floating point 3 component vector structure.

Parameters
xfirst vector component value
ysecond vector component value
zthird vector component value

◆ float3() [3/6]

constexpr float3 ( float2 xy,
float z )
inlineconstexprnoexcept

Creates a new floating point 3 component vector structure.

Parameters
xyfirst and second vector components value
zthird vector component value

◆ float3() [4/6]

constexpr float3 ( float x,
float2 yz )
inlineconstexprnoexcept

Creates a new floating point 3 component vector structure.

Parameters
xfirst vector component value
yzsecond and third vector components value

◆ float3() [5/6]

constexpr float3 ( uint3 xyz)
inlineconstexprnoexcept

Creates a new floating point 3 component vector structure.

Parameters
xyztarget unsigned integer vector value

◆ float3() [6/6]

constexpr float3 ( int3 xyz)
inlineconstexprnoexcept

Creates a new floating point 3 component vector structure.

Parameters
xyztarget signed integer vector value

Member Function Documentation

◆ operator[]() [1/2]

float & operator[] ( psize i)
inlinenoexcept

Returns vector component by index.

Parameters
itarget component index

◆ operator[]() [2/2]

float operator[] ( psize i) const
inlinenoexcept

Returns vector component by index.

Parameters
itarget component index

Member Data Documentation

◆ x

float x

First vector component.

◆ y

float y

Second vector component.

◆ z

float z

Third vector component.