Function angle_cos

Source
pub fn angle_cos<T, const N: usize>(u: &Vector<T, N>, v: &Vector<T, N>) -> T
where T: Float + Sum,
Expand description

Calculates the cosine of the angle between two vectors.

For vectors a and b, the cosine of the angle θ between them is: cos(θ) = (a · b) / (||a|| ||b||) Where (a · b) is the dot product and ||a|| and ||b|| are the magnitudes of the vectors.

§Arguments

  • u - A reference to the first vector
  • v - A reference to the second vector

§Returns

The cosine of the angle between the two vectors as a value of type T.

§Type Parameters

  • T - The floating-point type of the vector components
  • N - The dimensionality of the vectors

§Type Constraints

  • T: Float - The component type must be a floating-point type
  • T: Sum - The component type must support summation