class V4d

A 64 bits float 3-element vector.

x:double
y:double
z:double
w:double
V4d()

Uninitialized by default

V4d(a: double)

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

V4d(a: double, b: double, c: double, d: double)

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

__eq__(o: V4d) bool

Equality

__neq__(o: V4d) bool

Inequality

__getitem__(i: int) double

Element access by index.

__add__(v: V4d) V4d

Component-wise addition

__sub__(v: V4d) V4d

Component-wise subtraction

__mul__(v: V4d) V4d

Component-wise multiplication

__mul__(a: double) V4d

Component-wise multiplication

__truediv__(v: V4d) V4d

Component-wise division

__truediv__(a: double) V4d

Component-wise division

__neg__() V4d

Component-wise multiplication by -1

equalWithAbsError(m: V4d, e: double) 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: V4d, e: double) 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: V4d) double

Dot product

__xor__(v: V4d) double

Dot product

cross(v: V4d) double

Cross product

__mod__(v: V4d) double

Cross product

negate() V4d

Component-wise multiplication by -1

length() double

Return the Euclidean norm

length2() double

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

normalize()

Normalize in place

normalizeNonNull()

Normalize without any checks for length()==0. Slightly faster than the other normalization routines, but if v.length() is 0.0, the result is undefined.

normalized() V4d

Return a normalized vector. Does not modify *this.

normalizedNonNull() V4d

Return a normalized vector. Does not modify *this, and does not check for length()==0. Slightly faster than the other normalization routines, but if v.length() is 0.0, the result is undefined.