21 #include "CubeManager.h"
76 demCubeFile = (QString) kernels[
"ElevationModel"];
79 demCubeFile = (QString) kernels[
"ShapeModel"];
138 vector<double> lookDirection) {
144 if (!ellipseIntersected) {
149 static const int maxit = 100;
151 double dX, dY, dZ, dist2;
159 SpiceDouble currentIntersectPt[3];
160 SpiceDouble newIntersectPt[3];
168 double tol2 = tol * tol;
182 double t = newIntersectPt[0] * newIntersectPt[0] +
183 newIntersectPt[1] * newIntersectPt[1];
185 latDD = atan2(newIntersectPt[2], sqrt(t)) *
RAD2DEG;
186 lonDD = atan2(newIntersectPt[1], newIntersectPt[0]) *
RAD2DEG;
204 memcpy(currentIntersectPt, newIntersectPt, 3 *
sizeof(
double));
208 surfpt_c((SpiceDouble *) &observerPos[0], &lookDirection[0], r, r, r, newIntersectPt,
209 (SpiceBoolean*) &status);
226 dX = currentIntersectPt[0] - newIntersectPt[0];
227 dY = currentIntersectPt[1] - newIntersectPt[1];
228 dZ = currentIntersectPt[2] - newIntersectPt[2];
229 dist2 = (dX*dX + dY*dY + dZ*dZ) * 1000 * 1000;
335 std::vector<SpiceDouble>
normal(3);
336 if (neighborPoints.isEmpty()) {
337 normal[0] = normal[1] = normal[2] = 0.0;
344 double topMinusBottom[3];
345 vsub_c(neighborPoints[0], neighborPoints[1], topMinusBottom);
346 double rightMinusLeft[3];
347 vsub_c(neighborPoints[3], neighborPoints [2], rightMinusLeft);
350 ucrss_c(topMinusBottom, rightMinusLeft, (SpiceDouble *) &normal[0]);
354 unorm_c((SpiceDouble *) &normal[0], (SpiceDouble *) &normal[0], &mag);
357 normal[0] = normal[1] = normal[2] = 0.0;
370 double centerLookVect[3];
373 unorm_c(pB, centerLookVect, &mag);
374 double dotprod = vdot_c((SpiceDouble *) &normal[0], centerLookVect);
376 vminus_c((SpiceDouble *) &normal[0], (SpiceDouble *) &normal[0]);
void calculateEllipsoidalSurfaceNormal()
Calculates the ellipsoidal surface normal.
double WorldX() const
This returns the world X coordinate provided SetGround, SetCoordinate, SetUniversalGround, or SetWorld returned with success.
std::vector< double > normal()
Returns the local surface normal at the current intersection point.
double HotSample()
Returns the sample coordinate of the center pixel in the buffer for the interpolator.
Portal * m_portal
Buffer used to read from the model.
~DemShape()
Destroys the DemShape.
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
void calculateSurfaceNormal()
This method calculates the surface normal of the current intersection point.
PixelType pixelType() const
double degrees() const
Get the angle in units of Degrees.
double Interpolate(const double isamp, const double iline, const double buf[])
Performs an interpolation on the data according to the parameters set in the constructor.
void setNormal(const std::vector< double >)
Sets the normal for the currect intersection point.
Buffer for containing a two dimensional section of an image.
bool hasIntersection()
Returns intersection status.
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
Cube * m_demCube
The cube containing the model.
This class is designed to encapsulate the concept of a Latitude.
double * DoubleBuffer() const
Returns the value of the shape buffer.
Projection * projection()
void read(Blob &blob) const
This method will read data from the specified Blob object.
void ToNaifArray(double naifOutput[3]) const
A naif array is a c-style array of size 3.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
Distance measurement, usually in meters.
This algorithm is designed for applications that jump around between a couple of spots in the cube wi...
Projection * m_demProj
The projection of the model.
void setHasIntersection(bool b)
Sets the flag to indicate whether this ShapeModel has an intersection.
This class is designed to encapsulate the concept of a Longitude.
double HotLine()
Returns the line coordinate of the center pixel in the buffer for the interpolator.
bool intersectEllipsoid(const std::vector< double > observerPosRelativeToTarget, const std::vector< double > &observerLookVectorToTarget)
Finds the intersection point on the ellipsoid model using the given position of the observer (spacecr...
Degrees are generally considered more human readable, 0-360 is one circle, however most math does not...
int Samples()
Returns the number of samples needed by the interpolator.
double resolution()
Convenience method to get pixel resolution (m/pix) at current intersection point. ...
Contains multiple PvlContainers.
double kilometers() const
Get the displacement in kilometers.
void calculateLocalNormal(QVector< double * > cornerNeighborPoints)
This method calculates the local surface normal of the current intersection point.
bool IsSpecial(const double d)
Returns if the input pixel is special.
void addCachingAlgorithm(CubeCachingAlgorithm *)
This will add the given caching algorithm to the list of attempted caching algorithms.
Container for cube-like labels.
static Cube * Open(const QString &cubeFileName)
This method calls the method OpenCube() on the static instance.
void SetPosition(const double sample, const double line, const int band)
Sets the line and sample position of the buffer.
bool isValid() const
This indicates whether we have a legitimate angle stored or are in an unset, or invalid, state.
This class is used to create and store valid Isis3 targets.
Define shapes and provide utilities for Isis3 targets.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
Cube * demCube()
Returns the cube defining the shape model.
int Lines()
Returns the number of lines needed by the interpolator.
double m_pixPerDegree
Scale of DEM file in pixels per degree.
Distance localRadius(const Latitude &lat, const Longitude &lon)
Gets the radius from the DEM, if we have one.
void FromNaifArray(const double naifValues[3])
A naif array is a c-style array of size 3.
double demScale()
Return the scale of the DEM shape, in pixels per degree.
static void CheckErrors(bool resetNaif=true)
This method looks for any naif errors that might have occurred.
virtual bool SetUniversalGround(const double coord1, const double coord2)
This method is used to set the lat/lon or radius/azimuth (i.e.
bool intersectSurface(std::vector< double > observerPos, std::vector< double > lookDirection)
Find the intersection point with the DEM.
Interpolator * m_interp
Use bilinear interpolation from dem.
virtual void calculateDefaultNormal()
This method calculates the default normal (Ellipsoid for backwards compatability) for the DemShape...
void setName(QString name)
Sets the shape name.
The distance is being specified in meters.
void setHasNormal(bool status)
Sets the flag to indicate whether this ShapeModel has a surface normal.
double kilometers() const
Get the distance in kilometers.
const double RAD2DEG(57.29577951308232087679815481)
Multiplier for converting from radians to degrees.
SurfacePoint * surfaceIntersection() const
Returns the surface intersection for this ShapeModel.
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
DemShape()
Construct a DemShape object.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
double WorldY() const
This returns the world Y coordinate provided SetGround, SetCoordinate, SetUniversalGround, or SetWorld returned with success.
IO Handler for Isis Cubes.
bool isDEM() const
Indicates that this shape model is from a DEM.