fn cell_scale_for_gap(scale_x: f32, scale_y: f32) -> f32 {
    let max_gap_scale = 0.9;
    let max_gap_len = 1. / 128.;
    let no_gap_len = 1. / 512.;

    let cell_len = scale_x.min(scale_y);
    if cell_len <= no_gap_len {
        1.
    } else if cell_len >= max_gap_len {
        max_gap_scale
    } else {
        let range_log = (max_gap_len / no_gap_len).ln() / 1.1f32.ln();
        let len_log = (cell_len / no_gap_len).ln() / 1.1f32.ln();
        let ratio = ((-3. + 6. * (len_log / range_log)).tanh() + 1.) / 2.;
        return max_gap_scale.max(1.0f32.min(max_gap_scale + (1. - max_gap_scale) * ratio));
    }
}
/// Dynamically calculate the gap between cells based on render zoom scale.
Dynamically calculate the gap between cells based on render zoom scale.
Dynamically calculate the gap between cells based on render zoom scale .
fn cell_scale_for_gap(scale_x: f32, scale_y: f32) -> f32 {
    let max_gap_scale = 0.9;
    let max_gap_len = 1. / 128.;
    let no_gap_len = 1. / 512.;
    let cell_len = scale_x.min(scale_y);
    if cell_len <= no_gap_len {
        1.
    } else if cell_len >= max_gap_len {
        max_gap_scale
    } else {
        let range_log = (max_gap_len / no_gap_len).ln() / 1.1f32.ln();
        let len_log = (cell_len / no_gap_len).ln() / 1.1f32.ln();
        let ratio = ((-3. + 6. * (len_log / range_log)).tanh() + 1.) / 2.;
        return max_gap_scale.max(1.0f32.min(max_gap_scale + (1. - max_gap_scale) * ratio));
    }
}
fn cell_scale_for_gap ( scale_x : f32 , scale_y : f32 ) -> f32 { let max_gap_scale = 0.9 ; let max_gap_len = 1. / 128. ; let no_gap_len = 1. / 512. ; let cell_len = scale_x . min ( scale_y ) ; if cell_len <= no_gap_len { 1. } else if cell_len >= max_gap_len { max_gap_scale } else { let range_log = ( max_gap_len / no_gap_len ) . ln ( ) / 1.1f32 . ln ( ) ; let len_log = ( cell_len / no_gap_len ) . ln ( ) / 1.1f32 . ln ( ) ; let ratio = ( ( - 3. + 6. * ( len_log / range_log ) ) . tanh ( ) + 1. ) / 2. ; return max_gap_scale . max ( 1.0f32 . min ( max_gap_scale + ( 1. - max_gap_scale ) * ratio ) ) ; } }
Dynamically calculate the gap between cells based on render zoom scale.
Dynamically calculate the gap between cells based on render zoom scale .
scale_x
f32
scale_y
f32