From ffdf9cbe061e119856563c0b6110d9695309d2ec Mon Sep 17 00:00:00 2001 From: roseej Date: Mon, 17 Jan 2022 10:35:06 -0500 Subject: [PATCH 1/7] Add files via upload --- WGS84ReferenceFrame.cpp | 59 +++++++++++++++++++++++++++ WGS84ReferenceFrame.h | 90 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 149 insertions(+) create mode 100644 WGS84ReferenceFrame.cpp create mode 100644 WGS84ReferenceFrame.h diff --git a/WGS84ReferenceFrame.cpp b/WGS84ReferenceFrame.cpp new file mode 100644 index 0000000..5ed97b6 --- /dev/null +++ b/WGS84ReferenceFrame.cpp @@ -0,0 +1,59 @@ +//#################################################################### +// +// FILENAME: WGS84ReferenceFrame.cpp +// +// CLASSIFICATION: Unclassified +// +// DESCRIPTION: +// +// Implementation for WGS84 reference frame realization and epoch. +// +// LIMITATIONS: None +// +// +// SOFTWARE HISTORY: +// Date Author Comment +// ----------- ------ ------- +// 31-December-2021 Eugene Rose CCB Change +// +// NOTES: +// As of writing this, these are the WGS84 realizations to date. +// WGS84 ORIGINAL 1984.0 +// G730 1994.0 +// G873 1997.0 +// G1150 2001.0 +// G1674 2005.0 +// G1762 2005.0 +// +//################################################################### +#define CSM_LIBRARY + +#include "csm.h" +#include "WGS84ReferenceFrame.h" + +namespace csm +{ + //**************************************************************************** + // WGS84ReferenceFrame::setDefinition() + //**************************************************************************** + void WGS84ReferenceFrame::setDefinition(std::string name, const float epoch) + { + m_realization = realizationDefinition(name, epoch); + } + + //**************************************************************************** + // WGS84ReferenceFrame::setDefinition() + //**************************************************************************** + void WGS84ReferenceFrame::setDefinition(const realizationDefinition& rd) + { + m_realization = rd; + } + + //**************************************************************************** + // WGS84ReferenceFrame::getDefinition() + //**************************************************************************** + csm::WGS84ReferenceFrame::realizationDefinition WGS84ReferenceFrame::getDefinition() const + { + return m_realization; + } +} \ No newline at end of file diff --git a/WGS84ReferenceFrame.h b/WGS84ReferenceFrame.h new file mode 100644 index 0000000..b0e0984 --- /dev/null +++ b/WGS84ReferenceFrame.h @@ -0,0 +1,90 @@ +//#################################################################### +// +// FILENAME: WGS84ReferenceFrame.h +// +// CLASSIFICATION: Unclassified +// +// DESCRIPTION: +// +// Header for WGS84 reference frame realization and epoch. +// +// LIMITATIONS: None +// +// +// SOFTWARE HISTORY: +// Date Author Comment +// ----------- ------ ------- +// 31-December-2021 Eugene Rose CCB Change +// +// NOTES: +// As of writing this, these are the WGS84 realizations to date. +// WGS84 ORIGINAL 1984.0 +// G730 1994.0 +// G873 1997.0 +// G1150 2001.0 +// G1674 2005.0 +// G1762 2005.0 +// +//################################################################### + +#ifndef __CSM_WGS84REFERENCEFRAME_H +#define __CSM_WGS84REFERENCEFRAME_H + +#include "csm.h" +#include + +#define WGS84_ORIGINAL "WGS84 ORIGINAL" +#define WGS84_G730 "G730" +#define WGS84_G873 "G873" +#define WGS84_G1150 "G1150" +#define WGS84_G1674 "G1674" +#define WGS84_G1762 "G1762" + +namespace csm +{ + + class CSM_EXPORT_API WGS84ReferenceFrame + { + public: + + struct CSM_EXPORT_API realizationDefinition { + public: + realizationDefinition() : m_name("WGS84_ORIGINAL"), m_epoch(1984.0) {}; + realizationDefinition(std::string name, float epoch) : m_name(name), m_epoch(epoch) {}; + std::string m_name; + float m_epoch; + }; + //> Realizations are defined by a string name and a float epoch which is in terms of years since 0AD. + // The default realization is the original one from 1984.0 + //< + + realizationDefinition m_realization; + + WGS84ReferenceFrame() {}; + //> construct default realization + //< + + WGS84ReferenceFrame(std::string name, const float epoch) : m_realization(name,epoch) {}; + //> construct custom realization + //< + + void setDefinition(std::string name, const float epoch); + //> convenience to set the internal structure (it is public) + //< + + void setDefinition(const realizationDefinition& rd); + //> convenience to set the internal structure (it is public) + //< + + realizationDefinition getDefinition() const; + //> convenience to get the internal structure (it is public) + //< + + private: + + }; + +} // namespace csm + +#endif // __CSM_WGS84REFERENCEFRAME_H + From 8cb67eb49dd6896a5bf355cbad292c59046bcc8f Mon Sep 17 00:00:00 2001 From: roseej Date: Fri, 28 Jan 2022 16:02:00 -0500 Subject: [PATCH 2/7] Update WGS84ReferenceFrame.cpp Address Scott Minster comments --- WGS84ReferenceFrame.cpp | 89 ++++++++++++++++++++++++++++------------- 1 file changed, 61 insertions(+), 28 deletions(-) diff --git a/WGS84ReferenceFrame.cpp b/WGS84ReferenceFrame.cpp index 5ed97b6..1d695d8 100644 --- a/WGS84ReferenceFrame.cpp +++ b/WGS84ReferenceFrame.cpp @@ -1,12 +1,12 @@ //#################################################################### // -// FILENAME: WGS84ReferenceFrame.cpp +// FILENAME: WGS84ReferenceFrame.h // // CLASSIFICATION: Unclassified // // DESCRIPTION: // -// Implementation for WGS84 reference frame realization and epoch. +// Header for WGS84 reference frame realization and epoch. // // LIMITATIONS: None // @@ -26,34 +26,67 @@ // G1762 2005.0 // //################################################################### -#define CSM_LIBRARY + +#ifndef __CSM_WGS84REFERENCEFRAME_H +#define __CSM_WGS84REFERENCEFRAME_H #include "csm.h" -#include "WGS84ReferenceFrame.h" +#include + +#define WGS84_ORIGINAL "WGS84 ORIGINAL" +#define WGS84_G730 "G730" +#define WGS84_G873 "G873" +#define WGS84_G1150 "G1150" +#define WGS84_G1674 "G1674" +#define WGS84_G1762 "G1762" namespace csm { - //**************************************************************************** - // WGS84ReferenceFrame::setDefinition() - //**************************************************************************** - void WGS84ReferenceFrame::setDefinition(std::string name, const float epoch) - { - m_realization = realizationDefinition(name, epoch); - } - - //**************************************************************************** - // WGS84ReferenceFrame::setDefinition() - //**************************************************************************** - void WGS84ReferenceFrame::setDefinition(const realizationDefinition& rd) - { - m_realization = rd; - } - - //**************************************************************************** - // WGS84ReferenceFrame::getDefinition() - //**************************************************************************** - csm::WGS84ReferenceFrame::realizationDefinition WGS84ReferenceFrame::getDefinition() const - { - return m_realization; - } -} \ No newline at end of file + +class CSM_EXPORT_API WGS84ReferenceFrame +{ +public: + + struct CSM_EXPORT_API RealizationDefinition + { + public: + RealizationDefinition() : m_name("WGS84_ORIGINAL"), m_epoch(1984.0) {}; + RealizationDefinition(const std::string &name, float epoch) : m_name(name), m_epoch(epoch) {}; + std::string m_name; + float m_epoch; + }; + //> Realizations are defined by a string name and a float epoch which is in terms of years since 0AD. + // The default realization is the original one from 1984.0 + //< + + WGS84ReferenceFrame() {}; + //> construct default realization + //< + + WGS84ReferenceFrame(const std::string &name, const float epoch) : m_realization(name,epoch) {}; + //> construct custom realization + //< + + void setDefinition(const std::string &name, const float epoch); + //> convenience to set the internal structure (it is public) + //< + + void setDefinition(const RealizationDefinition& rd); + //> convenience to set the internal structure (it is public) + //< + + RealizationDefinition getDefinition() const; + //> convenience to get the internal structure (it is public) + //< + +private: + RealizationDefinition m_realization; + //> the name and epoch of the realization are here + //< + +}; + +} // namespace csm + +#endif // __CSM_WGS84REFERENCEFRAME_H + From 38f1c1a6a620d126c34263335763abf993d81ccb Mon Sep 17 00:00:00 2001 From: roseej Date: Fri, 28 Jan 2022 16:12:27 -0500 Subject: [PATCH 3/7] Update WGS84ReferenceFrame.cpp fix previous update which inserted header file code into .cpp file. This addresses Scott's comments to the .cpp file. --- WGS84ReferenceFrame.cpp | 83 +++++++++++++---------------------------- 1 file changed, 25 insertions(+), 58 deletions(-) diff --git a/WGS84ReferenceFrame.cpp b/WGS84ReferenceFrame.cpp index 1d695d8..8d3799c 100644 --- a/WGS84ReferenceFrame.cpp +++ b/WGS84ReferenceFrame.cpp @@ -1,12 +1,12 @@ //#################################################################### // -// FILENAME: WGS84ReferenceFrame.h +// FILENAME: WGS84ReferenceFrame.cpp // // CLASSIFICATION: Unclassified // // DESCRIPTION: // -// Header for WGS84 reference frame realization and epoch. +// Implementation for WGS84 reference frame realization and epoch. // // LIMITATIONS: None // @@ -26,67 +26,34 @@ // G1762 2005.0 // //################################################################### - -#ifndef __CSM_WGS84REFERENCEFRAME_H -#define __CSM_WGS84REFERENCEFRAME_H +#define CSM_LIBRARY #include "csm.h" -#include - -#define WGS84_ORIGINAL "WGS84 ORIGINAL" -#define WGS84_G730 "G730" -#define WGS84_G873 "G873" -#define WGS84_G1150 "G1150" -#define WGS84_G1674 "G1674" -#define WGS84_G1762 "G1762" +#include "WGS84ReferenceFrame.h" namespace csm { - -class CSM_EXPORT_API WGS84ReferenceFrame +//**************************************************************************** +// WGS84ReferenceFrame::setDefinition() +//**************************************************************************** +void WGS84ReferenceFrame::setDefinition(const std::string &name, const float epoch) { -public: - - struct CSM_EXPORT_API RealizationDefinition - { - public: - RealizationDefinition() : m_name("WGS84_ORIGINAL"), m_epoch(1984.0) {}; - RealizationDefinition(const std::string &name, float epoch) : m_name(name), m_epoch(epoch) {}; - std::string m_name; - float m_epoch; - }; - //> Realizations are defined by a string name and a float epoch which is in terms of years since 0AD. - // The default realization is the original one from 1984.0 - //< - - WGS84ReferenceFrame() {}; - //> construct default realization - //< - - WGS84ReferenceFrame(const std::string &name, const float epoch) : m_realization(name,epoch) {}; - //> construct custom realization - //< - - void setDefinition(const std::string &name, const float epoch); - //> convenience to set the internal structure (it is public) - //< - - void setDefinition(const RealizationDefinition& rd); - //> convenience to set the internal structure (it is public) - //< + m_realization = RealizationDefinition(name, epoch); +} - RealizationDefinition getDefinition() const; - //> convenience to get the internal structure (it is public) - //< - -private: - RealizationDefinition m_realization; - //> the name and epoch of the realization are here - //< - -}; - -} // namespace csm - -#endif // __CSM_WGS84REFERENCEFRAME_H +//**************************************************************************** +// WGS84ReferenceFrame::setDefinition() +//**************************************************************************** +void WGS84ReferenceFrame::setDefinition(const RealizationDefinition& rd) +{ + m_realization = rd; +} +//**************************************************************************** +// WGS84ReferenceFrame::getDefinition() +//**************************************************************************** +csm::WGS84ReferenceFrame::RealizationDefinition WGS84ReferenceFrame::getDefinition() const +{ + return m_realization; +} +} From cd7b36411cf16b027fefb6f0d25dca845b454b68 Mon Sep 17 00:00:00 2001 From: roseej Date: Fri, 28 Jan 2022 16:13:50 -0500 Subject: [PATCH 4/7] Update WGS84ReferenceFrame.h Address Scott's comments. --- WGS84ReferenceFrame.h | 72 ++++++++++++++++++++++--------------------- 1 file changed, 37 insertions(+), 35 deletions(-) diff --git a/WGS84ReferenceFrame.h b/WGS84ReferenceFrame.h index b0e0984..1d695d8 100644 --- a/WGS84ReferenceFrame.h +++ b/WGS84ReferenceFrame.h @@ -43,46 +43,48 @@ namespace csm { - class CSM_EXPORT_API WGS84ReferenceFrame - { - public: - - struct CSM_EXPORT_API realizationDefinition { - public: - realizationDefinition() : m_name("WGS84_ORIGINAL"), m_epoch(1984.0) {}; - realizationDefinition(std::string name, float epoch) : m_name(name), m_epoch(epoch) {}; - std::string m_name; - float m_epoch; - }; - //> Realizations are defined by a string name and a float epoch which is in terms of years since 0AD. - // The default realization is the original one from 1984.0 - //< +class CSM_EXPORT_API WGS84ReferenceFrame +{ +public: + + struct CSM_EXPORT_API RealizationDefinition + { + public: + RealizationDefinition() : m_name("WGS84_ORIGINAL"), m_epoch(1984.0) {}; + RealizationDefinition(const std::string &name, float epoch) : m_name(name), m_epoch(epoch) {}; + std::string m_name; + float m_epoch; + }; + //> Realizations are defined by a string name and a float epoch which is in terms of years since 0AD. + // The default realization is the original one from 1984.0 + //< - realizationDefinition m_realization; + WGS84ReferenceFrame() {}; + //> construct default realization + //< - WGS84ReferenceFrame() {}; - //> construct default realization - //< + WGS84ReferenceFrame(const std::string &name, const float epoch) : m_realization(name,epoch) {}; + //> construct custom realization + //< - WGS84ReferenceFrame(std::string name, const float epoch) : m_realization(name,epoch) {}; - //> construct custom realization - //< + void setDefinition(const std::string &name, const float epoch); + //> convenience to set the internal structure (it is public) + //< + + void setDefinition(const RealizationDefinition& rd); + //> convenience to set the internal structure (it is public) + //< - void setDefinition(std::string name, const float epoch); - //> convenience to set the internal structure (it is public) - //< - - void setDefinition(const realizationDefinition& rd); - //> convenience to set the internal structure (it is public) - //< + RealizationDefinition getDefinition() const; + //> convenience to get the internal structure (it is public) + //< + +private: + RealizationDefinition m_realization; + //> the name and epoch of the realization are here + //< - realizationDefinition getDefinition() const; - //> convenience to get the internal structure (it is public) - //< - - private: - - }; +}; } // namespace csm From 0d42faabce17b38a6a7e47bf705b14c8ab8b53f8 Mon Sep 17 00:00:00 2001 From: roseej Date: Wed, 2 Feb 2022 16:22:39 -0500 Subject: [PATCH 5/7] non-ECEF sensor models 8 files for non-ECEF sensor model enhancement. --- ObjectSpace.cpp | 125 +++++++++ ObjectSpace.h | 279 +++++++++++++++++++ ObjectSpacePointCloudGM.cpp | 141 ++++++++++ ObjectSpacePointCloudGM.h | 399 +++++++++++++++++++++++++++ ObjectSpaceRasterGM.cpp | 148 ++++++++++ ObjectSpaceRasterGM.h | 524 ++++++++++++++++++++++++++++++++++++ ProjectionParameters.cpp | 184 +++++++++++++ ProjectionParameters.h | 225 ++++++++++++++++ 8 files changed, 2025 insertions(+) create mode 100644 ObjectSpace.cpp create mode 100644 ObjectSpace.h create mode 100644 ObjectSpacePointCloudGM.cpp create mode 100644 ObjectSpacePointCloudGM.h create mode 100644 ObjectSpaceRasterGM.cpp create mode 100644 ObjectSpaceRasterGM.h create mode 100644 ProjectionParameters.cpp create mode 100644 ProjectionParameters.h diff --git a/ObjectSpace.cpp b/ObjectSpace.cpp new file mode 100644 index 0000000..6fb310d --- /dev/null +++ b/ObjectSpace.cpp @@ -0,0 +1,125 @@ +//#################################################################### +// +// FILENAME: ObjectSpace.cpp +// +// CLASSIFICATION: Unclassified +// +// DESCRIPTION: +// +// Implementation for object space definition class and non-ECEF Object Space coordinate +// classes. +// +// LIMITATIONS: None +// +// +// SOFTWARE HISTORY: +// Date Author Comment +// ----------- ------ ------- +// 31-March-2022 Eugene Rose CCB Change CSM 3.0.4 +// +// NOTES: +// +//##################################################################### +#define CSM_LIBRARY +#include "csm.h" +#include "ObjectSpace.h" + +namespace csm +{ +//***************************************************************************** +// ObjectSpaceCoordinateCovar::ObjectSpaceCoordinateCovar +//***************************************************************************** +ObjectSpaceCoordinateCovar::ObjectSpaceCoordinateCovar() +{ + x = 0; + y = 0; + z = 0; + std::memset(covariance, 0, sizeof(covariance)); +} + + +//***************************************************************************** +// ObjectSpaceCoordinateCovar::ObjectSpaceCoordinateCovar +//***************************************************************************** +ObjectSpaceCoordinateCovar::ObjectSpaceCoordinateCovar( + double aX, double aY, double aZ) +{ + x = aX; y = aY; z = aZ; + std::memset(covariance, 0, sizeof(covariance)); +} + +//***************************************************************************** +// ObjectSpaceCoordinateCovar::ObjectSpaceCoordinateCovar +//***************************************************************************** +ObjectSpaceCoordinateCovar::ObjectSpaceCoordinateCovar( + double aX, double aY, double aZ, const double aCovar[9]) +{ + x = aX; y = aY; z = aZ; + std::memcpy(covariance, aCovar, sizeof(covariance)); +} + +//***************************************************************************** +// ObjectSpaceCoordinateCovar::ObjectSpaceCoordinateCovar +//***************************************************************************** +ObjectSpaceCoordinateCovar::ObjectSpaceCoordinateCovar(double aX, double aY, double aZ, + double aCovar00, double aCovar01, double aCovar02, + double aCovar11, double aCovar12, + double aCovar22) +{ + x = aX; y = aY; z = aZ; + covariance[0] = aCovar00; + covariance[1] = covariance[3] = aCovar01; + covariance[2] = covariance[6] = aCovar02; + covariance[4] = aCovar11; + covariance[5] = covariance[7] = aCovar12; + covariance[8] = aCovar22; +} + +//***************************************************************************** +// ObjectSpaceVectorCovar::ObjectSpaceVectorCovar +//***************************************************************************** +ObjectSpaceVectorCovar::ObjectSpaceVectorCovar() +{ + x = 0.0; + y = 0.0; + z = 0.0; + for (int i = 0; i < 9; i++) + { + covariance[i] = 0.0; + } +} + +//***************************************************************************** +// ObjectSpaceVectorCovar::ObjectSpaceVectorCovar +//***************************************************************************** +ObjectSpaceVectorCovar::ObjectSpaceVectorCovar(double aX, double aY, double aZ, + double aCovar[9]) +{ + x = aX; + y = aY; + z = aZ; + std::memcpy(covariance, aCovar, sizeof(covariance)); +} + +//***************************************************************************** +// ObjectSpaceVectorCovar::ObjectSpaceVectorCovar +//***************************************************************************** +ObjectSpaceVectorCovar::ObjectSpaceVectorCovar(double aX, double aY, double aZ, + double aCovar00, double aCovar01, double aCovar02, + double aCovar11, double aCovar12, + double aCovar22) +{ + x = aX; + y = aY; + z = aZ; + covariance[0] = aCovar00; + covariance[1] = covariance[3] = aCovar01; + covariance[2] = covariance[6] = aCovar02; + covariance[4] = aCovar11; + covariance[5] = covariance[7] = aCovar12; + covariance[8] = aCovar22; + +} + +} + diff --git a/ObjectSpace.h b/ObjectSpace.h new file mode 100644 index 0000000..beca4f4 --- /dev/null +++ b/ObjectSpace.h @@ -0,0 +1,279 @@ +//#################################################################### +// +// FILENAME: ObjectSpace.h +// +// CLASSIFICATION: Unclassified +// +// DESCRIPTION: +// +// Header for object space definition class and non-ECEF ObjectSpace coordinate classes. +// +// LIMITATIONS: None +// +// +// SOFTWARE HISTORY: +// Date Author Comment +// ----------- ------ ------- +// 31-March-2022 Eugene Rose CCB Change CSM 3.0.4 +// +// NOTES: +// +//##################################################################### + +#ifndef __CSM_OBJECTSPACE_H +#define __CSM_OBJECTSPACE_H + +#include + +namespace csm +{ +enum class CSM_EXPORT_API ObjectSpaceType : unsigned char +{ + LSR, + ECI, + UNDEFINED +}; +//> +// This enum class identifies the object space type. +//< + +//*** +// STRUCT: ObjectSpaceCoordinate +//> This structure represents a three-dimensional point in the object space coordinate system. +// +// Coordinate values are in units of meters. +//< +//*** +struct CSM_EXPORT_API ObjectSpaceCoordinate +{ +public: + double x; + double y; + double z; + //> three coordinate values + //< + + ObjectSpaceCoordinate() : + x(0.0), y(0.0), z(0.0) {} + //> the default constructor initializes the coordinates all to 0.0 + //< + + ObjectSpaceCoordinate(double aX, double aY, double aZ) : x(aX), y(aY), z(aZ) {} + //> constructor that initializes with the values given + //< +}; // ObjectSpaceCoordinate + +//*** +// STRUCT: ObjectCoordinateCovar +//> This structure represents a three-dimensional point in the object space coordinate system +// and its 3 by 3 covariance matrix. +// +// Coordinate values are in units of meters and covariances are in units of meters-squared. +//< +//*** +struct CSM_EXPORT_API ObjectSpaceCoordinateCovar : public ObjectSpaceCoordinate +{ +public: + double covariance[9]; +//> 3x3 coordinate covariance matrix, in meters squared, +// stored as an array of nine doubles as follows: +// +//- [0] = x variance +//- [1] = xy covariance +//- [2] = xz covariance +//- [3] = yx covariance +//- [4] = y variance +//- [5] = yz covariance +//- [6] = zx covariance +//- [7] = zy covariance +//- [8] = z variance +//< + + + ObjectSpaceCoordinateCovar(); + //> Default Constructor + //< + + ObjectSpaceCoordinateCovar(double aX, double aY, double aZ); + //> This constructor takes x, y, and z values in meters. + // The covariance is set to zeroes. + //< + + ObjectSpaceCoordinateCovar(double aX, double aY, double aZ, const double aCovar[9]); + //> This constructor takes x, y, and z values in meters and + // covariance as an array of nine doubles in meters squared. + // Note that no check is made to ensure symmetry of the covariance + // matrix. + //< + + ObjectSpaceCoordinateCovar(double aX, double aY, double aZ, + double aCovar00, double aCovar01, double aCovar02, + double aCovar11, double aCovar12, + double aCovar22); + //> This constructor takes x, y, and z values in meters and the + // upper-triangular portion of a covariance matrix in meters squared. + // It is assumed that the covariance matrix is symmetric. + //< + +}; // ObjectSpaceCoordinateCovar + +//*** +// STRUCT: ObjectSpaceVector +//> This structure represents a three-dimensional vector in the object space coordinate system. +// +// Vector coordinates are in units of meters. +//< +//*** +struct CSM_EXPORT_API ObjectSpaceVector +{ +public: + double x; + double y; + double z; + //> these are the vector components in units of meters. + //< + + ObjectSpaceVector() : x(0.0), y(0.0), z(0.0) {} + //> This constructor takes x, y, and z values in meters. + // The covariance is set to zeroes. + //< + ObjectSpaceVector(double aX, double aY, double aZ) : x(aX), y(aY), z(aZ) {} + //> constructor that initializes with the values given + //< +}; + +//*** +// STRUCT: ObjectSpaceVectorCovar +//> This structure represents a three-dimensional vector and its 3 by 3 covariance matrix +// in the object space coordinate system. +// +// Vector coordinates are in units of meters and covariances are in units of meters-squared. +//< +//*** +struct CSM_EXPORT_API ObjectSpaceVectorCovar +{ +public: + double x; + double y; + double z; + //> these are the vector components in units of meters. + //< + + double covariance[9]; + //> 3x3 coordinate covariance matrix, in meters squared, + // stored as an array of nine doubles as follows: + // + //- [0] = x variance + //- [1] = xy covariance + //- [2] = xz covariance + //- [3] = yx covariance + //- [4] = y variance + //- [5] = yz covariance + //- [6] = zx covariance + //- [7] = zy covariance + //- [8] = z variance + //< + + ObjectSpaceVectorCovar(); + //> default constructor initializes coordinates and covariances to 0.0 + //< + + ObjectSpaceVectorCovar(double aX, double aY, double aZ, double covar[9]); + //> constructor that initializes with the values given + //< + + ObjectSpaceVectorCovar(double aX, double aY, double aZ, + double aCovar00, double aCovar01, double aCovar02, + double aCovar11, double aCovar12, + double aCovar22); + //> This constructor takes x, y, and z values in meters and the + // upper-triangular portion of a covariance matrix in meters squared. + // It is assumed that the covariance matrix is symmetric. + //< +}; + +//*** +// STRUCT: ObjectSpaceLocus +//> This structure contains an object space coordinate (in meters) and +// an object space direction vector. +//< +//*** +struct CSM_EXPORT_API ObjectSpaceLocus +{ +public: + ObjectSpaceCoordinate point; + //> the origin point of the locus vector. + //< + + ObjectSpaceVector direction; + //> the three components of the direction vector. + //< + + ObjectSpaceLocus() : point(), direction() {} + //< the default constructors set all of the initial values to 0.0. + //> + + + ObjectSpaceLocus(const ObjectSpaceCoordinate& argPoint, + const ObjectSpaceVector& argDirection) + : + point(argPoint), + direction(argDirection) + {} + //> construct with the values given + //< + + ObjectSpaceLocus( double ptX, double ptY, double ptZ, + double dirX, double dirY, double dirZ) + : + point(ptX, ptY, ptZ), + direction(dirX, dirY, dirZ) + {} + //> construct with the coordinate values and vector components given. + //< +}; + + +//*** +// STRUCT: ObjectSpaceLocusCovar +//> This structure contains an object space coordinate (in meters) and +// an object space direction vector. +//< +//*** +struct CSM_EXPORT_API ObjectSpaceLocusCovar +{ +public: + ObjectSpaceCoordinateCovar point; + //> the origin point of the locus vector. + //< + + ObjectSpaceVectorCovar direction; + //> the three components of the direction vector. + //< + + ObjectSpaceLocusCovar() : point(), direction() {} + //< the default constructors set all of the initial values to 0.0. + //> + + + ObjectSpaceLocusCovar(const ObjectSpaceCoordinateCovar& argPoint, + const ObjectSpaceVectorCovar& argDirection) + : + point(argPoint), + direction(argDirection) + {} + //> construct with the values given + //< + + ObjectSpaceLocusCovar(double ptX, double ptY, double ptZ, double pt_covar[9], + double dirX, double dirY, double dirZ, double dir_covar[9]) + : + point(ptX, ptY, ptZ,pt_covar), + direction(dirX, dirY, dirZ, dir_covar) + {} + //> construct with the coordinate values and vector components given. + //< +}; + +} // namespace csm +#endif // __CSM_OBJECTSPACE_H diff --git a/ObjectSpacePointCloudGM.cpp b/ObjectSpacePointCloudGM.cpp new file mode 100644 index 0000000..d554ff7 --- /dev/null +++ b/ObjectSpacePointCloudGM.cpp @@ -0,0 +1,141 @@ +//############################################################################# +// +// FILENAME: ObjectSpacePointCloudGM.cpp +// +// CLASSIFICATION: Unclassified +// +// DESCRIPTION: +// +// This file provides implementation for methods declared in the +// ObjectSpacePointCloudGM class. +// +// SOFTWARE HISTORY: +// Date Author Comment +// ----------- ------ ------- +// 31-Dec-2021 EJR Initial Coding +// +// NOTES: +// +// Refer to ObjectSpacePointCloudGM.h for more information. +// +//############################################################################# +#define CSM_LIBRARY + +#include "GeometricModel.h" +#include "ObjectSpacePointCloudGM.h" + +namespace csm { +ObjectSpacePointCloudGM::ObjectSpacePointCloudGM() { }; + +std::string ObjectSpacePointCloudGM::getFamily()const { + return (GeometricModel::getFamily() + CSM_OSPC_FAMILY); +} + +//***************************************************************************** +// ObjectSpacePointCloudGM::getObjectSpaceDefinition +//***************************************************************************** +ObjectSpaceType ObjectSpacePointCloudGM::getObjectSpaceDefinition() const +{ + return m_objectSpaceDefinition; +} + +//***************************************************************************** +// ObjectSpacePointCloudGM::setObjectSpaceDefinition +//***************************************************************************** +void ObjectSpacePointCloudGM::setObjectSpaceDefinition(const ObjectSpaceType &type) +{ + m_objectSpaceDefinition = type; +} + +//***************************************************************************** +// ObjectSpacePointCloudGM::computeAllSensorPartials() +//***************************************************************************** + +std::vector ObjectSpacePointCloudGM::computeAllSensorPartials( + const ObjectSpaceCoordinate& groundPt, + param::Set pSet, + double desiredPrecision, + double* achievedPrecision, + WarningList* warnings) const +{ + const std::vector indices = csm::GeometricModel::getParameterSetIndices(pSet); + + std::vector val; + + const size_t NUM_PARAMS = indices.size(); + + if (NUM_PARAMS) + { + val.resize(NUM_PARAMS); + + //*** + // The achieved precision should be the MAXIMUM of the achieved + // precision values found for each desired index. + //*** + if (achievedPrecision) *achievedPrecision = 0.0; + ModelCoord mc = objectSpaceToModel(groundPt); + for (int i = 0; i < NUM_PARAMS; ++i) + { + double prec = 0.0; + val[i] = computeSensorPartials(indices[i], + mc, + groundPt, + desiredPrecision, + &prec, + warnings); + + if (achievedPrecision && (prec > *achievedPrecision)) + { + *achievedPrecision = prec; + } + } + } + return val; +}; + +//***************************************************************************** +// ObjectSpacePointCloudGM::computeAllSensorPartials() +//***************************************************************************** +std::vector ObjectSpacePointCloudGM::computeAllSensorPartials( + const ModelCoord& modelPt, + const ObjectSpaceCoordinate& groundPt, + param::Set pSet, + double desiredPrecision, + double* achievedPrecision, + WarningList* warnings) const +{ + const std::vector indices = csm::GeometricModel::getParameterSetIndices(pSet); + + std::vector val; + + const size_t NUM_PARAMS = indices.size(); + + if (NUM_PARAMS) + { + val.resize(NUM_PARAMS); + + //*** + // The achieved precision should be the MAXIMUM of the achieved + // precision values found for each desired index. + //*** + if (achievedPrecision) *achievedPrecision = 0.0; + + for (int i = 0; i < NUM_PARAMS; ++i) + { + double prec = 0.0; + val[i] = computeSensorPartials(indices[i], + modelPt, + groundPt, + desiredPrecision, + &prec, + warnings); + + if (achievedPrecision && (prec > *achievedPrecision)) + { + *achievedPrecision = prec; + } + } + } + return val; +} +} \ No newline at end of file diff --git a/ObjectSpacePointCloudGM.h b/ObjectSpacePointCloudGM.h new file mode 100644 index 0000000..9c44fde --- /dev/null +++ b/ObjectSpacePointCloudGM.h @@ -0,0 +1,399 @@ + +//############################################################################# +// +// FILENAME: ObjectSpacePointCloudGM.h +// +// CLASSIFICATION: Unclassified +// +// DESCRIPTION: +// +// Header for abstract class that is to provide a common interface from +// which CSM point cloud geometric models that operate in non ECEF +// coordinate systems will inherit. It is derived from the +// GeometricModel class. +// +// LIMITATIONS: None +// +// +// SOFTWARE HISTORY: +// Date Author Comment +// ----------- ------ ------- +// 31-Dec-2021 EJR Initial version. +// +// NOTES: +// +//############################################################################# + +#ifndef __CSM_OBJECT_POINTCLOUD_GM_H +#define __CSM_OBJECT_POINTCLOUD_GM_H + +#include "csm.h" +#include "Error.h" +#include "GeometricModel.h" +#include "ObjectSpace.h" +#include "csmPointCloud.h" +#define CSM_OSPC_FAMILY "ObjectSpacePointCloud" + +namespace csm { + +class CorrelationModel; + +class CSM_EXPORT_API ObjectSpacePointCloudGM : public GeometricModel { +public: + ObjectSpacePointCloudGM(); + virtual ~ObjectSpacePointCloudGM() { } + + virtual std::string getFamily() const; + //> This method returns the Family ID for the current model. + //< + + virtual Version getVersion() const = 0; + //> get the protected data member that defines the specifics + // of the LSR object space being used by the model. + //< + + //--- + // Model-space description + //--- + virtual ModelCoordProperties getModelCoordinateProperties() const = 0; + //> This method returns a structure containing human-readable + // descriptions of the model-space coordinate system used by this + // sensor model. See the definition of ModelCoordProperties for an + // example of how it might be initialized. + //< + + // replace Geometric versions which are ecef-based + virtual ObjectSpaceCoordinate getObjectSpaceReferencePoint() const = 0; + //> This method returns the ground point indicating the general + // location of the image. + //< + + virtual void setObjectSpaceReferencePoint(const ObjectSpaceCoordinate& groundPt) = 0; + //> This method sets the ground point indicating the general location + // of the image. + //< + + //--- + // Core Transformations + //--- + virtual ModelCoord objectSpaceToModel(const ObjectSpaceCoordinate& groundPt, + double desiredPrecision = 0.001, + double* achievedPrecision = NULL, + WarningList* warnings = NULL) const = 0; + //> This method converts the given groundPt (x,y,z in meters) to a + // returned model coordinate (m0,m1,m2 in the model's coordinate + // space). + // + // Iterative algorithms will use desiredPrecision, in meters, as the + // convergence criterion, otherwise it will be ignored. + // + // If a non-NULL achievedPrecision argument is received, it will be + // populated with the actual precision, in meters, achieved by iterative + // algorithms and 0.0 for deterministic algorithms. + // + // If a non-NULL warnings argument is received, it will be populated + // as applicable. + //< + + virtual ModelCoordCovar objectSpaceToModel(const ObjectSpaceCoordinateCovar& groundPt, + double desiredPrecision = 0.001, + double* achievedPrecision = NULL, + WarningList* warnings = NULL) const = 0; + //> This method converts the given groundPt (x,y,z in meters and + // corresponding 3x3 covariance in meters squared) to a returned + // model coordinate with covariance (m0,m1,m2 in the model's + // coordinate space and corresponding 3x3 covariance). + // + // Iterative algorithms will use desiredPrecision, in meters, as the + // convergence criterion, otherwise it will be ignored. + // + // If a non-NULL achievedPrecision argument is received, it will be + // populated with the actual precision, in meters, achieved by iterative + // algorithms and 0.0 for deterministic algorithms. + // + // If a non-NULL warnings argument is received, it will be populated + // as applicable. + //< + + virtual ObjectSpaceCoordinate modelToObjectSpace(const ModelCoord& modelPt, + double desiredPrecision = 0.001, + double* achievedPrecision = NULL, + WarningList* warnings = NULL) const = 0; + //> This method converts the given modelPt (m0,m1,m2 in model + // coordinates) to a returned ground coordinate (x,y,z in meters). + // + // Iterative algorithms will use desiredPrecision, in meters, as the + // convergence criterion, otherwise it will be ignored. + // + // If a non-NULL achievedPrecision argument is received, it will be + // populated with the actual precision, in meters, achieved by iterative + // algorithms and 0.0 for deterministic algorithms. + // + // If a non-NULL warnings argument is received, it will be populated + // as applicable. + //< + + virtual ObjectSpaceCoordinateCovar modelToObjectSpace(const ModelCoordCovar& modelPt, + double desiredPrecision = 0.001, + double* achievedPrecision = NULL, + WarningList* warnings = NULL) const = 0; + //> This method converts the given modelPt (m0,m1,m2 in model + // coordinates) and corresponding 3x3 covariance to a returned ground + // coordinate with covariance (x,y,z in meters and corresponding + // 3x3 covariance in meters squared). + // + // Iterative algorithms will use desiredPrecision, in meters, as the + // convergence criterion, otherwise it will be ignored. + // + // If a non-NULL achievedPrecision argument is received, it will be + // populated with the actual precision, in meters, achieved by iterative + // algorithms and 0.0 for deterministic algorithms. + // + // If a non-NULL warnings argument is received, it will be populated + // as applicable. + //< + + //--- + // Model bounds + //--- + virtual ModelBounds getValidModelBounds() const = 0; + //> This method returns an object representing the model-space region + // over which the current model is valid. The ModelBounds object has a + // contains() function that may be used to check whether a given model + // coordinate lies within this region. + // + // NOTE: Attempting to use the model for transformations involving model + // coordinates outside the returned bounds may result in incorrect or + // misleading error estimates! + //< + + //--- + // Uncertainty Propagation + //--- + struct SensorPartials + { + double dM0; + double dM1; + double dM2; + }; + //> This type is used to hold the partial derivatives of model + // coordinates m0, m1, and m2, respectively, with respect to a model + // parameter. + //< + + + virtual SensorPartials computeSensorPartials(int index, + const ObjectSpaceCoordinate& groundPt, + double desiredPrecision = 0.001, + double* achievedPrecision = NULL, + WarningList* warnings = NULL) const = 0; + //> This is one of two overloaded methods. This method takes only + // the necessary inputs. Some efficiency may be obtained by using the + // other method. Even more efficiency may be obtained by using the + // computeAllSensorPartials method. + // + // This method returns the partial derivatives of m0, m1, and m2 (in + // model coordinates) with respect to the model parameter given by + // index, at the given groundPt (x,y,z in meters). + // + // Derived model implementations may wish to implement this method by + // calling the groundToImage method and passing the resulting image + // coordinate to the other computeSensorPartials method. + // + // If a non-NULL achievedPrecision argument is received, it will be + // populated with the highest actual precision, in meters, achieved by + // iterative algorithms and 0.0 for deterministic algorithms. + // + // If a non-NULL warnings argument is received, it will be populated + // as applicable. + //< + + virtual SensorPartials computeSensorPartials(int index, + const ModelCoord& modelPt, + const ObjectSpaceCoordinate& groundPt, + double desiredPrecision = 0.001, + double* achievedPrecision = NULL, + WarningList* warnings = NULL) const = 0; + //> This is one of two overloaded methods. This method takes + // an input model coordinate for efficiency. Even more efficiency may + // be obtained by using the computeAllSensorPartials method. + // + // This method returns the partial derivatives of m0, m1, and m2 (in + // model coordinates) with respect to the model parameter given by + // index, at the given groundPt (x,y,z in meters). + // + // The modelPt, corresponding to the groundPt, is given so that it does + // not need to be computed by the method. Results are undefined if + // the modelPt provided does not correspond to the result of calling the + // groundToModel method with the given groundPt. + // + // Implementations with iterative algorithms (typically ground-to-image + // calls) will use desiredPrecision, in meters, as the convergence + // criterion, otherwise it will be ignored. + // + // If a non-NULL achievedPrecision argument is received, it will be + // populated with the highest actual precision, in meters, achieved by + // iterative algorithms and 0.0 for deterministic algorithms. + // + // If a non-NULL warnings argument is received, it will be populated + // as applicable. + //< + + virtual std::vector computeAllSensorPartials(const ObjectSpaceCoordinate& groundPt, + param::Set pSet = param::VALID, + double desiredPrecision = 0.001, + double* achievedPrecision = NULL, + WarningList* warnings = NULL) const; + //> This is one of two overloaded methods. This method takes only + // the necessary inputs. Some efficiency may be obtained by using the + // other method. + // + // This method returns the partial derivatives of m0, m1, and m2 (in + // model coordinates) with respect to each of the model parameters at + // the given groundPt (x,y,z in meters). Desired model parameters + // are indicated by the given pSet. + // + // Implementations with iterative algorithms (typically ground-to-image + // calls) will use desiredPrecision, in meters, as the convergence + // criterion, otherwise it will be ignored. + // + // If a non-NULL achievedPrecision argument is received, it will be + // populated with the highest actual precision, in meters, achieved by + // iterative algorithms and 0.0 for deterministic algorithms. + // + // If a non-NULL warnings argument is received, it will be populated + // as applicable. + // + // The value returned is a vector of structures with m0, m1, and m2 + // partials for one model parameter in each structure. The indices of + // the corresponding model parameters can be found by calling the + // getParameterSetIndices method for the given pSet. + // + // Derived models may wish to implement this directly for efficiency, + // but an implementation is provided here that calls the + // computeSensorPartials method for each desired parameter index. + //< + + virtual std::vector computeAllSensorPartials(const ModelCoord& modelPt, + const ObjectSpaceCoordinate& groundPt, + param::Set pSet = param::VALID, + double desiredPrecision = 0.001, + double* achievedPrecision = NULL, + WarningList* warnings = NULL) const; + //> This is one of two overloaded methods. This method takes + // an input image coordinate for efficiency. + // + // This method returns the partial derivatives of m0, m1, and m2 (in + // model coordinates) with respect to each of the model parameters at + // the given groundPt (x,y,z in meters). Desired model parameters + // are indicated by the given pSet. + // + // The modelPt, corresponding to the groundPt, is given so that it does + // not need to be computed by the method. Results are undefined if + // the modelPt provided does not correspond to the result of calling the + // groundToModel method with the given groundPt. + // + // Implementations with iterative algorithms (typically ground-to-image + // calls) will use desiredPrecision, in meters, as the convergence + // criterion, otherwise it will be ignored. + // + // If a non-NULL achievedPrecision argument is received, it will be + // populated with the highest actual precision, in meters, achieved by + // iterative algorithms and 0.0 for deterministic algorithms. + // + // If a non-NULL warnings argument is received, it will be populated + // as applicable. + // + // The value returned is a vector of structures with m0, m1, and m2 + // partials for one model parameter in each structure. The indices of + // the corresponding model parameters can be found by calling the + // getParameterSetIndices method for the given pSet. + // + // Derived models may wish to implement this directly for efficiency, + // but an implementation is provided here that calls the + // computeSensorPartials method for each desired parameter index. + //< + + virtual std::vector computeObjectSpacePartials(const ObjectSpaceCoordinate& groundPt) const = 0; + //> This method returns the partial derivatives of model coordinates m0, + // m1, m2 with respect to the given groundPt (x,y,z in meters). + // + // The value returned is a vector with nine elements as follows: + // + //- [0] = partial derivative of m0 with respect to x + //- [1] = partial derivative of m0 with respect to y + //- [2] = partial derivative of m0 with respect to z + //- [3] = partial derivative of m1 with respect to x + //- [4] = partial derivative of m1 with respect to y + //- [5] = partial derivative of m1 with respect to z + //- [6] = partial derivative of m2 with respect to x + //- [7] = partial derivative of m2 with respect to y + //- [8] = partial derivative of m2 with respect to z + //< + + virtual const CorrelationModel& getCorrelationModel() const = 0; + //> This method returns a reference to a correlation model. + // The correlation model is used to determine the correlation between + // the model parameters of different models of the same type. + // It is primarily used for replacement sensor model generation; + // most applications will use the getCrossCovarianceMatrix function. + //< + + inline std::vector getUnmodeledError(const ModelCoord& modelPt) const; + //> This method returns the 3x3 covariance matrix (in model coordinates) + // at the given modelPt for any model error not accounted for by the + // model parameters. + // + // The value returned is a vector of nine elements as follows: + // + //- [0] = m0 variance + //- [1] = m0/m1 covariance + //- [2] = m0/m2 covariance + //- [3] = m1/m0 covariance + //- [4] = m1 variance + //- [5] = m1/m2 covariance + //- [6] = m2/m0 covariance + //- [7] = m2/m1 covariance + //- [8] = m2 variance + //< + + virtual std::vector getUnmodeledCrossCovariance(const ModelCoord& pt1, + const ModelCoord& pt2) const = 0; + //> This method returns the 3x3 cross-covariance matrix (in model + // coordinates) between model points pt1 and pt2 for any model error not + // accounted for by the model parameters. + // + // The value returned is a vector of nine elements as follows: + // + //- [0] = pt1.m0/pt2.m0 covariance + //- [1] = pt1.m0/pt2.m1 covariance + //- [2] = pt1.m0/pt2.m2 covariance + //- [3] = pt1.m1/pt2.m0 covariance + //- [4] = pt1.m1/pt2.m1 covariance + //- [5] = pt1.m1/pt2.m2 covariance + //- [6] = pt1.m2/pt2.m0 covariance + //- [7] = pt1.m2/pt2.m1 covariance + //- [8] = pt1.m2/pt2.m2 covariance + //< + ObjectSpaceType getObjectSpaceDefinition() const; + //> get the protected data member that defines the specifics + // of the LSR object space being used by the model. + //< + // +protected: + ObjectSpaceType m_objectSpaceDefinition; + void setObjectSpaceDefinition(const ObjectSpaceType& osd); +}; + +//***************************************************************************** +// PointCloudGM::getUnmodeledError +//***************************************************************************** +inline std::vector ObjectSpacePointCloudGM::getUnmodeledError(const ModelCoord& modelPt) const +{ + return getUnmodeledCrossCovariance(modelPt, modelPt); +} + + +} // namespace csm + +#endif // __CSM_OBJECT_POINTCLOUD_GM_H diff --git a/ObjectSpaceRasterGM.cpp b/ObjectSpaceRasterGM.cpp new file mode 100644 index 0000000..b25b523 --- /dev/null +++ b/ObjectSpaceRasterGM.cpp @@ -0,0 +1,148 @@ +//############################################################################# +// +// FILENAME: ObjectSpaceRasterGM.cpp +// +// CLASSIFICATION: Unclassified +// +// DESCRIPTION: +// +// This file provides implementation for methods declared in the +// ObjectSpaceRasterGM class. +// +// SOFTWARE HISTORY: +// Date Author Comment +// ----------- ------ ------- +// 31-Dec-2021 EJR Initial Coding +// +// NOTES: +// +// Refer to ObjectSpaceRasterGM.h for more information. +// +//############################################################################# +#define CSM_LIBRARY + +#include "GeometricModel.h" +#include "ObjectSpaceRasterGM.h" + +namespace csm { +//***************************************************************************** +// ObjectSpaceRasterGM::ObjectSpaceRasterGM +//***************************************************************************** +ObjectSpaceRasterGM::ObjectSpaceRasterGM() { }; + +//***************************************************************************** +// ObjectSpaceRasterGM::getFamily +//***************************************************************************** +std::string ObjectSpaceRasterGM::getFamily()const { + return (GeometricModel::getFamily() + CSM_OSRASTER_FAMILY); +} + +//***************************************************************************** +// ObjectSpaceRasterGM::getObjectSpaceDefinition +//***************************************************************************** +ObjectSpaceType ObjectSpaceRasterGM::getObjectSpaceDefinition() const +{ + return m_objectSpaceDefinition; +} + +//***************************************************************************** +// ObjectSpaceRasterGM::setObjectSpaceDefinition +//***************************************************************************** +void ObjectSpaceRasterGM::setObjectSpaceDefinition(const ObjectSpaceType& osd) +{ + m_objectSpaceDefinition = osd; +} + +//***************************************************************************** +// ObjectSpaceRasterGM::computeAllSensorPartials +//***************************************************************************** +std::vector ObjectSpaceRasterGM::computeAllSensorPartials( + const ObjectSpaceCoordinate& groundPt, + param::Set pSet, + double desiredPrecision, + double* achievedPrecision, + WarningList* warnings) const +{ + const std::vector indices = csm::GeometricModel::getParameterSetIndices(pSet); + + std::vector val; + + const size_t NUM_PARAMS = indices.size(); + + if (NUM_PARAMS) + { + val.resize(NUM_PARAMS); + + //*** + // The achieved precision should be the MAXIMUM of the achieved + // precision values found for each desired index. + //*** + if (achievedPrecision) *achievedPrecision = 0.0; + + ImageCoord ip = objectSpaceToImage(groundPt); + for (int i = 0; i < NUM_PARAMS; ++i) + { + double prec = 0.0; + val[i] = computeSensorPartials(indices[i], + ip, + groundPt, + desiredPrecision, + &prec, + warnings); + + if (achievedPrecision && (prec > *achievedPrecision)) + { + *achievedPrecision = prec; + } + } + } + return val; +}; + +//***************************************************************************** +// ObjectSpaceRasterGM::computeAllSensorPartials +//***************************************************************************** +std::vector ObjectSpaceRasterGM::computeAllSensorPartials( + const ImageCoord& imagePt, + const ObjectSpaceCoordinate& groundPt, + param::Set pSet, + double desiredPrecision, + double* achievedPrecision, + WarningList* warnings) const +{ + const std::vector indices = csm::GeometricModel::getParameterSetIndices(pSet); + + std::vector val; + + const size_t NUM_PARAMS = indices.size(); + + if (NUM_PARAMS) + { + val.resize(NUM_PARAMS); + + //*** + // The achieved precision should be the MAXIMUM of the achieved + // precision values found for each desired index. + //*** + if (achievedPrecision) *achievedPrecision = 0.0; + + for (int i = 0; i < NUM_PARAMS; ++i) + { + double prec = 0.0; + val[i] = computeSensorPartials(indices[i], + imagePt, + groundPt, + desiredPrecision, + &prec, + warnings); + + if (achievedPrecision && (prec > *achievedPrecision)) + { + *achievedPrecision = prec; + } + } + } + return val; +} + +} \ No newline at end of file diff --git a/ObjectSpaceRasterGM.h b/ObjectSpaceRasterGM.h new file mode 100644 index 0000000..c1173f8 --- /dev/null +++ b/ObjectSpaceRasterGM.h @@ -0,0 +1,524 @@ + +//############################################################################# +// +// FILENAME: ObjectSpaceRasterGM.h +// +// CLASSIFICATION: Unclassified +// +// DESCRIPTION: +// +// Header for abstract class that is to provide a common interface from +// which CSM raster geometric models that operate in non ECEF +// coordinate systems will inherit. It is derived from the +// GeometricModel class. +// +// LIMITATIONS: None +// +// +// SOFTWARE HISTORY: +// Date Author Comment +// ----------- ------ ------- +// 31-MAR 22 EJR Initial version. +// +// NOTES: +// +//############################################################################# + +#ifndef __CSM_OBJECTRASTERGM_H +#define __CSM_OBJECTRASTERGM_H + +#include "csm.h" +#include "ProjectionParameters.h" +#include "Error.h" +#include "GeometricModel.h" +#include "ObjectSpace.h" +#include "csmMultiPoint.h" +#define CSM_OSRASTER_FAMILY "ObjectSpaceRasterGM" + +namespace csm +{ +class CorrelationModel; + +class CSM_EXPORT_API ObjectSpaceRasterGM : public GeometricModel +{ +public: + ObjectSpaceRasterGM(); + // need a desctructor realization so that subclass destructors have + // something to call when they are destroyed. + + virtual ~ObjectSpaceRasterGM() {}; + + std::string getFamily()const; + //> This method returns the Family ID for the current model. + //< + + virtual Version getVersion() const = 0; + //> This method returns the version of the model code. The Version + // object can be compared to other Version objects with its comparison + // operators. Not to be confused with the CSM API version. + //< + + // these two method supplements the methods in GeometricModel which work + // in ECEF space. + virtual ObjectSpaceCoordinate getObjectSpaceReferencePoint() const = 0; + //> This method returns the ground point indicating the general + // location of the image. + //< + + virtual void setObjectSpaceReferencePoint(const ObjectSpaceCoordinate& groundPt) = 0; + //> This method sets the ground point indicating the general location + // of the image. + //< + //--- + // Core Photogrammetry + //--- + virtual ImageCoord objectSpaceToImage(const ObjectSpaceCoordinate& groundPt, + double desiredPrecision = 0.001, + double* achievedPrecision = NULL, + WarningList* warnings = NULL) const = 0; + //> This method converts the given groundPt (x,y,z in Object Space meters) to a + // returned image coordinate (line, sample in full image space pixels). + // + // Iterative algorithms will use desiredPrecision, in meters, as the + // convergence criterion, otherwise it will be ignored. + // + // If a non-NULL achievedPrecision argument is received, it will be + // populated with the actual precision, in meters, achieved by iterative + // algorithms and 0.0 for deterministic algorithms. + // + // If a non-NULL warnings argument is received, it will be populated + // as applicable. + //< + + virtual ImageCoordCovar objectSpaceToImageCovar(const ObjectSpaceCoordinateCovar &groundPt, + double desiredPrecision = 0.001, + double* achievedPrecision = NULL, + WarningList* warnings = NULL) const = 0; + //> This method converts the given groundPt (x,y,z in meters and + // corresponding 3x3 covariance in meters squared) to a returned + // image coordinate with covariance (line, sample in full image space + // pixels and corresponding 2x2 covariance in pixels squared). + // + // Iterative algorithms will use desiredPrecision, in meters, as the + // convergence criterion, otherwise it will be ignored. + // + // If a non-NULL achievedPrecision argument is received, it will be + // populated with the actual precision, in meters, achieved by iterative + // algorithms and 0.0 for deterministic algorithms. + // + // If a non-NULL warnings argument is received, it will be populated + // as applicable. + //< + + virtual ObjectSpaceCoordinate imageToObjectSpace(const ImageCoord& imagePt, + const ProjectionParameters *geometry, + double desiredPrecision = 0.001, + double* achievedPrecision = NULL, + WarningList* warnings = NULL) const = 0; + //> This method converts the given imagePt (line,sample in full image + // space pixels) and given projection parameters to a returned + // ground coordinate (x,y,z in Object Space meters). + // + // Iterative algorithms will use desiredPrecision, in meters, as the + // convergence criterion, otherwise it will be ignored. + // + // If a non-NULL achievedPrecision argument is received, it will be + // populated with the actual precision, in meters, achieved by iterative + // algorithms and 0.0 for deterministic algorithms. + // + // If a non-NULL warnings argument is received, it will be populated + // as applicable. + //< + + virtual ObjectSpaceCoordinateCovar imageToObjectSpaceCovar(const ImageCoordCovar& imagePt, + const ProjectionParametersCovar *geometry, + double desiredPrecision = 0.001, + double* achievedPrecision = NULL, + WarningList* warnings = NULL) const = 0; + //> This method converts the given imagePt (line, sample in full image + // space pixels and corresponding 2x2 covariance in pixels squared) + // and given projetion parameters with covariances to a returned ground + // coordinate with covariance (x,y,z in Object Space meters and corresponding + // 3x3 covariance in Object Space meters squared). + // + // Iterative algorithms will use desiredPrecision, in meters, as the + // convergence criterion, otherwise it will be ignored. + // + // If a non-NULL achievedPrecision argument is received, it will be + // populated with the actual precision, in meters, achieved by iterative + // algorithms and 0.0 for deterministic algorithms. + // + // If a non-NULL warnings argument is received, it will be populated + // as applicable. + //< + + virtual ObjectSpaceLocus imageToProximateObjectSpaceImagingLocus( + const ImageCoord& imagePt, + const ObjectSpaceCoordinate& groundPt, + double desiredPrecision = 0.001, + double* achievedPrecision = NULL, + WarningList* warnings = NULL) const = 0; + //> This method, for the given imagePt (line, sample in full image space + // pixels), returns the position and direction of the imaging locus + // nearest the given groundPt (x,y,z in Object Space meters). + // + // Note that there are two opposite directions possible. Both are + // valid, so either can be returned; the calling application can convert + // to the other as necessary. + // + // Iterative algorithms will use desiredPrecision, in meters, as the + // convergence criterion for the locus position, otherwise it will be + // ignored. + // + // If a non-NULL achievedPrecision argument is received, it will be + // populated with the actual precision, in meters, achieved by iterative + // algorithms and 0.0 for deterministic algorithms. + // + // If a non-NULL warnings argument is received, it will be populated + // as applicable. + //< + + virtual ObjectSpaceLocus imageToRemoteGroundSpaceImagingLocus( + const ImageCoord& imagePt, + double desiredPrecision = 0.001, + double* achievedPrecision = NULL, + WarningList* warnings = NULL) const = 0; + //> This method, for the given imagePt (line, sample in full image space + // pixels), returns the position and direction of the imaging locus + // at the sensor. + // + // Note that there are two opposite directions possible. Both are + // valid, so either can be returned; the calling application can convert + // to the other as necessary. + // + // Iterative algorithms will use desiredPrecision, in meters, as the + // convergence criterion for the locus position, otherwise it will be + // ignored. + // + // If a non-NULL achievedPrecision argument is received, it will be + // populated with the actual precision, in meters, achieved by iterative + // algorithms and 0.0 for deterministic algorithms. + // + // If a non-NULL warnings argument is received, it will be populated + // as applicable. + // + // Notes: + // + // The remote imaging locus is only well-defined for optical sensors. + // It is undefined for SAR sensors and might not be available for + // polynomial and other non-physical models. The + // imageToProximateImagingLocus method should be used instead where + // possible. + //< + + //--- + // Monoscopic Mensuration + //--- + virtual ImageCoord getImageStart() const = 0; + //> This method returns the starting coordinate (line, sample in full + // image space pixels) for the imaging operation. Typically (0,0). + //< + + virtual ImageVector getImageSize() const = 0; + //> This method returns the number of lines and samples in full image + // space pixels for the imaging operation. + // + // Note that the model might not be valid over the entire imaging + // operation. Use getValidImageRange() to get the valid range of image + // coordinates. + //< + + virtual ImageCoordPair getValidImageRange() const = 0; + //> This method returns the minimum and maximum image coordinates + // (line, sample in full image space pixels), respectively, over which + // the current model is valid. The image coordinates define opposite + // corners of a rectangle whose sides are parallel to the line and + // sample axes. + // + // The valid image range does not always match the full image + // coverage as returned by the getImageStart and getImageSize methods. + // + // Used in conjunction with the getValidHeightRange method, it is + // possible to determine the full range of ground coordinates over which + // the model is valid. + //< + + virtual std::pair getValidHeightRange() const = 0; + //> This method returns the minimum and maximum heights (in meters + // relative to WGS-84 ellipsoid), respectively, over which the model is + // valid. For example, a model for an airborne platform might not be + // designed to return valid coordinates for heights above the aircraft. + // + // If there are no limits defined for the model, (-99999.0,99999.0) + // will be returned. + //< + + virtual ObjectSpaceVector getIlluminationDirection(const ObjectSpaceCoordinate& groundPt) const = 0; + //> This method returns a vector defining the direction of + // illumination at the given groundPt (x,y,z in Object Space meters). + // Note that there are two opposite directions possible. Both are + // valid, so either can be returned; the calling application can convert + // to the other as necessary. + //< + + //--- + // Time and Trajectory + //--- + virtual double getImageTime(const ImageCoord& imagePt) const = 0; + //> This method returns the time in seconds at which the pixel at the + // given imagePt (line, sample in full image space pixels) was captured + // + // The time provided is relative to the reference date and time given + // by the Model::getReferenceDateAndTime method. + //< + + virtual ObjectSpaceCoordinate getSensorPosition(const ImageCoord& imagePt) const = 0; + //> This method returns the position of the physical sensor + // (x,y,z in Object Space meters) when the pixel at the given imagePt + // (line, sample in full image space pixels) was captured. + // + // A csm::Error will be thrown if the sensor position is not available. + //< + + virtual ObjectSpaceCoordinate getSensorPosition(double time) const = 0; + //> This method returns the position of the physical sensor + // (x,y,z meters Object Space) at the given time relative to the reference date + // and time given by the Model::getReferenceDateAndTime method. + //< + + virtual ObjectSpaceVector getSensorVelocity(const ImageCoord& imagePt) const = 0; + //> This method returns the velocity of the physical sensor + // (x,y,z in Object Space meters per second) when the pixel at the given imagePt + // (line, sample in full image space pixels) was captured. + //< + + virtual ObjectSpaceVector getSensorVelocity(double time) const = 0; + //> This method returns the velocity of the physical sensor + // (x,y,z in Object Space meters per second ) at the given time relative to the + // reference date and time given by the Model::getReferenceDateAndTime + // method. + //< + + /// + +/// +/// ******************************************************************************* + //--- + // Uncertainty Propagation + //--- + typedef std::pair SensorPartials; + //> This type is used to hold the partial derivatives of line and + // sample, respectively, with respect to a model parameter. + // The units are pixels per the model parameter units. + //< + + virtual SensorPartials computeSensorPartials( + int index, + const ObjectSpaceCoordinate& groundPt, + double desiredPrecision = 0.001, + double* achievedPrecision = NULL, + WarningList* warnings = NULL) const = 0; + //> This is one of two overloaded methods. This method takes only + // the necessary inputs. Some effieciency can be obtained by using the + // other method. Even more efficiency can be obtained by using the + // computeAllSensorPartials method. + // + // This method returns the partial derivatives of line and sample + // (in pixels per the applicable model parameter units), respectively, + // with respect to the model parameter given by index at the given + // groundPt (x,y,z in Object Space meters). + // + // Derived model implementations may wish to implement this method by + // calling the groundToImage method and passing the resulting image + // coordinate to the other computeSensorPartials method. + // + // If a non-NULL achievedPrecision argument is received, it will be + // populated with the highest actual precision, in meters, achieved by + // iterative algorithms and 0.0 for deterministic algorithms. + // + // If a non-NULL achievedPrecision argument is received, it will be + // populated with the actual precision, in meters, achieved by iterative + // algorithms and 0.0 for deterministic algorithms. + // + // If a non-NULL warnings argument is received, it will be populated + // as applicable. + //< + + virtual SensorPartials computeSensorPartials( + int index, + const ImageCoord& imagePt, + const ObjectSpaceCoordinate& groundPt, + double desiredPrecision = 0.001, + double* achievedPrecision = NULL, + WarningList* warnings = NULL) const = 0; + //> This is one of two overloaded methods. This method takes + // an input image coordinate for efficiency. Even more efficiency can + // be obtained by using the computeAllSensorPartials method. + // + // This method returns the partial derivatives of line and sample + // (in pixels per the applicable model parameter units), respectively, + // with respect to the model parameter given by index at the given + // groundPt (x,y,z in Object Space meters). + // + // The imagePt, corresponding to the groundPt, is given so that it does + // not need to be computed by the method. Results are unpredictable if + // the imagePt provided does not correspond to the result of calling the + // groundToImage method with the given groundPt. + // + // Implementations with iterative algorithms (typically ground-to-image + // calls) will use desiredPrecision, in meters, as the convergence + // criterion, otherwise it will be ignored. + // + // If a non-NULL achievedPrecision argument is received, it will be + // populated with the highest actual precision, in meters, achieved by + // iterative algorithms and 0.0 for deterministic algorithms. + // + // If a non-NULL warnings argument is received, it will be populated + // as applicable. + //< + + virtual std::vector computeAllSensorPartials( + const ObjectSpaceCoordinate& groundPt, + param::Set pSet = param::VALID, + double desiredPrecision = 0.001, + double* achievedPrecision = NULL, + WarningList* warnings = NULL) const = 0; + //> This is one of two overloaded methods. This method takes only + // the necessary inputs. Some effieciency can be obtained by using the + // other method. + // + // This method returns the partial derivatives of line and sample + // (in pixels per the applicable model parameter units), respectively, + // with respect to to each of the desired model parameters at the given + // groundPt (x,y,z in Object Space meters). Desired model parameters are + // indicated by the given pSet. + // + // Implementations with iterative algorithms (typically ground-to-image + // calls) will use desiredPrecision, in meters, as the convergence + // criterion, otherwise it will be ignored. + // + // If a non-NULL achievedPrecision argument is received, it will be + // populated with the highest actual precision, in meters, achieved by + // iterative algorithms and 0.0 for deterministic algorithms. + // + // If a non-NULL warnings argument is received, it will be populated + // as applicable. + // + // The value returned is a vector of pairs with line and sample partials + // for one model parameter in each pair. The indices of the + // corresponding model parameters can be found by calling the + // getParameterSetIndices method for the given pSet. + // + // Derived models may wish to implement this directly for efficiency, + // but an implementation is provided here that calls the + // computeSensorPartials method for each desired parameter index. + //< + + virtual std::vector computeAllSensorPartials( + const ImageCoord& imagePt, + const ObjectSpaceCoordinate& groundPt, + param::Set pSet = param::VALID, + double desiredPrecision = 0.001, + double* achievedPrecision = NULL, + WarningList* warnings = NULL) const = 0; + //> This is one of two overloaded methods. This method takes + // an input image coordinate for efficiency. + // + // This method returns the partial derivatives of line and sample + // (in pixels per the applicable model parameter units), respectively, + // with respect to to each of the desired model parameters at the given + // groundPt (x,y,z in Object Space meters). Desired model parameters are + // indicated by the given pSet. + // + // The imagePt, corresponding to the groundPt, is given so that it does + // not need to be computed by the method. Results are unpredictable if + // the imagePt provided does not correspond to the result of calling the + // groundToImage method with the given groundPt. + // + // Implementations with iterative algorithms (typically ground-to-image + // calls) will use desiredPrecision, in meters, as the convergence + // criterion, otherwise it will be ignored. + // + // If a non-NULL achievedPrecision argument is received, it will be + // populated with the highest actual precision, in meters, achieved by + // iterative algorithms and 0.0 for deterministic algorithms. + // + // If a non-NULL warnings argument is received, it will be populated + // as applicable. + // + // The value returned is a vector of pairs with line and sample partials + // for one model parameter in each pair. The indices of the + // corresponding model parameters can be found by calling the + // getParameterSetIndices method for the given pSet. + // + // Derived models may wish to implement this directly for efficiency, + // but an implementation is provided here that calls the + // computeSensorPartials method for each desired parameter index. + //< + + virtual std::vector computeGroundPartials( + const ObjectSpaceCoordinate& groundPt) const = 0; + //> This method returns the partial derivatives of line and sample + // (in pixels per meter) with respect to the given groundPt + // (x,y,z in Object Space meters). + // + // The value returned is a vector with six elements as follows: + // + //- [0] = line wrt x + //- [1] = line wrt y + //- [2] = line wrt z + //- [3] = sample wrt x + //- [4] = sample wrt y + //- [5] = sample wrt z + //< + + virtual const CorrelationModel& getCorrelationModel() const = 0; + //> This method returns a reference to a CorrelationModel. + // The CorrelationModel is used to determine the correlation between + // the model parameters of different models of the same type. + // These correlations are used to establish the "a priori" cross-covariance + // between images. While some applications (such as generation of a + // replacement sensor model) may wish to call this method directly, + // it is reccommended that the inherited method + // GeometricModel::getCrossCovarianceMatrix() be called instead. + //< + + inline std::vector getUnmodeledError(const ImageCoord& imagePt) const + { + return getUnmodeledCrossCovariance(imagePt, imagePt); + } + //> This method returns the 2x2 line and sample covariance (in pixels + // squared) at the given imagePt for any model error not accounted for + // by the model parameters. + // + // The value returned is a vector of four elements as follows: + // + //- [0] = line variance + //- [1] = line/sample covariance + //- [2] = sample/line covariance + //- [3] = sample variance + //< + + virtual std::vector getUnmodeledCrossCovariance( + const ImageCoord& pt1, + const ImageCoord& pt2) const = 0; + + //> This method returns the 2x2 line and sample cross covariance + // (in pixels squared) between the given imagePt1 and imagePt2 for any + // model error not accounted for by the model parameters. The error is + // reported as the four terms of a 2x2 matrix, returned as a 4 element + // vector. + //< }; + + ObjectSpaceType getObjectSpaceDefinition() const; + //> get the protected data member that defines the specifics + // of the LSR object space being used by the model. + //< +protected: + ObjectSpaceType m_objectSpaceDefinition; + void setObjectSpaceDefinition(const ObjectSpaceType& osd); +}; + +} // namespace csm + +#endif // __CSM_OBJECTRASTERGM_H diff --git a/ProjectionParameters.cpp b/ProjectionParameters.cpp new file mode 100644 index 0000000..dd57589 --- /dev/null +++ b/ProjectionParameters.cpp @@ -0,0 +1,184 @@ +//############################################################################# +// +// FILENAME: ProjectionParameters.cpp +// +// CLASSIFICATION: Unclassified +// +// DESCRIPTION: +// +// This file provides implementation for helper methods associated with +// object space single image projection parameters. +// +// SOFTWARE HISTORY: +// Date Author Comment +// ----------- ------ ------- +// 31-Dec-2021 Rose Initial Coding CSM 3.0.4 +// +//############################################################################# +#define CSM_LIBRARY + +#include "ProjectionParameters.h" +#include + + +namespace csm +{ + +//***************************************************************************** +// range3d::range3d() +//***************************************************************************** +geometryType3d range3d::getType() const +{ + return geometryType3d::RANGE; +} + +//***************************************************************************** +// range3d::range3d() +//***************************************************************************** +range3d::range3d() +{ + m_range = 0.0; +} + +//***************************************************************************** +// range3d::range3d(double range) +//***************************************************************************** +range3d::range3d(double range) +{ + m_range = range; +} + +//***************************************************************************** +// range3d::getrange +//***************************************************************************** +double range3d::getRange() const +{ + return m_range; +} + +//***************************************************************************** +// range3dCovar::getType(() +//***************************************************************************** +geometryType3d range3dCovar::getType() const +{ + return geometryType3d::RANGECOVAR; +} + +//***************************************************************************** +// range3dCovar::range3dCovar() +//***************************************************************************** +range3dCovar::range3dCovar() +{ + m_range = 0.0; + m_rangeVariance = 0.0; +} + +//***************************************************************************** +// range3dCovar::range3dCovar(double range, double rangeVar) +//***************************************************************************** +range3dCovar::range3dCovar(double range, double rangeVar) +{ + m_range = range; + m_rangeVariance = rangeVar; +} + +//***************************************************************************** +// range3dCovar::getrange +//***************************************************************************** +double range3dCovar::getRange() const +{ + return m_range; +} + +//***************************************************************************** +// range3dCovar::getrangeVariance +//***************************************************************************** +double range3dCovar::getRangeVariance() const +{ + return m_rangeVariance; +} + +//***************************************************************************** +// plane3d::getType(() +//***************************************************************************** +geometryType3d plane3d::getType() const +{ + return geometryType3d::PLANE; +} +//***************************************************************************** +// plane3d::plane3d() +//***************************************************************************** +plane3d::plane3d() +{ + m_point = ObjectSpaceCoordinate(); + m_normal = ObjectSpaceVector(); +} + +//***************************************************************************** +// plane3d::plane3d(const ObjectSpaceCoordinate& coord, const ObjectSpaceVector& normal) +//****************************************************************************** +plane3d::plane3d(const ObjectSpaceCoordinate& coord, const ObjectSpaceVector& normal) +{ + m_point = coord; + m_normal = normal; +} +//******************************************************************************* +// plane3d::getPoint() +//******************************************************************************** +ObjectSpaceCoordinate plane3d::getPoint() const +{ + return m_point; +} + +//******************************************************************************* +// plane3d::getNormal() +//******************************************************************************** +ObjectSpaceVector plane3d::getNormal() const +{ + return m_normal; +} + + +//***************************************************************************** +// plane3dCovar::getType(() +//***************************************************************************** +geometryType3d plane3dCovar::getType() const +{ + return geometryType3d::PLANECOVAR; +} + +//******************************************************************************* +// plane3dCovar::plane3dCovar() +//******************************************************************************** +plane3dCovar::plane3dCovar() +{ + m_point = ObjectSpaceCoordinateCovar(); + m_normal = ObjectSpaceVectorCovar(); +} + +//***************************************************************************** +// plane3d::plane3d(const ObjectSpaceCoordinate& coord, const ObjectSpaceVector& normal) +//****************************************************************************** +plane3dCovar::plane3dCovar(const ObjectSpaceCoordinateCovar& coord, const ObjectSpaceVectorCovar& normal) +{ + m_point = coord; + m_normal = normal; +} + +//******************************************************************************* +// plane3dCovar::getPoint() +//******************************************************************************** +ObjectSpaceCoordinateCovar plane3dCovar::getPoint() const +{ + return m_point; +} + +//******************************************************************************* +// plane3dCovar::getNormal() +//******************************************************************************** +ObjectSpaceVectorCovar plane3dCovar::getNormal() const +{ + return m_normal; +} + +} // namespace csm diff --git a/ProjectionParameters.h b/ProjectionParameters.h new file mode 100644 index 0000000..a8fbf06 --- /dev/null +++ b/ProjectionParameters.h @@ -0,0 +1,225 @@ +//#################################################################### +// +// FILENAME: ProjectionParameters.h +// +// CLASSIFICATION: Unclassified +// +// DESCRIPTION: +// +// Header for object space single image projection parameters. +// +// LIMITATIONS: None +// +// +// SOFTWARE HISTORY: +// Date Author Comment +// ----------- ------ ------- +// 31-March-2022 Eugene Rose CCB Change CSM 3.0.4 +// +// NOTES: +// +//##################################################################### + +#ifndef __CSM_GEOMETRY3D_H +#define __CSM_GEOMETRY3D_H + +#include "csm.h" +#include +#include +#include "ObjectSpace.h" +#include +#include +#include + +namespace csm +{ + +enum class geometryType3d +{ + RANGE, + PLANE, + RANGECOVAR, + PLANECOVAR, + UNSPECIFIED +}; +//> +// This enum class identifies the projection parameters type. +//< + +// ************************************************************ +// ProjectionParameters virtual base class +// ************************************************************ +class CSM_EXPORT_API ProjectionParameters +{ + +public: + virtual ~ProjectionParameters() {}; + //> virtual destructor provides something for base class destructors to call on. + //< + + virtual geometryType3d getType() const = 0; + //> returns the type enum parameter + //< +protected: + ProjectionParameters() {}; + //> the default constructor does nothing + //< + +}; + + +class CSM_EXPORT_API ProjectionParametersCovar +{ + +public: + virtual ~ProjectionParametersCovar() {}; + //> virtual destructor provides something for base class destructors to call on. + //< + + virtual geometryType3d getType() const = 0; + //> returns the type enum parameter + //< +protected: + ProjectionParametersCovar() {}; + //> the default constructor does nothing + //< + +}; + +class CSM_EXPORT_API range3d : public ProjectionParameters +{ +public: + range3d(); + //> + // default constructor sets range to zero and also + // sets m_type to RANGE + //< + + range3d(double range); + //> + // initializes with the given range in meters + //< + + geometryType3d getType() const; + //> + // get the geometry type (enum) + //< + + double getRange() const; + //> return the range value in meters + //< +private: + double m_range; +}; + +class CSM_EXPORT_API range3dCovar : public ProjectionParametersCovar +{ +public: + range3dCovar(); + //> + // default constructor sets range and range variance to zero and also + // sets m_type to RANGE + //< + + range3dCovar(double range, double rangeVariance); + //> + // initializes with the give values in meters and meters-squared + //< + + geometryType3d getType() const; + //> + // get the geometry type (enum) + //< + + double getRange() const; + //> return the range value in meters + //< + + double getRangeVariance() const; + //> + // returns the range variance + //< +private: + double m_range; + //> + // range value in meters + //< + double m_rangeVariance; + //> + // range variance in meters squared + //< +}; + +class CSM_EXPORT_API plane3d : public ProjectionParameters +{ +public: + plane3d(); + //> the default constructor will intialize the point and the vector to + // zero. + // Also sets m_type to PLANE + //< + + plane3d(const ObjectSpaceCoordinate& coord, const ObjectSpaceVector& normal); + + //> this constructor will initialize the point and the normal with the give values. + //< + + geometryType3d getType() const; + //> + // get the geometry type (enum) + //< + + ObjectSpaceCoordinate getPoint() const; + //> read the point + //< + + ObjectSpaceVector getNormal() const; + //> read the normal + //< +private: + ObjectSpaceCoordinate m_point; + //> a point on the plane. + //< + ObjectSpaceVector m_normal; + //> + // normal to the plane + //< +}; + +class CSM_EXPORT_API plane3dCovar : public ProjectionParametersCovar +{ +public: + plane3dCovar(); + //> the default constructor will intialize the point and the vector to + // zero. Also the point and vector covariances to zero. + // Also sets m_type to PLANE + //< + + plane3dCovar(const ObjectSpaceCoordinateCovar& coord, const ObjectSpaceVectorCovar& normal); + //> this constructor will initialize the point and the normal with the give values. + //< + + geometryType3d getType() const; + //> + // get the geometry type (enum) + //< + + ObjectSpaceCoordinateCovar getPoint() const; + //> read the point + //< + + ObjectSpaceVectorCovar getNormal() const; + //> read the normal + //< +private: + ObjectSpaceCoordinateCovar m_point; + //> a point on the plane. + //< + ObjectSpaceVectorCovar m_normal; + //> + // normal to the plane + //< +}; +} + +#endif // __CSM_GEOMETRY3D_H From 16357579d2900fa7d18764271073d020058f552b Mon Sep 17 00:00:00 2001 From: roseej Date: Fri, 11 Feb 2022 11:21:10 -0500 Subject: [PATCH 6/7] Cleanup Clean up. Better variable names. Better subclass names. Complete documentation. Remove unnecessary includes. --- ObjectSpace.cpp | 137 ++++++++++++++++++++++++++++++++++-- ObjectSpace.h | 74 +++++++++++++++++-- ObjectSpacePointCloudGM.cpp | 15 ---- ObjectSpacePointCloudGM.h | 8 +-- ObjectSpaceRasterGM.cpp | 26 ++----- ObjectSpaceRasterGM.h | 91 ++++++++++++------------ ProjectionParameters.cpp | 85 +++++++++++----------- ProjectionParameters.h | 50 ++++++------- 8 files changed, 320 insertions(+), 166 deletions(-) diff --git a/ObjectSpace.cpp b/ObjectSpace.cpp index 6fb310d..180dad3 100644 --- a/ObjectSpace.cpp +++ b/ObjectSpace.cpp @@ -26,6 +26,27 @@ namespace csm { +//***************************************************************************** +// ObjectSpaceCoordinate::ObjectSpaceCoordinate (copy constructor) +//***************************************************************************** +ObjectSpaceCoordinate::ObjectSpaceCoordinate(const ObjectSpaceCoordinate& other) +{ + x = other.x; + y = other.y; + z = other.z; +} + +//***************************************************************************** +// ObjectSpaceCoordinate::operator= +//***************************************************************************** +ObjectSpaceCoordinate& ObjectSpaceCoordinate::operator=(const ObjectSpaceCoordinate& other) +{ + x = other.x; + y = other.y; + z = other.z; + return *this; +} + //***************************************************************************** // ObjectSpaceCoordinateCovar::ObjectSpaceCoordinateCovar //***************************************************************************** @@ -75,6 +96,51 @@ ObjectSpaceCoordinateCovar::ObjectSpaceCoordinateCovar(double aX, double aY, dou covariance[8] = aCovar22; } +//***************************************************************************** +// ObjectSpaceCoordinateCovar::ObjectSpaceCoordinateCovar (copy constructor) +//***************************************************************************** +ObjectSpaceCoordinateCovar::ObjectSpaceCoordinateCovar(const ObjectSpaceCoordinateCovar& other) +{ + x = other.x; + y = other.y; + z = other.z; + std::memcpy(covariance, other.covariance, sizeof(covariance)); +} + +//***************************************************************************** +// ObjectSpaceCoordinateCovar::operator= +//***************************************************************************** +ObjectSpaceCoordinateCovar& ObjectSpaceCoordinateCovar::operator=(const ObjectSpaceCoordinateCovar& other) +{ + x = other.x; + y = other.y; + z = other.z; + std::memcpy(covariance, other.covariance, sizeof(covariance)); + return *this; +} + + +//***************************************************************************** +// ObjectSpaceVector::ObjectSpaceVector (copy constructor) +//***************************************************************************** +ObjectSpaceVector::ObjectSpaceVector(const ObjectSpaceVector& other) +{ + x = other.x; + y = other.y; + z = other.z; +} + +//***************************************************************************** +// ObjectSpaceVector::operator= +//***************************************************************************** +ObjectSpaceVector& ObjectSpaceVector::operator=(const ObjectSpaceVector& other) +{ + x = other.x; + y = other.y; + z = other.z; + return *this; +} + //***************************************************************************** // ObjectSpaceVectorCovar::ObjectSpaceVectorCovar //***************************************************************************** @@ -82,11 +148,8 @@ ObjectSpaceVectorCovar::ObjectSpaceVectorCovar() { x = 0.0; y = 0.0; - z = 0.0; - for (int i = 0; i < 9; i++) - { - covariance[i] = 0.0; - } + z = 0.0; + std::memset(covariance, 0, sizeof(covariance)); } //***************************************************************************** @@ -121,5 +184,69 @@ ObjectSpaceVectorCovar::ObjectSpaceVectorCovar(double aX, double aY, double aZ, } + +//***************************************************************************** +// ObjectSpaceVectorCovar::ObjectSpaceVectorCovar (copy constructor) +//***************************************************************************** +ObjectSpaceVectorCovar::ObjectSpaceVectorCovar(const ObjectSpaceVectorCovar& other) +{ + x = other.x; + y = other.y; + z = other.z; + std::memcpy(covariance, other.covariance, sizeof(covariance)); +} + +//***************************************************************************** +// ObjectSpaceVectorCovar::operator= +//***************************************************************************** +ObjectSpaceVectorCovar& ObjectSpaceVectorCovar::operator=(const ObjectSpaceVectorCovar& other) +{ + x = other.x; + y = other.y; + z = other.z; + std::memcpy(covariance, other.covariance, sizeof(covariance)); + + return *this; +} + +//***************************************************************************** +// ObjectSpaceLocus::ObjectSpaceLocus (copy constructor) +//***************************************************************************** +ObjectSpaceLocus::ObjectSpaceLocus(const ObjectSpaceLocus& other) +{ + point = (other.point); // use assignment operator of ObjectSpacePoint + direction = (other.direction); // use assignment operator of ObjectSpaceVector +} + +//***************************************************************************** +// ObjectSpaceVector::operator= +//***************************************************************************** +ObjectSpaceLocus& ObjectSpaceLocus::operator=(const ObjectSpaceLocus& other) +{ + point = (other.point); // use assignment operator of ObjectSpacePoint + direction = (other.direction); // use assignment operator of ObjectSpaceVector + return *this; +} + + +//***************************************************************************** +// ObjectSpaceLocusCovar::ObjectSpaceLocusCovar (copy constructor) +//***************************************************************************** +ObjectSpaceLocusCovar::ObjectSpaceLocusCovar(const ObjectSpaceLocusCovar& other) +{ + point = (other.point); // use assignment operator of ObjectSpacePoint + direction = (other.direction); // use assignment operator of ObjectSpaceVector +} + +//***************************************************************************** +// ObjectSpaceLocusCovar::operator= +//***************************************************************************** +ObjectSpaceLocusCovar& ObjectSpaceLocusCovar::operator=(const ObjectSpaceLocusCovar& other) +{ + point = (other.point); // use assignment operator of ObjectSpacePoint + direction = (other.direction); // use assignment operator of ObjectSpaceVector + return *this; +} + } diff --git a/ObjectSpace.h b/ObjectSpace.h index beca4f4..fc2abda 100644 --- a/ObjectSpace.h +++ b/ObjectSpace.h @@ -23,8 +23,6 @@ #ifndef __CSM_OBJECTSPACE_H #define __CSM_OBJECTSPACE_H -#include - namespace csm { enum class CSM_EXPORT_API ObjectSpaceType : unsigned char @@ -61,6 +59,17 @@ struct CSM_EXPORT_API ObjectSpaceCoordinate ObjectSpaceCoordinate(double aX, double aY, double aZ) : x(aX), y(aY), z(aZ) {} //> constructor that initializes with the values given //< + + ObjectSpaceCoordinate(const ObjectSpaceCoordinate& other); + //> + // copy constructor + //< + + ObjectSpaceCoordinate& operator=(const ObjectSpaceCoordinate& other); + //> + // assignment operator + //< + }; // ObjectSpaceCoordinate //*** @@ -71,9 +80,15 @@ struct CSM_EXPORT_API ObjectSpaceCoordinate // Coordinate values are in units of meters and covariances are in units of meters-squared. //< //*** -struct CSM_EXPORT_API ObjectSpaceCoordinateCovar : public ObjectSpaceCoordinate +struct CSM_EXPORT_API ObjectSpaceCoordinateCovar { public: + double x; + double y; + double z; + //> three coordinate values + //< + double covariance[9]; //> 3x3 coordinate covariance matrix, in meters squared, // stored as an array of nine doubles as follows: @@ -89,7 +104,6 @@ struct CSM_EXPORT_API ObjectSpaceCoordinateCovar : public ObjectSpaceCoordinate //- [8] = z variance //< - ObjectSpaceCoordinateCovar(); //> Default Constructor //< @@ -115,6 +129,16 @@ struct CSM_EXPORT_API ObjectSpaceCoordinateCovar : public ObjectSpaceCoordinate // It is assumed that the covariance matrix is symmetric. //< + ObjectSpaceCoordinateCovar(const ObjectSpaceCoordinateCovar& other); + //> + // copy constructor + //< + + ObjectSpaceCoordinateCovar& operator=(const ObjectSpaceCoordinateCovar& other); + //> + // assignment operator + //< + }; // ObjectSpaceCoordinateCovar //*** @@ -140,6 +164,16 @@ struct CSM_EXPORT_API ObjectSpaceVector ObjectSpaceVector(double aX, double aY, double aZ) : x(aX), y(aY), z(aZ) {} //> constructor that initializes with the values given //< + + ObjectSpaceVector(const ObjectSpaceVector& other); + //> + // copy constructor + //< + + ObjectSpaceVector& operator=(const ObjectSpaceVector& other); + //> + // assignment operator + //< }; //*** @@ -190,6 +224,16 @@ struct CSM_EXPORT_API ObjectSpaceVectorCovar // upper-triangular portion of a covariance matrix in meters squared. // It is assumed that the covariance matrix is symmetric. //< + + ObjectSpaceVectorCovar(const ObjectSpaceVectorCovar& other); + //> + // copy constructor + //< + + ObjectSpaceVectorCovar& operator=(const ObjectSpaceVectorCovar& other); + //> + // assignment operator + //< }; //*** @@ -231,6 +275,16 @@ struct CSM_EXPORT_API ObjectSpaceLocus {} //> construct with the coordinate values and vector components given. //< + + ObjectSpaceLocus(const ObjectSpaceLocus& other); + //> + // copy constructor + //< + + ObjectSpaceLocus& operator=(const ObjectSpaceLocus& other); + //> + // assignment operator + //< }; @@ -255,7 +309,6 @@ struct CSM_EXPORT_API ObjectSpaceLocusCovar //< the default constructors set all of the initial values to 0.0. //> - ObjectSpaceLocusCovar(const ObjectSpaceCoordinateCovar& argPoint, const ObjectSpaceVectorCovar& argDirection) : @@ -273,6 +326,17 @@ struct CSM_EXPORT_API ObjectSpaceLocusCovar {} //> construct with the coordinate values and vector components given. //< + + ObjectSpaceLocusCovar(const ObjectSpaceLocusCovar& other); + //> + // copy constructor + //< + + ObjectSpaceLocusCovar& operator=(const ObjectSpaceLocusCovar& other); + //> + // assignment operator + //< + }; } // namespace csm diff --git a/ObjectSpacePointCloudGM.cpp b/ObjectSpacePointCloudGM.cpp index d554ff7..a4e27b9 100644 --- a/ObjectSpacePointCloudGM.cpp +++ b/ObjectSpacePointCloudGM.cpp @@ -31,21 +31,6 @@ std::string ObjectSpacePointCloudGM::getFamily()const { return (GeometricModel::getFamily() + CSM_OSPC_FAMILY); } -//***************************************************************************** -// ObjectSpacePointCloudGM::getObjectSpaceDefinition -//***************************************************************************** -ObjectSpaceType ObjectSpacePointCloudGM::getObjectSpaceDefinition() const -{ - return m_objectSpaceDefinition; -} - -//***************************************************************************** -// ObjectSpacePointCloudGM::setObjectSpaceDefinition -//***************************************************************************** -void ObjectSpacePointCloudGM::setObjectSpaceDefinition(const ObjectSpaceType &type) -{ - m_objectSpaceDefinition = type; -} //***************************************************************************** // ObjectSpacePointCloudGM::computeAllSensorPartials() diff --git a/ObjectSpacePointCloudGM.h b/ObjectSpacePointCloudGM.h index 9c44fde..18a9803 100644 --- a/ObjectSpacePointCloudGM.h +++ b/ObjectSpacePointCloudGM.h @@ -28,8 +28,6 @@ #define __CSM_OBJECT_POINTCLOUD_GM_H #include "csm.h" -#include "Error.h" -#include "GeometricModel.h" #include "ObjectSpace.h" #include "csmPointCloud.h" #define CSM_OSPC_FAMILY "ObjectSpacePointCloud" @@ -375,14 +373,12 @@ class CSM_EXPORT_API ObjectSpacePointCloudGM : public GeometricModel { //- [7] = pt1.m2/pt2.m1 covariance //- [8] = pt1.m2/pt2.m2 covariance //< + ObjectSpaceType getObjectSpaceDefinition() const; //> get the protected data member that defines the specifics // of the LSR object space being used by the model. //< - // -protected: - ObjectSpaceType m_objectSpaceDefinition; - void setObjectSpaceDefinition(const ObjectSpaceType& osd); + }; //***************************************************************************** diff --git a/ObjectSpaceRasterGM.cpp b/ObjectSpaceRasterGM.cpp index b25b523..4bb4420 100644 --- a/ObjectSpaceRasterGM.cpp +++ b/ObjectSpaceRasterGM.cpp @@ -37,27 +37,11 @@ std::string ObjectSpaceRasterGM::getFamily()const { return (GeometricModel::getFamily() + CSM_OSRASTER_FAMILY); } -//***************************************************************************** -// ObjectSpaceRasterGM::getObjectSpaceDefinition -//***************************************************************************** -ObjectSpaceType ObjectSpaceRasterGM::getObjectSpaceDefinition() const -{ - return m_objectSpaceDefinition; -} - -//***************************************************************************** -// ObjectSpaceRasterGM::setObjectSpaceDefinition -//***************************************************************************** -void ObjectSpaceRasterGM::setObjectSpaceDefinition(const ObjectSpaceType& osd) -{ - m_objectSpaceDefinition = osd; -} - //***************************************************************************** // ObjectSpaceRasterGM::computeAllSensorPartials //***************************************************************************** std::vector ObjectSpaceRasterGM::computeAllSensorPartials( - const ObjectSpaceCoordinate& groundPt, + const ObjectSpaceCoordinate& objectSpacePt, param::Set pSet, double desiredPrecision, double* achievedPrecision, @@ -79,13 +63,13 @@ std::vector ObjectSpaceRasterGM::computeAll //*** if (achievedPrecision) *achievedPrecision = 0.0; - ImageCoord ip = objectSpaceToImage(groundPt); + ImageCoord ip = objectSpaceToImage(objectSpacePt); for (int i = 0; i < NUM_PARAMS; ++i) { double prec = 0.0; val[i] = computeSensorPartials(indices[i], ip, - groundPt, + objectSpacePt, desiredPrecision, &prec, warnings); @@ -104,7 +88,7 @@ std::vector ObjectSpaceRasterGM::computeAll //***************************************************************************** std::vector ObjectSpaceRasterGM::computeAllSensorPartials( const ImageCoord& imagePt, - const ObjectSpaceCoordinate& groundPt, + const ObjectSpaceCoordinate& objectSpacePt, param::Set pSet, double desiredPrecision, double* achievedPrecision, @@ -131,7 +115,7 @@ std::vector ObjectSpaceRasterGM::computeAll double prec = 0.0; val[i] = computeSensorPartials(indices[i], imagePt, - groundPt, + objectSpacePt, desiredPrecision, &prec, warnings); diff --git a/ObjectSpaceRasterGM.h b/ObjectSpaceRasterGM.h index c1173f8..709a15d 100644 --- a/ObjectSpaceRasterGM.h +++ b/ObjectSpaceRasterGM.h @@ -32,7 +32,6 @@ #include "Error.h" #include "GeometricModel.h" #include "ObjectSpace.h" -#include "csmMultiPoint.h" #define CSM_OSRASTER_FAMILY "ObjectSpaceRasterGM" namespace csm @@ -42,11 +41,15 @@ class CorrelationModel; class CSM_EXPORT_API ObjectSpaceRasterGM : public GeometricModel { public: - ObjectSpaceRasterGM(); - // need a desctructor realization so that subclass destructors have - // something to call when they are destroyed. + ObjectSpaceRasterGM(); + //> + // default ctor does nothing + //< virtual ~ObjectSpaceRasterGM() {}; + //> + // need a desctructor realization so that subclass destructors have + //< something to call when they are destroyed. std::string getFamily()const; //> This method returns the Family ID for the current model. @@ -58,25 +61,25 @@ class CSM_EXPORT_API ObjectSpaceRasterGM : public GeometricModel // operators. Not to be confused with the CSM API version. //< - // these two method supplements the methods in GeometricModel which work + // these two methods supplement the methods in GeometricModel which work // in ECEF space. virtual ObjectSpaceCoordinate getObjectSpaceReferencePoint() const = 0; - //> This method returns the ground point indicating the general + //> This method returns the object space point indicating the general // location of the image. //< - virtual void setObjectSpaceReferencePoint(const ObjectSpaceCoordinate& groundPt) = 0; - //> This method sets the ground point indicating the general location + virtual void setObjectSpaceReferencePoint(const ObjectSpaceCoordinate& objectSpacePt) = 0; + //> This method sets the object space point indicating the general location // of the image. //< //--- // Core Photogrammetry //--- - virtual ImageCoord objectSpaceToImage(const ObjectSpaceCoordinate& groundPt, + virtual ImageCoord objectSpaceToImage(const ObjectSpaceCoordinate& objectSpacePt, double desiredPrecision = 0.001, double* achievedPrecision = NULL, WarningList* warnings = NULL) const = 0; - //> This method converts the given groundPt (x,y,z in Object Space meters) to a + //> This method converts the given objectSpacePt (x,y,z in Object Space meters) to a // returned image coordinate (line, sample in full image space pixels). // // Iterative algorithms will use desiredPrecision, in meters, as the @@ -90,11 +93,11 @@ class CSM_EXPORT_API ObjectSpaceRasterGM : public GeometricModel // as applicable. //< - virtual ImageCoordCovar objectSpaceToImageCovar(const ObjectSpaceCoordinateCovar &groundPt, + virtual ImageCoordCovar objectSpaceToImageCovar(const ObjectSpaceCoordinateCovar & objectSpacePt, double desiredPrecision = 0.001, double* achievedPrecision = NULL, WarningList* warnings = NULL) const = 0; - //> This method converts the given groundPt (x,y,z in meters and + //> This method converts the given objectSpacePt (x,y,z in meters and // corresponding 3x3 covariance in meters squared) to a returned // image coordinate with covariance (line, sample in full image space // pixels and corresponding 2x2 covariance in pixels squared). @@ -117,7 +120,7 @@ class CSM_EXPORT_API ObjectSpaceRasterGM : public GeometricModel WarningList* warnings = NULL) const = 0; //> This method converts the given imagePt (line,sample in full image // space pixels) and given projection parameters to a returned - // ground coordinate (x,y,z in Object Space meters). + // object space coordinate (x,y,z in Object Space meters). // // Iterative algorithms will use desiredPrecision, in meters, as the // convergence criterion, otherwise it will be ignored. @@ -137,7 +140,7 @@ class CSM_EXPORT_API ObjectSpaceRasterGM : public GeometricModel WarningList* warnings = NULL) const = 0; //> This method converts the given imagePt (line, sample in full image // space pixels and corresponding 2x2 covariance in pixels squared) - // and given projetion parameters with covariances to a returned ground + // and given projetion parameters with covariances to a returned object space // coordinate with covariance (x,y,z in Object Space meters and corresponding // 3x3 covariance in Object Space meters squared). // @@ -154,13 +157,13 @@ class CSM_EXPORT_API ObjectSpaceRasterGM : public GeometricModel virtual ObjectSpaceLocus imageToProximateObjectSpaceImagingLocus( const ImageCoord& imagePt, - const ObjectSpaceCoordinate& groundPt, + const ObjectSpaceCoordinate& objectSpacePt, double desiredPrecision = 0.001, double* achievedPrecision = NULL, WarningList* warnings = NULL) const = 0; //> This method, for the given imagePt (line, sample in full image space // pixels), returns the position and direction of the imaging locus - // nearest the given groundPt (x,y,z in Object Space meters). + // nearest the given objectSpacePt (x,y,z in Object Space meters). // // Note that there are two opposite directions possible. Both are // valid, so either can be returned; the calling application can convert @@ -227,7 +230,7 @@ class CSM_EXPORT_API ObjectSpaceRasterGM : public GeometricModel // operation. Use getValidImageRange() to get the valid range of image // coordinates. //< - + using ImageCoordPair = std::pair; virtual ImageCoordPair getValidImageRange() const = 0; //> This method returns the minimum and maximum image coordinates // (line, sample in full image space pixels), respectively, over which @@ -243,19 +246,18 @@ class CSM_EXPORT_API ObjectSpaceRasterGM : public GeometricModel // the model is valid. //< - virtual std::pair getValidHeightRange() const = 0; - //> This method returns the minimum and maximum heights (in meters - // relative to WGS-84 ellipsoid), respectively, over which the model is - // valid. For example, a model for an airborne platform might not be - // designed to return valid coordinates for heights above the aircraft. + virtual std::pair getValidRangeRange() const = 0; + //> This method returns the minimum and maximum range (in meters + // relative to the sensor position), respectively, over which the model is + // valid. // // If there are no limits defined for the model, (-99999.0,99999.0) // will be returned. //< - virtual ObjectSpaceVector getIlluminationDirection(const ObjectSpaceCoordinate& groundPt) const = 0; + virtual ObjectSpaceVector getIlluminationDirection(const ObjectSpaceCoordinate& objectSpacePt) const = 0; //> This method returns a vector defining the direction of - // illumination at the given groundPt (x,y,z in Object Space meters). + // illumination at the given objectSpacePt (x,y,z in Object Space meters). // Note that there are two opposite directions possible. Both are // valid, so either can be returned; the calling application can convert // to the other as necessary. @@ -282,7 +284,7 @@ class CSM_EXPORT_API ObjectSpaceRasterGM : public GeometricModel virtual ObjectSpaceCoordinate getSensorPosition(double time) const = 0; //> This method returns the position of the physical sensor - // (x,y,z meters Object Space) at the given time relative to the reference date + // (x,y,z Object Space meters) at the given time relative to the reference date // and time given by the Model::getReferenceDateAndTime method. //< @@ -314,7 +316,7 @@ class CSM_EXPORT_API ObjectSpaceRasterGM : public GeometricModel virtual SensorPartials computeSensorPartials( int index, - const ObjectSpaceCoordinate& groundPt, + const ObjectSpaceCoordinate& objectSpacePt, double desiredPrecision = 0.001, double* achievedPrecision = NULL, WarningList* warnings = NULL) const = 0; @@ -326,7 +328,7 @@ class CSM_EXPORT_API ObjectSpaceRasterGM : public GeometricModel // This method returns the partial derivatives of line and sample // (in pixels per the applicable model parameter units), respectively, // with respect to the model parameter given by index at the given - // groundPt (x,y,z in Object Space meters). + // objectSpacePt (x,y,z in Object Space meters). // // Derived model implementations may wish to implement this method by // calling the groundToImage method and passing the resulting image @@ -347,7 +349,7 @@ class CSM_EXPORT_API ObjectSpaceRasterGM : public GeometricModel virtual SensorPartials computeSensorPartials( int index, const ImageCoord& imagePt, - const ObjectSpaceCoordinate& groundPt, + const ObjectSpaceCoordinate& objectSpacePt, double desiredPrecision = 0.001, double* achievedPrecision = NULL, WarningList* warnings = NULL) const = 0; @@ -358,12 +360,12 @@ class CSM_EXPORT_API ObjectSpaceRasterGM : public GeometricModel // This method returns the partial derivatives of line and sample // (in pixels per the applicable model parameter units), respectively, // with respect to the model parameter given by index at the given - // groundPt (x,y,z in Object Space meters). + // objectSpacePt (x,y,z in Object Space meters). // - // The imagePt, corresponding to the groundPt, is given so that it does + // The imagePt, corresponding to the objectSpacePt, is given so that it does // not need to be computed by the method. Results are unpredictable if // the imagePt provided does not correspond to the result of calling the - // groundToImage method with the given groundPt. + // groundToImage method with the given objectSpacePt. // // Implementations with iterative algorithms (typically ground-to-image // calls) will use desiredPrecision, in meters, as the convergence @@ -378,7 +380,7 @@ class CSM_EXPORT_API ObjectSpaceRasterGM : public GeometricModel //< virtual std::vector computeAllSensorPartials( - const ObjectSpaceCoordinate& groundPt, + const ObjectSpaceCoordinate& objectSpacePt, param::Set pSet = param::VALID, double desiredPrecision = 0.001, double* achievedPrecision = NULL, @@ -390,7 +392,7 @@ class CSM_EXPORT_API ObjectSpaceRasterGM : public GeometricModel // This method returns the partial derivatives of line and sample // (in pixels per the applicable model parameter units), respectively, // with respect to to each of the desired model parameters at the given - // groundPt (x,y,z in Object Space meters). Desired model parameters are + // objectSpacePt (x,y,z in Object Space meters). Desired model parameters are // indicated by the given pSet. // // Implementations with iterative algorithms (typically ground-to-image @@ -416,7 +418,7 @@ class CSM_EXPORT_API ObjectSpaceRasterGM : public GeometricModel virtual std::vector computeAllSensorPartials( const ImageCoord& imagePt, - const ObjectSpaceCoordinate& groundPt, + const ObjectSpaceCoordinate& objectSpacePt, param::Set pSet = param::VALID, double desiredPrecision = 0.001, double* achievedPrecision = NULL, @@ -427,13 +429,13 @@ class CSM_EXPORT_API ObjectSpaceRasterGM : public GeometricModel // This method returns the partial derivatives of line and sample // (in pixels per the applicable model parameter units), respectively, // with respect to to each of the desired model parameters at the given - // groundPt (x,y,z in Object Space meters). Desired model parameters are + // objectSpacePt (x,y,z in Object Space meters). Desired model parameters are // indicated by the given pSet. // - // The imagePt, corresponding to the groundPt, is given so that it does + // The imagePt, corresponding to the objectSpacePt, is given so that it does // not need to be computed by the method. Results are unpredictable if // the imagePt provided does not correspond to the result of calling the - // groundToImage method with the given groundPt. + // groundToImage method with the given objectSpacePt. // // Implementations with iterative algorithms (typically ground-to-image // calls) will use desiredPrecision, in meters, as the convergence @@ -457,9 +459,9 @@ class CSM_EXPORT_API ObjectSpaceRasterGM : public GeometricModel //< virtual std::vector computeGroundPartials( - const ObjectSpaceCoordinate& groundPt) const = 0; + const ObjectSpaceCoordinate& objectSpacePt) const = 0; //> This method returns the partial derivatives of line and sample - // (in pixels per meter) with respect to the given groundPt + // (in pixels per meter) with respect to the given objectSpacePt // (x,y,z in Object Space meters). // // The value returned is a vector with six elements as follows: @@ -502,7 +504,6 @@ class CSM_EXPORT_API ObjectSpaceRasterGM : public GeometricModel virtual std::vector getUnmodeledCrossCovariance( const ImageCoord& pt1, const ImageCoord& pt2) const = 0; - //> This method returns the 2x2 line and sample cross covariance // (in pixels squared) between the given imagePt1 and imagePt2 for any // model error not accounted for by the model parameters. The error is @@ -510,13 +511,11 @@ class CSM_EXPORT_API ObjectSpaceRasterGM : public GeometricModel // vector. //< }; - ObjectSpaceType getObjectSpaceDefinition() const; - //> get the protected data member that defines the specifics - // of the LSR object space being used by the model. + virtual ObjectSpaceType getObjectSpaceDefinition() const = 0; + //> get the protected data member that defines which + // object space being used by the model. //< -protected: - ObjectSpaceType m_objectSpaceDefinition; - void setObjectSpaceDefinition(const ObjectSpaceType& osd); + }; } // namespace csm diff --git a/ProjectionParameters.cpp b/ProjectionParameters.cpp index dd57589..2a92b73 100644 --- a/ProjectionParameters.cpp +++ b/ProjectionParameters.cpp @@ -18,165 +18,164 @@ #define CSM_LIBRARY #include "ProjectionParameters.h" -#include namespace csm { //***************************************************************************** -// range3d::range3d() +// RangeParameters::RangeParameters() //***************************************************************************** -geometryType3d range3d::getType() const +ProjectionGeometryType RangeParameters::getType() const { - return geometryType3d::RANGE; + return ProjectionGeometryType::RANGE; } //***************************************************************************** -// range3d::range3d() +// RangeParameters::RangeParameters() //***************************************************************************** -range3d::range3d() +RangeParameters::RangeParameters() { m_range = 0.0; } //***************************************************************************** -// range3d::range3d(double range) +// RangeParameters::RangeParameters(double range) //***************************************************************************** -range3d::range3d(double range) +RangeParameters::RangeParameters(double range) { m_range = range; } //***************************************************************************** -// range3d::getrange +// RangeParameters::getrange //***************************************************************************** -double range3d::getRange() const +double RangeParameters::getRange() const { return m_range; } //***************************************************************************** -// range3dCovar::getType(() +// RangeParametersCovar::getType(() //***************************************************************************** -geometryType3d range3dCovar::getType() const +ProjectionGeometryType RangeParametersCovar::getType() const { - return geometryType3d::RANGECOVAR; + return ProjectionGeometryType::RANGECOVAR; } //***************************************************************************** -// range3dCovar::range3dCovar() +// RangeParametersCovar::RangeParametersCovar() //***************************************************************************** -range3dCovar::range3dCovar() +RangeParametersCovar::RangeParametersCovar() { m_range = 0.0; m_rangeVariance = 0.0; } //***************************************************************************** -// range3dCovar::range3dCovar(double range, double rangeVar) +// RangeParametersCovar::RangeParametersCovar(double range, double rangeVar) //***************************************************************************** -range3dCovar::range3dCovar(double range, double rangeVar) +RangeParametersCovar::RangeParametersCovar(double range, double rangeVar) { m_range = range; m_rangeVariance = rangeVar; } //***************************************************************************** -// range3dCovar::getrange +// RangeParametersCovar::getrange //***************************************************************************** -double range3dCovar::getRange() const +double RangeParametersCovar::getRange() const { return m_range; } //***************************************************************************** -// range3dCovar::getrangeVariance +// RangeParametersCovar::getrangeVariance //***************************************************************************** -double range3dCovar::getRangeVariance() const +double RangeParametersCovar::getRangeVariance() const { return m_rangeVariance; } //***************************************************************************** -// plane3d::getType(() +// PlaneParameters::getType(() //***************************************************************************** -geometryType3d plane3d::getType() const +ProjectionGeometryType PlaneParameters::getType() const { - return geometryType3d::PLANE; + return ProjectionGeometryType::PLANE; } //***************************************************************************** -// plane3d::plane3d() +// PlaneParameters::PlaneParameters() //***************************************************************************** -plane3d::plane3d() +PlaneParameters::PlaneParameters() { m_point = ObjectSpaceCoordinate(); m_normal = ObjectSpaceVector(); } //***************************************************************************** -// plane3d::plane3d(const ObjectSpaceCoordinate& coord, const ObjectSpaceVector& normal) +// PlaneParameters::PlaneParameters(const ObjectSpaceCoordinate& coord, const ObjectSpaceVector& normal) //****************************************************************************** -plane3d::plane3d(const ObjectSpaceCoordinate& coord, const ObjectSpaceVector& normal) +PlaneParameters::PlaneParameters(const ObjectSpaceCoordinate& coord, const ObjectSpaceVector& normal) { m_point = coord; m_normal = normal; } //******************************************************************************* -// plane3d::getPoint() +// PlaneParameters::getPoint() //******************************************************************************** -ObjectSpaceCoordinate plane3d::getPoint() const +ObjectSpaceCoordinate PlaneParameters::getPoint() const { return m_point; } //******************************************************************************* -// plane3d::getNormal() +// PlaneParameters::getNormal() //******************************************************************************** -ObjectSpaceVector plane3d::getNormal() const +ObjectSpaceVector PlaneParameters::getNormal() const { return m_normal; } //***************************************************************************** -// plane3dCovar::getType(() +// PlaneParametersCovar::getType(() //***************************************************************************** -geometryType3d plane3dCovar::getType() const +ProjectionGeometryType PlaneParametersCovar::getType() const { - return geometryType3d::PLANECOVAR; + return ProjectionGeometryType::PLANECOVAR; } //******************************************************************************* -// plane3dCovar::plane3dCovar() +// PlaneParametersCovar::PlaneParametersCovar() //******************************************************************************** -plane3dCovar::plane3dCovar() +PlaneParametersCovar::PlaneParametersCovar() { m_point = ObjectSpaceCoordinateCovar(); m_normal = ObjectSpaceVectorCovar(); } //***************************************************************************** -// plane3d::plane3d(const ObjectSpaceCoordinate& coord, const ObjectSpaceVector& normal) +// PlaneParameters::PlaneParameters(const ObjectSpaceCoordinate& coord, const ObjectSpaceVector& normal) //****************************************************************************** -plane3dCovar::plane3dCovar(const ObjectSpaceCoordinateCovar& coord, const ObjectSpaceVectorCovar& normal) +PlaneParametersCovar::PlaneParametersCovar(const ObjectSpaceCoordinateCovar& coord, const ObjectSpaceVectorCovar& normal) { m_point = coord; m_normal = normal; } //******************************************************************************* -// plane3dCovar::getPoint() +// PlaneParametersCovar::getPoint() //******************************************************************************** -ObjectSpaceCoordinateCovar plane3dCovar::getPoint() const +ObjectSpaceCoordinateCovar PlaneParametersCovar::getPoint() const { return m_point; } //******************************************************************************* -// plane3dCovar::getNormal() +// PlaneParametersCovar::getNormal() //******************************************************************************** -ObjectSpaceVectorCovar plane3dCovar::getNormal() const +ObjectSpaceVectorCovar PlaneParametersCovar::getNormal() const { return m_normal; } diff --git a/ProjectionParameters.h b/ProjectionParameters.h index a8fbf06..b4c2d0e 100644 --- a/ProjectionParameters.h +++ b/ProjectionParameters.h @@ -24,17 +24,15 @@ #define __CSM_GEOMETRY3D_H #include "csm.h" -#include -#include #include "ObjectSpace.h" -#include -#include -#include +//> +// need ObjectSpace.h for ObjectSpaceCoordinate etc. +//< namespace csm { -enum class geometryType3d +enum class ProjectionGeometryType { RANGE, PLANE, @@ -57,7 +55,7 @@ class CSM_EXPORT_API ProjectionParameters //> virtual destructor provides something for base class destructors to call on. //< - virtual geometryType3d getType() const = 0; + virtual ProjectionGeometryType getType() const = 0; //> returns the type enum parameter //< protected: @@ -67,7 +65,9 @@ class CSM_EXPORT_API ProjectionParameters }; - +// ************************************************************ +// ProjectionParametersCovar virtual base class +// ************************************************************ class CSM_EXPORT_API ProjectionParametersCovar { @@ -76,7 +76,7 @@ class CSM_EXPORT_API ProjectionParametersCovar //> virtual destructor provides something for base class destructors to call on. //< - virtual geometryType3d getType() const = 0; + virtual ProjectionGeometryType getType() const = 0; //> returns the type enum parameter //< protected: @@ -86,21 +86,21 @@ class CSM_EXPORT_API ProjectionParametersCovar }; -class CSM_EXPORT_API range3d : public ProjectionParameters +class CSM_EXPORT_API RangeParameters : public ProjectionParameters { public: - range3d(); + RangeParameters(); //> // default constructor sets range to zero and also // sets m_type to RANGE //< - range3d(double range); + RangeParameters(double range); //> // initializes with the given range in meters //< - geometryType3d getType() const; + ProjectionGeometryType getType() const; //> // get the geometry type (enum) //< @@ -112,21 +112,21 @@ class CSM_EXPORT_API range3d : public ProjectionParameters double m_range; }; -class CSM_EXPORT_API range3dCovar : public ProjectionParametersCovar +class CSM_EXPORT_API RangeParametersCovar : public ProjectionParametersCovar { public: - range3dCovar(); + RangeParametersCovar(); //> // default constructor sets range and range variance to zero and also // sets m_type to RANGE //< - range3dCovar(double range, double rangeVariance); + RangeParametersCovar(double range, double rangeVariance); //> // initializes with the give values in meters and meters-squared //< - geometryType3d getType() const; + ProjectionGeometryType getType() const; //> // get the geometry type (enum) //< @@ -150,21 +150,21 @@ class CSM_EXPORT_API range3dCovar : public ProjectionParametersCovar //< }; -class CSM_EXPORT_API plane3d : public ProjectionParameters +class CSM_EXPORT_API PlaneParameters : public ProjectionParameters { public: - plane3d(); + PlaneParameters(); //> the default constructor will intialize the point and the vector to // zero. // Also sets m_type to PLANE //< - plane3d(const ObjectSpaceCoordinate& coord, const ObjectSpaceVector& normal); + PlaneParameters(const ObjectSpaceCoordinate& coord, const ObjectSpaceVector& normal); //> this constructor will initialize the point and the normal with the give values. //< - geometryType3d getType() const; + ProjectionGeometryType getType() const; //> // get the geometry type (enum) //< @@ -186,20 +186,20 @@ class CSM_EXPORT_API plane3d : public ProjectionParameters //< }; -class CSM_EXPORT_API plane3dCovar : public ProjectionParametersCovar +class CSM_EXPORT_API PlaneParametersCovar : public ProjectionParametersCovar { public: - plane3dCovar(); + PlaneParametersCovar(); //> the default constructor will intialize the point and the vector to // zero. Also the point and vector covariances to zero. // Also sets m_type to PLANE //< - plane3dCovar(const ObjectSpaceCoordinateCovar& coord, const ObjectSpaceVectorCovar& normal); + PlaneParametersCovar(const ObjectSpaceCoordinateCovar& coord, const ObjectSpaceVectorCovar& normal); //> this constructor will initialize the point and the normal with the give values. //< - geometryType3d getType() const; + ProjectionGeometryType getType() const; //> // get the geometry type (enum) //< From cad2487dc0abb1e94edd5faf819eb52027cb2c42 Mon Sep 17 00:00:00 2001 From: roseej Date: Mon, 28 Feb 2022 15:14:24 -0500 Subject: [PATCH 7/7] Comment Adjudication 2/28/22 --- ObjectSpace.cpp | 88 ++++++++++++++++++++++++++++++++++- ObjectSpace.h | 52 +++++++++++++++++++++ ObjectSpacePointCloudGM.cpp | 15 +++++- ObjectSpaceRasterGM.cpp | 19 +++++--- ObjectSpaceRasterGM.h | 19 ++++---- ProjectionParameters.cpp | 64 +++++++++++++++++++++++-- ProjectionParameters.h | 93 ++++++++++++++++++++++++++++--------- 7 files changed, 303 insertions(+), 47 deletions(-) diff --git a/ObjectSpace.cpp b/ObjectSpace.cpp index 180dad3..076170c 100644 --- a/ObjectSpace.cpp +++ b/ObjectSpace.cpp @@ -47,6 +47,16 @@ ObjectSpaceCoordinate& ObjectSpaceCoordinate::operator=(const ObjectSpaceCoordin return *this; } +//***************************************************************************** +// ObjectSpaceCoordinate::setCoordinate +//***************************************************************************** +void ObjectSpaceCoordinate::setCoordinate(double xArg, double yArg, double zArg) +{ + x = xArg; + y = yArg; + z = zArg; +} + //***************************************************************************** // ObjectSpaceCoordinateCovar::ObjectSpaceCoordinateCovar //***************************************************************************** @@ -119,6 +129,23 @@ ObjectSpaceCoordinateCovar& ObjectSpaceCoordinateCovar::operator=(const ObjectSp return *this; } +//***************************************************************************** +// ObjectSpaceCoordinateCovar::setCoordinate +//***************************************************************************** +void ObjectSpaceCoordinateCovar::setCoordinate(double xArg, double yArg, double zArg) +{ + x = xArg; + y = yArg; + z = zArg; +} + +//***************************************************************************** +// ObjectSpaceCoordinateCovar::setCovariance +//***************************************************************************** +void ObjectSpaceCoordinateCovar::setCovariance(const double aCovar[9]) +{ + std::memcpy(covariance, aCovar, sizeof(covariance)); +} //***************************************************************************** // ObjectSpaceVector::ObjectSpaceVector (copy constructor) @@ -141,6 +168,16 @@ ObjectSpaceVector& ObjectSpaceVector::operator=(const ObjectSpaceVector& other) return *this; } +//***************************************************************************** +// ObjectSpaceVector::setCoordinate +//***************************************************************************** +void ObjectSpaceVector::setCoordinate(double xArg, double yArg, double zArg) +{ + x = xArg; + y = yArg; + z = zArg; +} + //***************************************************************************** // ObjectSpaceVectorCovar::ObjectSpaceVectorCovar //***************************************************************************** @@ -209,6 +246,24 @@ ObjectSpaceVectorCovar& ObjectSpaceVectorCovar::operator=(const ObjectSpaceVecto return *this; } +//***************************************************************************** +// ObjectSpaceVectorCovar::setCoordinate +//***************************************************************************** +void ObjectSpaceVectorCovar::setCoordinate(double xArg, double yArg, double zArg) +{ + x = xArg; + y = yArg; + z = zArg; +} + +//***************************************************************************** +// ObjectSpaceVectorCovar::setCovariance +//***************************************************************************** +void ObjectSpaceVectorCovar::setCovariance(const double aCovar[9]) +{ + std::memcpy(covariance, aCovar, sizeof(covariance)); +} + //***************************************************************************** // ObjectSpaceLocus::ObjectSpaceLocus (copy constructor) //***************************************************************************** @@ -219,7 +274,7 @@ ObjectSpaceLocus::ObjectSpaceLocus(const ObjectSpaceLocus& other) } //***************************************************************************** -// ObjectSpaceVector::operator= +// ObjectSpaceLocus::operator= //***************************************************************************** ObjectSpaceLocus& ObjectSpaceLocus::operator=(const ObjectSpaceLocus& other) { @@ -228,6 +283,21 @@ ObjectSpaceLocus& ObjectSpaceLocus::operator=(const ObjectSpaceLocus& other) return *this; } +//***************************************************************************** +// ObjectSpaceLocus::setPoint +//***************************************************************************** +void ObjectSpaceLocus::setPoint(const ObjectSpaceCoordinate& argPoint) +{ + point = argPoint; +} + +//***************************************************************************** +// ObjectSpaceLocus::setVector +//***************************************************************************** +void ObjectSpaceLocus::setVector(const ObjectSpaceVector& argDirection) +{ + direction = argDirection; +} //***************************************************************************** // ObjectSpaceLocusCovar::ObjectSpaceLocusCovar (copy constructor) @@ -248,5 +318,21 @@ ObjectSpaceLocusCovar& ObjectSpaceLocusCovar::operator=(const ObjectSpaceLocusCo return *this; } +//***************************************************************************** +// ObjectSpaceLocusCovar::setPoint +//***************************************************************************** +void ObjectSpaceLocusCovar::setPoint(const ObjectSpaceCoordinateCovar& argPoint) +{ + point = argPoint; +} + +//***************************************************************************** +// ObjectSpaceLocusCovar::setVector +//***************************************************************************** +void ObjectSpaceLocusCovar::setVector(const ObjectSpaceVectorCovar& argDirection) +{ + direction = argDirection; +} + } diff --git a/ObjectSpace.h b/ObjectSpace.h index fc2abda..8d84338 100644 --- a/ObjectSpace.h +++ b/ObjectSpace.h @@ -70,6 +70,11 @@ struct CSM_EXPORT_API ObjectSpaceCoordinate // assignment operator //< + void setCoordinate(double x, double y, double z); + //> + // set all three coordinate values + //< + }; // ObjectSpaceCoordinate //*** @@ -139,6 +144,16 @@ struct CSM_EXPORT_API ObjectSpaceCoordinateCovar // assignment operator //< + void setCoordinate(double x, double y, double z); + //> + // set all three coordinate values + //< + + void setCovariance(const double aCovar[9]); + //> + // set the covariance in an existing object + //< + }; // ObjectSpaceCoordinateCovar //*** @@ -174,6 +189,12 @@ struct CSM_EXPORT_API ObjectSpaceVector //> // assignment operator //< + + void setCoordinate(double x, double y, double z); + //> + // set all three coordinate values + //< + }; //*** @@ -234,6 +255,16 @@ struct CSM_EXPORT_API ObjectSpaceVectorCovar //> // assignment operator //< + + void setCoordinate(double x, double y, double z); + //> + // set all three coordinate values + //< + + void setCovariance(const double aCovar[9]); + //> + // set the covariance in an existing object + //< }; //*** @@ -285,6 +316,16 @@ struct CSM_EXPORT_API ObjectSpaceLocus //> // assignment operator //< + + void setPoint(const ObjectSpaceCoordinate& argPoint); + //> + // set the point in an existing object + //< + + void setVector(const ObjectSpaceVector& argDirection); + //> + // set the direction in an existing object + //< }; @@ -337,6 +378,17 @@ struct CSM_EXPORT_API ObjectSpaceLocusCovar // assignment operator //< + + void setPoint(const ObjectSpaceCoordinateCovar& argPoint); + //> + // set the point in an existing object + //< + + void setVector(const ObjectSpaceVectorCovar& argDirection); + //> + // set the direction in an existing object + //< + }; } // namespace csm diff --git a/ObjectSpacePointCloudGM.cpp b/ObjectSpacePointCloudGM.cpp index a4e27b9..c93a728 100644 --- a/ObjectSpacePointCloudGM.cpp +++ b/ObjectSpacePointCloudGM.cpp @@ -58,7 +58,20 @@ std::vector ObjectSpacePointCloudGM::co // precision values found for each desired index. //*** if (achievedPrecision) *achievedPrecision = 0.0; - ModelCoord mc = objectSpaceToModel(groundPt); + + /* + virtual ModelCoord objectSpaceToModel(const ObjectSpaceCoordinate& groundPt, + double desiredPrecision = 0.001, + double* achievedPrecision = NULL, + WarningList* warnings = NULL) const = 0; + */ + double osToMPrecision = 0.0; + ModelCoord mc = objectSpaceToModel(groundPt,desiredPrecision,&osToMPrecision); + if (achievedPrecision && (osToMPrecision > desiredPrecision)) + { + *achievedPrecision = osToMPrecision; + } + for (int i = 0; i < NUM_PARAMS; ++i) { double prec = 0.0; diff --git a/ObjectSpaceRasterGM.cpp b/ObjectSpaceRasterGM.cpp index 4bb4420..812bcb7 100644 --- a/ObjectSpaceRasterGM.cpp +++ b/ObjectSpaceRasterGM.cpp @@ -42,9 +42,9 @@ std::string ObjectSpaceRasterGM::getFamily()const { //***************************************************************************** std::vector ObjectSpaceRasterGM::computeAllSensorPartials( const ObjectSpaceCoordinate& objectSpacePt, - param::Set pSet, - double desiredPrecision, - double* achievedPrecision, + param::Set pSet /* =param::VALID */, + double desiredPrecision /* =0.001 */, + double* achievedPrecision /* = NULL */, WarningList* warnings) const { const std::vector indices = csm::GeometricModel::getParameterSetIndices(pSet); @@ -63,7 +63,12 @@ std::vector ObjectSpaceRasterGM::computeAll //*** if (achievedPrecision) *achievedPrecision = 0.0; - ImageCoord ip = objectSpaceToImage(objectSpacePt); + double osToIPrecision = 0.0; + ImageCoord ip = objectSpaceToImage(objectSpacePt,desiredPrecision,&osToIPrecision); + if (achievedPrecision && (osToIPrecision > desiredPrecision)) + { + *achievedPrecision = osToIPrecision; + } for (int i = 0; i < NUM_PARAMS; ++i) { double prec = 0.0; @@ -89,9 +94,9 @@ std::vector ObjectSpaceRasterGM::computeAll std::vector ObjectSpaceRasterGM::computeAllSensorPartials( const ImageCoord& imagePt, const ObjectSpaceCoordinate& objectSpacePt, - param::Set pSet, - double desiredPrecision, - double* achievedPrecision, + param::Set pSet /* = param::VALID */, + double desiredPrecision /* = 0.001 */, + double* achievedPrecision /* = NULL */, WarningList* warnings) const { const std::vector indices = csm::GeometricModel::getParameterSetIndices(pSet); diff --git a/ObjectSpaceRasterGM.h b/ObjectSpaceRasterGM.h index 709a15d..b0a98e6 100644 --- a/ObjectSpaceRasterGM.h +++ b/ObjectSpaceRasterGM.h @@ -82,11 +82,11 @@ class CSM_EXPORT_API ObjectSpaceRasterGM : public GeometricModel //> This method converts the given objectSpacePt (x,y,z in Object Space meters) to a // returned image coordinate (line, sample in full image space pixels). // - // Iterative algorithms will use desiredPrecision, in meters, as the + // Iterative algorithms will use desiredPrecision, in pixels, as the // convergence criterion, otherwise it will be ignored. // // If a non-NULL achievedPrecision argument is received, it will be - // populated with the actual precision, in meters, achieved by iterative + // populated with the actual precision, in pixels, achieved by iterative // algorithms and 0.0 for deterministic algorithms. // // If a non-NULL warnings argument is received, it will be populated @@ -102,11 +102,11 @@ class CSM_EXPORT_API ObjectSpaceRasterGM : public GeometricModel // image coordinate with covariance (line, sample in full image space // pixels and corresponding 2x2 covariance in pixels squared). // - // Iterative algorithms will use desiredPrecision, in meters, as the + // Iterative algorithms will use desiredPrecision, in pixels, as the // convergence criterion, otherwise it will be ignored. // // If a non-NULL achievedPrecision argument is received, it will be - // populated with the actual precision, in meters, achieved by iterative + // populated with the actual precision, in pixels, achieved by iterative // algorithms and 0.0 for deterministic algorithms. // // If a non-NULL warnings argument is received, it will be populated @@ -122,11 +122,11 @@ class CSM_EXPORT_API ObjectSpaceRasterGM : public GeometricModel // space pixels) and given projection parameters to a returned // object space coordinate (x,y,z in Object Space meters). // - // Iterative algorithms will use desiredPrecision, in meters, as the + // Iterative algorithms will use desiredPrecision, in pixels, as the // convergence criterion, otherwise it will be ignored. // // If a non-NULL achievedPrecision argument is received, it will be - // populated with the actual precision, in meters, achieved by iterative + // populated with the actual precision, in pixels, achieved by iterative // algorithms and 0.0 for deterministic algorithms. // // If a non-NULL warnings argument is received, it will be populated @@ -144,11 +144,11 @@ class CSM_EXPORT_API ObjectSpaceRasterGM : public GeometricModel // coordinate with covariance (x,y,z in Object Space meters and corresponding // 3x3 covariance in Object Space meters squared). // - // Iterative algorithms will use desiredPrecision, in meters, as the + // Iterative algorithms will use desiredPrecision, in pixels, as the // convergence criterion, otherwise it will be ignored. // // If a non-NULL achievedPrecision argument is received, it will be - // populated with the actual precision, in meters, achieved by iterative + // populated with the actual precision, in pixels, achieved by iterative // algorithms and 0.0 for deterministic algorithms. // // If a non-NULL warnings argument is received, it will be populated @@ -279,7 +279,6 @@ class CSM_EXPORT_API ObjectSpaceRasterGM : public GeometricModel // (x,y,z in Object Space meters) when the pixel at the given imagePt // (line, sample in full image space pixels) was captured. // - // A csm::Error will be thrown if the sensor position is not available. //< virtual ObjectSpaceCoordinate getSensorPosition(double time) const = 0; @@ -301,8 +300,6 @@ class CSM_EXPORT_API ObjectSpaceRasterGM : public GeometricModel // method. //< - /// - /// /// ******************************************************************************* //--- diff --git a/ProjectionParameters.cpp b/ProjectionParameters.cpp index 2a92b73..d68e1a7 100644 --- a/ProjectionParameters.cpp +++ b/ProjectionParameters.cpp @@ -50,11 +50,19 @@ RangeParameters::RangeParameters(double range) //***************************************************************************** // RangeParameters::getrange //***************************************************************************** -double RangeParameters::getRange() const +const double &RangeParameters::getRange() const { return m_range; } +//***************************************************************************** +// RangeParameters::setrange +//***************************************************************************** +void RangeParameters::setRange(double range) +{ + m_range = range; +} + //***************************************************************************** // RangeParametersCovar::getType(() //***************************************************************************** @@ -97,6 +105,21 @@ double RangeParametersCovar::getRangeVariance() const return m_rangeVariance; } +//***************************************************************************** +// RangeParametersCovar::setrange +//***************************************************************************** +void RangeParametersCovar::setRange(double range) +{ + m_range = range; +} + +//***************************************************************************** +// RangeParametersCovar::setrangeVariance +//***************************************************************************** +void RangeParametersCovar::setRangeVariance(double rangeVar) +{ + m_rangeVariance = rangeVar; +} //***************************************************************************** // PlaneParameters::getType(() //***************************************************************************** @@ -124,7 +147,7 @@ PlaneParameters::PlaneParameters(const ObjectSpaceCoordinate& coord, const Objec //******************************************************************************* // PlaneParameters::getPoint() //******************************************************************************** -ObjectSpaceCoordinate PlaneParameters::getPoint() const +const ObjectSpaceCoordinate& PlaneParameters::getPoint() const { return m_point; } @@ -132,11 +155,26 @@ ObjectSpaceCoordinate PlaneParameters::getPoint() const //******************************************************************************* // PlaneParameters::getNormal() //******************************************************************************** -ObjectSpaceVector PlaneParameters::getNormal() const +const ObjectSpaceVector& PlaneParameters::getNormal() const { return m_normal; } +//******************************************************************************* +// PlaneParameters::setPoint() +//******************************************************************************** +void PlaneParameters::setPoint(const ObjectSpaceCoordinate& pointArg) +{ + m_point = pointArg; // assignment operator usage +} + +//******************************************************************************* +// PlaneParameters::setNormal() +//******************************************************************************** +void PlaneParameters::setNormal(const ObjectSpaceVector& normalArg) +{ + m_normal = normalArg; // assignment operator usage +} //***************************************************************************** // PlaneParametersCovar::getType(() @@ -167,7 +205,7 @@ PlaneParametersCovar::PlaneParametersCovar(const ObjectSpaceCoordinateCovar& coo //******************************************************************************* // PlaneParametersCovar::getPoint() //******************************************************************************** -ObjectSpaceCoordinateCovar PlaneParametersCovar::getPoint() const +const ObjectSpaceCoordinateCovar& PlaneParametersCovar::getPoint() const { return m_point; } @@ -175,9 +213,25 @@ ObjectSpaceCoordinateCovar PlaneParametersCovar::getPoint() const //******************************************************************************* // PlaneParametersCovar::getNormal() //******************************************************************************** -ObjectSpaceVectorCovar PlaneParametersCovar::getNormal() const +const ObjectSpaceVectorCovar& PlaneParametersCovar::getNormal() const { return m_normal; } +//******************************************************************************* +// PlaneParametersCovar::setPoint() +//******************************************************************************** +void PlaneParametersCovar::setPoint(const ObjectSpaceCoordinateCovar& pointArg) +{ + m_point = pointArg; // assignment operator usage +} + +//******************************************************************************* +// PlaneParametersCovar::setNormal() +//******************************************************************************** +void PlaneParametersCovar::setNormal(const ObjectSpaceVectorCovar& normalArg) +{ + m_normal = normalArg; // assignment operator usage +} + } // namespace csm diff --git a/ProjectionParameters.h b/ProjectionParameters.h index b4c2d0e..8dbe228 100644 --- a/ProjectionParameters.h +++ b/ProjectionParameters.h @@ -20,8 +20,8 @@ // //##################################################################### -#ifndef __CSM_GEOMETRY3D_H -#define __CSM_GEOMETRY3D_H +#ifndef __PROJECTIONPARAMETERS_H +#define __PROJECTIONPARAMETERS_H #include "csm.h" #include "ObjectSpace.h" @@ -52,15 +52,18 @@ class CSM_EXPORT_API ProjectionParameters public: virtual ~ProjectionParameters() {}; - //> virtual destructor provides something for base class destructors to call on. + //> + // virtual destructor provides something for base class destructors to call on. //< virtual ProjectionGeometryType getType() const = 0; - //> returns the type enum parameter + //> + // returns the type enum parameter //< protected: ProjectionParameters() {}; - //> the default constructor does nothing + //> + // the default constructor does nothing //< }; @@ -73,15 +76,18 @@ class CSM_EXPORT_API ProjectionParametersCovar public: virtual ~ProjectionParametersCovar() {}; - //> virtual destructor provides something for base class destructors to call on. + //> + // virtual destructor provides something for base class destructors to call on. //< virtual ProjectionGeometryType getType() const = 0; - //> returns the type enum parameter + //> + // returns the type enum parameter //< protected: ProjectionParametersCovar() {}; - //> the default constructor does nothing + //> + // the default constructor does nothing //< }; @@ -105,10 +111,17 @@ class CSM_EXPORT_API RangeParameters : public ProjectionParameters // get the geometry type (enum) //< - double getRange() const; - //> return the range value in meters + const double &getRange() const; + //> + // return the range value in meters + //< + + void setRange(double range); + //> + // set the range in an existing object //< -private: + +protected: double m_range; }; @@ -139,7 +152,19 @@ class CSM_EXPORT_API RangeParametersCovar : public ProjectionParametersCovar //> // returns the range variance //< -private: + + void setRange(double range); + //> + // set the range in an existing object + //< + + void setRangeVariance(double rangeVar); + //> + // set the range variance in an existing object + //< + + +protected: double m_range; //> // range value in meters @@ -169,14 +194,25 @@ class CSM_EXPORT_API PlaneParameters : public ProjectionParameters // get the geometry type (enum) //< - ObjectSpaceCoordinate getPoint() const; + const ObjectSpaceCoordinate& getPoint() const; //> read the point //< - ObjectSpaceVector getNormal() const; + const ObjectSpaceVector& getNormal() const; //> read the normal //< -private: + + void setPoint(const ObjectSpaceCoordinate& pointArg); + //< + // set the point in an existing object + //> + + void setNormal(const ObjectSpaceVector& normalArg); + //< + // set the normal in an existing object + //< + +protected: ObjectSpaceCoordinate m_point; //> a point on the plane. //< @@ -196,7 +232,8 @@ class CSM_EXPORT_API PlaneParametersCovar : public ProjectionParametersCovar //< PlaneParametersCovar(const ObjectSpaceCoordinateCovar& coord, const ObjectSpaceVectorCovar& normal); - //> this constructor will initialize the point and the normal with the give values. + //> + // this constructor will initialize the point and the normal with the give values. //< ProjectionGeometryType getType() const; @@ -204,14 +241,26 @@ class CSM_EXPORT_API PlaneParametersCovar : public ProjectionParametersCovar // get the geometry type (enum) //< - ObjectSpaceCoordinateCovar getPoint() const; - //> read the point + const ObjectSpaceCoordinateCovar &getPoint() const; + //> + // read the point //< - ObjectSpaceVectorCovar getNormal() const; - //> read the normal + const ObjectSpaceVectorCovar &getNormal() const; + //> + // read the normal + //< + + void setPoint(const ObjectSpaceCoordinateCovar& pointArg); + //< + // set the point in an existing object + //> + + void setNormal(const ObjectSpaceVectorCovar& normalArg); //< -private: + // set the normal in an existing object + //< +protected: ObjectSpaceCoordinateCovar m_point; //> a point on the plane. //< @@ -222,4 +271,4 @@ class CSM_EXPORT_API PlaneParametersCovar : public ProjectionParametersCovar }; } -#endif // __CSM_GEOMETRY3D_H +#endif // __PROJECTIONPARAMETERS_H