47 CameraGroundMap::CameraGroundMap(
Camera *parent) {
66 bool CameraGroundMap::SetFocalPlane(
const double ux,
const double uy,
const double uz) {
67 NaifStatus::CheckErrors();
74 SpiceDouble unitLookC[3];
75 vhat_c(lookC, unitLookC);
77 NaifStatus::CheckErrors();
79 bool result = p_camera->SetLookDirection(unitLookC);
93 if (p_camera->target()->shape()->name() ==
"Plane") {
97 if (radius < 0.0) radius = 0.0;
101 LookCtoFocalPlaneXY();
106 Distance radius(p_camera->LocalRadius(lat, lon));
107 if (radius.isValid()) {
108 if (p_camera->Sensor::SetGround(
SurfacePoint(lat, lon, radius))) {
109 LookCtoFocalPlaneXY();
122 void CameraGroundMap::LookCtoFocalPlaneXY() {
124 p_camera->Sensor::LookDirection(lookC);
127 double focalLength = p_camera->DistortionMap()->UndistortedFocalPlaneZ();
128 double scale = focalLength / lookC[2];
130 p_focalPlaneX = lookC[0] * scale;
131 p_focalPlaneY = lookC[1] * scale;
143 if (p_camera->Sensor::SetGround(surfacePoint)) {
144 LookCtoFocalPlaneXY();
167 bool CameraGroundMap::GetXY(
const SurfacePoint &point,
double *cudx,
double *cudy) {
169 vector<double> pB(3);
175 if (p_camera->target()->isSky()) {
185 vector<double> sJ = p_camera->instrumentPosition()->Coordinate();
188 vector<double> lookJ(3);
189 for (
int ic = 0; ic < 3; ic++) {
190 lookJ[ic] = pJ[ic] - sJ[ic];
200 double upsB[3], upB[3], dist;
201 vminus_c((SpiceDouble *) &lookB[0], upsB);
202 unorm_c(upsB, upsB, &dist);
203 unorm_c((SpiceDouble *) &pB[0], upB, &dist);
204 double angle = vdot_c(upB, upsB);
209 else if (angle < -1) {
213 emission = acos(angle) * 180.0 /
Isis::PI;
216 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];
252 bool CameraGroundMap::GetXY(
const double lat,
const double lon,
253 const double radius,
double *cudx,
double *cudy) {
256 Distance(radius, Distance::Meters));
257 return GetXY(spoint, cudx, cudy);
277 bool CameraGroundMap::GetdXYdPosition(
const SpicePosition::PartialType varType,
int coefIndex,
278 double *dx,
double *dy) {
283 double fl = p_camera->DistortionMap()->UndistortedFocalPlaneZ();
287 vector<double> lookC(3);
293 for (
int j = 0; j < 3; j++) d_lookJ[j] *= -1.0;
295 *dx = fl * DQuotient(lookC, d_lookC, 0);
296 *dy = fl * DQuotient(lookC, d_lookC, 1);
317 double *dx,
double *dy) {
322 double fl = p_camera->DistortionMap()->UndistortedFocalPlaneZ();
326 vector<double> lookC(3);
332 *dx = fl * DQuotient(lookC, d_lookC, 0);
333 *dy = fl * DQuotient(lookC, d_lookC, 1);
353 double *dx,
double *dy) {
364 double fl = p_camera->DistortionMap()->UndistortedFocalPlaneZ();
369 vector<double> dlookJ = bodyRot->
toJ2000Partial(m_pB, varType, coefIndex);
370 vector<double> lookC(3);
371 vector<double> dlookC(3);
377 *dx = fl * DQuotient(lookC, dlookC, 0);
378 *dy = fl * DQuotient(lookC, dlookC, 1);
396 bool CameraGroundMap::GetdXYdPoint(vector<double> d_pB,
double *dx,
double *dy) {
401 double fl = p_camera->DistortionMap()->UndistortedFocalPlaneZ();
405 vector<double> lookC(3);
409 vector<double> d_lookJ = bodyRot->
J2000Vector(d_pB);
412 *dx = fl * DQuotient(lookC, d_lookC, 0);
413 *dy = fl * DQuotient(lookC, d_lookC, 1);
437 double sinLon = sin(rlon);
438 double cosLon = cos(rlon);
439 double sinLat = sin(rlat);
440 double cosLat = cos(rlat);
446 v[0] = cosLat * cosLon;
452 v[1] = cosLat * sinLon;
461 QString msg =
"Invalid partial type for this method";
509 double sinLon = sin(rlon);
510 double cosLon = cos(rlon);
511 double sinLat = sin(rlat);
512 double cosLat = cos(rlat);
516 if (wrt == WRT_Latitude) {
517 v[0] = -radkm * sinLat * cosLon;
518 v[1] = -radkm * sinLon * sinLat;
519 v[2] = radkm * cosLat;
521 else if (wrt == WRT_Longitude) {
522 v[0] = -radkm * cosLat * sinLon;
523 v[1] = radkm * cosLat * cosLon;
527 v[0] = cosLon * cosLat;
528 v[1] = sinLon * cosLat;
548 double CameraGroundMap::DQuotient(vector<double> &look,
549 vector<double> &dlook,
551 return (look[2] * dlook[index] - look[index] * dlook[2]) /
This class defines a body-fixed surface point.
double degrees() const
Get the angle in units of Degrees.
Distance GetLocalRadius() const
Return the radius of the surface point.
double radians() const
Convert an angle to a double.
void SetGroundMap(CameraGroundMap *map)
Sets the Ground Map.
const double PI(3.14159265358979323846)
The mathematical constant PI.
This class is designed to encapsulate the concept of a Latitude.
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 ...
Distance measurement, usually in meters.
Longitude GetLongitude() const
Return the body-fixed longitude for the surface point.
This class is designed to encapsulate the concept of a Longitude.
PartialType
Radius axes types to use when computing partials.
std::vector< double > ReferenceVector(const std::vector< double > &jVec)
Given a direction vector in J2000, return a reference frame direction.
Latitude GetLatitude() const
Return the body-fixed latitude for the surface point.
double kilometers() const
Get the displacement in kilometers.
#define _FILEINFO_
Macro for the filename and line number.
Obtain SPICE rotation information for a body.
PartialType
This enumeration indicates whether the partial derivative is taken with respect to Right Ascension...
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
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 > J2000Vector(const std::vector< double > &rVec)
Given a direction vector in the reference frame, return a J2000 direction.
Obtain SPICE position information for a body.
double kilometers() const
Get the distance in kilometers.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
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...