MCPcopy Create free account
hub / github.com/DOI-USGS/ISIS3 / SetGroundLocal

Method SetGroundLocal

isis/src/base/objs/Sensor/Sensor.cpp:477–517  ·  view source on GitHub ↗

* This method handles the common functions for the overloaded SetUniversalGround methods. * Instead of computing a point on the target, a point is set (lat,lon,radius) and the look * direction is computed. * * @param backCheck If true this method will check the lat/lon point to see if * it falls on the backside of the target (or beyond the * horizon).

Source from the content-addressed store, hash-verified

475 * @history 2017-03-23 Kris Becker - Added formal occlusion callback
476 */
477 bool Sensor::SetGroundLocal(bool backCheck) {
478 ShapeModel *shape = target()->shape();
479 // With the 3 spherical value compute the x/y/z coordinate
480 //latrec_c(m_radius, (m_longitude * PI / 180.0), (m_latitude * PI / 180.0), m_pB);
481
482
483 if (!(shape->hasIntersection())) {
484 return false;
485 }
486
487 // Make sure the point isn't on the backside of the body
488
489 // This is static purely for performance reasons. A significant speedup
490 // is achieved here.
491 const vector<double> &sB =
492 bodyRotation()->ReferenceVector(instrumentPosition()->Coordinate());
493
494 m_lookB[0] = shape->surfaceIntersection()->GetX().kilometers() - sB[0];
495 m_lookB[1] = shape->surfaceIntersection()->GetY().kilometers() - sB[1];
496 m_lookB[2] = shape->surfaceIntersection()->GetZ().kilometers() - sB[2];
497 m_newLookB = true;
498
499 // See if the point is on the backside of the target. Note occlusion handling
500 // now handles this in derived shape models that can support it. (KJB 2017-03-23)
501 // This may be good if the computation of the look direction is more sophisticated.
502 if (backCheck) {
503 // Assume the intersection point is good in order to get the emission angle
504 // shape->setHasIntersection(true); //KJB there should be a formal intersection in ShapeModel
505 std::vector<double> lookdir = lookDirectionBodyFixed();
506 if ( !shape->isVisibleFrom(sB, lookdir) ) {
507 shape->clearSurfacePoint();
508 shape->setHasIntersection(false);
509 return false;
510 }
511 }
512
513 // return with success
514 shape->setHasIntersection(true);
515
516 return true;
517 }
518
519
520 /**

Callers

nothing calls this directly

Calls 12

hasIntersectionMethod · 0.80
ReferenceVectorMethod · 0.80
surfaceIntersectionMethod · 0.80
GetZMethod · 0.80
setHasIntersectionMethod · 0.80
shapeMethod · 0.45
CoordinateMethod · 0.45
kilometersMethod · 0.45
GetXMethod · 0.45
GetYMethod · 0.45
isVisibleFromMethod · 0.45
clearSurfacePointMethod · 0.45

Tested by

no test coverage detected