- class V2d
A 64 bits float 2-element vector.
- x:double
- y:double
- V2d()
Uninitialized by default
- V2d(a: double)
Initialize to a scalar (a,a)
- V2d(a: double, b: double)
Initialize to given elements (a,b)
- __getitem__(i: int) double
Element access by index.
- equalWithAbsError(m: V2d, 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: V2d, 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])
- 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.