pub fn cosine_similarity(a: V3, b: V3) -> (f64, (V3, V3)) {
        let unit_a = a.unit();
        let unit_b = b.unit();

        // worked out by hand
        let value = V3::dot(&unit_a, &unit_b);
        let d_a = (unit_b - unit_a * value) / a.norm();
        let d_b = (unit_a - unit_b * value) / b.norm();
        (value, (d_a, d_b))
    }
/// Cosine of the angle between two vectors.
///
/// This is a value in the range `[-1, 1]` that is equal to `1` for vectors pointing
/// in the same direction, and `-1` for vectors pointing in opposite directions.
Cosine of the angle between two vectors.
Cosine of the angle between two vectors .
pub fn cosine_similarity(a: V3, b: V3) -> (f64, (V3, V3)) {
        let unit_a = a.unit();
        let unit_b = b.unit();
        // worked out by hand
        let value = V3::dot(&unit_a, &unit_b);
        let d_a = (unit_b - unit_a * value) / a.norm();
        let d_b = (unit_a - unit_b * value) / b.norm();
        (value, (d_a, d_b))
    }
pub fn cosine_similarity ( a : V3 , b : V3 ) -> ( f64 , ( V3 , V3 ) ) { let unit_a = a . unit ( ) ; let unit_b = b . unit ( ) ; // worked out by hand let value = V3 :: dot ( & unit_a , & unit_b ) ; let d_a = ( unit_b - unit_a * value ) / a . norm ( ) ; let d_b = ( unit_a - unit_b * value ) / b . norm ( ) ; ( value , ( d_a , d_b ) ) }
Cosine of the angle between two vectors.
Cosine of the angle between two vectors .
a
V3
b
V3
a
V3
b
V3