No Description

gispoi.cpp 501B

12345678910111213141516
  1. #include "gispoi.h"
  2. GISPOI::GISPOI()
  3. {
  4. }
  5. // Function odDistance(A,B)
  6. // Given two objects A and B of type GISPOI, uses their longitudes and
  7. // latitudes to compute and return their orthodromic distance in kilometers.
  8. double GISPOI::odDistance(const GISPOI &B) const {
  9. return EARTH_RADIUS * acos(
  10. sin( deg2rad( getLat() ) ) * sin( deg2rad( B.getLat() ) ) +
  11. cos( deg2rad( getLat() ) ) * cos( deg2rad( B.getLat() ) ) *
  12. cos( deg2rad( getLon() ) - deg2rad(B.getLon()) ) );
  13. }