18#include "TProjection.h" 
   19#include "SpecialPixel.h" 
   24  bool Stereo::elevation(Camera &cam1, Camera &cam2, 
double &radius,
 
   25                         double &latitude, 
double &longitude, 
 
   26                         double &sepang, 
double &error) {
 
   30    if ( !cam1.HasSurfaceIntersection() ) 
return (
false);
 
   31    if ( !cam2.HasSurfaceIntersection() ) 
return (
false);
 
   34    double TC1[3], TC2[3];
 
   35    targetToSpacecraft(cam1, TC1);
 
   36    targetToSpacecraft(cam2, TC2);
 
   40    double TP1[3], TP2[3];
 
   41    targetToSurface(cam1, TP1);
 
   42    targetToSurface(cam2, TP2);
 
   45    sepang = vsep_c(TC1, TC2) * dpr_c();
 
   47    SpiceDouble CP1[3], CP2[3];
 
   48    vsub_c(TC1, TP1, CP1);
 
   49    vsub_c(TC2, TP2, CP2);
 
   51    sepang = vsep_c(CP1, CP2) * dpr_c();
 
   57    vscl_c(1.0/DR1, CP1, CP1);
 
   58    vscl_c(1.0/DR2, CP2, CP2);
 
   69    double dd = TC2[0] - TC1[0];
 
   70    double ee = TC2[1] - TC1[1];
 
   71    double ff = TC2[2] - TC1[2];
 
   74    double bzcy = bb*zz - cc*yy;
 
   75    double cebf = cc*ee - bb*ff;
 
   76    double cxaz = cc*xx - aa*zz;
 
   77    double afcd = aa*ff - cc*dd;
 
   78    double aybx = aa*yy - bb*xx;
 
   79    double bdae = bb*dd - aa*ee;
 
   82    double T=-(bzcy*cebf+cxaz*afcd+aybx*bdae)/
 
   83              (bzcy*bzcy+cxaz*cxaz+aybx*aybx);
 
   84    double lx=TC1[0] + T * CP1[0];
 
   85    double ly=TC1[1] + T * CP1[1];
 
   86    double lz=TC1[2] + T * CP1[2];
 
   89    double x = TC2[0] - lx;
 
   90    double y = TC2[1] - ly;
 
   91    double z = TC2[2] - lz;
 
   94    double rx = y * CP2[2] - CP2[1] * z;
 
   95    double ry = CP2[0] * z - x * CP2[2];
 
   96    double rz = x * CP2[1] - CP2[0] * y;
 
   97    double dr = std::sqrt(rx*rx+ry*ry+rz*rz);
 
  100    rx = CP1[1] * CP2[2] - CP2[1] * CP1[2];
 
  101    ry = CP2[0] * CP1[2] - CP1[0] * CP2[2];
 
  102    rz = CP1[0] * CP2[1] - CP2[0] * CP1[1];
 
  103    double raa = std::sqrt(rx*rx+ry*ry+rz*rz);
 
  117    double mx = (lx+rx)/2.0;
 
  118    double my = (ly+ry)/2.0;
 
  119    double mz = (lz+rz)/2.0;
 
  120    rectangular(mx, my, mz, latitude, longitude, radius);
 
  127  void Stereo::spherical(
const double latitude, 
const double longitude, 
 
  129                         double &x, 
double &y, 
double &z) { 
 
  131    latrec_c(radius/1000.0, longitude*rpd_c(), latitude*rpd_c(), &rec[0]);
 
  138   void Stereo::rectangular(
const double x, 
const double y, 
const double z, 
 
  139                            double &latitude, 
double &longitude,
 
  145     reclat_c(&rec[0], &radius, &longitude, &latitude);
 
  146     longitude *= dpr_c();
 
  153   std::vector<double> Stereo::array2StdVec(
const double d[3]) {
 
  154     std::vector<double> v;
 
  155     for ( 
int  i = 0 ; i < 3 ; i++ ) {
 
  161   double *Stereo::stdVec2Array(
const std::vector<double> &v, 
double *d) {
 
  163       d = 
new double[v.size()];
 
  166     for ( 
unsigned int i = 0 ; i < v.size() ; i++ ) {
 
  172   void Stereo::targetToSpacecraft(Camera &camera, 
double TP[3]) {
 
  173     camera.instrumentPosition(TP);
 
  177   void Stereo::targetToSurface(Camera &camera, 
double TC[3]) {
 
  178     camera.Coordinate(TC);
 
static double To360Domain(const double lon)
This method converts a longitude into the 0 to 360 domain.
 
This is free and unencumbered software released into the public domain.
 
const double Null
Value for an Isis Null pixel.