angle_vectors_signed

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

Computes the signed angle between two vectors.

It calculates the angle such that rotating vector u about the normal by angle would result in a vector that looks into the same direction as v.

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.

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

XYZ components of the plane’s normal spanned by u and v.

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 signed angle in radians (in degrees if deg == True).

Examples

>>> normal = [0.0, 0.0, 1.0]
>>> angle_vectors_signed([0.0, 1.0, 0.0], [1.0, 0.0, 0.0], normal)
-1.57079