angle_vectors_signed

compas.geometry.angle_vectors_signed(u, v, normal, deg=False, threshold=0.001)[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 (sequence of float) – XYZ components of the first vector.

  • v (sequence of float) – XYZ components of the second vector.

  • normal (sequence of float) – XYZ components of the plane’s normal spanned by u and v.

  • deg (boolean) – returns angle in degrees if True

  • threshold (The threshold (radians) used to consider if the angle is zero.) – Defaults to 1e-3.

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