Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created January 2, 2021 17:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/642d34f5b476bffc789c2b71fb060017 to your computer and use it in GitHub Desktop.
Save parzibyte/642d34f5b476bffc789c2b71fb060017 to your computer and use it in GitHub Desktop.
double calcularDistancia(int x1, int y1, int x2, int y2)
{
/*
Aplicar la fórmula que dice:
distancia = raiz_cuadrada_de(elevar_al_cuadrado(x1-x2) + elevar_al_cuadrado(y1-y2))
Nota: no importa el orden de los puntos ni si la distancia al restar es negativa
*/
return sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment