angle_vectors

compas.geometry.angle_vectors(u, v, deg=False, tol=None)[source]

Compute the smallest angle between two vectors.

Parameters:
u[float, float, float] | compas.geometry.Vector

XYZ components of the first vector.

v[float, float, float] | compas.geometry.Vector

XYZ components of the second vector.

degbool, optional

If True, returns the angle in degrees.

tolfloat, optional

The tolerance for comparing values to zero. Default is TOL.absolute.

Returns:
float

The smallest angle in radians (in degrees if deg == True). The angle is always positive.

Examples

>>> angle_vectors([0.0, 1.0, 0.0], [1.0, 0.0, 0.0])
1.57079