41 bool Stereo::elevation(Camera &cam1, Camera &cam2,
double &radius,
42 double &latitude,
double &longitude,
43 double &sepang,
double &error) {
47 if ( !cam1.HasSurfaceIntersection() )
return (
false);
48 if ( !cam2.HasSurfaceIntersection() )
return (
false);
51 double TC1[3], TC2[3];
52 targetToSpacecraft(cam1, TC1);
53 targetToSpacecraft(cam2, TC2);
57 double TP1[3], TP2[3];
58 targetToSurface(cam1, TP1);
59 targetToSurface(cam2, TP2);
62 sepang = vsep_c(TC1, TC2) * dpr_c();
64 SpiceDouble CP1[3], CP2[3];
65 vsub_c(TC1, TP1, CP1);
66 vsub_c(TC2, TP2, CP2);
68 sepang = vsep_c(CP1, CP2) * dpr_c();
74 vscl_c(1.0/DR1, CP1, CP1);
75 vscl_c(1.0/DR2, CP2, CP2);
86 double dd = TC2[0] - TC1[0];
87 double ee = TC2[1] - TC1[1];
88 double ff = TC2[2] - TC1[2];
91 double bzcy = bb*zz - cc*yy;
92 double cebf = cc*ee - bb*ff;
93 double cxaz = cc*xx - aa*zz;
94 double afcd = aa*ff - cc*dd;
95 double aybx = aa*yy - bb*xx;
96 double bdae = bb*dd - aa*ee;
99 double T=-(bzcy*cebf+cxaz*afcd+aybx*bdae)/
100 (bzcy*bzcy+cxaz*cxaz+aybx*aybx);
101 double lx=TC1[0] + T * CP1[0];
102 double ly=TC1[1] + T * CP1[1];
103 double lz=TC1[2] + T * CP1[2];
106 double x = TC2[0] - lx;
107 double y = TC2[1] - ly;
108 double z = TC2[2] - lz;
111 double rx = y * CP2[2] - CP2[1] * z;
112 double ry = CP2[0] * z - x * CP2[2];
113 double rz = x * CP2[1] - CP2[0] * y;
114 double dr = std::sqrt(rx*rx+ry*ry+rz*rz);
117 rx = CP1[1] * CP2[2] - CP2[1] * CP1[2];
118 ry = CP2[0] * CP1[2] - CP1[0] * CP2[2];
119 rz = CP1[0] * CP2[1] - CP2[0] * CP1[1];
120 double raa = std::sqrt(rx*rx+ry*ry+rz*rz);
134 double mx = (lx+rx)/2.0;
135 double my = (ly+ry)/2.0;
136 double mz = (lz+rz)/2.0;
137 rectangular(mx, my, mz, latitude, longitude, radius);
144 void Stereo::spherical(
const double latitude,
const double longitude,
146 double &x,
double &y,
double &z) {
148 latrec_c(radius/1000.0, longitude*rpd_c(), latitude*rpd_c(), &rec[0]);
155 void Stereo::rectangular(
const double x,
const double y,
const double z,
156 double &latitude,
double &longitude,
162 reclat_c(&rec[0], &radius, &longitude, &latitude);
163 longitude *= dpr_c();
170 std::vector<double> Stereo::array2StdVec(
const double d[3]) {
171 std::vector<double> v;
172 for (
int i = 0 ; i < 3 ; i++ ) {
178 double *Stereo::stdVec2Array(
const std::vector<double> &v,
double *d) {
180 d =
new double[v.size()];
183 for (
unsigned int i = 0 ; i < v.size() ; i++ ) {
189 void Stereo::targetToSpacecraft(Camera &camera,
double TP[3]) {
190 camera.instrumentPosition(TP);
194 void Stereo::targetToSurface(Camera &camera,
double TC[3]) {
195 camera.Coordinate(TC);
const double Null
Value for an Isis Null pixel.
static double To360Domain(const double lon)
This method converts a longitude into the 0 to 360 domain.
Namespace for ISIS/Bullet specific routines.