Unverified Commit 84b0ec6e authored by acpaquette's avatar acpaquette Committed by GitHub
Browse files

Fixes arccos evaluating double close to -1 or 1 (#4405)

* Fixed issue where the acos of -1.0000000001 was resulting in a nan

* Update variable name

* Add entry to changelog
parent 11835256
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ release.
- Fixed "About Qview" to point to website documentation. [4333](https://github.com/USGS-Astrogeology/ISIS3/issues/4333)
- Fixed bug where the time bias was not being added to the ephemeris times in ckwriter. [4129](https://github.com/USGS-Astrogeology/ISIS3/issues/4129)
- Fixed logging in FindFeatures where we were trying to get a non-existent Pvl group from the Pvl log. [#4375](https://github.com/USGS-Astrogeology/ISIS3/issues/4375)
- Fixed an arccos evaluating a double close to either 1, -1 when calculating the ground azimuth in camera.cpp. [#4393](https://github.com/USGS-Astrogeology/ISIS3/issues/4393)

### Changed

+8 −3
Original line number Diff line number Diff line
@@ -2303,7 +2303,14 @@ namespace Isis {
    if (sin(b) == 0.0 || sin(c) == 0.0) {
      return azimuth;
    }
    double A = acos((cos(a) - cos(b)*cos(c))/(sin(b)*sin(c))) * 180.0 / PI;
    double intermediate = (cos(a) - cos(b)*cos(c))/(sin(b)*sin(c));
    if (intermediate < -1.0) {
      intermediate = -1.0;
    }
    else if (intermediate > 1.0) {
      intermediate = 1.0;
    }
    double A = acos(intermediate) * 180.0 / PI;
    //double B = acos((cos(b) - cos(c)*cos(a))/(sin(c)*sin(a))) * 180.0 / PI;
    if (glat >= 0.0) {
      if (quad == 1 || quad == 4) {
@@ -3078,5 +3085,3 @@ namespace Isis {

// end namespace isis
}