angle(point1::T, point2::T) where {T}

Accurately ascertains the undirected angle (0 <= radians < pi) between two points given in N-dimensional Cartesian coordinates.

Prefer this to acos alternatives

  • more reliably accurate
  • more consistently stable

Suggested when any |coordinate| of either point may be outside 2^±20 or [1/1000000, 1000000]. Strongly recommended when any |coordinate| is outside 2^±24 or [1/16000000, 16000000].

If one of the points is at the origin, the result is zero.

You must define a tuple constructor Tuple(x::YourPointType) = ... if one does not already exist.