pymel.util.arrays.axis

axis(a, b, c=None, normalize=False)

axis(u, v[, normalize=False]) –> VectorN

Returns the axis of rotation from u to v as the vector n = u ^ v if the normalize keyword argument is set to True, n is also normalized. u and v should be 3 dimensional Vectors representing 3D vectors.

>>> u = VectorN(1.0, 0.0, 0.0)
>>> v = VectorN(0.707, 0.0, -0.707)
>>> axis(u, v) == VectorN([0.0, 0.707, 0.0])
True
>>> axis(u, [0.707, 0.0, -0.707], normalize=True) == VectorN([-0.0, 1.0, 0.0])     
True

Alternatively can use the form axis(a, b, c), where a, b, c are 4 dimensional Vectors representing 3D points, it is then equivalent to axis(b-a, c-a).

>>> o = VectorN(0.0, 1.0, 0.0, 1.0)        
>>> p = VectorN(1.0, 1.0, 0.0, 1.0)
>>> q = VectorN(0.707, 1.0, -0.707, 1.0)
>>> axis(o, p, q, normalize=True) == VectorN([0.0, 1.0, 0.0])
True

Related : see VectorN.axis method.

Previous topic

pymel.util.arrays.atanh

Next topic

pymel.util.arrays.blend

Core

Core Modules

Other Modules

This Page