Skip to content

Instantly share code, notes, and snippets.

@alilleybrinker
Created October 25, 2024 16:01
Show Gist options
  • Save alilleybrinker/050c93d0e642e85341fda52869539dcf to your computer and use it in GitHub Desktop.
Save alilleybrinker/050c93d0e642e85341fda52869539dcf to your computer and use it in GitHub Desktop.
#[rustfmt::skip]
fn linear_distance(
[x0, y0]: &[f64; 2],
[x1, y1]: &[f64; 2],
) -> f64
{
let y_component = (y1 - y0).powi(2);
let x_component = (x1 - x0).powi(2);
(y_component + x_component).sqrt()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment