vec2i class by value built-in

Two-dimensional vector with integer components

Typically used for positions and sizes in whole pixels or tiles.

Constructors

vec2i(const vec2i&in)
Creates a copy of another vector
vec2i(int, int)
Creates a vector from X and Y components

Operators

vec2i opAdd(const vec2i&in) const +
Adds two vectors
vec2i& opAddAssign(const vec2i&in) +=
Adds another vector in place
vec2i& opAssign(const vec2i&in) =
Copies another vector
vec2i opDiv(int) const /
Divides every component by a number
vec2i opDiv(const vec2i&in) const /
Divides the vectors component by component
vec2i& opDivAssign(int) /=
Divides every component by a number in place
vec2i& opDivAssign(const vec2i&in) /=
Divides by another vector component by component in place
bool opEquals(const vec2i&in) const ==
Returns whether all components are equal
vec2i opMul(int) const *
Multiplies every component by a number
vec2i opMul(const vec2i&in) const *
Multiplies the vectors component by component
vec2i& opMulAssign(int) *=
Multiplies every component by a number in place
vec2i& opMulAssign(const vec2i&in) *=
Multiplies by another vector component by component in place
vec2i opNeg() const -x
Returns the vector with all components negated
vec2i opSub(const vec2i&in) const -
Subtracts two vectors
vec2i& opSubAssign(const vec2i&in) -=
Subtracts another vector in place

Properties

int length read-only
Length of the vector
int x
X component
int y
Y component

Operator documentation

vec2i vec2i::opDiv(int) const /

Divides every component by a number

Integer division, the results are truncated towards zero. Dividing by zero is not allowed.

vec2i vec2i::opDiv(const vec2i&in) const /

Divides the vectors component by component

Integer division, the results are truncated towards zero. No component of the divisor may be zero.

Property documentation

int vec2i::length read-only

Length of the vector

Rounded down to a whole number.