7#include "SurfacePoint.h" 
   11#include "IException.h" 
   15#include "SpecialPixel.h" 
   17using namespace boost::numeric::ublas;
 
   36    p_localRadius = other.p_localRadius;
 
   59    if(other.p_rectCovar) {
 
   60      p_rectCovar = 
new symmetric_matrix<double, upper>(*other.p_rectCovar);
 
   66    if(other.p_sphereCovar) {
 
   67      p_sphereCovar = 
new symmetric_matrix<double, upper>(*other.p_sphereCovar);
 
 
  110    SetSpherical(lat, lon, radius, latSigma, lonSigma, radiusSigma);
 
 
  120      const Distance &radius, 
const symmetric_matrix<double, upper> &covar) {
 
  175      const Displacement &z, 
const symmetric_matrix<double, upper> &covar) {
 
  187    FreeAllocatedMemory();
 
 
  229      IString msg = 
"x, y, and z must be set to valid displacements.  One or " 
  230        "more coordinates have been set to an invalid displacement.";
 
  262    if (!p_localRadius.
isValid()) {
 
 
  292    if (xSigma.isValid() && ySigma.isValid() && zSigma.isValid())
 
 
  309                                    const symmetric_matrix<double,upper>& covar) {
 
  353    if (!xSigma.isValid() || !ySigma.isValid() || !zSigma.isValid()) {
 
  354      IString msg = 
"x sigma, y sigma , and z sigma must be set to valid " 
  355        "distances.  One or more sigmas have been set to an invalid distance.";
 
  359    symmetric_matrix<double,upper> covar(3);
 
  361    covar(0,0) = xSigma.meters() * xSigma.meters();
 
  362    covar(1,1) = ySigma.meters() * ySigma.meters();
 
  363    covar(2,2) = zSigma.meters() * zSigma.meters();
 
 
  377                                          SurfacePoint::CoordUnits units) {
 
  381      IString msg = 
"A point must be set before a variance/covariance matrix " 
  387    if (units != Kilometers && units != Meters) {
 
  388      IString msg = 
"Units must be Kilometers or Meters";
 
  397      p_rectCovar = 
new symmetric_matrix<double, upper>(covar);
 
  400    if (units == Meters) {
 
  402      (*p_rectCovar)(0,0) = covar(0,0)/1.0e6;
 
  403      (*p_rectCovar)(0,1) = covar(0,1)/1.0e6;
 
  404      (*p_rectCovar)(0,2) = covar(0,2)/1.0e6;
 
  405      (*p_rectCovar)(1,1) = covar(1,1)/1.0e6;
 
  406      (*p_rectCovar)(1,2) = covar(1,2)/1.0e6;
 
  407      (*p_rectCovar)(2,2) = covar(2,2)/1.0e6;
 
  410    SpiceDouble rectMat[3][3];
 
  416    double radius = sqrt(x2 + y2 + z*z);
 
  419    rectMat[0][0] = covar(0,0);
 
  420    rectMat[0][1] = rectMat[1][0] = covar(0,1);
 
  421    rectMat[0][2] = rectMat[2][0] = covar(0,2);
 
  422    rectMat[1][1] = covar(1,1);
 
  423    rectMat[1][2] = rectMat[2][1] = covar(1,2);
 
  424    rectMat[2][2] = covar(2,2);
 
  428    double zOverR = p_z->
meters() / radius;
 
  429    double r2 = radius*radius;
 
  430    double denom = r2*radius*sqrt(1.0 - (zOverR*zOverR));
 
  434    J[1][0] = -p_y->
meters() / (x2 + y2);
 
  435    J[1][1] = p_x->
meters() / (x2 + y2);
 
  437    J[2][0] = p_x->
meters() / radius;  
 
  438    J[2][1] = p_y->
meters() / radius;
 
  439    J[2][2] = p_z->
meters() / radius;
 
  444    SpiceDouble mat[3][3];
 
  445    mxm_c (J, rectMat, mat);
 
  446    mxmt_c (mat, J, mat);
 
  447    if (units == Kilometers) {
 
  449      (*p_sphereCovar)(0,0) = mat[0][0] * 1.0e6;
 
  450      (*p_sphereCovar)(0,1) = mat[0][1] * 1.0e6;
 
  451      (*p_sphereCovar)(0,2) = mat[0][2] * 1000.0;
 
  452      (*p_sphereCovar)(1,1) = mat[1][1] * 1.0e6;
 
  454      (*p_sphereCovar)(1,2) = mat[1][2] * 1000.0;
 
  455      (*p_sphereCovar)(2,2) = mat[2][2];
 
  459      (*p_sphereCovar)(0,0) = mat[0][0];
 
  460      (*p_sphereCovar)(0,1) = mat[0][1];
 
  461      (*p_sphereCovar)(0,2) = mat[0][2] / 1000.0;
 
  462      (*p_sphereCovar)(1,1) = mat[1][1];
 
  463      (*p_sphereCovar)(1,2) = mat[1][2] / 1000.0;
 
  464      (*p_sphereCovar)(2,2) = mat[2][2] / 1.0e6;
 
 
  484    if (!lat.isValid()  ||  !lon.isValid()  ||  !radius.isValid()) {
 
  485      IString msg = 
"Latitude, longitude, or radius is an invalid value.";
 
  489    SpiceDouble dlat = (double) lat.radians();
 
  490    SpiceDouble dlon = (double) lon.radians();
 
  491    SpiceDouble dradius = radius.kilometers();
 
  494    latrec_c ( dradius, dlon, dlat, rect);
 
  497    p_localRadius = radius;
 
 
  524    if (latSigma.isValid() && lonSigma.isValid() && radiusSigma.isValid())
 
 
  539      const Distance &radius, 
const symmetric_matrix<double, upper> &covar) {
 
  574                                        const Angle &lonSigma,
 
  576    if (latSigma.isValid() && lonSigma.isValid() && radiusSigma.isValid()) {
 
  577      symmetric_matrix<double,upper> covar(3);
 
  580      double sphericalCoordinate;
 
  581      sphericalCoordinate = (double) latSigma.radians();
 
  582      covar(0,0) =  sphericalCoordinate*sphericalCoordinate;
 
  583      sphericalCoordinate = (double) lonSigma.radians();
 
  584      covar(1,1) = sphericalCoordinate*sphericalCoordinate;
 
  585      sphericalCoordinate = (double) radiusSigma.meters();
 
  586      covar(2,2) = sphericalCoordinate*sphericalCoordinate;
 
 
  621      IString msg = 
"Cannot set spherical sigmas on an invalid surface point";
 
 
  638                                        const symmetric_matrix<double, upper> & covar,
 
  639                                        SurfacePoint::CoordUnits units) {
 
  643      IString msg = 
"A point must be set before a variance/covariance matrix " 
  649    if (units != Kilometers && units != Meters) {
 
  650      IString msg = 
"Units must be Kilometers or Meters";
 
  665    if (units == Meters) {
 
  667      (*p_sphereCovar)(0,0) = covar(0,0);
 
  668      (*p_sphereCovar)(0,1) = covar(0,1);
 
  669      (*p_sphereCovar)(0,2) = covar(0,2) / 1000.;
 
  670      (*p_sphereCovar)(1,1) = covar(1,1);
 
  671      (*p_sphereCovar)(1,2) = covar(1,2) / 1000.;
 
  672      (*p_sphereCovar)(2,2) = covar(2,2) / 1.0e6;
 
  677    SpiceDouble sphereMat[3][3];
 
  679    sphereMat[0][0] = covar(0,0);
 
  680    sphereMat[0][1] = sphereMat[1][0] = covar(0,1);
 
  681    sphereMat[0][2] = sphereMat[2][0] = covar(0,2);
 
  682    sphereMat[1][1] = covar(1,1);
 
  683    sphereMat[1][2] = sphereMat[2][1] = covar(1,2);
 
  684    sphereMat[2][2] = covar(2,2);
 
  696    double cosPhi = cos(lat);
 
  697    double sinPhi = sin(lat);
 
  698    double cosLamda = cos(lon);
 
  699    double sinLamda = sin(lon);
 
  700    double rcosPhi = radius*cosPhi;
 
  701    double rsinPhi = radius*sinPhi;
 
  702    J[0][0] = -rsinPhi * cosLamda;
 
  703    J[0][1] = -rcosPhi * sinLamda;
 
  704    J[0][2] = cosPhi * cosLamda;
 
  705    J[1][0] = -rsinPhi * sinLamda;
 
  706    J[1][1] = rcosPhi * cosLamda;
 
  707    J[1][2] = cosPhi * sinLamda;
 
  713      p_rectCovar = 
new symmetric_matrix<double, upper>(3);
 
  715    SpiceDouble mat[3][3];
 
  716    mxm_c (J, sphereMat, mat);
 
  717    mxmt_c (mat, J, mat);
 
  719    if (units == Kilometers) {
 
  720      (*p_rectCovar)(0,0) = mat[0][0];
 
  721      (*p_rectCovar)(0,1) = mat[0][1];
 
  722      (*p_rectCovar)(0,2) = mat[0][2];
 
  723      (*p_rectCovar)(1,1) = mat[1][1];
 
  724      (*p_rectCovar)(1,2) = mat[1][2];
 
  725      (*p_rectCovar)(2,2) = mat[2][2];
 
  729      (*p_rectCovar)(0,0) = mat[0][0]/1.0e6;
 
  730      (*p_rectCovar)(0,1) = mat[0][1]/1.0e6;
 
  731      (*p_rectCovar)(0,2) = mat[0][2]/1.0e6;
 
  732      (*p_rectCovar)(1,1) = mat[1][1]/1.0e6;
 
  733      (*p_rectCovar)(1,2) = mat[1][2]/1.0e6;
 
  734      (*p_rectCovar)(2,2) = mat[2][2]/1.0e6;
 
 
  759         IString msg =
"Unknown surface point coordinate type enum [" + 
toString(type) + 
"]." ;
 
 
  774    std::vector<double> derivative(3);
 
  783         IString msg =
"Unknown surface point coordinate type enum [" + 
toString(type) + 
"]." ;
 
 
  799    std::vector<double> derivative(3);
 
  802    double sinLon = sin(rlon);
 
  803    double cosLon = cos(rlon);
 
  804    double sinLat = sin(rlat);
 
  805    double cosLat = cos(rlat);
 
  810        derivative[0] = -radkm * sinLat * cosLon;
 
  811        derivative[1] = -radkm * sinLon * sinLat;
 
  812        derivative[2] =  radkm * cosLat;
 
  815        derivative[0] = -radkm * cosLat * sinLon;
 
  816        derivative[1] =  radkm * cosLat * cosLon;
 
  820        derivative[0] = cosLon * cosLat;
 
  821        derivative[1] = sinLon * cosLat;
 
  822        derivative[2] = sinLat;
 
  825        IString msg = 
"Invalid coordinate index  (must be less than 3).";
 
 
  841    std::vector<double> derivative(3,0.0);
 
  854        IString msg = 
"Invalid coordinate index  (must be less than 3).";
 
 
  877      IString msg = 
"Cannot convert an invalid surface point to a naif array";
 
 
  892    if(p_x && p_y && p_z) {
 
 
  916    if (!radius.isValid()) {
 
  917      IString msg = 
"Radius value must be a valid Distance.";
 
  923        IString msg = 
"In order to reset the local radius, a Surface Point must " 
  932    p_localRadius = radius;
 
  936    latrec_c ((SpiceDouble) radius.kilometers(), lon, lat, rect);
 
 
  947  bool SurfacePoint::Valid()
 const {
 
  950           (*p_x != zero || *p_y != zero || *p_z != zero);
 
  986            IString msg = 
"Invalid coordinate index  (must be less than 3).";
 
 1008            IString msg = 
"Invalid coordinate index  enum (must be less than 3).";
 
 1014         IString msg =
"Unknown surface point coordinate type enum [" + 
toString(type) + 
"]." ;
 
 
 1051            IString msg = 
"Invalid coordinate index  (must be less than 3).";
 
 1073            IString msg = 
"Invalid coordinate index  (must be less than 3).";
 
 1079         IString msg =
"Unknown surface point coordinate type enum [" + 
toString(type) + 
"]." ;
 
 
 1113             dist = GetLocalRadiusSigma();
 
 1117            IString msg = 
"Invalid coordinate index  (must be less than 3).";
 
 1139            IString msg = 
"Invalid coordinate index  (must be less than 3).";
 
 1145         IString msg =
"Unknown surface point coordinate type enum [" + 
toString(type) + 
"]." ;
 
 
 1166          value = disp.meters();
 
 1170          value = disp.kilometers();
 
 1174           IString msg = 
"Unrecognized unit for a Displacement (must be meters or kilometers).";
 
 
 1194          value = dist.meters();
 
 1198          value = dist.kilometers();
 
 1202           IString msg = 
"Unrecognized unit for a Distance (not meters or kilometers).";
 
 
 1230         IString msg = 
"Invalid unit for latitude (must be Radians or Degrees).";
 
 
 1278    if (Valid() && !
IsSpecial(deltaLonMeters)) {
 
 1279      double convFactor = cos((
double)
GetLatitude().radians());
 
 1280      double deltaLonRadians;
 
 1283      if (convFactor > 1.0e-50) {             
 
 1288        deltaLonRadians = 
PI;
 
 1290      return deltaLonRadians;
 
 
 1312    if (relativeLat == 0.) {
 
 
 1340    if (deltaLonRadians == 0.) {
 
 1341      deltaLonMeters = 0.;
 
 1346      deltaLonMeters = deltaLonRadians * scalingRadius;
 
 1349    return deltaLonMeters;
 
 
 1364    if (type.compare(
"LATITUDINAL", Qt::CaseInsensitive) == 0) {
 
 1367    else if (type.compare(
"RECTANGULAR", Qt::CaseInsensitive) == 0) {
 
 1372                          "Unknown coordinate type for a SurfacePoint [" + type + 
"].",
 
 
 1394        return "Latitudinal";
 
 1398        return "Rectangular";
 
 1402         IString msg =
"Unknown surface point coordinate type enum [" + 
toString(type) + 
"]." ;
 
 
 1429         IString msg = 
"Invalid unit for longitude (must be Radians of Degrees).";
 
 
 1443  Displacement SurfacePoint::GetY()
 const {
 
 1444    if(!p_y) 
return Displacement();
 
 1450  Displacement SurfacePoint::GetZ()
 const {
 
 1451    if(!p_z) 
return Displacement();
 
 1457  Distance SurfacePoint::GetXSigma()
 const {
 
 1464  Distance SurfacePoint::GetYSigma()
 const {
 
 1471  Distance SurfacePoint::GetZSigma()
 const {
 
 1513            IString msg = 
"Invalid coordinate index  (must be less than 3).";
 
 1535            IString msg = 
"Invalid coordinate index  (must be less than 3).";
 
 1541         IString msg =
"Unknown surface point coordinate type enum [" + 
toString(type) + 
"]." ;
 
 
 1557    if (dXSigma <= 0.0 ) {
 
 1558        IString msg = 
"SurfacePoint::GetXWeight(): Sigma <= 0.0";
 
 1562    return 1.0/(dXSigma*dXSigma);
 
 
 1575    if (dYSigma <= 0.0 ) {
 
 1576        IString msg = 
"SurfacePoint::GetYWeight(): Sigma <= 0.0";
 
 1580    return 1.0/(dYSigma*dYSigma);
 
 
 1593    if (dZSigma <= 0.0 ) {
 
 1594        IString msg = 
"SurfacePoint::GetZWeight(): Sigma <= 0.0";
 
 1598    return 1.0/(dZSigma*dZSigma);
 
 
 1602  symmetric_matrix<double, upper> SurfacePoint::GetRectangularMatrix
 
 1603                               (SurfacePoint::CoordUnits units)
 const {
 
 1605      symmetric_matrix<double, upper> tmp(3);
 
 1611    if (units != Kilometers && units != Meters) {
 
 1612      IString msg = 
"Units must be Kilometers or Meters";
 
 1616    symmetric_matrix<double, upper> covar(3);
 
 1623        covar(0,0) = (*p_rectCovar)(0,0)*1.0e6;
 
 1624        covar(0,1) = (*p_rectCovar)(0,1)*1.0e6;
 
 1625        covar(0,2) = (*p_rectCovar)(0,2)*1.0e6;
 
 1626        covar(1,1) = (*p_rectCovar)(1,1)*1.0e6;
 
 1627        covar(1,2) = (*p_rectCovar)(1,2)*1.0e6;
 
 1628        covar(2,2) = (*p_rectCovar)(2,2)*1.0e6;
 
 1637        IString msg = 
"Unrecognized unit for a Displacement (must be meters or kilometers).";
 
 1645  Angle SurfacePoint::GetLatSigma()
 const {
 
 1653  Angle SurfacePoint::GetLonSigma()
 const {
 
 1670      double x = p_x->
meters();
 
 1671      double y = p_y->
meters();
 
 1672      double z = p_z->
meters();
 
 1674      if (x != 0.  ||  y != 0.  || z != 0.)
 
 
 1689      double x = p_x->
meters();
 
 1690      double y = p_y->
meters();
 
 1692      if(x == 0.0 && y == 0.0) {
 
 1696      double lon = atan2(y, x);
 
 
 1712        double x = p_x->
meters();
 
 1713        double y = p_y->
meters();
 
 1714        double z = p_z->
meters();
 
 1718      else if (*p_x == zero && *p_y == zero && *p_z == zero) { 
 
 1722        IString msg = 
"SurfacePoint::Can't compute local radius on invalid point";
 
 
 1733     return p_localRadius;
 
 
 1776  Distance SurfacePoint::GetLocalRadiusSigma()
 const {
 
 1784  symmetric_matrix<double, upper> SurfacePoint::GetSphericalMatrix
 
 1785                               (SurfacePoint::CoordUnits units)
 const {
 
 1787      symmetric_matrix<double, upper> tmp(3);
 
 1793    if (units != Kilometers && units != Meters) {
 
 1794      IString msg = 
"Units must be Kilometers or Meters";
 
 1798    symmetric_matrix<double, upper> covar(3);
 
 1805        covar(0,0) = (*p_sphereCovar)(0,0);
 
 1806        covar(0,1) = (*p_sphereCovar)(0,1);
 
 1807        covar(0,2) = (*p_sphereCovar)(0,2)*1000.;
 
 1808        covar(1,1) = (*p_sphereCovar)(1,1);
 
 1809        covar(1,2) = (*p_sphereCovar)(1,2)*1000.;
 
 1810        covar(2,2) = (*p_sphereCovar)(2,2)*1.0e6;
 
 1819        IString msg = 
"Unrecognized unit for a Displacement (must be meters or kilometers).";
 
 1833    double dlatSigma = GetLatSigma().
radians();
 
 1835      if( dlatSigma <= 0.0 ) {
 
 1836          IString msg = 
"SurfacePoint::GetLatWeight(): Sigma <= 0.0";
 
 1840      return 1.0/(dlatSigma*dlatSigma);
 
 
 1849    double dlonSigma = GetLonSigma().
radians();
 
 1851        if( dlonSigma <= 0.0 ) {
 
 1852            IString msg = 
"SurfacePoint::GetLonWeight(): Sigma <= 0.0";
 
 1856        return 1.0/(dlonSigma*dlonSigma);
 
 
 1866    double dlocalRadiusSigma = GetLocalRadiusSigma().
kilometers();
 
 1868        if (dlocalRadiusSigma <= 0.0 ) {
 
 1869            IString msg = 
"SurfacePoint::GetRadWeight(): Sigma <= 0.0";
 
 1873        return 1.0/(dlocalRadiusSigma*dlocalRadiusSigma);
 
 
 1882    if(!Valid() || !other.Valid())
 
 
 1898      const Distance &sphereRadius)
 const {
 
 1899    if(!Valid() || !other.Valid())
 
 1905    const Angle &otherLatitude = other.GetLatitude();
 
 1906    const Angle &otherLongitude = other.GetLongitude();
 
 1910    Angle deltaLat = latitude - otherLatitude;
 
 1911    Angle deltaLon = longitude - otherLongitude;
 
 1913    double haversinLat = sin(deltaLat.radians() / 2.0);
 
 1914    haversinLat *= haversinLat;
 
 1916    double haversinLon = sin(deltaLon.radians() / 2.0);
 
 1917    haversinLon *= haversinLon;
 
 1919    double a = haversinLat + cos(latitude.radians()) *
 
 1920               cos(otherLatitude.radians()) *
 
 1923    double c = 2 * atan(sqrt(a) / sqrt(1 - a));
 
 1925    return sphereRadius * c;
 
 
 1929  bool SurfacePoint::operator==(
const SurfacePoint &other)
 const {
 
 1932    if(equal && p_x && p_y && p_z && other.p_x && other.p_y && other.p_z) {
 
 1933      equal = equal && *p_x == *other.p_x;
 
 1934      equal = equal && *p_y == *other.p_y;
 
 1935      equal = equal && *p_z == *other.p_z;
 
 1938      equal = equal && p_x == NULL && other.p_x == NULL;
 
 1939      equal = equal && p_y == NULL && other.p_y == NULL;
 
 1940      equal = equal && p_z == NULL && other.p_z == NULL;
 
 1944      equal = equal && (*p_rectCovar)(0, 0) == (*other.p_rectCovar)(0, 0);
 
 1945      equal = equal && (*p_rectCovar)(0, 1) == (*other.p_rectCovar)(0, 1);
 
 1946      equal = equal && (*p_rectCovar)(0, 2) == (*other.p_rectCovar)(0, 2);
 
 1947      equal = equal && (*p_rectCovar)(1, 1) == (*other.p_rectCovar)(1, 1);
 
 1948      equal = equal && (*p_rectCovar)(1, 2) == (*other.p_rectCovar)(1, 2);
 
 1949      equal = equal && (*p_rectCovar)(2, 2) == (*other.p_rectCovar)(2, 2);
 
 1952      equal = equal && 
p_rectCovar == NULL && other.p_rectCovar == NULL;
 
 1956      equal = equal && (*p_sphereCovar)(0, 0) == (*other.p_sphereCovar)(0, 0);
 
 1957      equal = equal && (*p_sphereCovar)(0, 1) == (*other.p_sphereCovar)(0, 1);
 
 1958      equal = equal && (*p_sphereCovar)(0, 2) == (*other.p_sphereCovar)(0, 2);
 
 1959      equal = equal && (*p_sphereCovar)(1, 1) == (*other.p_sphereCovar)(1, 1);
 
 1960      equal = equal && (*p_sphereCovar)(1, 2) == (*other.p_sphereCovar)(1, 2);
 
 1961      equal = equal && (*p_sphereCovar)(2, 2) == (*other.p_sphereCovar)(2, 2);
 
 1964      equal = equal && 
p_sphereCovar == NULL && other.p_sphereCovar == NULL;
 
 1970  SurfacePoint &SurfacePoint::operator=(
const SurfacePoint &other) {
 
 1973    if(p_x && other.p_x &&
 
 1983      FreeAllocatedMemory();
 
 1986        p_x = 
new Displacement(*other.p_x);
 
 1990        p_y = 
new Displacement(*other.p_y);
 
 1994        p_z = 
new Displacement(*other.p_z);
 
 1997      if(other.p_rectCovar) {
 
 1998        p_rectCovar = 
new symmetric_matrix<double, upper>(*other.p_rectCovar);
 
 2001      if(other.p_sphereCovar) {
 
 2002        p_sphereCovar = 
new symmetric_matrix<double, upper>(*other.p_sphereCovar);
 
 2007    p_localRadius = other.GetLocalRadius();
 
 2012  void SurfacePoint::FreeAllocatedMemory() {
 
Defines an angle and provides unit conversions.
 
double radians() const
Convert an angle to a double.
 
double degrees() const
Get the angle in units of Degrees.
 
@ Radians
Radians are generally used in mathematical equations, 0-2*PI is one circle, however these are more di...
 
Displacement is a signed length, usually in meters.
 
double kilometers() const
Get the displacement in kilometers.
 
bool isValid() const
Test if this displacement has been initialized or not.
 
@ Kilometers
The distance is being specified in kilometers.
 
@ Meters
The distance is being specified in meters.
 
void setKilometers(double displacementInKilometers)
Set the displacement in kilometers.
 
double meters() const
Get the displacement in meters.
 
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.
 
@ Kilometers
The distance is being specified in kilometers.
 
@ Meters
The distance is being specified in meters.
 
double meters() const
Get the distance in meters.
 
@ User
A type of error that could only have occurred due to a mistake on the user's part (e....
 
@ Programmer
This error is for when a programmer made an API call that was illegal.
 
Adds specific functionality to C++ strings.
 
This class is designed to encapsulate the concept of a Latitude.
 
This class is designed to encapsulate the concept of a Longitude.
 
This class defines a body-fixed surface point.
 
void SetRectangularCoordinates(const Displacement &x, const Displacement &y, const Displacement &z)
Set surface point in rectangular coordinates.
 
CoordinateType
Defines the coordinate typ, units, and coordinate index for some of the output methods.
 
@ Latitudinal
Planetocentric latitudinal (lat/lon/rad) coordinates.
 
@ Rectangular
Body-fixed rectangular x/y/z coordinates.
 
std::vector< double > LatitudinalDerivative(CoordIndex index)
Compute partial derivative of the conversion of the latitudinal coordinates to body-fixed rectangular...
 
void SetMatrix(CoordinateType type, const boost::numeric::ublas::symmetric_matrix< double, boost::numeric::ublas::upper > &covar)
Set the covariance matrix.
 
void SetSphericalCoordinates(const Latitude &lat, const Longitude &lon, const Distance &radius)
Update spherical coordinates (lat/lon/radius)
 
static QString coordinateTypeToString(CoordinateType type)
Converts the given SurfacePoint::CoordinateType enumeration to a string.
 
double LatToDouble(Latitude lat, CoordUnits units)
This method returns a double version of a Latitude in the specified units.
 
Latitude GetLatitude() const
Return the body-fixed latitude for the surface point.
 
void SetRectangularSigmas(const Distance &xSigma, const Distance &ySigma, const Distance &zSigma)
Set surface point and sigmas in rectangular coordinates and convert to planetocentric.
 
double GetLonWeight() const
Return longitude weight for bundle adjustment Units are 1/(radians)^2.
 
double DistanceToDouble(Distance dist, CoordUnits units)
This method returns a double version of a Distance in the specified units.
 
void SetSphericalSigmasDistance(const Distance &latSigma, const Distance &lonSigma, const Distance &radiusSigma)
Set the spherical sigmas (in Distance units) into the spherical variance/covariance matrix.
 
Distance GetLonSigmaDistance() const
Return the longitude sigma in meters.
 
double GetWeight(CoordinateType type, CoordIndex index)
This method returns the weight of a SurfacePoint coordinate Note: At this time a units argument is no...
 
void ToNaifArray(double naifOutput[3]) const
A naif array is a c-style array of size 3.
 
void SetRectangularPoint(const Displacement &x, const Displacement &y, const Displacement &z)
This is a private method to set a surface point in rectangular, body-fixed coordinates.
 
boost::numeric::ublas::symmetric_matrix< double, boost::numeric::ublas::upper > * p_rectCovar
3x3 upper triangular covariance matrix rectangular coordinates
 
void ComputeLocalRadius()
Compute the local radius of the surface point.
 
Distance GetDistanceToPoint(const SurfacePoint &other) const
Computes and returns the distance between two surface points.
 
void SetSphericalSigmas(const Angle &latSigma, const Angle &lonSigma, const Distance &radiusSigma)
Set the spherical sigmas into the spherical variance/covariance matrix in diagonal units of radians^2...
 
void SetSpherical(const Latitude &lat, const Longitude &lon, const Distance &radius, const Angle &latSigma=Angle(), const Angle &lonSigma=Angle(), const Distance &radiusSigma=Distance())
Set surface point and covariance matrix in planetocentric coordinates and convert to rectangular (Lat...
 
double MetersToLongitude(double lonLength)
This method returns an angular measure in radians of a distance in the direction of and relative to t...
 
boost::numeric::ublas::symmetric_matrix< double, boost::numeric::ublas::upper > * p_sphereCovar
3x3 upper triangular covariance matrix ocentric coordinates
 
~SurfacePoint()
Destroys a SurfacePoint object/.
 
void InitCovariance()
Initialize the variance/covariance matrices.
 
void SetRectangular(const Displacement &x, const Displacement &y, const Displacement &z, const Distance &xSigma=Distance(), const Distance &ySigma=Distance(), const Distance &zSigma=Distance())
Set surface point in rectangular body-fixed coordinates wtih optional sigmas.
 
double LongitudeToMeters(double longitude) const
This method returns a length in meters version of a delta longitude angle in radians relative to the ...
 
double GetZWeight() const
Return Z weight for bundle adjustment Units are 1/(kilometers)^2.
 
Longitude GetLongitude() const
Return the body-fixed longitude for the surface point.
 
void SetSphericalMatrix(const boost::numeric::ublas::symmetric_matrix< double, boost::numeric::ublas::upper > &covar, SurfacePoint::CoordUnits units=SurfacePoint::Meters)
Set spherical covariance matrix.
 
static CoordinateType stringToCoordinateType(QString type)
This method converts the given string value to a SurfacePoint::CoordinateType enumeration.
 
std::vector< double > RectangularDerivative(CoordIndex index)
Compute partial derivative of the body-fixed rectangular coordinates with respect to the indicated co...
 
double GetCoord(CoordinateType type, CoordIndex index, CoordUnits units)
This method returns a coordinate of a SurfacePoint.
 
double GetLocalRadiusWeight() const
Return radius weight for bundle adjustment Units are 1/(kilometers)^2.
 
double LatitudeToMeters(double latitude) const
This method returns a Displacement of an Angle relative to the current SurfacePoint latitude.
 
SurfacePoint()
Constructs an empty SurfacePoint object.
 
double MetersToLatitude(double latLength)
This method returns an angular measure of a distance in the direction of and relative to the latitude...
 
double DisplacementToDouble(Displacement disp, CoordUnits units)
This method returns a double version of a Displacement in the specified units.
 
double GetYWeight() const
Return Y weight for bundle adjustment Units are 1/(kilometers)^2.
 
double GetSigma(CoordinateType type, CoordIndex index, CoordUnits units)
This method returns a sigma of a SurfacePoint coordinate.
 
double GetLatWeight() const
Return latitude weight for bundle adjustment Units are 1/(radians)^2.
 
Distance GetSigmaDistance(CoordinateType type, CoordIndex index)
This method returns a sigma of a SurfacePoint coordinate as a Distance.
 
std::vector< double > Partial(CoordinateType type, CoordIndex index)
Compute partial derivative of conversion from body-fixed coordinates to the specified.
 
void SetRectangularMatrix(const boost::numeric::ublas::symmetric_matrix< double, boost::numeric::ublas::upper > &covar, SurfacePoint::CoordUnits units=SurfacePoint::Meters)
Set rectangular covariance matrix and store in units of km**2.
 
void ResetLocalRadius(const Distance &radius)
This method resets the local radius of a SurfacePoint.
 
void FromNaifArray(const double naifValues[3])
A naif array is a c-style array of size 3.
 
double GetXWeight() const
Return X weight for bundle adjustment Units are 1/(kilometers)^2.
 
Distance GetLatSigmaDistance() const
Return the latitude sigma as a Distance.
 
void SetSphericalPoint(const Latitude &lat, const Longitude &lon, const Distance &radius)
This is a private method to set a surface point in spherical (lat/lon/radius), body-fixed coordinates...
 
Distance GetLocalRadius() const
Return the radius of the surface point.
 
double LonToDouble(Longitude lon, CoordUnits units)
This method returns a double version of a Longitude in the specified units.
 
void InitPoint()
Initialize a surface point.
 
This is free and unencumbered software released into the public domain.
 
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
 
const double Null
Value for an Isis Null pixel.
 
bool IsSpecial(const double d)
Returns if the input pixel is special.
 
const double PI
The mathematical constant PI.
 
Namespace for the standard library.