Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor distance calculation to use Haversine formula #2

Conversation

babiaraujo
Copy link
Contributor

  • Replace the previous distance calculation method with the Haversine formula to improve accuracy over long distances.
  • Introduce a degreesToRadians utility function to enhance code readability and reduce redundancy.
  • Add detailed comments to the getDistanceBetweenCoordinates function and degreesToRadians utility function to improve documentation and understandability of the calculation logic.
  • Define earthRadiusKm as a constant to clarify the use of Earth's radius in the distance calculation and facilitate potential adjustments.

This update ensures more precise distance measurements between geographical coordinates and improves the maintainability and clarity of the code.

@TarcisioPhilips TarcisioPhilips merged commit 1454c99 into TarcisioPhilips:main Apr 4, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants