pub fn angle_cos<T, const N: usize>(u: &Vector<T, N>, v: &Vector<T, N>) -> T
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 vectorv
- 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 componentsN
- The dimensionality of the vectors
§Type Constraints
T: Float
- The component type must be a floating-point typeT: Sum
- The component type must support summation