Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) GetDistance

 

GetDistance is a math code snippet to calculate the distance between two coordinats from their horizontal and vertical distances, using Pythagoras.

 

#include <cmath>

//From www.richelbilderbeek.nl/CppGetDistance.htm
double GetDistance(const double dX, const double dY)
{
  return std::sqrt( (dX * dX) + (dY * dY) );
}

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict