fn find_scale(
        coeff: &[f64; 4],
        center: &[f64; 2],
        focal: &[f64; 2],
    ) -> [(f64, f64); 2] {
        [0, 1].map(|i| {
            let min_edge_dist = center[i].min(1.0 - center[i]) / focal[i];
            // Find the input theta angle where Undistort(theta) = min_edge_dist
            if let Some(theta) = Self::undistort_inverse(coeff, min_edge_dist) {
                if theta >= std::f64::consts::PI / 2.0 {
                    // infinity?
                    (1.0, focal[i])
                } else {
                    // Find the input coordinates that will give us that theta
                    let target_edge = theta.tan();
                    log::info!("{}", target_edge);
                    (
                        target_edge / (0.5 / focal[i]),
                        1.0 / min_edge_dist / 2.0,
                    )
                }
            } else {
                // Cannot find scale so just don't scale
                (1.0, focal[i])
            }
        })
    }
// Find a scale that maps the middle point of 4 edges of the undistorted image to
// the edge of the field of view of the distorted image.
//
// Returns the scales and the adjusted fovs
Find a scale that maps the middle point of 4 edges of the undistorted image to
the edge of the field of view of the distorted image.

Returns the scales and the adjusted fovs
Find a scale that maps the middle point of 4 edges of the undistorted image to the edge of the field of view of the distorted image . Returns the scales and the adjusted fovs
fn find_scale(
        coeff: &[f64; 4],
        center: &[f64; 2],
        focal: &[f64; 2],
    ) -> [(f64, f64); 2] {
        [0, 1].map(|i| {
            let min_edge_dist = center[i].min(1.0 - center[i]) / focal[i];
            // Find the input theta angle where Undistort(theta) = min_edge_dist
            if let Some(theta) = Self::undistort_inverse(coeff, min_edge_dist) {
                if theta >= std::f64::consts::PI / 2.0 {
                    // infinity?
                    (1.0, focal[i])
                } else {
                    // Find the input coordinates that will give us that theta
                    let target_edge = theta.tan();
                    log::info!("{}", target_edge);
                    (
                        target_edge / (0.5 / focal[i]),
                        1.0 / min_edge_dist / 2.0,
                    )
                }
            } else {
                // Cannot find scale so just don't scale
                (1.0, focal[i])
            }
        })
    }
fn find_scale ( coeff : & [ f64 ; 4 ] , center : & [ f64 ; 2 ] , focal : & [ f64 ; 2 ] , ) -> [ ( f64 , f64 ) ; 2 ] { [ 0 , 1 ] . map ( | i | { let min_edge_dist = center [ i ] . min ( 1.0 - center [ i ] ) / focal [ i ] ; // Find the input theta angle where Undistort(theta) = min_edge_dist if let Some ( theta ) = Self :: undistort_inverse ( coeff , min_edge_dist ) { if theta >= std :: f64 :: consts :: PI / 2.0 { // infinity? ( 1.0 , focal [ i ] ) } else { // Find the input coordinates that will give us that theta let target_edge = theta . tan ( ) ; log :: info ! ( " " target_edge ) ; ( target_edge / ( 0.5 / focal [ i ] ) , 1.0 / min_edge_dist / 2.0 , ) } } else { // Cannot find scale so just don't scale ( 1.0 , focal [ i ] ) } } ) }
Find a scale that maps the middle point of 4 edges of the undistorted image to
the edge of the field of view of the distorted image.
Find a scale that maps the middle point of 4 edges of the undistorted image to the edge of the field of view of the distorted image .
coeff
&[f64; 4]
center
&[f64; 2]
focal
&[f64; 2]
coeff
&[f64; 4]
center
&[f64; 2]
focal
&[f64; 2]