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();
169 double *cudy,
bool test) {
171 vector<double> pB(3);
177 if (p_camera->target()->isSky()) {
187 vector<double> sJ = p_camera->instrumentPosition()->Coordinate();
190 vector<double> lookJ(3);
191 for (
int ic = 0; ic < 3; ic++) {
192 lookJ[ic] = pJ[ic] - sJ[ic];
215 double upsB[3], upB[3], dist;
216 vminus_c((SpiceDouble *) &lookB[0], upsB);
217 unorm_c(upsB, upsB, &dist);
218 unorm_c((SpiceDouble *) &pB[0], upB, &dist);
219 double cosangle = vdot_c(upB, upsB);
224 else if (cosangle < -1) {
228 emission = acos(cosangle) * 180.0 /
Isis::PI;
231 if (fabs(emission) > 90.) {
239 vector<double> lookC(3);
243 double fl = p_camera->DistortionMap()->UndistortedFocalPlaneZ();
245 *cudx = lookC[0] * fl / lookC[2];
246 *cudy = lookC[1] * fl / lookC[2];
270 bool CameraGroundMap::GetXY(
const double lat,
const double lon,
271 const double radius,
double *cudx,
double *cudy) {
274 Distance(radius, Distance::Meters));
275 return GetXY(spoint, cudx, cudy);
295 bool CameraGroundMap::GetdXYdPosition(
const SpicePosition::PartialType varType,
int coefIndex,
296 double *dx,
double *dy) {
301 double fl = p_camera->DistortionMap()->UndistortedFocalPlaneZ();
305 vector<double> lookC(3);
311 for (
int j = 0; j < 3; j++) d_lookJ[j] *= -1.0;
313 *dx = fl * DQuotient(lookC, d_lookC, 0);
314 *dy = fl * DQuotient(lookC, d_lookC, 1);
335 double *dx,
double *dy) {
340 double fl = p_camera->DistortionMap()->UndistortedFocalPlaneZ();
344 vector<double> lookC(3);
350 *dx = fl * DQuotient(lookC, d_lookC, 0);
351 *dy = fl * DQuotient(lookC, d_lookC, 1);
371 double *dx,
double *dy) {
382 double fl = p_camera->DistortionMap()->UndistortedFocalPlaneZ();
387 vector<double> dlookJ = bodyRot->
toJ2000Partial(m_pB, varType, coefIndex);
388 vector<double> lookC(3);
389 vector<double> dlookC(3);
395 *dx = fl * DQuotient(lookC, dlookC, 0);
396 *dy = fl * DQuotient(lookC, dlookC, 1);
414 bool CameraGroundMap::GetdXYdPoint(vector<double> d_pB,
double *dx,
double *dy) {
419 double fl = p_camera->DistortionMap()->UndistortedFocalPlaneZ();
423 vector<double> lookC(3);
427 vector<double> d_lookJ = bodyRot->
J2000Vector(d_pB);
430 *dx = fl * DQuotient(lookC, d_lookC, 0);
431 *dy = fl * DQuotient(lookC, d_lookC, 1);
455 double sinLon = sin(rlon);
456 double cosLon = cos(rlon);
457 double sinLat = sin(rlat);
458 double cosLat = cos(rlat);
464 v[0] = cosLat * cosLon;
470 v[1] = cosLat * sinLon;
479 QString msg =
"Invalid partial type for this method";
527 double sinLon = sin(rlon);
528 double cosLon = cos(rlon);
529 double sinLat = sin(rlat);
530 double cosLat = cos(rlat);
534 if (wrt == WRT_Latitude) {
535 v[0] = -radkm * sinLat * cosLon;
536 v[1] = -radkm * sinLon * sinLat;
537 v[2] = radkm * cosLat;
539 else if (wrt == WRT_Longitude) {
540 v[0] = -radkm * cosLat * sinLon;
541 v[1] = radkm * cosLat * cosLon;
545 v[0] = cosLon * cosLat;
546 v[1] = sinLon * cosLat;
566 double CameraGroundMap::DQuotient(vector<double> &look,
567 vector<double> &dlook,
569 return (look[2] * dlook[index] - look[index] * dlook[2]) /
This class defines a body-fixed surface point.
const double PI
The mathematical constant PI.
void SetGroundMap(CameraGroundMap *map)
Sets the Ground Map.
double radians() const
Convert an angle to a double.
Namespace for the standard library.
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 ...
double kilometers() const
Get the distance in kilometers.
Distance measurement, usually in meters.
Latitude GetLatitude() const
Return the body-fixed latitude for the surface point.
double degrees() const
Get the angle in units of Degrees.
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.
#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...
Longitude GetLongitude() const
Return the body-fixed longitude for the surface point.
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.
Namespace for ISIS/Bullet specific routines.
double kilometers() const
Get the displacement in kilometers.
Distance GetLocalRadius() const
Return the radius of the surface point.
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...