pymel.util.angle

angle(a, b, c=None)

angle(u, v) –> float

Returns the angle of rotation between u and v. u and v should be 3 dimensional Vectors representing 3D vectors.

Note: this angle is not signed, use axis to know the direction of the rotation.

>>> u = VectorN(1.0, 0.0, 0.0)
>>> v = VectorN(0.707, 0.0, -0.707)
>>> angle(u, v)
0.78539816339744828
>>> angle(u, [0.707, 0.0, -0.707])
0.78539816339744828

Alternatively can use the form angle(a, b, c), where a, b, c are 4 dimensional Vectors representing 3D points, it is then equivalent to angle(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)
>>> angle(o, p, q)
0.78539816339744828

Related : see VectorN.angle method.

Previous topic

pymel.util.all

Next topic

pymel.util.any

Core

Core Modules

Other Modules

This Page