class V4i

A signed 32 bits integer 3-element vector.

x:int
y:int
z:int
w:int
V4i()

Uninitialized by default

V4i(a: int)

Initialize to a scalar (a,a,a,a)

V4i(a: int, b: int, c: int, d: int)

Initialize to given elements (a,b,c,d)

__eq__(o: V4i) bool

Equality

__neq__(o: V4i) bool

Inequality

__getitem__(i: int) int

Element access by index.

__add__(v: V4i) V4i

Component-wise addition

__sub__(v: V4i) V4i

Component-wise subtraction

__mul__(v: V4i) V4i

Component-wise multiplication

__mul__(a: int) V4i

Component-wise multiplication

__truediv__(v: V4i) V4i

Component-wise division

__truediv__(a: int) V4i

Component-wise division

__neg__() V4i

Component-wise multiplication by -1

equalWithAbsError(m: V4i, 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: V4i, 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: V4i) int

Dot product

__xor__(v: V4i) int

Dot product

cross(v: V4i) V4i

Cross product

__mod__(v: V4i) V4i

Cross product

negate() V4i

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.