Isis 3 Developer Reference
SurfacePoint.h
Go to the documentation of this file.
1 #ifndef SurfacePoint_h
2 #define SurfacePoint_h
3 
25 #include <vector>
26 #include <cmath>
27 
28 // Qt library
29 #include <QString>
30 
31 #include "boost/numeric/ublas/symmetric.hpp"
32 #include "boost/numeric/ublas/io.hpp"
33 
34 // ISIS library
35 #include "Displacement.h"
36 #include "Distance.h"
37 #include "Angle.h"
38 
39 namespace Isis {
40  class Latitude;
41  class Longitude;
42 
148  class SurfacePoint {
149  public:
150 
151  // definitions
158  };
159  enum CoordUnits {
164  };
165  enum CoordIndex {
166  One=0,
167  Two=1,
169  };
170 
171  // Constructors
172  SurfacePoint();
173  SurfacePoint(const SurfacePoint &other);
174  SurfacePoint(const Latitude &lat, const Longitude &lon,
175  const Distance &radius);
176  SurfacePoint(const Latitude &lat, const Longitude &lon,
177  const Distance &radius, const Angle &latSigma, const Angle &lonSigma,
178  const Distance &radiusSigma);
179  SurfacePoint(const Latitude &lat, const Longitude &lon,
180  const Distance &radius,
181  const boost::numeric::ublas::symmetric_matrix
182  <double,boost::numeric::ublas::upper>& covar);
183  SurfacePoint(const Displacement &x, const Displacement &y,
184  const Displacement &z);
185  SurfacePoint(const Displacement &x, const Displacement &y,
186  const Displacement &z, const Distance &xSigma, const Distance &ySigma,
187  const Distance &zSigma);
188  SurfacePoint(const Displacement &x, const Displacement &y,
189  const Displacement &z,
190  const boost::numeric::ublas::symmetric_matrix
191  <double,boost::numeric::ublas::upper>& covar);
192  ~SurfacePoint();
193 
194 // Rectangular loading utilities
195  void SetRectangular(const Displacement &x, const Displacement &y,
196  const Displacement &z, const Distance &xSigma=Distance(),
197  const Distance &ySigma=Distance(), const Distance &zSigma=Distance());
198 
199  void SetRectangular(const Displacement x, const Displacement y, const Displacement z,
200  const boost::numeric::ublas::symmetric_matrix<double,boost::numeric::ublas::upper>& covar);
201 
202  void SetRectangularCoordinates(const Displacement &x, const Displacement &y,
203  const Displacement &z);
204 
206  void SetRectangularSigmas(const Distance &xSigma, const Distance &ySigma,
207  const Distance &zSigma);
208 
210  const boost::numeric::ublas::symmetric_matrix<double,boost::numeric::ublas::upper>& covar,
212 
213 // Spherical loading utilities
214 
217  void SetSpherical (const Latitude &lat, const Longitude &lon,
218  const Distance &radius, const Angle &latSigma=Angle(),
219  const Angle &lonSigma=Angle(),
220  const Distance &radiusSigma=Distance());
221 
222  void SetSpherical (const Latitude &lat, const Longitude &lon,
223  const Distance &radius,
224  const boost::numeric::ublas::symmetric_matrix
225  <double,boost::numeric::ublas::upper>& covar);
226 
227  void SetSphericalCoordinates(const Latitude &lat, const Longitude &lon,
228  const Distance &radius);
229 
230  void SetSphericalMatrix(
231  const boost::numeric::ublas::symmetric_matrix<double,boost::numeric::ublas::upper>& covar,
233 
234  void SetSphericalSigmas(const Angle &latSigma, const Angle &lonSigma,
235  const Distance &radiusSigma);
236 
237  void SetSphericalSigmasDistance(const Distance &latSigma,
238  const Distance &lonSigma,
239  const Distance &radiusSigma);
240 
241  void ResetLocalRadius(const Distance &radius);
242  bool Valid() const;
243 
244 // Generic utilities for convenience
245 
247  void SetMatrix(CoordinateType type,
248  const boost::numeric::ublas::symmetric_matrix<double,boost::numeric::ublas::upper>& covar);
249 
251  // coordinate type with respect to the indicated coordinate (specified by index).
252  std::vector<double> Partial(CoordinateType type, CoordIndex index);
253 
254 // Output methods
255  double GetCoord(CoordinateType type, CoordIndex index, CoordUnits units);
256  // Consider making this GetSigmaDistance and use the Distance methods to specify units for
257  // maximum flexibility and safety. ***TBD***
258  double GetSigma(CoordinateType type, CoordIndex index, CoordUnits units);
260  double GetWeight(CoordinateType type, CoordIndex index);
261  Displacement GetX() const;
262  Displacement GetY() const;
263  Displacement GetZ() const;
264  Distance GetXSigma() const;
265  Distance GetYSigma() const;
266  Distance GetZSigma() const;
267  double GetXWeight() const;
268  double GetYWeight() const;
269  double GetZWeight() const;
270  boost::numeric::ublas::symmetric_matrix<double,boost::numeric::ublas::upper>
272  Latitude GetLatitude() const;
273  Longitude GetLongitude() const;
274  Distance GetLocalRadius() const;
275  Angle GetLatSigma() const;
277  double GetLatWeight() const;
278  Angle GetLonSigma() const;
280  double GetLonWeight() const;
282  double GetLocalRadiusWeight() const;
283  boost::numeric::ublas::symmetric_matrix
284  <double,boost::numeric::ublas::upper> GetSphericalMatrix
286 
287 // Conversion methods (for convenience)
288  double DisplacementToDouble(Displacement disp, CoordUnits units);
289  double DistanceToDouble(Distance dist, CoordUnits units);
290  double MetersToLatitude(double latLength);
291  double MetersToLongitude(double lonLength);
292  double LatitudeToMeters(double latitude) const;
293  double LongitudeToMeters(double longitude) const;
294  double LatToDouble(Latitude lat, CoordUnits units);
295  double LonToDouble(Longitude lon, CoordUnits units);
296  static CoordinateType stringToCoordinateType(QString type);
297  static QString coordinateTypeToString(CoordinateType type);
298 
299 // Computational methods
300  Distance GetDistanceToPoint(const SurfacePoint &other) const;
302  const Distance &sphereRadius) const;
303  std::vector<double> LatitudinalDerivative(CoordIndex index);
304  std::vector<double> RectangularDerivative(CoordIndex index);
305 
306 // Misc methods
307  void ToNaifArray(double naifOutput[3]) const;
308  void FromNaifArray(const double naifValues[3]);
309 
310 // Operators
311  bool operator==(const SurfacePoint &other) const;
312  SurfacePoint &operator=(const SurfacePoint &other);
313 
314  private:
315  void ComputeLocalRadius();
316  void InitCovariance();
317  void InitPoint();
318  void SetRectangularPoint(const Displacement &x, const Displacement &y, const Displacement &z);
319  void SetSphericalPoint(const Latitude &lat, const Longitude &lon, const Distance &radius);
320  void FreeAllocatedMemory();
321 
322  Distance p_localRadius;
323  Displacement *p_x;
324  Displacement *p_y;
325  Displacement *p_z;
327  boost::numeric::ublas::symmetric_matrix
328  <double,boost::numeric::ublas::upper> *p_rectCovar;
330  boost::numeric::ublas::symmetric_matrix
331  <double,boost::numeric::ublas::upper> *p_sphereCovar;
332  };
333 };
334 
335 #endif
336 
This class defines a body-fixed surface point.
Definition: SurfacePoint.h:148
CoordIndex
Definition: SurfacePoint.h:165
double LonToDouble(Longitude lon, CoordUnits units)
This method returns a double version of a Longitude in the specified units.
Definition: SurfacePoint.cpp:1409
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...
Definition: SurfacePoint.cpp:512
double GetYWeight() const
Return Y weight for bundle adjustment Units are 1/(kilometers)^2.
Definition: SurfacePoint.cpp:1565
Distance GetXSigma() const
Definition: SurfacePoint.cpp:1451
Displacement GetZ() const
Definition: SurfacePoint.cpp:1444
Distance GetDistanceToPoint(const SurfacePoint &other) const
Computes and returns the distance between two surface points.
Definition: SurfacePoint.cpp:1874
double MetersToLatitude(double latLength)
This method returns an angular measure of a distance in the direction of and relative to the latitude...
Definition: SurfacePoint.cpp:1242
~SurfacePoint()
Destroys a SurfacePoint object/.
Definition: SurfacePoint.cpp:180
Displacement GetX() const
Definition: SurfacePoint.cpp:1430
boost::numeric::ublas::symmetric_matrix< double, boost::numeric::ublas::upper > GetSphericalMatrix(SurfacePoint::CoordUnits units=SurfacePoint::Meters) const
Definition: SurfacePoint.cpp:1779
Distance GetZSigma() const
Definition: SurfacePoint.cpp:1465
void SetRectangularCoordinates(const Displacement &x, const Displacement &y, const Displacement &z)
Set surface point in rectangular coordinates.
Definition: SurfacePoint.cpp:321
This class is designed to encapsulate the concept of a Latitude.
Definition: Latitude.h:63
Distance GetLatSigmaDistance() const
Return the latitude sigma as a Distance.
Definition: SurfacePoint.cpp:1741
double GetSigma(CoordinateType type, CoordIndex index, CoordUnits units)
This method returns a sigma of a SurfacePoint coordinate.
Definition: SurfacePoint.cpp:1023
void ResetLocalRadius(const Distance &radius)
This method resets the local radius of a SurfacePoint.
Definition: SurfacePoint.cpp:908
boost::numeric::ublas::symmetric_matrix< double, boost::numeric::ublas::upper > GetRectangularMatrix(SurfacePoint::CoordUnits units=SurfacePoint::Meters) const
Definition: SurfacePoint.cpp:1597
Definition: SurfacePoint.h:160
Distance GetLonSigmaDistance() const
Return the longitude sigma in meters.
Definition: SurfacePoint.cpp:1757
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
std::vector< double > LatitudinalDerivative(CoordIndex index)
Compute partial derivative of the conversion of the latitudinal coordinates to body-fixed rectangular...
Definition: SurfacePoint.cpp:792
Distance measurement, usually in meters.
Definition: Distance.h:47
Latitude GetLatitude() const
Return the body-fixed latitude for the surface point.
Definition: SurfacePoint.cpp:1659
double GetCoord(CoordinateType type, CoordIndex index, CoordUnits units)
This method returns a coordinate of a SurfacePoint.
Definition: SurfacePoint.cpp:956
void SetRectangularSigmas(const Distance &xSigma, const Distance &ySigma, const Distance &zSigma)
Set surface point and sigmas in rectangular coordinates and convert to planetocentric.
Definition: SurfacePoint.cpp:344
Definition: SurfacePoint.h:162
std::vector< double > RectangularDerivative(CoordIndex index)
Compute partial derivative of the body-fixed rectangular coordinates with respect to the indicated co...
Definition: SurfacePoint.cpp:834
double GetZWeight() const
Return Z weight for bundle adjustment Units are 1/(kilometers)^2.
Definition: SurfacePoint.cpp:1583
Planetocentric latitudinal (lat/lon/rad) coordinates.
Definition: SurfacePoint.h:156
This class is designed to encapsulate the concept of a Longitude.
Definition: Longitude.h:52
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.
Definition: SurfacePoint.cpp:370
void SetSphericalMatrix(const boost::numeric::ublas::symmetric_matrix< double, boost::numeric::ublas::upper > &covar, SurfacePoint::CoordUnits units=SurfacePoint::Meters)
Set spherical covariance matrix.
Definition: SurfacePoint.cpp:631
double LongitudeToMeters(double longitude) const
This method returns a length in meters version of a delta longitude angle in radians relative to the ...
Definition: SurfacePoint.cpp:1330
std::vector< double > Partial(CoordinateType type, CoordIndex index)
Compute partial derivative of conversion from body-fixed coordinates to the specified.
Definition: SurfacePoint.cpp:767
double DisplacementToDouble(Displacement disp, CoordUnits units)
This method returns a double version of a Displacement in the specified units.
Definition: SurfacePoint.cpp:1154
static QString coordinateTypeToString(CoordinateType type)
Converts the given SurfacePoint::CoordinateType enumeration to a string.
Definition: SurfacePoint.cpp:1383
double MetersToLongitude(double lonLength)
This method returns an angular measure in radians of a distance in the direction of and relative to t...
Definition: SurfacePoint.cpp:1270
Definition: SurfacePoint.h:161
double GetLocalRadiusWeight() const
Return radius weight for bundle adjustment Units are 1/(kilometers)^2.
Definition: SurfacePoint.cpp:1858
double LatToDouble(Latitude lat, CoordUnits units)
This method returns a double version of a Latitude in the specified units.
Definition: SurfacePoint.cpp:1210
void SetMatrix(CoordinateType type, const boost::numeric::ublas::symmetric_matrix< double, boost::numeric::ublas::upper > &covar)
Set the covariance matrix.
Definition: SurfacePoint.cpp:743
Angle GetLatSigma() const
Definition: SurfacePoint.cpp:1639
Body-fixed rectangular x/y/z coordinates.
Definition: SurfacePoint.h:157
CoordinateType
Defines the coordinate typ, units, and coordinate index for some of the output methods.
Definition: SurfacePoint.h:155
bool Valid() const
Definition: SurfacePoint.cpp:941
Distance GetSigmaDistance(CoordinateType type, CoordIndex index)
This method returns a sigma of a SurfacePoint coordinate as a Distance.
Definition: SurfacePoint.cpp:1088
double GetLonWeight() const
Return longitude weight for bundle adjustment Units are 1/(radians)^2.
Definition: SurfacePoint.cpp:1842
Distance GetYSigma() const
Definition: SurfacePoint.cpp:1458
static CoordinateType stringToCoordinateType(QString type)
This method converts the given string value to a SurfacePoint::CoordinateType enumeration.
Definition: SurfacePoint.cpp:1357
double LatitudeToMeters(double latitude) const
This method returns a Displacement of an Angle relative to the current SurfacePoint latitude...
Definition: SurfacePoint.cpp:1304
Defines an angle and provides unit conversions.
Definition: Angle.h:62
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...
Definition: SurfacePoint.cpp:567
Definition: SurfacePoint.h:166
Longitude GetLongitude() const
Return the body-fixed longitude for the surface point.
Definition: SurfacePoint.cpp:1679
double GetXWeight() const
Return X weight for bundle adjustment Units are 1/(kilometers)^2.
Definition: SurfacePoint.cpp:1547
Definition: SurfacePoint.h:163
void ToNaifArray(double naifOutput[3]) const
A naif array is a c-style array of size 3.
Definition: SurfacePoint.cpp:864
Definition: SurfacePoint.h:168
Displacement is a signed length, usually in meters.
Definition: Displacement.h:43
void FromNaifArray(const double naifValues[3])
A naif array is a c-style array of size 3.
Definition: SurfacePoint.cpp:885
Distance GetLocalRadiusSigma() const
Definition: SurfacePoint.cpp:1770
double DistanceToDouble(Distance dist, CoordUnits units)
This method returns a double version of a Distance in the specified units.
Definition: SurfacePoint.cpp:1182
Angle GetLonSigma() const
Definition: SurfacePoint.cpp:1647
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
Definition: SurfacePoint.h:167
void SetSphericalSigmasDistance(const Distance &latSigma, const Distance &lonSigma, const Distance &radiusSigma)
Set the spherical sigmas (in Distance units) into the spherical variance/covariance matrix...
Definition: SurfacePoint.cpp:611
SurfacePoint()
Constructs an empty SurfacePoint object.
Definition: SurfacePoint.cpp:20
bool operator==(const SurfacePoint &other) const
Definition: SurfacePoint.cpp:1923
double GetWeight(CoordinateType type, CoordIndex index)
This method returns the weight of a SurfacePoint coordinate Note: At this time a units argument is no...
Definition: SurfacePoint.cpp:1485
CoordUnits
Definition: SurfacePoint.h:159
SurfacePoint & operator=(const SurfacePoint &other)
Definition: SurfacePoint.cpp:1964
void SetSphericalCoordinates(const Latitude &lat, const Longitude &lon, const Distance &radius)
Update spherical coordinates (lat/lon/radius)
Definition: SurfacePoint.cpp:547
Distance GetLocalRadius() const
Return the radius of the surface point.
Definition: SurfacePoint.cpp:1726
Displacement GetY() const
Definition: SurfacePoint.cpp:1437
double GetLatWeight() const
Return latitude weight for bundle adjustment Units are 1/(radians)^2.
Definition: SurfacePoint.cpp:1826
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.
Definition: SurfacePoint.cpp:277