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 ([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.

  • deg (bool, optional) – If True, returns the angle in degrees.

  • threshold (float, optional) – The threshold (radians) used to consider if the angle is zero.

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