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;
302 IString msg =
"A valid intersection must be defined before computing the surface normal";
314 double a = radii[0].kilometers();
315 double b = radii[1].kilometers();
316 double c = radii[2].kilometers();
318 vector<double>
normal(3,0.);
321 surfnm_c(a, b, c, pB, (SpiceDouble *) &
normal[0]);
363 std::vector<SpiceDouble>
normal(3);
364 if (neighborPoints.isEmpty()) {
372 double topMinusBottom[3];
373 vsub_c(neighborPoints[0], neighborPoints[1], topMinusBottom);
374 double rightMinusLeft[3];
375 vsub_c(neighborPoints[3], neighborPoints [2], rightMinusLeft);
378 ucrss_c(topMinusBottom, rightMinusLeft, (SpiceDouble *) &
normal[0]);
382 unorm_c((SpiceDouble *) &
normal[0], (SpiceDouble *) &
normal[0], &mag);
398 double centerLookVect[3];
401 unorm_c(pB, centerLookVect, &mag);
402 double dotprod = vdot_c((SpiceDouble *) &
normal[0], centerLookVect);
404 vminus_c((SpiceDouble *) &
normal[0], (SpiceDouble *) &
normal[0]);
void calculateLocalNormal(QVector< double *> cornerNeighborPoints)
This method calculates the local surface normal of the current intersection point.
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.
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
double * DoubleBuffer() const
Returns the value of the shape buffer.
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.
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.
Cube * m_demCube
The cube containing the model.
Namespace for the standard library.
This class is designed to encapsulate the concept of a Latitude.
SurfacePoint * surfaceIntersection() const
Returns the surface intersection for this ShapeModel.
Projection * projection()
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
This error is for when a programmer made an API call that was illegal.
double kilometers() const
Get the distance in kilometers.
Distance measurement, usually in meters.
double degrees() const
Get the angle in units of Degrees.
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.
std::vector< Distance > targetRadii() const
Returns the radii of the body in km.
void setHasIntersection(bool b)
Sets the flag to indicate whether this ShapeModel has an intersection.
double WorldX() const
This returns the world X coordinate provided SetGround, SetCoordinate, SetUniversalGround, or SetWorld returned with success.
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.
#define _FILEINFO_
Macro for the filename and line number.
void read(Blob &blob) const
This method will read data from the specified Blob object.
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.
PixelType pixelType() const
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.
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.
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
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 ToNaifArray(double naifOutput[3]) const
A naif array is a c-style array of size 3.
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.
Adds specific functionality to C++ strings.
Namespace for ISIS/Bullet specific routines.
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.
bool isValid() const
This indicates whether we have a legitimate angle stored or are in an unset, or invalid, state.
const double RAD2DEG
Multiplier for converting from radians to degrees.
double kilometers() const
Get the displacement in kilometers.
double WorldY() const
This returns the world Y coordinate provided SetGround, SetCoordinate, SetUniversalGround, or SetWorld returned with success.
DemShape()
Construct a DemShape object.
bool isDEM() const
Indicates that this shape model is from a DEM.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
IO Handler for Isis Cubes.