Skip to content

Vector2Int

Jesusemora edited this page Mar 30, 2023 · 1 revision

Vector2Int

Variables

Variable Description
int &x reference to the first element of pos[]. can be used as myVector2Int.x.
int &y reference to the second element of pos[]. can be used as myVector2Int.y.

public methods

Function Description
float Magnitude() returns non sqr magnitude of current Vector2Int
float sqrMagnitude() returns sqr magnitude of current Vector2Int
Vector2 normalized returns the normalized version of current Vector2Int as a Vector2

static methods

Function Description
int fastDistance(Vector2Int a, Vector2Int b) returns the distance between a and b in a tiled space ( like chess )
float Distance(Vector2Int a, Vector2Int b) returns the exact distance between a and b
int Dot(Vector2Int a, Vector2Int b) returns the dot product of a and b
Vector2Int Lerp(Vector2Int a, Vector2Int b) returns the middle point between a and b, equivalent to glsl mix(a, b, 0.5) or cg lerp(a, b, 0.5)
Vector2Int Lerp(Vector2Int a, Vector2Int b, float c) returns the point c between a and b, equivalent to glsl mix(a, b, c) or cg lerp(a, b, c)

constructors

Vector2Int(float x, float y) generates a Vector2Int containing the rounded values x and y.
Vector2Int(int x, int y) generates a Vector2Int containing the values of x and y.
Vector2Int() generates a Vector2Int containing the values 0 and 0.
Vector2Int(const Vector2 &why) generates a Vector2Int from the rounded values of a Vector2.
Vector2Int(const Vector3 &why) generates a Vector2Int from the rounded x and y values of a Vector3.

operators

operator+ adds two Vector2Ints

operator- subtracts two Vector2Ints

operator+ adds the rounded values of Vector2 to Vector2Int

operator- subtracts the rounded values of Vector2 to Vector2Int

operator+= adds the values of Vector2Int to current

operator-= subtracts the values of Vector2Int from current

operator+= adds the rounded values of Vector2 to current

operator-= subtracts the rounded values of Vector2 from current

operator* multiplies current Vector2Int by a rounded float

operator* multiplies current Vector2Int by a rounded double

operator* multiplies current Vector2Int by an int

operator/ divides current Vector2Int by a float

operator/ divides current Vector2Int by a int

operator+ adds the value of float to every value of current Vector2Int and rounds it

operator+ adds int to every value of current Vector2Int

operator- subtracts float from every value of current Vector2Int and rounds it

operator- subtracts int from every value of current Vector2Int

operator*= multiplies every value of current Vector2Int by float and rounds it

operator/= divides every value of current Vector2Int by float and rounds it

operator*= multiplies every value of current Vector2 by int

operator/= divides every value of current Vector2 by int

operator== returns true if two Vector2Ints are equal or if Vector2Int is equal to the rounded values of Vector2 or if Vector2Int is equal to the rounded x and y values of Vector3, and false if they are different.

Clone this wiki locally