angle_vectors

compas.geometry.angle_vectors(u, v, deg=False, tol=0.0)[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.

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

  • tol (float, optional) – Tolerance for the length of the vectors.

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