Loading isis/src/base/objs/EquatorialCylindricalShape/EquatorialCylindricalShape.cpp +57 −0 Original line number Diff line number Diff line Loading @@ -411,5 +411,62 @@ namespace Isis { return hasIntersection(); } // Do nothing since the DEM intersection was already successful /** * Finds the intersection point on the ellipsoid model using the given * position of the observer (spacecraft) and direction vector from the * observer to the target (body). * * @param observerBodyFixedPosition Three dimensional position of the observer, * in the coordinate system of the target body. * @param observerLookVectorToTarget Three dimensional direction vector from * the observer to the target. * * @return @b bool Indicates whether this shape model found a valid ellipsoid intersection. */ bool EquatorialCylindricalShape::intersectEllipsoid( const std::vector<double> observerBodyFixedPosition, const std::vector<double> &observerLookVectorToTarget) { // Clear out previous surface point and normal clearSurfacePoint(); SpiceDouble lookB[3]; // This memcpy does: // lookB[0] = observerLookVectorToTarget[0]; // lookB[1] = observerLookVectorToTarget[1]; // lookB[2] = observerLookVectorToTarget[2]; memcpy(lookB,&observerLookVectorToTarget[0], 3*sizeof(double)); // get target radii // std::vector<Distance> radii = targetRadii(); // SpiceDouble a = radii[0].kilometers(); // SpiceDouble b = radii[1].kilometers(); // SpiceDouble c = radii[2].kilometers(); SpiceDouble a = m_maxRadius->kilometers(); SpiceDouble b = m_maxRadius->kilometers(); SpiceDouble c = m_maxRadius->kilometers(); // check if observer look vector intersects the target SpiceDouble intersectionPoint[3]; SpiceBoolean intersected = false; NaifStatus::CheckErrors(); surfpt_c((SpiceDouble *) &observerBodyFixedPosition[0], lookB, a, b, c, intersectionPoint, &intersected); NaifStatus::CheckErrors(); if (intersected) { SurfacePoint p; p.FromNaifArray(intersectionPoint); setSurfacePoint(p); } setHasIntersection(intersected); m_hasEllipsoidIntersection = intersected; return intersected; } } isis/src/base/objs/EquatorialCylindricalShape/EquatorialCylindricalShape.h +9 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,10 @@ namespace Isis { * intersection in intersectSurface() method to prevent early return * and attempt the iterative method even when the ellipsoid is not * intersected. Fixes #1438 * @history 2017-11-22 Jeff Anderson - Added the intersectEllipsoid virtual method so that * the DTM intersect method can use a starting radius for the * ellipsoid that is written to the labels during demprep as opposed * to the default radius of the target. */ class EquatorialCylindricalShape : public DemShape { public: Loading @@ -60,6 +64,11 @@ namespace Isis { bool intersectSurface(std::vector<double> observerPos, std::vector<double> lookDirection); protected: virtual bool intersectEllipsoid( const std::vector<double> observerPosRelativeToTarget, const std::vector<double> &observerLookVectorToTarget); private: Distance *m_minRadius; //!< Minimum radius value in DEM file Distance *m_maxRadius; //!< Maximum radius value in DEM file Loading isis/src/base/objs/ShapeModel/ShapeModel.h +7 −3 Original line number Diff line number Diff line Loading @@ -67,6 +67,8 @@ namespace Isis { * @history 2017-05-19 Tyler Wilson - Removed the calculateEllipsoidalSurfaceNormal() function, * as this is now being handled in the EllipsoidShape class. * References #1028. * @history 2017-11-22 Jeff Anderson - made intersectEllipsoid method virtual so it can be * overridden in the EquatorialCylindricalShape class * @history 2017-03-23 Kris Becker - added isVisibleFrom() and two * intersectSurface() methods to address real * occlusions. It is recommended that derived Loading Loading @@ -176,15 +178,17 @@ namespace Isis { bool hasEllipsoidIntersection(); // Intersect ellipse bool intersectEllipsoid(const std::vector<double> observerPosRelativeToTarget, virtual bool intersectEllipsoid( const std::vector<double> observerPosRelativeToTarget, const std::vector<double> &observerLookVectorToTarget); bool m_hasEllipsoidIntersection; //!< Indicates the ellipsoid was successfully intersected bool hasValidTarget() const; std::vector<Distance> targetRadii() const; void setHasNormal(bool status); double resolution(); private: bool m_hasEllipsoidIntersection; //!< Indicates the ellipsoid was successfully intersected bool m_hasIntersection; //!< indicates good intersection exists bool m_hasNormal; //!< indicates normal has been computed std::vector<double> m_normal; //!< Local normal of current intersection point Loading Loading
isis/src/base/objs/EquatorialCylindricalShape/EquatorialCylindricalShape.cpp +57 −0 Original line number Diff line number Diff line Loading @@ -411,5 +411,62 @@ namespace Isis { return hasIntersection(); } // Do nothing since the DEM intersection was already successful /** * Finds the intersection point on the ellipsoid model using the given * position of the observer (spacecraft) and direction vector from the * observer to the target (body). * * @param observerBodyFixedPosition Three dimensional position of the observer, * in the coordinate system of the target body. * @param observerLookVectorToTarget Three dimensional direction vector from * the observer to the target. * * @return @b bool Indicates whether this shape model found a valid ellipsoid intersection. */ bool EquatorialCylindricalShape::intersectEllipsoid( const std::vector<double> observerBodyFixedPosition, const std::vector<double> &observerLookVectorToTarget) { // Clear out previous surface point and normal clearSurfacePoint(); SpiceDouble lookB[3]; // This memcpy does: // lookB[0] = observerLookVectorToTarget[0]; // lookB[1] = observerLookVectorToTarget[1]; // lookB[2] = observerLookVectorToTarget[2]; memcpy(lookB,&observerLookVectorToTarget[0], 3*sizeof(double)); // get target radii // std::vector<Distance> radii = targetRadii(); // SpiceDouble a = radii[0].kilometers(); // SpiceDouble b = radii[1].kilometers(); // SpiceDouble c = radii[2].kilometers(); SpiceDouble a = m_maxRadius->kilometers(); SpiceDouble b = m_maxRadius->kilometers(); SpiceDouble c = m_maxRadius->kilometers(); // check if observer look vector intersects the target SpiceDouble intersectionPoint[3]; SpiceBoolean intersected = false; NaifStatus::CheckErrors(); surfpt_c((SpiceDouble *) &observerBodyFixedPosition[0], lookB, a, b, c, intersectionPoint, &intersected); NaifStatus::CheckErrors(); if (intersected) { SurfacePoint p; p.FromNaifArray(intersectionPoint); setSurfacePoint(p); } setHasIntersection(intersected); m_hasEllipsoidIntersection = intersected; return intersected; } }
isis/src/base/objs/EquatorialCylindricalShape/EquatorialCylindricalShape.h +9 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,10 @@ namespace Isis { * intersection in intersectSurface() method to prevent early return * and attempt the iterative method even when the ellipsoid is not * intersected. Fixes #1438 * @history 2017-11-22 Jeff Anderson - Added the intersectEllipsoid virtual method so that * the DTM intersect method can use a starting radius for the * ellipsoid that is written to the labels during demprep as opposed * to the default radius of the target. */ class EquatorialCylindricalShape : public DemShape { public: Loading @@ -60,6 +64,11 @@ namespace Isis { bool intersectSurface(std::vector<double> observerPos, std::vector<double> lookDirection); protected: virtual bool intersectEllipsoid( const std::vector<double> observerPosRelativeToTarget, const std::vector<double> &observerLookVectorToTarget); private: Distance *m_minRadius; //!< Minimum radius value in DEM file Distance *m_maxRadius; //!< Maximum radius value in DEM file Loading
isis/src/base/objs/ShapeModel/ShapeModel.h +7 −3 Original line number Diff line number Diff line Loading @@ -67,6 +67,8 @@ namespace Isis { * @history 2017-05-19 Tyler Wilson - Removed the calculateEllipsoidalSurfaceNormal() function, * as this is now being handled in the EllipsoidShape class. * References #1028. * @history 2017-11-22 Jeff Anderson - made intersectEllipsoid method virtual so it can be * overridden in the EquatorialCylindricalShape class * @history 2017-03-23 Kris Becker - added isVisibleFrom() and two * intersectSurface() methods to address real * occlusions. It is recommended that derived Loading Loading @@ -176,15 +178,17 @@ namespace Isis { bool hasEllipsoidIntersection(); // Intersect ellipse bool intersectEllipsoid(const std::vector<double> observerPosRelativeToTarget, virtual bool intersectEllipsoid( const std::vector<double> observerPosRelativeToTarget, const std::vector<double> &observerLookVectorToTarget); bool m_hasEllipsoidIntersection; //!< Indicates the ellipsoid was successfully intersected bool hasValidTarget() const; std::vector<Distance> targetRadii() const; void setHasNormal(bool status); double resolution(); private: bool m_hasEllipsoidIntersection; //!< Indicates the ellipsoid was successfully intersected bool m_hasIntersection; //!< indicates good intersection exists bool m_hasNormal; //!< indicates normal has been computed std::vector<double> m_normal; //!< Local normal of current intersection point Loading