/// Find the closest points between two lines. The result is a
/// pair of parametric points, the first for `self` and the second
/// for `line`. If the lines are parallel then None is
/// returned.
///
/// Adapted from "Real-Time Collision Detection" by Christer
/// Ericson, published by Morgan Kaufmann Publishers, Copyright
/// 2005 Elsevier Inc
Find the closest points between two lines. The result is a
pair of parametric points, the first for `self` and the second
for `line`. If the lines are parallel then None is
returned.

Adapted from "Real-Time Collision Detection" by Christer
Ericson, published by Morgan Kaufmann Publishers, Copyright
2005 Elsevier Inc
Find the closest points between two lines . The result is a pair of parametric points the first for ` self ` and the second for ` line ` . If the lines are parallel then None is returned . Adapted from " Real - Time Collision Detection " by Christer Ericson published by Morgan Kaufmann Publishers Copyright 2005 Elsevier Inc
pub fn closest_points_between_lines(self,
                                        line: Line3f) -> Option<(f32, f32)> {
        let d1 = self.points.1 - self.points.0;
        let d2 = line.points.1 - line.points.0;
        let r = self.points.0 - line.points.0;
        let a = d1.dot(d1);
        let b = d1.dot(d2);
        let c = d1.dot(r);
        let e = d2.dot(d2);
        let f = d2.dot(r);
        let d = a * e - b * b;
        if d == 0.0 {
            None
        }
        else {
            let s = (b * f - c * e) / d;
            let t = (a * f - b * c) / d;
            Some((s, t))
        }
    }
pub fn closest_points_between_lines ( self , line : Line3f ) -> Option < ( f32 , f32 ) > { let d1 = self . points . 1 - self . points . 0 ; let d2 = line . points . 1 - line . points . 0 ; let r = self . points . 0 - line . points . 0 ; let a = d1 . dot ( d1 ) ; let b = d1 . dot ( d2 ) ; let c = d1 . dot ( r ) ; let e = d2 . dot ( d2 ) ; let f = d2 . dot ( r ) ; let d = a * e - b * b ; if d == 0.0 { None } else { let s = ( b * f - c * e ) / d ; let t = ( a * f - b * c ) / d ; Some ( ( s , t ) ) } }
Find the closest points between two lines.
Find the closest points between two lines .
self
line
Line3f