Signed integer 2 component vector structure. More...
#include <int.hpp>
Public Member Functions | |
constexpr | int2 (int32 xy=0) noexcept |
Creates a new signed integer 2 component vector structure. | |
constexpr | int2 (int32 x, int32 y) noexcept |
Creates a new signed integer 2 component vector structure. | |
constexpr | int2 (uint2 xy) noexcept |
Creates a new signed integer 2 component vector structure. | |
int32 & | operator[] (psize i) noexcept |
Returns vector component by index. | |
int32 | operator[] (psize i) const noexcept |
Returns vector component by index. | |
constexpr | operator uint2 () const noexcept |
Returns as 2 component unsigned integer vector. (xy) | |
constexpr | operator uint32 () noexcept |
Returns first vector component as unsigned integer value. (x) | |
constexpr | operator int32 () noexcept |
Returns first vector component value. (x) | |
constexpr int2 | operator+ (int2 v) const noexcept |
constexpr int2 | operator- (int2 v) const noexcept |
constexpr int2 | operator* (int2 v) const noexcept |
constexpr int2 | operator/ (int2 v) const noexcept |
constexpr int2 | operator% (int2 v) const noexcept |
constexpr int2 | operator& (int2 v) const noexcept |
constexpr int2 | operator| (int2 v) const noexcept |
constexpr int2 | operator^ (int2 v) const noexcept |
constexpr int2 | operator>> (int2 v) const noexcept |
constexpr int2 | operator<< (int2 v) const noexcept |
constexpr int2 | operator+ (int32 n) const noexcept |
constexpr int2 | operator- (int32 n) const noexcept |
constexpr int2 | operator* (int32 n) const noexcept |
constexpr int2 | operator/ (int32 n) const noexcept |
constexpr int2 | operator% (int32 n) const noexcept |
constexpr int2 | operator& (int32 n) const noexcept |
constexpr int2 | operator| (int32 n) const noexcept |
constexpr int2 | operator^ (int32 n) const noexcept |
constexpr int2 | operator>> (int32 n) const noexcept |
constexpr int2 | operator<< (int32 n) const noexcept |
constexpr int2 | operator- () const noexcept |
constexpr int2 | operator! () const noexcept |
constexpr int2 | operator~ () const noexcept |
int2 & | operator+= (int2 v) noexcept |
int2 & | operator-= (int2 v) noexcept |
int2 & | operator*= (int2 v) noexcept |
int2 & | operator/= (int2 v) noexcept |
int2 & | operator%= (int2 v) noexcept |
int2 & | operator&= (int2 v) noexcept |
int2 & | operator|= (int2 v) noexcept |
int2 & | operator^= (int2 v) noexcept |
int2 & | operator>>= (int2 v) noexcept |
int2 & | operator<<= (int2 v) noexcept |
int2 & | operator+= (int32 n) noexcept |
int2 & | operator-= (int32 n) noexcept |
int2 & | operator*= (int32 n) noexcept |
int2 & | operator/= (int32 n) noexcept |
int2 & | operator%= (int32 n) noexcept |
int2 & | operator&= (int32 n) noexcept |
int2 & | operator|= (int32 n) noexcept |
int2 & | operator^= (int32 n) noexcept |
int2 & | operator>>= (int32 n) noexcept |
int2 & | operator<<= (int32 n) noexcept |
int2 & | operator= (int32 n) noexcept |
constexpr bool | operator== (int2 v) const noexcept |
constexpr bool | operator!= (int2 v) const noexcept |
constexpr uint2 | operator< (int2 v) const noexcept |
constexpr uint2 | operator> (int2 v) const noexcept |
constexpr uint2 | operator<= (int2 v) const noexcept |
constexpr uint2 | operator>= (int2 v) const noexcept |
constexpr bool | operator== (int32 n) const noexcept |
constexpr bool | operator!= (int32 n) const noexcept |
constexpr uint2 | operator< (int32 n) const noexcept |
constexpr uint2 | operator> (int32 n) const noexcept |
constexpr uint2 | operator<= (int32 n) const noexcept |
constexpr uint2 | operator>= (int32 n) const noexcept |
Public Attributes | |
int32 | x |
int32 | y |
Static Public Attributes | |
static const int2 | zero = int2(0) |
static const int2 | one = int2(1) |
static const int2 | minusOne = int2(-1) |
static const int2 | left = int2(-1, 0) |
static const int2 | right = int2(1, 0) |
static const int2 | bottom = int2(0, -1) |
static const int2 | top = int2(0, 1) |
Signed integer 2 component vector structure.
Commonly used to represent: points, positions, directions, velocities, etc.
Creates a new signed integer 2 component vector structure.
xy | target value for all vector components |
Creates a new signed integer 2 component vector structure.
x | first vector component value |
y | second vector component value |
Creates a new signed integer 2 component vector structure.
xy | target unsigned integer vector value |
Returns vector component by index.
i | target component index |
Returns vector component by index.
i | target component index |
int32 x |
First vector component.
int32 y |
Second vector component.