Math v0.0.1
int4

Signed integer 4 component vector structure. More...

#include <int.hpp>

Public Member Functions

constexpr int4 (int32 xyzw=0) noexcept
 Creates a new signed integer 4 component vector structure.
 
constexpr int4 (int32 x, int32 y, int32 z, int32 w) noexcept
 Creates a new signed integer 4 component vector structure.
 
constexpr int4 (int2 xy, int32 z, int32 w) noexcept
 Creates a new signed integer 4 component vector structure.
 
constexpr int4 (int32 x, int2 yz, int32 w) noexcept
 Creates a new signed integer 4 component vector structure.
 
constexpr int4 (int32 x, int32 y, int2 zw) noexcept
 Creates a new signed integer 4 component vector structure.
 
constexpr int4 (int2 xy, int2 zw) noexcept
 Creates a new signed integer 4 component vector structure.
 
constexpr int4 (int3 xyz, int32 w) noexcept
 Creates a new signed integer 4 component vector structure.
 
constexpr int4 (int32 x, int3 yzw) noexcept
 Creates a new signed integer 4 component vector structure.
 
constexpr int4 (uint4 xyzw) noexcept
 Creates a new signed integer 4 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 uint4 () const noexcept
 Returns as 4 component unsigned integer vector. (xyzw)
 
constexpr operator uint3 () const noexcept
 Returns as 3 component unsigned integer vector. (xyz)
 
constexpr operator int3 () const noexcept
 Returns as 3 component signed 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. (x)
 
constexpr operator int32 () const noexcept
 Returns first vector component value. (x)
 
constexpr int4 operator+ (int4 v) const noexcept
 
constexpr int4 operator- (int4 v) const noexcept
 
constexpr int4 operator* (int4 v) const noexcept
 
constexpr int4 operator/ (int4 v) const noexcept
 
constexpr int4 operator% (int4 v) const noexcept
 
constexpr int4 operator& (int4 v) const noexcept
 
constexpr int4 operator| (int4 v) const noexcept
 
constexpr int4 operator^ (int4 v) const noexcept
 
constexpr int4 operator>> (int4 v) const noexcept
 
constexpr int4 operator<< (int4 v) const noexcept
 
constexpr int4 operator+ (int32 n) const noexcept
 
constexpr int4 operator- (int32 n) const noexcept
 
constexpr int4 operator* (int32 n) const noexcept
 
constexpr int4 operator/ (int32 n) const noexcept
 
constexpr int4 operator% (int32 n) const noexcept
 
constexpr int4 operator& (int32 n) const noexcept
 
constexpr int4 operator| (int32 n) const noexcept
 
constexpr int4 operator^ (int32 n) const noexcept
 
constexpr int4 operator>> (int32 n) const noexcept
 
constexpr int4 operator<< (int32 n) const noexcept
 
constexpr int4 operator- () const noexcept
 
constexpr int4 operator! () const noexcept
 
constexpr int4 operator~ () const noexcept
 
int4operator+= (int4 v) noexcept
 
int4operator-= (int4 v) noexcept
 
int4operator*= (int4 v) noexcept
 
int4operator/= (int4 v) noexcept
 
int4operator%= (int4 v) noexcept
 
int4operator&= (int4 v) noexcept
 
int4operator|= (int4 v) noexcept
 
int4operator^= (int4 v) noexcept
 
int4operator>>= (int4 v) noexcept
 
int4operator<<= (int4 v) noexcept
 
int4operator+= (int32 n) noexcept
 
int4operator-= (int32 n) noexcept
 
int4operator*= (int32 n) noexcept
 
int4operator/= (int32 n) noexcept
 
int4operator%= (int32 n) noexcept
 
int4operator&= (int32 n) noexcept
 
int4operator|= (int32 n) noexcept
 
int4operator^= (int32 n) noexcept
 
int4operator>>= (int32 n) noexcept
 
int4operator<<= (int32 n) noexcept
 
int4operator= (int32 n) noexcept
 
constexpr bool operator== (int4 v) const noexcept
 
constexpr bool operator!= (int4 v) const noexcept
 
constexpr uint4 operator< (int4 v) const noexcept
 
constexpr uint4 operator> (int4 v) const noexcept
 
constexpr uint4 operator<= (int4 v) const noexcept
 
constexpr uint4 operator>= (int4 v) const noexcept
 
constexpr bool operator== (int32 n) const noexcept
 
constexpr bool operator!= (int32 n) const noexcept
 
constexpr uint4 operator< (int32 n) const noexcept
 
constexpr uint4 operator> (int32 n) const noexcept
 
constexpr uint4 operator<= (int32 n) const noexcept
 
constexpr uint4 operator>= (int32 n) const noexcept
 

Public Attributes

int32 x
 
int32 y
 
int32 z
 
int32 w
 

Static Public Attributes

static const int4 zero = int4(0)
 
static const int4 one = int4(1)
 
static const int4 minusOne = int4(-1)
 

Detailed Description

Signed integer 4 component vector structure.

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

Constructor & Destructor Documentation

◆ int4() [1/9]

constexpr int4 ( int32 xyzw = 0)
inlineexplicitconstexprnoexcept

Creates a new signed integer 4 component vector structure.

Parameters
xyzwtarget value for all vector components

◆ int4() [2/9]

constexpr int4 ( int32 x,
int32 y,
int32 z,
int32 w )
inlineconstexprnoexcept

Creates a new signed integer 4 component vector structure.

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

◆ int4() [3/9]

constexpr int4 ( int2 xy,
int32 z,
int32 w )
inlineconstexprnoexcept

Creates a new signed integer 4 component vector structure.

Parameters
xyfirst and second vector components value
zthird vector component value
wfourth vector component value

◆ int4() [4/9]

constexpr int4 ( int32 x,
int2 yz,
int32 w )
inlineconstexprnoexcept

Creates a new signed integer 4 component vector structure.

Parameters
xfirst vector component value
yzsecond and third vector components value
wfourth vector component value

◆ int4() [5/9]

constexpr int4 ( int32 x,
int32 y,
int2 zw )
inlineconstexprnoexcept

Creates a new signed integer 4 component vector structure.

Parameters
xfirst vector component value
ysecond vector component value
zwthird and fourth vector components value

◆ int4() [6/9]

constexpr int4 ( int2 xy,
int2 zw )
inlineconstexprnoexcept

Creates a new signed integer 4 component vector structure.

Parameters
xyfirst and second vector components value
zwthird and fourth vector components value

◆ int4() [7/9]

constexpr int4 ( int3 xyz,
int32 w )
inlineconstexprnoexcept

Creates a new signed integer 4 component vector structure.

Parameters
xyzfirst, second and third vector components value
wfourth vector component value

◆ int4() [8/9]

constexpr int4 ( int32 x,
int3 yzw )
inlineconstexprnoexcept

Creates a new signed integer 4 component vector structure.

Parameters
xfirst vector component value
[in]yzwsecond, third and fourth vector components value

◆ int4() [9/9]

constexpr int4 ( uint4 xyzw)
inlineconstexprnoexcept

Creates a new signed integer 4 component vector structure.

Parameters
xyzwtarget 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.

◆ w

int32 w

Fourth vector component.