Isis Developer Reference
SurfacePoint.h
Go to the documentation of this file.
1 #ifndef SurfacePoint_h
2 #define SurfacePoint_h
3 
8 /* SPDX-License-Identifier: CC0-1.0 */
9 #include <vector>
10 #include <cmath>
11 
12 // Qt library
13 #include <QString>
14 
15 #include "boost/numeric/ublas/symmetric.hpp"
16 #include "boost/numeric/ublas/io.hpp"
17 
18 // ISIS library
19 #include "Displacement.h"
20 #include "Distance.h"
21 #include "Angle.h"
22 
23 namespace Isis {
24  class Latitude;
25  class Longitude;
26 
132  class SurfacePoint {
133  public:
134 
135  // definitions
141  Rectangular
142  };
143  enum CoordUnits {
147  Radians
148  };
149  enum CoordIndex {
150  One=0,
151  Two=1,
152  Three=2
153  };
154 
155  // Constructors
156  SurfacePoint();
157  SurfacePoint(const SurfacePoint &other);
158  SurfacePoint(const Latitude &lat, const Longitude &lon,
159  const Distance &radius);
160  SurfacePoint(const Latitude &lat, const Longitude &lon,
161  const Distance &radius, const Angle &latSigma, const Angle &lonSigma,
162  const Distance &radiusSigma);
163  SurfacePoint(const Latitude &lat, const Longitude &lon,
164  const Distance &radius,
165  const boost::numeric::ublas::symmetric_matrix
166  <double,boost::numeric::ublas::upper>& covar);
167  SurfacePoint(const Displacement &x, const Displacement &y,
168  const Displacement &z);
169  SurfacePoint(const Displacement &x, const Displacement &y,
170  const Displacement &z, const Distance &xSigma, const Distance &ySigma,
171  const Distance &zSigma);
173  const Displacement &z,
174  const boost::numeric::ublas::symmetric_matrix
175  <double,boost::numeric::ublas::upper>& covar);
176  ~SurfacePoint();
177 
178 // Rectangular loading utilities
179  void SetRectangular(const Displacement &x, const Displacement &y,
180  const Displacement &z, const Distance &xSigma=Distance(),
181  const Distance &ySigma=Distance(), const Distance &zSigma=Distance());
182 
183  void SetRectangular(const Displacement x, const Displacement y, const Displacement z,
184  const boost::numeric::ublas::symmetric_matrix<double,boost::numeric::ublas::upper>& covar);
185 
186  void SetRectangularCoordinates(const Displacement &x, const Displacement &y,
187  const Displacement &z);
188 
190  void SetRectangularSigmas(const Distance &xSigma, const Distance &ySigma,
191  const Distance &zSigma);
192 
194  const boost::numeric::ublas::symmetric_matrix<double,boost::numeric::ublas::upper>& covar,
196 
197 // Spherical loading utilities
198 
201  void SetSpherical (const Latitude &lat, const Longitude &lon,
202  const Distance &radius, const Angle &latSigma=Angle(),
203  const Angle &lonSigma=Angle(),
204  const Distance &radiusSigma=Distance());
205 
206  void SetSpherical (const Latitude &lat, const Longitude &lon,
207  const Distance &radius,
208  const boost::numeric::ublas::symmetric_matrix
209  <double,boost::numeric::ublas::upper>& covar);
210 
211  void SetSphericalCoordinates(const Latitude &lat, const Longitude &lon,
212  const Distance &radius);
213 
214  void SetSphericalMatrix(
215  const boost::numeric::ublas::symmetric_matrix<double,boost::numeric::ublas::upper>& covar,
217 
218  void SetSphericalSigmas(const Angle &latSigma, const Angle &lonSigma,
219  const Distance &radiusSigma);
220 
221  void SetSphericalSigmasDistance(const Distance &latSigma,
222  const Distance &lonSigma,
223  const Distance &radiusSigma);
224 
225  void ResetLocalRadius(const Distance &radius);
226  bool Valid() const;
227 
228 // Generic utilities for convenience
229 
231  void SetMatrix(CoordinateType type,
232  const boost::numeric::ublas::symmetric_matrix<double,boost::numeric::ublas::upper>& covar);
233 
235  // coordinate type with respect to the indicated coordinate (specified by index).
236  std::vector<double> Partial(CoordinateType type, CoordIndex index);
237 
238 // Output methods
239  double GetCoord(CoordinateType type, CoordIndex index, CoordUnits units);
240  // Consider making this GetSigmaDistance and use the Distance methods to specify units for
241  // maximum flexibility and safety. ***TBD***
242  double GetSigma(CoordinateType type, CoordIndex index, CoordUnits units);
244  double GetWeight(CoordinateType type, CoordIndex index);
245  Displacement GetX() const;
246  Displacement GetY() const;
247  Displacement GetZ() const;
248  Distance GetXSigma() const;
249  Distance GetYSigma() const;
250  Distance GetZSigma() const;
251  double GetXWeight() const;
252  double GetYWeight() const;
253  double GetZWeight() const;
254  boost::numeric::ublas::symmetric_matrix<double,boost::numeric::ublas::upper>
256  Latitude GetLatitude() const;
257  Longitude GetLongitude() const;
258  Distance GetLocalRadius() const;
259  Angle GetLatSigma() const;
261  double GetLatWeight() const;
262  Angle GetLonSigma() const;
264  double GetLonWeight() const;
266  double GetLocalRadiusWeight() const;
267  boost::numeric::ublas::symmetric_matrix
268  <double,boost::numeric::ublas::upper> GetSphericalMatrix
270 
271 // Conversion methods (for convenience)
272  double DisplacementToDouble(Displacement disp, CoordUnits units);
273  double DistanceToDouble(Distance dist, CoordUnits units);
274  double MetersToLatitude(double latLength);
275  double MetersToLongitude(double lonLength);
276  double LatitudeToMeters(double latitude) const;
277  double LongitudeToMeters(double longitude) const;
278  double LatToDouble(Latitude lat, CoordUnits units);
279  double LonToDouble(Longitude lon, CoordUnits units);
280  static CoordinateType stringToCoordinateType(QString type);
281  static QString coordinateTypeToString(CoordinateType type);
282 
283 // Computational methods
284  Distance GetDistanceToPoint(const SurfacePoint &other) const;
286  const Distance &sphereRadius) const;
287  std::vector<double> LatitudinalDerivative(CoordIndex index);
288  std::vector<double> RectangularDerivative(CoordIndex index);
289 
290 // Misc methods
291  void ToNaifArray(double naifOutput[3]) const;
292  void FromNaifArray(const double naifValues[3]);
293 
294 // Operators
295  bool operator==(const SurfacePoint &other) const;
296  SurfacePoint &operator=(const SurfacePoint &other);
297 
298  private:
299  void ComputeLocalRadius();
300  void InitCovariance();
301  void InitPoint();
302  void SetRectangularPoint(const Displacement &x, const Displacement &y, const Displacement &z);
303  void SetSphericalPoint(const Latitude &lat, const Longitude &lon, const Distance &radius);
304  void FreeAllocatedMemory();
305 
306  Distance p_localRadius;
307  Displacement *p_x;
308  Displacement *p_y;
309  Displacement *p_z;
311  boost::numeric::ublas::symmetric_matrix
312  <double,boost::numeric::ublas::upper> *p_rectCovar;
314  boost::numeric::ublas::symmetric_matrix
315  <double,boost::numeric::ublas::upper> *p_sphereCovar;
316  };
317 };
318 
319 #endif
320 
Isis::Distance::kilometers
double kilometers() const
Get the distance in kilometers.
Definition: Distance.cpp:106
Isis::SurfacePoint::operator==
bool operator==(const SurfacePoint &other) const
Definition: SurfacePoint.cpp:1929
Displacement.h
Isis::SurfacePoint::SetRectangular
void SetRectangular(const Displacement x, const Displacement y, const Displacement z, const boost::numeric::ublas::symmetric_matrix< double, boost::numeric::ublas::upper > &covar)
Isis::SurfacePoint::SetRectangular
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:283
Isis::SurfacePoint::MetersToLatitude
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:1248
Isis::SurfacePoint::~SurfacePoint
~SurfacePoint()
Destroys a SurfacePoint object/.
Definition: SurfacePoint.cpp:186
Isis::SurfacePoint::LonToDouble
double LonToDouble(Longitude lon, CoordUnits units)
This method returns a double version of a Longitude in the specified units.
Definition: SurfacePoint.cpp:1415
Isis::SurfacePoint::GetX
Displacement GetX() const
Definition: SurfacePoint.cpp:1436
Isis::SurfacePoint::GetSphericalMatrix
boost::numeric::ublas::symmetric_matrix< double, boost::numeric::ublas::upper > GetSphericalMatrix(SurfacePoint::CoordUnits units=SurfacePoint::Meters) const
Definition: SurfacePoint.cpp:1785
Isis::PI
const double PI
The mathematical constant PI.
Definition: Constants.h:40
Isis::Latitude
This class is designed to encapsulate the concept of a Latitude.
Definition: Latitude.h:51
Isis::SurfacePoint::SetSpherical
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:518
Isis::SurfacePoint::GetSigma
double GetSigma(CoordinateType type, CoordIndex index, CoordUnits units)
This method returns a sigma of a SurfacePoint coordinate.
Definition: SurfacePoint.cpp:1029
Isis::SurfacePoint::GetLonSigmaDistance
Distance GetLonSigmaDistance() const
Return the longitude sigma in meters.
Definition: SurfacePoint.cpp:1763
SpecialPixel.h
Isis::SurfacePoint::GetDistanceToPoint
Distance GetDistanceToPoint(const SurfacePoint &other) const
Computes and returns the distance between two surface points.
Definition: SurfacePoint.cpp:1880
Isis::SurfacePoint::GetLatSigmaDistance
Distance GetLatSigmaDistance() const
Return the latitude sigma as a Distance.
Definition: SurfacePoint.cpp:1747
Isis::SurfacePoint::SetRectangularCoordinates
void SetRectangularCoordinates(const Displacement &x, const Displacement &y, const Displacement &z)
Set surface point in rectangular coordinates.
Definition: SurfacePoint.cpp:327
Isis::SurfacePoint::GetZWeight
double GetZWeight() const
Return Z weight for bundle adjustment Units are 1/(kilometers)^2.
Definition: SurfacePoint.cpp:1589
Isis::SurfacePoint::GetYWeight
double GetYWeight() const
Return Y weight for bundle adjustment Units are 1/(kilometers)^2.
Definition: SurfacePoint.cpp:1571
Longitude.h
Isis::SurfacePoint::SetRectangularMatrix
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:376
Isis::SurfacePoint::Two
@ Two
Definition: SurfacePoint.h:151
Isis::SurfacePoint::SetSphericalMatrix
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:637
Isis::SurfacePoint::GetXSigma
Distance GetXSigma() const
Definition: SurfacePoint.cpp:1457
Isis::SurfacePoint::GetZ
Displacement GetZ() const
Definition: SurfacePoint.cpp:1450
Isis::SurfacePoint::Radians
@ Radians
Definition: SurfacePoint.h:147
Isis::SurfacePoint::GetLatitude
Latitude GetLatitude() const
Return the body-fixed latitude for the surface point.
Definition: SurfacePoint.cpp:1665
Isis::SurfacePoint::Three
@ Three
Definition: SurfacePoint.h:152
Isis::SurfacePoint::GetZSigma
Distance GetZSigma() const
Definition: SurfacePoint.cpp:1471
Isis::SurfacePoint::ResetLocalRadius
void ResetLocalRadius(const Distance &radius)
This method resets the local radius of a SurfacePoint.
Definition: SurfacePoint.cpp:914
Isis::SurfacePoint::GetRectangularMatrix
boost::numeric::ublas::symmetric_matrix< double, boost::numeric::ublas::upper > GetRectangularMatrix(SurfacePoint::CoordUnits units=SurfacePoint::Meters) const
Definition: SurfacePoint.cpp:1603
Isis::toString
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:211
Isis::SurfacePoint::coordinateTypeToString
static QString coordinateTypeToString(CoordinateType type)
Converts the given SurfacePoint::CoordinateType enumeration to a string.
Definition: SurfacePoint.cpp:1389
Isis::IsSpecial
bool IsSpecial(const double d)
Returns if the input pixel is special.
Definition: SpecialPixel.h:197
Isis::SurfacePoint::LatitudinalDerivative
std::vector< double > LatitudinalDerivative(CoordIndex index)
Compute partial derivative of the conversion of the latitudinal coordinates to body-fixed rectangular...
Definition: SurfacePoint.cpp:798
IString.h
Isis::SurfacePoint::SetRectangularSigmas
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:350
Isis::SurfacePoint::GetCoord
double GetCoord(CoordinateType type, CoordIndex index, CoordUnits units)
This method returns a coordinate of a SurfacePoint.
Definition: SurfacePoint.cpp:962
Isis::Distance
Distance measurement, usually in meters.
Definition: Distance.h:34
Isis::Longitude
This class is designed to encapsulate the concept of a Longitude.
Definition: Longitude.h:40
Isis::SurfacePoint::LongitudeToMeters
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:1336
Isis::SurfacePoint::Kilometers
@ Kilometers
Definition: SurfacePoint.h:145
Isis::SurfacePoint::RectangularDerivative
std::vector< double > RectangularDerivative(CoordIndex index)
Compute partial derivative of the body-fixed rectangular coordinates with respect to the indicated co...
Definition: SurfacePoint.cpp:840
Isis::Displacement
Displacement is a signed length, usually in meters.
Definition: Displacement.h:31
Isis::SurfacePoint::DisplacementToDouble
double DisplacementToDouble(Displacement disp, CoordUnits units)
This method returns a double version of a Displacement in the specified units.
Definition: SurfacePoint.cpp:1160
Isis::SurfacePoint::SetMatrix
void SetMatrix(CoordinateType type, const boost::numeric::ublas::symmetric_matrix< double, boost::numeric::ublas::upper > &covar)
Set the covariance matrix.
Definition: SurfacePoint.cpp:749
Latitude.h
Isis::Displacement::meters
double meters() const
Get the displacement in meters.
Definition: Displacement.cpp:73
Isis::SurfacePoint::Rectangular
@ Rectangular
Body-fixed rectangular x/y/z coordinates.
Definition: SurfacePoint.h:141
_FILEINFO_
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:24
Isis::SurfacePoint::CoordinateType
CoordinateType
Defines the coordinate typ, units, and coordinate index for some of the output methods.
Definition: SurfacePoint.h:139
Isis::SurfacePoint::Valid
bool Valid() const
Definition: SurfacePoint.cpp:947
Isis::SurfacePoint::GetLocalRadiusWeight
double GetLocalRadiusWeight() const
Return radius weight for bundle adjustment Units are 1/(kilometers)^2.
Definition: SurfacePoint.cpp:1864
Isis::SurfacePoint::LatToDouble
double LatToDouble(Latitude lat, CoordUnits units)
This method returns a double version of a Latitude in the specified units.
Definition: SurfacePoint.cpp:1216
Isis::SurfacePoint::LatitudeToMeters
double LatitudeToMeters(double latitude) const
This method returns a Displacement of an Angle relative to the current SurfacePoint latitude.
Definition: SurfacePoint.cpp:1310
SurfacePoint.h
Isis::SurfacePoint::One
@ One
Definition: SurfacePoint.h:150
Isis::SurfacePoint::MetersToLongitude
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:1276
Isis::Distance::isValid
bool isValid() const
Test if this distance has been initialized or not.
Definition: Distance.cpp:192
Isis::SurfacePoint::FromNaifArray
void FromNaifArray(const double naifValues[3])
A naif array is a c-style array of size 3.
Definition: SurfacePoint.cpp:891
Isis::SurfacePoint::Meters
@ Meters
Definition: SurfacePoint.h:146
Isis::IException
Isis exception class.
Definition: IException.h:91
Isis::SurfacePoint::Partial
std::vector< double > Partial(CoordinateType type, CoordIndex index)
Compute partial derivative of conversion from body-fixed coordinates to the specified.
Definition: SurfacePoint.cpp:773
Isis::SurfacePoint::stringToCoordinateType
static CoordinateType stringToCoordinateType(QString type)
This method converts the given string value to a SurfacePoint::CoordinateType enumeration.
Definition: SurfacePoint.cpp:1363
Isis::SurfacePoint::GetYSigma
Distance GetYSigma() const
Definition: SurfacePoint.cpp:1464
Isis::Angle
Defines an angle and provides unit conversions.
Definition: Angle.h:45
Isis::SurfacePoint::SetSpherical
void SetSpherical(const Latitude &lat, const Longitude &lon, const Distance &radius, const boost::numeric::ublas::symmetric_matrix< double, boost::numeric::ublas::upper > &covar)
Isis::SurfacePoint::GetXWeight
double GetXWeight() const
Return X weight for bundle adjustment Units are 1/(kilometers)^2.
Definition: SurfacePoint.cpp:1553
Isis::SurfacePoint::SurfacePoint
SurfacePoint()
Constructs an empty SurfacePoint object.
Definition: SurfacePoint.cpp:26
Isis::SurfacePoint::GetLongitude
Longitude GetLongitude() const
Return the body-fixed longitude for the surface point.
Definition: SurfacePoint.cpp:1685
Isis::Null
const double Null
Value for an Isis Null pixel.
Definition: SpecialPixel.h:95
Isis::Displacement::kilometers
double kilometers() const
Get the displacement in kilometers.
Definition: Displacement.cpp:94
Isis::SurfacePoint::SurfacePoint
SurfacePoint(const Latitude &lat, const Longitude &lon, const Distance &radius, const boost::numeric::ublas::symmetric_matrix< double, boost::numeric::ublas::upper > &covar)
IException.h
Isis::SurfacePoint::GetLocalRadius
Distance GetLocalRadius() const
Return the radius of the surface point.
Definition: SurfacePoint.cpp:1732
std
Namespace for the standard library.
Isis::SurfacePoint::SetSphericalCoordinates
void SetSphericalCoordinates(const Latitude &lat, const Longitude &lon, const Distance &radius)
Update spherical coordinates (lat/lon/radius)
Definition: SurfacePoint.cpp:553
Isis::Angle::isValid
bool isValid() const
This indicates whether we have a legitimate angle stored or are in an unset, or invalid,...
Definition: Angle.cpp:95
Isis::SurfacePoint::CoordUnits
CoordUnits
Definition: SurfacePoint.h:143
Angle.h
Isis::Distance::meters
double meters() const
Get the distance in meters.
Definition: Distance.cpp:85
Isis::SurfacePoint::GetLatSigma
Angle GetLatSigma() const
Definition: SurfacePoint.cpp:1645
Isis::SurfacePoint::ToNaifArray
void ToNaifArray(double naifOutput[3]) const
A naif array is a c-style array of size 3.
Definition: SurfacePoint.cpp:870
Isis::SurfacePoint::GetLonWeight
double GetLonWeight() const
Return longitude weight for bundle adjustment Units are 1/(radians)^2.
Definition: SurfacePoint.cpp:1848
Isis::SurfacePoint::GetSigmaDistance
Distance GetSigmaDistance(CoordinateType type, CoordIndex index)
This method returns a sigma of a SurfacePoint coordinate as a Distance.
Definition: SurfacePoint.cpp:1094
Isis::SurfacePoint::GetLonSigma
Angle GetLonSigma() const
Definition: SurfacePoint.cpp:1653
Isis::SurfacePoint::DistanceToDouble
double DistanceToDouble(Distance dist, CoordUnits units)
This method returns a double version of a Distance in the specified units.
Definition: SurfacePoint.cpp:1188
Isis::SurfacePoint::Latitudinal
@ Latitudinal
Planetocentric latitudinal (lat/lon/rad) coordinates.
Definition: SurfacePoint.h:140
Isis::IString
Adds specific functionality to C++ strings.
Definition: IString.h:165
Distance.h
Isis::SurfacePoint::CoordIndex
CoordIndex
Definition: SurfacePoint.h:149
Isis::SurfacePoint::SetSphericalSigmas
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:573
Isis::SurfacePoint::SetSphericalSigmasDistance
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:617
Isis::SurfacePoint::GetLatWeight
double GetLatWeight() const
Return latitude weight for bundle adjustment Units are 1/(radians)^2.
Definition: SurfacePoint.cpp:1832
Isis::SurfacePoint::Degrees
@ Degrees
Definition: SurfacePoint.h:144
Isis::SurfacePoint::GetWeight
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:1491
Isis::SurfacePoint::operator=
SurfacePoint & operator=(const SurfacePoint &other)
Definition: SurfacePoint.cpp:1970
Isis::SurfacePoint
This class defines a body-fixed surface point.
Definition: SurfacePoint.h:132
Isis::SurfacePoint::GetY
Displacement GetY() const
Definition: SurfacePoint.cpp:1443
Isis::SurfacePoint::GetLocalRadiusSigma
Distance GetLocalRadiusSigma() const
Definition: SurfacePoint.cpp:1776
Isis::SurfacePoint::SurfacePoint
SurfacePoint(const Displacement &x, const Displacement &y, const Displacement &z, const boost::numeric::ublas::symmetric_matrix< double, boost::numeric::ublas::upper > &covar)
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::Angle::radians
double radians() const
Convert an angle to a double.
Definition: Angle.h:226