Math v0.0.1
int3

Signed integer 3 component vector structure. More...

#include <int.hpp>

Public Member Functions

constexpr int3 (int32 xyz=0) noexcept
 Creates a new signed integer 3 component vector structure.
 
constexpr int3 (int32 x, int32 y, int32 z) noexcept
 Creates a new signed integer 3 component vector structure.
 
constexpr int3 (int2 xy, int32 z) noexcept
 Creates a new signed integer 3 component vector structure.
 
constexpr int3 (int32 x, int2 yz) noexcept
 Creates a new signed integer 3 component vector structure.
 
constexpr int3 (uint3 xyz) noexcept
 Creates a new signed integer 3 component vector structure.
 
int32operator[] (psize i) noexcept
 Returns vector component by index.
 
int32 operator[] (psize i) const noexcept
 Returns vector component by index.
 
constexpr operator uint3 () const noexcept
 Returns as 3 component unsigned integer vector. (xyz)
 
constexpr operator uint2 () const noexcept
 Returns as 2 component unsigned integer vector. (xy)
 
constexpr operator int2 () const noexcept
 Returns as 2 component signed integer vector. (xy)
 
constexpr operator uint32 () const noexcept
 Returns first vector component as unsigned integer value. (xy)
 
constexpr operator int32 () const noexcept
 Returns first vector component value. (xy)
 
constexpr int3 operator+ (int3 v) const noexcept
 
constexpr int3 operator- (int3 v) const noexcept
 
constexpr int3 operator* (int3 v) const noexcept
 
constexpr int3 operator/ (int3 v) const noexcept
 
constexpr int3 operator% (int3 v) const noexcept
 
constexpr int3 operator& (int3 v) const noexcept
 
constexpr int3 operator| (int3 v) const noexcept
 
constexpr int3 operator^ (int3 v) const noexcept
 
constexpr int3 operator>> (int3 v) const noexcept
 
constexpr int3 operator<< (int3 v) const noexcept
 
constexpr int3 operator+ (int32 n) const noexcept
 
constexpr int3 operator- (int32 n) const noexcept
 
constexpr int3 operator* (int32 n) const noexcept
 
constexpr int3 operator/ (int32 n) const noexcept
 
constexpr int3 operator% (int32 n) const noexcept
 
constexpr int3 operator& (int32 n) const noexcept
 
constexpr int3 operator| (int32 n) const noexcept
 
constexpr int3 operator^ (int32 n) const noexcept
 
constexpr int3 operator>> (int32 n) const noexcept
 
constexpr int3 operator<< (int32 n) const noexcept
 
constexpr int3 operator- () const noexcept
 
constexpr int3 operator! () const noexcept
 
constexpr int3 operator~ () const noexcept
 
int3operator+= (int3 v) noexcept
 
int3operator-= (int3 v) noexcept
 
int3operator*= (int3 v) noexcept
 
int3operator/= (int3 v) noexcept
 
int3operator%= (int3 v) noexcept
 
int3operator&= (int3 v) noexcept
 
int3operator|= (int3 v) noexcept
 
int3operator^= (int3 v) noexcept
 
int3operator>>= (int3 v) noexcept
 
int3operator<<= (int3 v) noexcept
 
int3operator+= (int32 n) noexcept
 
int3operator-= (int32 n) noexcept
 
int3operator*= (int32 n) noexcept
 
int3operator/= (int32 n) noexcept
 
int3operator%= (int32 n) noexcept
 
int3operator&= (int32 n) noexcept
 
int3operator|= (int32 n) noexcept
 
int3operator^= (int32 n) noexcept
 
int3operator>>= (int32 n) noexcept
 
int3operator<<= (int32 n) noexcept
 
int3operator= (int32 n) noexcept
 
constexpr bool operator== (int3 v) const noexcept
 
constexpr bool operator!= (int3 v) const noexcept
 
constexpr uint3 operator< (int3 v) const noexcept
 
constexpr uint3 operator> (int3 v) const noexcept
 
constexpr uint3 operator<= (int3 v) const noexcept
 
constexpr uint3 operator>= (int3 v) const noexcept
 
constexpr bool operator== (int32 n) const noexcept
 
constexpr bool operator!= (int32 n) const noexcept
 
constexpr uint3 operator< (int32 n) const noexcept
 
constexpr uint3 operator> (int32 n) const noexcept
 
constexpr uint3 operator<= (int32 n) const noexcept
 
constexpr uint3 operator>= (int32 n) const noexcept
 

Public Attributes

int32 x
 
int32 y
 
int32 z
 

Static Public Attributes

static const int3 zero = int3(0)
 
static const int3 one = int3(1)
 
static const int3 minusOne = int3(-1)
 
static const int3 left = int3(-1, 0, 0)
 
static const int3 right = int3(1, 0, 0)
 
static const int3 bottom = int3(0, -1, 0)
 
static const int3 top = int3(0, 1, 0)
 
static const int3 back = int3(0, 0, -1)
 
static const int3 front = int3(0, 0, 1)
 

Detailed Description

Signed integer 3 component vector structure.

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

Constructor & Destructor Documentation

◆ int3() [1/5]

constexpr int3 ( int32 xyz = 0)
inlineexplicitconstexprnoexcept

Creates a new signed integer 3 component vector structure.

Parameters
xyztarget value for all vector components

◆ int3() [2/5]

constexpr int3 ( int32 x,
int32 y,
int32 z )
inlineconstexprnoexcept

Creates a new signed integer 3 component vector structure.

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

◆ int3() [3/5]

constexpr int3 ( int2 xy,
int32 z )
inlineconstexprnoexcept

Creates a new signed integer 3 component vector structure.

Parameters
xyfirst and second vector components value
zthird vector component value

◆ int3() [4/5]

constexpr int3 ( int32 x,
int2 yz )
inlineconstexprnoexcept

Creates a new signed integer 3 component vector structure.

Parameters
xfirst vector component value
yzsecond and third vector components value

◆ int3() [5/5]

constexpr int3 ( uint3 xyz)
inlineconstexprnoexcept

Creates a new signed integer 3 component vector structure.

Parameters
xyztarget unsigned integer vector value

Member Function Documentation

◆ operator[]() [1/2]

int32 & operator[] ( psize i)
inlinenoexcept

Returns vector component by index.

Parameters
itarget component index

◆ operator[]() [2/2]

int32 operator[] ( psize i) const
inlinenoexcept

Returns vector component by index.

Parameters
itarget component index

Member Data Documentation

◆ x

int32 x

First vector component.

◆ y

int32 y

Second vector component.

◆ z

int32 z

Third vector component.