Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
The computation of the azimuth was off by 180 degrees. The algorithm is from the same source: Vallado, section 4.4.3.
How did this bug come to be?
Vallado specifies that the azimuth needs to be computed by accounting for the quadrant check, and provides the sine and cosine of the azimuth angles as follows:
Given the quadrant check, I rewrote this as:
This is mathematically correct. However, when using the
atan2
function, the sign of each component matters. The code was usingatan2
incorrectly because I had moved the negative sign from the denominator to the numerator.Architectural Changes
No change
New Features
No change
Improvements
No change
Bug Fixes
Testing and validation
There isn't yet any public validation tests for azimuth and elevation, but it's been checked against proprietary data, which uncovered the error in azimuth. Elevation and range matched the proprietary data with high precision.
Documentation
This PR does not primarily deal with documentation changes.