Commit 3fe37965 authored by Jesse Mapel's avatar Jesse Mapel
Browse files

PROG: corrected occlusion check order in BulletShapeModel.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/trunk@8091 41f8697f-d340-4b68-9986-7bafba869bb8
parent 2da0cd66
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -310,11 +310,6 @@ namespace Isis {
    if ( triangleIndex() != other.triangleIndex() ) return (false);
    if ( partId() != other.partId() ) return (false);
    
    // Check the emission angle from other.observer to this.point
    btVector3 psB = (other.observer() - point()).normalized();
    btScalar  angle = std::acos( normal().dot( psB ) ) * RAD2DEG;
    if ( std::fabs( angle ) > 90.0 ) return (false);
    
    // How close are the two intercept points?
    if ( distance( other ) > tolerance ) return ( false );

+18 −0
Original line number Diff line number Diff line
@@ -346,6 +346,14 @@ namespace Isis {
      return true;
    }
    
    // Check if the emission angle is greater than 90 degrees
    // If true, then it is occluded, if false then unknown
    btVector3 psB = (observer - hit.point()).normalized();
    btScalar  angle = std::acos( hit.normal().dot( psB ) ) * RAD2DEG;
    if ( std::fabs( angle ) > 90.0 - DBL_MIN) {
      return true;
    }

    // Ray cast from the observer to the intersection
    //   If we have an intersection, test for occlusion
    BulletClosestRayCallback results( observer, hit.point() );
@@ -461,8 +469,18 @@ namespace Isis {
   */
  bool BulletShapeModel::isVisibleFrom(const std::vector<double> observerPos,
                                       const std::vector<double> lookDirection)  {

    if ( !m_intercept.isValid() ) return (false);

    // Check if the emission angle is greater than 90 degrees
    // If true, then it is occluded, if false then unknown
    btVector3 observer(observerPos[0], observerPos[1], observerPos[2]);
    btVector3 psB = (observer - m_intercept.point()).normalized();
    btScalar  angle = std::acos( m_intercept.normal().dot( psB ) ) * RAD2DEG;
    if ( std::fabs( angle ) > 90.0 - DBL_MIN) {
      return false;
    }

    btVector3 rayEnd = castLookDir( observer,  btVector3(lookDirection[0], lookDirection[1], lookDirection[2]) );
    BulletClosestRayCallback results(observer, rayEnd);
    (void) m_model->raycast(observer, rayEnd, results);