class V2i

A signed 32 bits integer 2-element vector.

x:int
y:int
V2i()

Uninitialized by default

V2i(a: int)

Initialize to a scalar (a,a)

V2i(a: int, b: int)

Initialize to given elements (a,b)

__eq__(o: V2i) bool

Equality

__neq__(o: V2i) bool

Inequality

__getitem__(i: int) int

Element access by index.

__add__(v: V2i) V2i

Component-wise addition

__sub__(v: V2i) V2i

Component-wise subtraction

__mul__(v: V2i) V2i

Component-wise multiplication

__mul__(a: int) V2i

Component-wise multiplication

__truediv__(v: V2i) V2i

Component-wise division

__truediv__(a: int) V2i

Component-wise division

__neg__() V2i

Component-wise multiplication by -1

equalWithAbsError(m: V2i, e: int) bool

Compare two vectors and test if they are “approximately equal”: Return True if the coefficients of this and m are the same with an absolute error of no more than e, i.e., for all i, j:

abs (this[i][j] - m[i][j]) <= e

equalWithRelError(m: V2i, e: int) bool

Compare two vectors and test if they are “approximately equal”: Return True if the coefficients of this and m are the same with a relative error of no more than e, i.e., for all i, j:

abs (this[i] - v[i][j]) <= e * abs (this[i][j])

dot(v: V2i) int

Dot product

__xor__(v: V2i) int

Dot product

cross(v: V2i) int

Cross product

__mod__(v: V2i) int

Cross product

negate() V2i

Component-wise multiplication by -1

length() int

Return the Euclidean norm

length2() int

Return the square of the Euclidean norm, i.e. the dot product with itself.