/// Rotate the capstone with so that corner 0 is the leftmost with respect
/// to the given reference line.
Rotate the capstone with so that corner 0 is the leftmost with respect
to the given reference line.
Rotate the capstone with so that corner 0 is the leftmost with respect to the given reference line .
fn rotate_capstone(cap: &mut Capstone, h0: Point, hd: Point) {
    let (best, _best_score) = cap
        .corners
        .iter()
        .enumerate()
        .map(|(i, p)| {
            let score: i32 = (p.x - h0.x) * -hd.y + (p.y - h0.y) * hd.x;
            (i, score)
        })
        .min_by_key(|(_i, score)| *score)
        .unwrap();
    // Rotate the capstone
    cap.corners.rotate_left(best);
    cap.c = perspective_setup(&cap.corners, 7.0, 7.0);
}
fn rotate_capstone ( cap : & mut Capstone , h0 : Point , hd : Point ) { let ( best , _best_score ) = cap . corners . iter ( ) . enumerate ( ) . map ( | ( i , p ) | { let score : i32 = ( p . x - h0 . x ) * - hd . y + ( p . y - h0 . y ) * hd . x ; ( i , score ) } ) . min_by_key ( | ( _i , score ) | * score ) . unwrap ( ) ; // Rotate the capstone cap . corners . rotate_left ( best ) ; cap . c = perspective_setup ( & cap . corners , 7.0 , 7.0 ) ; }
Rotate the capstone with so that corner 0 is the leftmost with respect
to the given reference line.
Rotate the capstone with so that corner 0 is the leftmost with respect to the given reference line .
cap
&mut Capstone
h0
Point
hd
Point