Vector math utilities used in Draft workbench.
Vector math utilities
|
def | DraftVecUtils.angle (u, v=Vector(1, 0, 0), normal=Vector(0, 0, 1)) |
|
def | DraftVecUtils.rotate (u, angle, axis=Vector(0, 0, 1)) |
|
def | DraftVecUtils.getRotation (vector, reference=Vector(1, 0, 0)) |
|
def | DraftVecUtils.isNull (vector) |
|
def | DraftVecUtils.find (vector, vlist) |
|
def | DraftVecUtils.closest (vector, vlist) |
|
def | DraftVecUtils.isColinear (vlist) |
|
◆ angle()
def DraftVecUtils.angle |
( |
|
u, |
|
|
|
v = Vector(1,0,0) , |
|
|
|
normal = Vector(0,0,1) |
|
) |
| |
angle(Vector,[Vector],[Vector]) - returns the angle
in radians between the two vectors. If only one is given,
angle is between the vector and the horizontal East direction.
If a third vector is given, it is the normal used to determine
the sign of the angle.
◆ closest()
def DraftVecUtils.closest |
( |
|
vector, |
|
|
|
vlist |
|
) |
| |
closest(vector,vlist): finds the closest vector to the given vector
in a list of vectors
◆ find()
def DraftVecUtils.find |
( |
|
vector, |
|
|
|
vlist |
|
) |
| |
find(vector,vlist): finds a vector in a list of vectors. returns
the index of the matching vector, or None if none is found.
◆ getRotation()
def DraftVecUtils.getRotation |
( |
|
vector, |
|
|
|
reference = Vector(1,0,0) |
|
) |
| |
getRotation(vector,[reference]): returns a tuple
representing a quaternion rotation between the reference
(or X axis if omitted) and the vector
◆ isColinear()
def DraftVecUtils.isColinear |
( |
|
vlist | ) |
|
isColinear(list_of_vectors): checks if vectors in given list are colinear
◆ isNull()
def DraftVecUtils.isNull |
( |
|
vector | ) |
|
isNull(vector): Tests if a vector is nul vector
◆ rotate()
def DraftVecUtils.rotate |
( |
|
u, |
|
|
|
angle, |
|
|
|
axis = Vector(0,0,1) |
|
) |
| |
rotate(Vector,Float,axis=Vector): rotates the first Vector
around the given axis, at the given angle.
If axis is omitted, the rotation is made on the xy plane.