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

ShapeModel Normal State Fix (#5345)



* Adds local normal member variable to shapemodel

* Fixes variable initialization and sets local normal properly in bullet

* Update tests and truth data

* Fixed up documentation in ShapeModel.h

* Handled cases where the hasLocalNormal flag should be set to false

* Fixed tests

* Fixed gtests

* Addressed PR feedback

* Fixed more typos

* Further adjusted truth data for test

* Added changelog

---------

Co-authored-by: default avatarKelvin Rodriguez <krodriguez@usgs.gov>
parent c6037724
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ release.
  outputsuffix, both, or neither for naming convention purposes. [#5162](https://github.com/DOI-USGS/ISIS3/pull/5162)
- Changed the default PCK load behavior to try and load mission specific PCKs, if that fails we default to the base PCKs [#5335](https://github.com/DOI-USGS/ISIS3/pull/5335)
- Disabled option to use web=true when running spiceinit with HRSC images. [#5223](https://github.com/DOI-USGS/ISIS3/issues/5223)
- Seperated `normal` and `localNormal` in ISIS shapemodels, now the local normal is stored in its own member variable with setters and getters. [#5345](https://github.com/DOI-USGS/ISIS3/pull/5345)
- Set build option `pybindings=ON` in `build.sh` to turn on python bindings. [#5389](https://github.com/DOI-USGS/ISIS3/pull/5389)
- Updated Ale to version 0.10.0 [#5399](https://github.com/DOI-USGS/ISIS3/pull/5399)

+3 −3
Original line number Diff line number Diff line
@@ -442,7 +442,7 @@ namespace Isis {
    }

    btVector3 normal = m_intercept.normal();
    setNormal(normal[0], normal[1], normal[2]);
    setLocalNormal(normal[0], normal[1], normal[2]);
  }


@@ -719,11 +719,11 @@ namespace Isis {
      ShapeModel::setSurfacePoint( makeSurfacePoint(m_intercept.point()) ); // sets ShapeModel::m_hasIntersection=t, ShapeModel::m_hasNormal=f

      btVector3 normal = m_intercept.normal();
      setNormal(normal[0], normal[1], normal[2]);
      setLocalNormal(normal[0], normal[1], normal[2]);
    }
    else {
      ShapeModel::clearSurfacePoint();
      setHasNormal(false);
      setHasLocalNormal(false);
    }

    return;
+4 −4
Original line number Diff line number Diff line
@@ -222,10 +222,10 @@ void outputModelStatus(BulletShapeModel &bulletModel) {
             << intersection->GetY().kilometers() << ", "
             << intersection->GetZ().kilometers() << ")";
  }
  qDebug() << "Model has normal? " << bulletModel.hasNormal();
  qDebug() << "Model has normal? " << bulletModel.hasLocalNormal();
  std::vector<double> normal;
  if ( bulletModel.hasNormal() ) {
    normal = bulletModel.normal();
  if ( bulletModel.hasLocalNormal() ) {
    normal = bulletModel.localNormal();
    qDebug() << "  Local Normal: ("
             << normal[0] << ", "
             << normal[1] << ", "
@@ -238,7 +238,7 @@ void outputModelStatus(BulletShapeModel &bulletModel) {
               << normal[1] << ", "
               << normal[2] << ")";
      bulletModel.setLocalNormalFromIntercept();
      normal = bulletModel.normal();
      normal = bulletModel.localNormal();
      qDebug() << "  Recalculated Local Normal: ("
               << normal[0] << ", "
               << normal[1] << ", "
+2 −2
Original line number Diff line number Diff line
@@ -1622,7 +1622,7 @@ namespace Isis {
    }

    // restore input state if calculation failed and clean up.
    if (!shapeModel->hasNormal()) {
    if (!shapeModel->hasLocalNormal()) {
      p_pointComputed = false;
      return;
    }
@@ -1634,7 +1634,7 @@ namespace Isis {

    // Set the method normal values
    std::vector<double> localNormal(3);
    localNormal = shapeModel->normal();
    localNormal = shapeModel->localNormal();
    memcpy(normal, (double *) &localNormal[0], sizeof(double) * 3);
  }

+6 −6
Original line number Diff line number Diff line
@@ -369,8 +369,8 @@ namespace Isis {
    std::vector<SpiceDouble> normal(3);
    if (neighborPoints.isEmpty()) {
      normal[0] = normal[1] = normal[2] = 0.0;
      setNormal(normal);
      setHasNormal(false);
      setLocalNormal(normal);
      setHasLocalNormal(false);
      return;
    }

@@ -389,12 +389,12 @@ namespace Isis {

    if (mag == 0.0) {
      normal[0] = normal[1] = normal[2] = 0.0;
      setNormal(normal);
      setHasNormal(false);
      setLocalNormal(normal);
      setHasLocalNormal(false);
      return;
   }
    else {
      setHasNormal(true);
      setHasLocalNormal(true);
    }

    // Check to make sure that the normal is pointing outward from the planet
@@ -410,7 +410,7 @@ namespace Isis {
      vminus_c((SpiceDouble *) &normal[0], (SpiceDouble *) &normal[0]);
    }

    setNormal(normal);
    setLocalNormal(normal);
  }


Loading