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);
63 bool result =
p_camera->SetLookDirection(unitLookC);
77 if (
p_camera->target()->shape()->name() ==
"Plane") {
81 if (radius < 0.0) radius = 0.0;
108 p_camera->Sensor::LookDirection(lookC);
111 double focalLength =
p_camera->DistortionMap()->UndistortedFocalPlaneZ();
112 double scale = focalLength / lookC[2];
127 if (
p_camera->Sensor::SetGround(surfacePoint)) {
153 double *cudy,
bool test) {
155 vector<double> pB(3);
171 vector<double> sJ =
p_camera->instrumentPosition()->Coordinate();
174 vector<double> lookJ(3);
175 for (
int ic = 0; ic < 3; ic++) {
176 lookJ[ic] = pJ[ic] - sJ[ic];
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);
227 double fl =
p_camera->DistortionMap()->UndistortedFocalPlaneZ();
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) {
285 double fl =
p_camera->DistortionMap()->UndistortedFocalPlaneZ();
289 vector<double> lookC(3);
295 for (
int j = 0; j < 3; j++) d_lookJ[j] *= -1.0;
319 double *dx,
double *dy) {
324 double fl =
p_camera->DistortionMap()->UndistortedFocalPlaneZ();
328 vector<double> lookC(3);
355 double *dx,
double *dy) {
366 double fl =
p_camera->DistortionMap()->UndistortedFocalPlaneZ();
372 vector<double> lookC(3);
373 vector<double> dlookC(3);
403 double fl =
p_camera->DistortionMap()->UndistortedFocalPlaneZ();
407 vector<double> lookC(3);
411 vector<double> d_lookJ = bodyRot->
J2000Vector(d_pB);
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";
511 double sinLon = sin(rlon);
512 double cosLon = cos(rlon);
513 double sinLat = sin(rlat);
514 double cosLat = cos(rlat);
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]) /
double radians() const
Convert an angle to a double.
double degrees() const
Get the angle in units of Degrees.
@ Degrees
Degrees are generally considered more human readable, 0-360 is one circle, however most math does not...
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,...
double kilometers() const
Get the displacement in kilometers.
Distance measurement, usually in meters.
bool isValid() const
Test if this distance has been initialized or not.
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.
Obtain SPICE position information for a body.
std::vector< double > CoordinatePartial(SpicePosition::PartialType partialVar, int coeffIndex)
Set the coefficients of a polynomial fit to each of the three coordinates of the position vector for ...
Obtain SPICE rotation information for a body.
std::vector< double > toJ2000Partial(const std::vector< double > &lookT, PartialType partialVar, int coeffIndex)
Given a direction vector in the reference frame, compute the derivative with respect to one of the co...
std::vector< double > ToReferencePartial(std::vector< double > &lookJ, PartialType partialVar, int coeffIndex)
Compute the derivative with respect to one of the coefficients in the angle polynomial fit equation o...
std::vector< double > ReferenceVector(const std::vector< double > &jVec)
Given a direction vector in J2000, return a reference frame direction.
std::vector< double > J2000Vector(const std::vector< double > &rVec)
Given a direction vector in the reference frame, return a J2000 direction.
PartialType
This enumeration indicates whether the partial derivative is taken with respect to Right Ascension,...
This class defines a body-fixed surface point.
Latitude GetLatitude() const
Return the body-fixed latitude for the surface point.
Longitude GetLongitude() const
Return the body-fixed longitude for the surface point.
Distance GetLocalRadius() const
Return the radius of the 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.