class V3f

A 32 bits float 3-element vector.

x:float
y:float
z:float
V3f()

Uninitialized by default

V3f(a: float)

Initialize to a scalar (a,a,a)

V3f(a: float, b: float, c: float)

Initialize to given elements (a,b,c)

__eq__(o: V3f) → bool

Equality

__neq__(o: V3f) → bool

Inequality

__getitem__(i: int) → float

Element access by index.

__add__(v: V3f) → V3f

Component-wise addition

__sub__(v: V3f) → V3f

Component-wise subtraction

__mul__(v: V3f) → V3f

Component-wise multiplication

__mul__(a: float) → V3f

Component-wise multiplication

__truediv__(v: V3f) → V3f

Component-wise division

__truediv__(a: float) → V3f

Component-wise division

__neg__() → V3f

Component-wise multiplication by -1

equalWithAbsError(m: V3f, e: float) → 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: V3f, e: float) → 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: V3f) → float

Dot product

__xor__(v: V3f) → float

Dot product

cross(v: V3f) → float

Cross product

__mod__(v: V3f) → float

Cross product

negate() → V3f

Component-wise multiplication by -1

length() → float

Return the Euclidean norm

length2() → float

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() → V3f

Return a normalized vector. Does not modify *this.

normalizedNonNull() → V3f

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.