7#include "CameraGroundMap.h"
15#include "IException.h"
18#include "NaifStatus.h"
19#include "SurfacePoint.h"
58 SpiceDouble unitLookC[3];
59 vhat_c(lookC, unitLookC);
78 double radius = lat.degrees();
81 if (radius < 0.0) radius = 0.0;
91 if (radius.isValid()) {
108 p_camera->Sensor::LookDirection(lookC);
112 double scale = focalLength / lookC[2];
127 if (
p_camera->Sensor::SetGround(surfacePoint)) {
153 double *cudy,
bool test) {
155 vector<double> pB(3);
170 vector<double> pJ = bodyRot->J2000Vector(pB);
174 vector<double> lookJ(3);
175 for (
int ic = 0; ic < 3; ic++) {
176 lookJ[ic] = pJ[ic] - sJ[ic];
198 vector<double> lookB = bodyRot->ReferenceVector(lookJ);
199 double upsB[3], upB[3], dist;
200 vminus_c((SpiceDouble *) &lookB[0], upsB);
201 unorm_c(upsB, upsB, &dist);
202 unorm_c((SpiceDouble *) &pB[0], upB, &dist);
203 double cosangle = vdot_c(upB, upsB);
208 else if (cosangle < -1) {
212 emission = acos(cosangle) * 180.0 /
Isis::PI;
215 if (fabs(emission) > 90.) {
223 vector<double> lookC(3);
224 lookC = instRot->ReferenceVector(
m_lookJ);
229 *cudx = lookC[0] * fl / lookC[2];
230 *cudy = lookC[1] * fl / lookC[2];
255 const double radius,
double *cudx,
double *cudy) {
259 return GetXY(spoint, cudx, cudy);
280 double *dx,
double *dy) {
289 vector<double> lookC(3);
290 lookC = instRot->ReferenceVector(
m_lookJ);
294 vector<double> d_lookJ = instPos->CoordinatePartial(varType, coefIndex);
295 for (
int j = 0; j < 3; j++) d_lookJ[j] *= -1.0;
296 vector<double> d_lookC = instRot->ReferenceVector(d_lookJ);
319 double *dx,
double *dy) {
328 vector<double> lookC(3);
329 lookC = instRot->ReferenceVector(
m_lookJ);
332 vector<double> d_lookC = instRot->ToReferencePartial(
m_lookJ, varType, coefIndex);
355 double *dx,
double *dy) {
371 vector<double> dlookJ = bodyRot->toJ2000Partial(
m_pB, varType, coefIndex);
372 vector<double> lookC(3);
373 vector<double> dlookC(3);
376 lookC = instRot->ReferenceVector(
m_lookJ);
377 dlookC = instRot->ReferenceVector(dlookJ);
407 vector<double> lookC(3);
408 lookC = instRot->ReferenceVector(
m_lookJ);
411 vector<double> d_lookJ = bodyRot->J2000Vector(d_pB);
412 vector<double> d_lookC = instRot->ReferenceVector(d_lookJ);
437 double rlat = spoint.GetLatitude().radians();
438 double rlon = spoint.GetLongitude().radians();
439 double sinLon = sin(rlon);
440 double cosLon = cos(rlon);
441 double sinLat = sin(rlat);
442 double cosLat = cos(rlat);
448 v[0] = cosLat * cosLon;
454 v[1] = cosLat * sinLon;
463 QString msg =
"Invalid partial type for this method";
491 v[0] = spoint.GetX().kilometers() / radkm;
492 v[1] = spoint.GetY().kilometers() / radkm;
493 v[2] = spoint.GetZ().kilometers() / radkm;
509 double rlat = spoint.GetLatitude().radians();
510 double rlon = spoint.GetLongitude().radians();
511 double sinLon = sin(rlon);
512 double cosLon = cos(rlon);
513 double sinLat = sin(rlat);
514 double cosLat = cos(rlat);
515 double radkm = spoint.GetLocalRadius().kilometers();
518 if (wrt == WRT_Latitude) {
519 v[0] = -radkm * sinLat * cosLon;
520 v[1] = -radkm * sinLon * sinLat;
521 v[2] = radkm * cosLat;
523 else if (wrt == WRT_Longitude) {
524 v[0] = -radkm * cosLat * sinLon;
525 v[1] = radkm * cosLat * cosLon;
529 v[0] = cosLon * cosLat;
530 v[1] = sinLon * cosLat;
551 vector<double> &dlook,
553 return (look[2] * dlook[index] - look[index] * dlook[2]) /
@ Degrees
Degrees are generally considered more human readable, 0-360 is one circle, however most math does not...
double UndistortedFocalPlaneZ() const
Gets the z-value in the undistorted focal plane coordinate system.
virtual bool SetGround(const Latitude &lat, const Longitude &lon)
Compute undistorted focal plane coordinate from ground position.
PartialType
Radius axes types to use when computing partials.
virtual bool GetXY(const SurfacePoint &spoint, double *cudx, double *cudy, bool test=true)
Compute undistorted focal plane coordinate from ground position using current Spice from SetImage cal...
virtual bool GetdXYdTOrientation(const SpiceRotation::PartialType varType, int coefIndex, double *cudx, double *cudy)
Compute derivative of focal plane coordinate w/r to target body using current state.
CameraGroundMap(Camera *parent)
Constructor.
virtual bool GetdXYdPoint(std::vector< double > d_pB, double *dx, double *dy)
Compute derivative of focal plane coordinate w/r to ground point using current state.
double p_focalPlaneX
Camera's x focal plane coordinate.
std::vector< double > m_lookJ
Look vector in J2000 calculated from ground coordinates in GetXY and used for partials.
double DQuotient(std::vector< double > &look, std::vector< double > &dlook, int index)
Convenience method for quotient rule applied to look vector.
virtual bool SetFocalPlane(const double ux, const double uy, const double uz)
Compute ground position from focal plane coordinate.
virtual bool GetdXYdPosition(const SpicePosition::PartialType varType, int coefIndex, double *cudx, double *cudy)
Compute derivative w/r to position of focal plane coordinate from ground position using current Spice...
virtual bool GetdXYdOrientation(const SpiceRotation::PartialType varType, int coefIndex, double *cudx, double *cudy)
Compute derivative of focal plane coordinate w/r to instrument using current state from SetImage call...
std::vector< double > EllipsoidPartial(SurfacePoint spoint, PartialType raxis)
Compute derivative of focal plane coordinate w/r to one of the ellipsoidal radii (a,...
std::vector< double > PointPartial(SurfacePoint spoint, PartialType wrt)
Compute derivative with respect to indicated variable of conversion function from lat/lon/rad to rect...
std::vector< double > m_pB
Surface point calculated from ground coordinates in GetXY and used for partials.
void LookCtoFocalPlaneXY()
Calculate focalplane x/y from lookvector in camera.
double p_focalPlaneY
Camera's y focal plane coordinate.
std::vector< double > MeanRadiusPartial(SurfacePoint spoint, Distance meanRadius)
Compute derivative of focal plane coordinate w/r to mean of the ellipsoidal radii (a,...
CameraDistortionMap * DistortionMap()
Returns a pointer to the CameraDistortionMap object.
void SetGroundMap(CameraGroundMap *map)
Sets the Ground Map.
double kilometers() const
Get the displacement in kilometers.
Distance measurement, usually in meters.
double kilometers() const
Get the distance in kilometers.
@ Meters
The distance is being specified in meters.
@ Programmer
This error is for when a programmer made an API call that was illegal.
This class is designed to encapsulate the concept of a Latitude.
This class is designed to encapsulate the concept of a Longitude.
static void CheckErrors(bool resetNaif=true)
This method looks for any naif errors that might have occurred.
Distance LocalRadius() const
Returns the local radius at the intersection point.
bool SetLookDirection(const double v[3])
Sets the look direction of the spacecraft.
virtual SpiceRotation * bodyRotation() const
Accessor method for the body rotation.
void instrumentPosition(double p[3]) const
Returns the spacecraft position in body-fixed frame km units.
virtual Target * target() const
Returns a pointer to the target object.
virtual SpiceRotation * instrumentRotation() const
Accessor method for the instrument rotation.
Obtain SPICE position information for a body.
Obtain SPICE rotation information for a body.
PartialType
This enumeration indicates whether the partial derivative is taken with respect to Right Ascension,...
This class defines a body-fixed surface point.
This is free and unencumbered software released into the public domain.
const double PI
The mathematical constant PI.
Namespace for the standard library.