Skip to content

Commit

Permalink
Fixed the comments/documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoconni committed Oct 18, 2020
1 parent e4829c0 commit 3743a5c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 35 deletions.
30 changes: 0 additions & 30 deletions src/math/FGLocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,22 +373,6 @@ void FGLocation::ComputeDerivedUnconditional(void) const
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The calculations, below, implement the Haversine formulas to calculate
// heading and distance to a set of lat/long coordinates from the current
// position.
//
// The basic equations are (lat1, long1 are source positions; lat2
// long2 are target positions):
//
// R = earth’s radius
// Δlat = lat2 − lat1
// Δlong = long2 − long1
//
// For the waypoint distance calculation:
//
// a = sin²(Δlat/2) + cos(lat1)∙cos(lat2)∙sin²(Δlong/2)
// c = 2∙atan2(√a, √(1−a))
// d = R∙c

double FGLocation::GetDistanceTo(double target_longitude,
double target_latitude) const
Expand All @@ -404,20 +388,6 @@ double FGLocation::GetDistanceTo(double target_longitude,
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The calculations, below, implement the Haversine formulas to calculate
// heading and distance to a set of lat/long coordinates from the current
// position.
//
// The basic equations are (lat1, long1 are source positions; lat2
// long2 are target positions):
//
// R = earth’s radius
// Δlat = lat2 − lat1
// Δlong = long2 − long1
//
// For the heading angle calculation:
//
// θ = atan2(sin(Δlong)∙cos(lat2), cos(lat1)∙sin(lat2) − sin(lat1)∙cos(lat2)∙cos(Δlong))

double FGLocation::GetHeadingTo(double target_longitude,
double target_latitude) const
Expand Down
10 changes: 5 additions & 5 deletions src/math/FGLocation.h
Original file line number Diff line number Diff line change
Expand Up @@ -304,17 +304,17 @@ class FGLocation : public FGJSBBase
location. This corresponds to the shortest distance between the two
locations. Earth curvature is taken into account.
@param target_longitude the target longitude in radians
@param target_latitude the target latitude in radians
@return The geodetic distance between the two locations */
@param target_latitude the target geodetic latitude in radians
@return The geodetic distance in feet between the two locations */
double GetDistanceTo(double target_longitude, double target_latitude) const;

/** Get the heading that should be followed from the current location to
a given location along the shortest path. Earth curvature is taken into
account.
@param target_longitude the target longitude in radians
@param target_latitude the target latitude in radians
@return The heading that should be followed to reach the targeted
location along the shortest path */
@param target_latitude the target geodetic latitude in radians
@return The heading in radians that should be followed to reach the
targeted location along the shortest path */
double GetHeadingTo(double target_longitude, double target_latitude) const;

/** Conversion from Local frame coordinates to a location in the
Expand Down

0 comments on commit 3743a5c

Please sign in to comment.