From 801d2fbfa16087c2559ba4f838033929c8593b6c Mon Sep 17 00:00:00 2001 From: Emmanuel Christophe <emmanuel.christophe@orfeo-toolbox.org> Date: Fri, 22 May 2009 15:59:32 +0800 Subject: [PATCH] OSSIM: cleaning files --- .../include/ossim/projection/otb/Arithmetic.h | 106 -- .../ossim/projection/otb/CivilDateTime.h | 180 ---- .../include/ossim/projection/otb/Coordinate.h | 67 -- .../include/ossim/projection/otb/Ephemeris.h | 125 --- .../include/ossim/projection/otb/Equation.h | 136 --- .../ossim/projection/otb/GMSTDateTime.h | 83 -- .../ossim/projection/otb/GalileanEphemeris.h | 70 -- .../ossim/projection/otb/GeodesicCoordinate.h | 49 - .../projection/otb/GeographicEphemeris.h | 67 -- .../projection/otb/HermiteInterpolator.h | 70 -- .../ossim/projection/otb/JSDDateTime.h | 126 --- .../include/ossim/projection/otb/JulianDate.h | 94 -- .../ossim/projection/otb/MJDDateTime.h | 83 -- .../ossim/projection/otb/PlatformPosition.h | 105 -- .../projection/otb/RectangularCoordinate.h | 52 - .../include/ossim/projection/otb/RefPoint.h | 78 -- .../include/ossim/projection/otb/SarSensor.h | 65 -- .../include/ossim/projection/otb/Sensor.h | 57 -- .../ossim/projection/otb/SensorParams.h | 227 ----- .../ossim/projection/otb/CivilDateTime.cpp | 468 --------- .../src/ossim/projection/otb/Coordinate.cpp | 56 -- .../src/ossim/projection/otb/Ephemeris.cpp | 196 ---- .../src/ossim/projection/otb/Equation.cpp | 948 ------------------ .../src/ossim/projection/otb/GMSTDateTime.cpp | 46 - .../projection/otb/GalileanEphemeris.cpp | 289 ------ .../projection/otb/GeodesicCoordinate.cpp | 39 - .../projection/otb/GeographicEphemeris.cpp | 80 -- .../projection/otb/HermiteInterpolator.cpp | 262 ----- .../src/ossim/projection/otb/JSDDateTime.cpp | 231 ----- .../src/ossim/projection/otb/JulianDate.cpp | 141 --- .../src/ossim/projection/otb/MJDDateTime.cpp | 46 - .../ossim/projection/otb/PlatformPosition.cpp | 246 ----- .../projection/otb/RectangularCoordinate.cpp | 102 -- .../src/ossim/projection/otb/RefPoint.cpp | 193 ---- .../src/ossim/projection/otb/SarSensor.cpp | 230 ----- .../src/ossim/projection/otb/Sensor.cpp | 35 - .../src/ossim/projection/otb/SensorParams.cpp | 232 ----- 37 files changed, 5680 deletions(-) delete mode 100644 Utilities/otbossim/include/ossim/projection/otb/Arithmetic.h delete mode 100644 Utilities/otbossim/include/ossim/projection/otb/CivilDateTime.h delete mode 100644 Utilities/otbossim/include/ossim/projection/otb/Coordinate.h delete mode 100644 Utilities/otbossim/include/ossim/projection/otb/Ephemeris.h delete mode 100644 Utilities/otbossim/include/ossim/projection/otb/Equation.h delete mode 100644 Utilities/otbossim/include/ossim/projection/otb/GMSTDateTime.h delete mode 100644 Utilities/otbossim/include/ossim/projection/otb/GalileanEphemeris.h delete mode 100644 Utilities/otbossim/include/ossim/projection/otb/GeodesicCoordinate.h delete mode 100644 Utilities/otbossim/include/ossim/projection/otb/GeographicEphemeris.h delete mode 100644 Utilities/otbossim/include/ossim/projection/otb/HermiteInterpolator.h delete mode 100644 Utilities/otbossim/include/ossim/projection/otb/JSDDateTime.h delete mode 100644 Utilities/otbossim/include/ossim/projection/otb/JulianDate.h delete mode 100644 Utilities/otbossim/include/ossim/projection/otb/MJDDateTime.h delete mode 100644 Utilities/otbossim/include/ossim/projection/otb/PlatformPosition.h delete mode 100644 Utilities/otbossim/include/ossim/projection/otb/RectangularCoordinate.h delete mode 100644 Utilities/otbossim/include/ossim/projection/otb/RefPoint.h delete mode 100644 Utilities/otbossim/include/ossim/projection/otb/SarSensor.h delete mode 100644 Utilities/otbossim/include/ossim/projection/otb/Sensor.h delete mode 100644 Utilities/otbossim/include/ossim/projection/otb/SensorParams.h delete mode 100644 Utilities/otbossim/src/ossim/projection/otb/CivilDateTime.cpp delete mode 100644 Utilities/otbossim/src/ossim/projection/otb/Coordinate.cpp delete mode 100644 Utilities/otbossim/src/ossim/projection/otb/Ephemeris.cpp delete mode 100644 Utilities/otbossim/src/ossim/projection/otb/Equation.cpp delete mode 100644 Utilities/otbossim/src/ossim/projection/otb/GMSTDateTime.cpp delete mode 100644 Utilities/otbossim/src/ossim/projection/otb/GalileanEphemeris.cpp delete mode 100644 Utilities/otbossim/src/ossim/projection/otb/GeodesicCoordinate.cpp delete mode 100644 Utilities/otbossim/src/ossim/projection/otb/GeographicEphemeris.cpp delete mode 100644 Utilities/otbossim/src/ossim/projection/otb/HermiteInterpolator.cpp delete mode 100644 Utilities/otbossim/src/ossim/projection/otb/JSDDateTime.cpp delete mode 100644 Utilities/otbossim/src/ossim/projection/otb/JulianDate.cpp delete mode 100644 Utilities/otbossim/src/ossim/projection/otb/MJDDateTime.cpp delete mode 100644 Utilities/otbossim/src/ossim/projection/otb/PlatformPosition.cpp delete mode 100644 Utilities/otbossim/src/ossim/projection/otb/RectangularCoordinate.cpp delete mode 100644 Utilities/otbossim/src/ossim/projection/otb/RefPoint.cpp delete mode 100644 Utilities/otbossim/src/ossim/projection/otb/SarSensor.cpp delete mode 100644 Utilities/otbossim/src/ossim/projection/otb/Sensor.cpp delete mode 100644 Utilities/otbossim/src/ossim/projection/otb/SensorParams.cpp diff --git a/Utilities/otbossim/include/ossim/projection/otb/Arithmetic.h b/Utilities/otbossim/include/ossim/projection/otb/Arithmetic.h deleted file mode 100644 index bc9433fa7d..0000000000 --- a/Utilities/otbossim/include/ossim/projection/otb/Arithmetic.h +++ /dev/null @@ -1,106 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - -#ifndef Arithmetic_h -#define Arithmetic_h - -#include <cmath> -#include <cstdlib> - -/*-------------------------------------------------------------------------*/ -/* "closest integer" function, returns long */ -/*-------------------------------------------------------------------------*/ - -long inint (double x) -{ - return (x >= 0.0) ? (long)(x + 0.5) : (long)(x-0.5) ; -} - -/*-------------------------------------------------------------------------*/ -/* "closest integer" function, returns double */ -/*-------------------------------------------------------------------------*/ - -double fnint (double x) -{ - return (x >= 0.0) ? (double)((long)(x + 0.5)) : (double)((long)(x - 0.5)); -} - -/*-------------------------------------------------------------------------*/ -/* Greatest Common Divisor */ -/*-------------------------------------------------------------------------*/ - -long pgcd ( long n , long p ) -{ - long k ; - long n1 , p1 ; - long m0 , m1 , m ; - - n1 = labs(n) ; - p1 = labs(p) ; - if (n1 > p1) - { - m0 = n1 ; - m1 = p1 ; - } - else - { - m0 = p1 ; - m1 = n1 ; - } - if (m1 != 0) - { - while (m1 != 0) - { - m = m0 - (m0/m1) * m1 ; - m0 = m1 ; - m1 = m ; - } - k = m0 ; - } - else k = 1 ; - - return k ; -} - -/*-------------------------------------------------------------------------*/ -/* Least Common Multiple */ -/*-------------------------------------------------------------------------*/ - -long ppcm ( long n , long p ) -{ - long k ; - long n1 , p1 ; - long m0 , m1 , m ; - - n1 = labs(n) ; - p1 = labs(p) ; - if (n1>p1) - { - m0 = n1 ; - m1 = p1 ; - } - else - { - m0 = p1 ; - m1 = n1 ; - } - if (m1 != 0) - { - m = m0 ; - while ((m % m1) != 0) m += m0 ; - k = m ; - } - else k = 0 ; - - return k ; -} -#endif - diff --git a/Utilities/otbossim/include/ossim/projection/otb/CivilDateTime.h b/Utilities/otbossim/include/ossim/projection/otb/CivilDateTime.h deleted file mode 100644 index 61383d81bb..0000000000 --- a/Utilities/otbossim/include/ossim/projection/otb/CivilDateTime.h +++ /dev/null @@ -1,180 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - - -#ifndef CivilDateTime_h -#define CivilDateTime_h - -#include <iosfwd> - -class JulianDate; -class JSDDateTime; -class GMSTDateTime; - -/** - * @brief This class represents a date and time in the civil format - */ -class CivilDateTime -{ -public: - - /** - * @brief Constructor - */ - CivilDateTime(); - - /** - * @brief Constructor with date and time initialisation - */ - CivilDateTime(int year, int month, int day, int second, double decimal); - - /** - * @brief Constructor with date and time initialisation using an utc string - */ - CivilDateTime(char* Utc); - - CivilDateTime(const char* Utc); - - /** - * @brief Destructor - */ - ~CivilDateTime(); - - /** - * @brief Copy constructor - */ - CivilDateTime(const CivilDateTime& rhs); - - /** - * @brief Affectation operator - */ - CivilDateTime& operator=(const CivilDateTime& rhs); - - /** - * @brief This function converts the current CivilDateTime into Julian Date - * @return 0 if no error or an int greater than 0 indicating the error - * @param julianDate [out] The classe that receives the result of the conversion of the current CivilDateTime into JulianDate - */ - int AsJulianDate(JulianDate* julianDate); - - /** - * @brief This function converts the current CivilDateTime into JSDDateTime - * @return 0 if no error or an int greater than 0 indicating the error - * @param JSDdate [out] The classe that receives the result of the conversion of the current CivilDateTime into JSDDateTime - */ - int AsJSDDateTime(JSDDateTime* JSDdate); - - /** - * @brief This function converts the current CivilDateTime into GMSTDateTime - * @return 0 if no error or an int greater than 0 indicating the error - * @param GMSTdate [out] The classe that receives the result of the conversion of the current CivilDateTime into GMSTDateTime - */ - int AsGMSTDateTime(GMSTDateTime* GMSTdate); - - int get_year() - { - return _year; - }; - - int get_month() - { - return _month; - }; - - int get_day() - { - return _day; - }; - - int get_second() - { - return _second; - }; - - double get_decimal() - { - return _decimal; - }; - - void set_year(int year) - { - _year = year; - }; - - void set_month(int month) - { - _month = month; - }; - - void set_day(int day) - { - _day = day; - }; - - void set_second(int second) - { - _second = second; - }; - - void set_decimal(double decimal) - { - _decimal = decimal; - }; - - /** - * @brief This function initialize the date and the the time of the class using an utc string - * @param Utc Utc string containing the date and time - * @return 0 if no error or an int gretter than 0 indiquating the error - */ - int SetUtcDateTime(char* Utc); - - int SetUtcDateTime(const char* Utc); - - - operator JulianDate() ; - - operator JSDDateTime() ; - - operator GMSTDateTime() ; - - std::ostream& print(std::ostream& out) const; - - friend std::ostream& operator<<(std::ostream& out, - const CivilDateTime& obj); - - - static const double JOURCIVIL_LENGTH; -protected: - /** - * @brief - */ - int _year; - /** - * @brief - */ - int _month; - /** - * @brief - */ - int _day; - /** - * @brief Number of secondes since the beginning of the day - */ - int _second; - /** - * @brief - */ - double _decimal; - - -private: -}; -#endif diff --git a/Utilities/otbossim/include/ossim/projection/otb/Coordinate.h b/Utilities/otbossim/include/ossim/projection/otb/Coordinate.h deleted file mode 100644 index 618e23de0b..0000000000 --- a/Utilities/otbossim/include/ossim/projection/otb/Coordinate.h +++ /dev/null @@ -1,67 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - -#ifndef Coordinate_h -#define Coordinate_h - -/** - * @brief This class represents a coordinate - */ - -class Coordinate -{ -public: - /** - * @brief Constructor - */ - Coordinate(); - /** - * @brief Destructor - */ - ~Coordinate(); - /** - * @brief Constructor with initializations - */ - Coordinate(double x, double y, double z); - /** - * @brief Copy constructor - */ - Coordinate(const Coordinate& rhs); - - /** - * @brief Affectation operator - */ - Coordinate& operator=(const Coordinate& rhs); - - void set_coordinates(double x, double y, double z); - - double get_x() - { - return _x; - }; - - double get_y() - { - return _y; - }; - - double get_z() - { - return _z; - }; -protected: - double _x; - double _y; - double _z; -private: -}; - -#endif diff --git a/Utilities/otbossim/include/ossim/projection/otb/Ephemeris.h b/Utilities/otbossim/include/ossim/projection/otb/Ephemeris.h deleted file mode 100644 index 5c8353eed8..0000000000 --- a/Utilities/otbossim/include/ossim/projection/otb/Ephemeris.h +++ /dev/null @@ -1,125 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - -#ifndef Ephemeride_h -#define Ephemeride_h - -#include <JSDDateTime.h> - -class ossimKeywordlist; - -/** - * @ingroup Ephemeris - * @brief This class represents an ephemeris - */ -class Ephemeris -{ -public: - /** - * @brief Constructor - */ - Ephemeris(); - - /** - * @brief Destructor - */ - virtual ~Ephemeris(); - - /** - * @brief Constructor with initialisations - */ - Ephemeris(JSDDateTime date, double pos[3], double vitesse[3]); - /** - * @brief Copy constructor - */ - Ephemeris(const Ephemeris& rhs); - - /** - * @brief Affectation operator - */ - Ephemeris& operator=(const Ephemeris& rhs); - - /** - * @brief This function creatse a copy of the current class - */ - virtual Ephemeris* Clone() - { - return new Ephemeris(*this); - } - - JSDDateTime get_date() const - { - return _date; - } - - double* get_position() - { - return _position; - } - - const double* get_position() const - { - return _position; - } - - double* get_vitesse() - { - return _vitesse; - } - - const double* get_vitesse() const - { - return _vitesse; - } - - void set_date(JSDDateTime date) - { - _date = date; - } - - void set_position(double position[3]) - { - _position[0] = position[0]; - _position[1] = position[1]; - _position[2] = position[2]; - } - - void set_vitesse(double vitesse[3]) - { - _vitesse[0] = vitesse[0]; - _vitesse[1] = vitesse[1]; - _vitesse[2] = vitesse[2]; - } - - /** - * @brief Method to save object state to a keyword list. - * @param kwl Keyword list to save to. - * @param prefix added to keys when saved. - * @return true on success, false on error. - */ - bool saveState(ossimKeywordlist& kwl, const char* prefix=0) const; - - /** - * @brief Method to the load (recreate) the state of the object from a - * keyword list. Return true if ok or false on error. - * @return true if load OK, false on error - */ - bool loadState (const ossimKeywordlist &kwl, const char *prefix=0); - -protected: - - JSDDateTime _date; - double _position[3]; - double _vitesse[3]; -private: -}; - -#endif diff --git a/Utilities/otbossim/include/ossim/projection/otb/Equation.h b/Utilities/otbossim/include/ossim/projection/otb/Equation.h deleted file mode 100644 index 763bdc7134..0000000000 --- a/Utilities/otbossim/include/ossim/projection/otb/Equation.h +++ /dev/null @@ -1,136 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - -#ifndef Equation_h -#define Equation_h - -#include <complex> -/** - * @brief This class manages and solves an equation of the fourth degree - */ -class Equation -{ -public: - /** - * @brief Constructor - */ - Equation(); - /** - * @brief Destructor - */ - ~Equation(); - - Equation(const Equation& rhs); - - Equation& operator=(const Equation& rhs); - - Equation(int degree, std::complex<double>* coefficients); - - void CreateEquation(int degree, std::complex<double>* coefficients); - - void Solve(); - - int get_nbrSol() - { - return _nbrSol; - }; - - std::complex<double>* get_solutions() - { - return _solutions; - }; - - int * get_order() - { - return _order; - }; - -protected: - - /** - * @brief Equation coefficients - */ - std::complex<double>* _coefficients; - /** - * @brief Equation degree - */ - int _degree; - - void ComputeTrueDegree(); - - void Normalisation(); - void DeNormalisation(); - static const double Epsilon; - - int _nbrSol; - int * _order; - std::complex<double>* _solutions; -private: - - enum NormalisationType - { - GreatValues, - SmallValues - }; - - NormalisationType _normalisationType; - double _normalisationCoefficient; - int _trueDegree; - - void Solve1(); - void Solve2(); - void Solve3(int d4 =0); - void Solve4(); - - /** - * ?? - */ - std::complex<double> Proche(std::complex<double> z, double epsilon); - - /** - * @brief Tests whether a triple root exists in a third degree equation - */ - int TestDegree3Triple(std::complex<double>* a, double epsilon); - /** - * @brief Tests whether a double root and a simple root exist in a third degree equation - */ - int TestDegree3SimpleDouble(std::complex<double>* a, double epsilon); - - /** - * @brief Returns the index of the smaller list element - */ - int IndiceMin ( int n , double *list); - - /** - * @brief Returns the index of the greater list element - */ - int IndiceMax ( int n , double *list); - - /** - * @brief Tests whether a quadruple root exists in a fourth degree equation - */ - int TestDegree4Quad ( std::complex<double> *a , double epsilon ); - /** - * @brief Tests whether two double roots exist in a fourth degree equation - */ - int TestDegree4DoubleDouble ( std::complex<double> *a , std::complex<double> *k , double epsilon ); - /** - * @brief Tests whether one simple root and one triple root exist in a fourth degree equation - */ - int TestDegree4SimpleTriple ( std::complex<double> *a , std::complex<double> *k , double epsilon ); - /** - * @brief Tests whether two simple root and one double root exist in a fourth degree equation - */ - int TestDegreeSimpleSimpleDouble( std::complex<double> *a , double epsilon ); - ; -}; - -#endif diff --git a/Utilities/otbossim/include/ossim/projection/otb/GMSTDateTime.h b/Utilities/otbossim/include/ossim/projection/otb/GMSTDateTime.h deleted file mode 100644 index 3b5d56266b..0000000000 --- a/Utilities/otbossim/include/ossim/projection/otb/GMSTDateTime.h +++ /dev/null @@ -1,83 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - -#ifndef GMSTDateTime_h -#define GMSTDateTime_h -#include <JulianDate.h> - -class CivilDateTime; -class JulianDate; - -/** - * @ingroup Date - * @brief This class represents a date - */ -class GMSTDateTime -{ -public: - - enum Ori_TSM_Green { AN1900 , AN1950 , AN2000 } ; - - /** - * @brief constructor - */ - GMSTDateTime(); - /** - * @brief Destructor - */ - ~GMSTDateTime(); - /** - * @brief Copy constructor - */ - GMSTDateTime(const GMSTDateTime& rhs); - - /** - * @brief Constructor with date initialisation - */ - GMSTDateTime(double tsm, Ori_TSM_Green origine); - - /** - * @brief Constructor with date initialisation using a CivilDateTime - */ - GMSTDateTime(CivilDateTime& rhs); - - /** - * @brief Affectation operator - */ - GMSTDateTime& operator=(const GMSTDateTime& rhs); - - double get_tms() - { - return _tms; - }; - - void set_tms(double tms) - { - _tms = tms; - }; - - Ori_TSM_Green get_origine() - { - return _origine; - }; - - void set_origine(Ori_TSM_Green origine) - { - _origine = origine; - } -protected: - - double _tms; - Ori_TSM_Green _origine; - -private: -}; -#endif diff --git a/Utilities/otbossim/include/ossim/projection/otb/GalileanEphemeris.h b/Utilities/otbossim/include/ossim/projection/otb/GalileanEphemeris.h deleted file mode 100644 index ad508ec23a..0000000000 --- a/Utilities/otbossim/include/ossim/projection/otb/GalileanEphemeris.h +++ /dev/null @@ -1,70 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - -#ifndef GalileanEphemeride_h -#define GalileanEphemeride_h - -#include <Ephemeris.h> - -class GeographicEphemeris; -/** - * @ingroup Ephemeris - * @brief This class represents an ephemeris in Galilean coordinates system - */ -class GalileanEphemeris : public Ephemeris -{ -public: - /** - * @brief Constructor - */ - GalileanEphemeris(); - - /** - * @brief Destructor - */ - ~GalileanEphemeris(); - - /** - * @brief Constructor with initialisations - */ - GalileanEphemeris(JSDDateTime date, double pos[3], double vitesse[3]); - - /** - * @brief Copy constructor - */ - GalileanEphemeris(const GalileanEphemeris& rhs); - - GalileanEphemeris(GeographicEphemeris& rhs); - /** - * @brief Affectation operator - */ - GalileanEphemeris& operator=(const GalileanEphemeris& rhs); - - /** - * @brief This fonction converts the current ephemeris in the Geographic coordinates syst�m - */ - void ToGeographic(GeographicEphemeris* vGeo); - void ToGeographic(double greenwich,GeographicEphemeris* vGeo); - - operator GeographicEphemeris(); - - /** - * @brief This function creates a copy of the current class - */ - virtual Ephemeris* Clone() - { - return new GalileanEphemeris(*this); - }; -protected: - int p2nutt(int newcmb, double greenwich, double day, double p[], double pd[] ); -private: -}; -#endif diff --git a/Utilities/otbossim/include/ossim/projection/otb/GeodesicCoordinate.h b/Utilities/otbossim/include/ossim/projection/otb/GeodesicCoordinate.h deleted file mode 100644 index 384a3f5d20..0000000000 --- a/Utilities/otbossim/include/ossim/projection/otb/GeodesicCoordinate.h +++ /dev/null @@ -1,49 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - -#ifndef GeodesicCoordinate_h -#define GeodesicCoordinate_h - -#include <Coordinate.h> - -/** - * @ingroup Date - * @brief This class represents a coordinate in a geodesic reference - */ - class GeodesicCoordinate : public Coordinate - { - public: - /** - * @brief Constructor - */ - GeodesicCoordinate(); - /** - * @brief Destructor - */ - ~GeodesicCoordinate(); - /** - * @brief Cosntructor with initializations - */ - GeodesicCoordinate(double x, double y, double z); - /** - * @brief Copy constructor - */ - GeodesicCoordinate(const GeodesicCoordinate& rhs); - - /** - * @brief Affectation operator - */ - GeodesicCoordinate& operator=(const GeodesicCoordinate& rhs); - protected: - private: - }; - - #endif diff --git a/Utilities/otbossim/include/ossim/projection/otb/GeographicEphemeris.h b/Utilities/otbossim/include/ossim/projection/otb/GeographicEphemeris.h deleted file mode 100644 index 2245197b99..0000000000 --- a/Utilities/otbossim/include/ossim/projection/otb/GeographicEphemeris.h +++ /dev/null @@ -1,67 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - -#ifndef GeographicEphemeride_h -#define GeographicEphemeride_h - -#include <Ephemeris.h> - -class GalileanEphemeris; -/** - * @ingroup Ephemeris - * @brief This class represent an ephemeris in Geographic coordinates system - */ -class GeographicEphemeris : public Ephemeris -{ -public: - /** - * @brief Constructor - */ - GeographicEphemeris(); - /** - * @brief Destructor - */ - virtual ~GeographicEphemeris(); - - /** - * @brief Constructor with initialisations - */ - GeographicEphemeris(JSDDateTime date, double pos[3], double vitesse[3]); - /** - * @brief Copy constructor - */ - GeographicEphemeris(const GeographicEphemeris& rhs); - - GeographicEphemeris(GalileanEphemeris& rhs); - /** - * @brief Affectation operator - */ - GeographicEphemeris& operator=(const GeographicEphemeris& rhs); - - /** - * @brief This fonction converts the current ephemeris in the Galilean coordinates system - */ - void ToGalilean(GalileanEphemeris* vGal); - - operator GalileanEphemeris(); - - /** - * @brief This function creates a copy of the current class - */ - virtual Ephemeris* Clone() - { - return new GeographicEphemeris(*this); - }; -protected: -private: - -}; -#endif diff --git a/Utilities/otbossim/include/ossim/projection/otb/HermiteInterpolator.h b/Utilities/otbossim/include/ossim/projection/otb/HermiteInterpolator.h deleted file mode 100644 index da1b6cdfad..0000000000 --- a/Utilities/otbossim/include/ossim/projection/otb/HermiteInterpolator.h +++ /dev/null @@ -1,70 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - -#ifndef HermiteInterpolator_h -#define HermiteInterpolator_h - - -/** - * @brief Abstract interpolator - * @see Interpolate - */ -class HermiteInterpolator -{ -public: - /** - * @brief Constructor - */ - HermiteInterpolator(); - - /** - * @brief Constructor with initialisations - * @param nbrPoints Number of points used to perform the interpolation - * @param x Values of the points abscissa - * @param y Values of the points - * @param dy Values of the differential coefficients - */ - HermiteInterpolator(int nbrPoints, double* x, double* y, double* dy); - - /** - * @brief Destructor - */ - ~HermiteInterpolator(); - - /** - * @brief Copy constructor - */ - HermiteInterpolator(const HermiteInterpolator& rhs); - - /** - * @brief Affectation operator - */ - HermiteInterpolator& operator =(const HermiteInterpolator& rhs); - /** - * @brief This function performs the interpolation for the abscissa x - * @param x Abscissa of the interpolation - * @param y [out] value of the point at the abscissa x - * @param dy [out] value of the differential coefficient at abscissa x - * @return Different of 0 if an error occurs - */ - int Interpolate(const double x, double& y, double& dy); -protected: - - void Clear(); - int _nbrPoints; - double* _x; - double* _y; - double* _dy; -private: -}; -#endif - - diff --git a/Utilities/otbossim/include/ossim/projection/otb/JSDDateTime.h b/Utilities/otbossim/include/ossim/projection/otb/JSDDateTime.h deleted file mode 100644 index d471bcc27c..0000000000 --- a/Utilities/otbossim/include/ossim/projection/otb/JSDDateTime.h +++ /dev/null @@ -1,126 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - -#ifndef JSDDateTime_h -#define JSDDateTime_h -#include <JulianDate.h> -#include <MJDDateTime.h> - -class CivilDateTime; -class GMSTDateTime; -class JulianDate; - -/** - * @brief This class represents a date - */ -class JSDDateTime -{ -public: - /** - * @brief constructor - */ - JSDDateTime(); - /** - * @brief Destructor - */ - ~JSDDateTime(); - /** - * @brief Copy constructor - */ - JSDDateTime(const JSDDateTime& rhs); - - /** - * @brief Constructor with date initialisation - */ - JSDDateTime(JulianDate day0hTU, double second, double decimal); - - /** - * @brief Constructor with date initialisation using a CivilDateTime - */ - JSDDateTime(CivilDateTime& rhs); - - /** - * @brief Constructor with date initialisation using a CivilDateTime - */ - JSDDateTime(JulianDate& rhs); - - /** - * @brief Constructor with date initialisation using a MJDDateTime (Modified Julian Date - Used for ENVISAT) - */ - JSDDateTime(MJDDateTime& rhs); - - /** - * @brief Affectation operator - */ - JSDDateTime& operator=(const JSDDateTime& rhs); - - JulianDate get_day0hTU() const - { - return _day0hTU; - } - - double get_second() const - { - return _second; - } - - double get_decimal() const - { - return _decimal; - } - - void set_day0hTU(JulianDate day) - { - _day0hTU = day; - } - - void set_second(double second) - { - _second = second; - } - - void set_decimal(double decimal) - { - _decimal = decimal; - } - - void NormDate() ; - - /** - * @brief This function converts the current JSDDateTime into Julian Date - * @return 0 if no error or an int greater than 0 indicating the error - * @param julianDate [out] The classe that receives the result of the conversion of the current JSDDateTime in JulianDate - */ - int AsJulianDate(JulianDate* julian); - - /** - * @brief This function converts the current JSDDateTime into GMST Date - * @return 0 if no error or an int greater than 0 indicating the error - * @param julianDate [out] The class that receives the result of the conversion of the current JSDDateTime into GMST Date - */ - int AsGMSTDateTime(GMSTDateTime* GMST); - - operator JulianDate() ; - operator GMSTDateTime() ; - -protected: - - /** - * @brief Julian day at 0h00 UT - */ - JulianDate _day0hTU; - double _second; - double _decimal; - - -private: -}; -#endif diff --git a/Utilities/otbossim/include/ossim/projection/otb/JulianDate.h b/Utilities/otbossim/include/ossim/projection/otb/JulianDate.h deleted file mode 100644 index 9fa48ce0d9..0000000000 --- a/Utilities/otbossim/include/ossim/projection/otb/JulianDate.h +++ /dev/null @@ -1,94 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - -#ifndef JulianData_h -#define JulianData_h - -class CivilDateTime; -class GMSTDateTime; -class JSDDateTime; -/** - * @brief This class represents a date in the julian referential - */ -class JulianDate -{ -public: - /** - * @brief constructor - */ - JulianDate(); - /** - * @brief Destructor - */ - ~JulianDate(); - /** - * @brief Copy constructor - */ - JulianDate(const JulianDate& rhs); - - /** - * @brief Constructor with date initialisation using a CivilDateTime - */ - JulianDate(CivilDateTime& rhs); - - /** - * @brief Constructor with date initialisation using a JSDDateTime - */ - JulianDate(JSDDateTime& rhs); - /** - * @brief Constructor with date initialisation - */ - JulianDate(double julianDate); - /** - * @brief Affectation operator - */ - JulianDate& operator=(const JulianDate& rhs); - /** - * @brief Summation operator - */ - JulianDate& operator+(const JulianDate& rhs); - - void set_julianDate(double julianDate) - { - _julianDate = julianDate; - } - - double get_julianDate() const - { - return _julianDate; - } - - /** - * @brief This function converts the current JulianDate in JSDDateTime - * @return 0 if no error or an int greater than 0 indicating the error - * @param JSDdate [out] The classe that receives the result of the conversion of the current JulianDate in JSDDateTime - */ - int AsJSDDateTime(JSDDateTime* JSDdate); - - /** - * @brief This function converts the current JulianDate into GMSTDateTime - * @return 0 if no error or an int greater than 0 indicating the error - * @param GMSTDateTime [out] The class that receives the result of the conversion of the current JulianDate into GMSTDateTime - */ - int AsGMSTDateTime(GMSTDateTime* GMST); - - operator JSDDateTime() ; - operator GMSTDateTime() ; - - -protected: - - double _julianDate; - -private: -}; -#endif - diff --git a/Utilities/otbossim/include/ossim/projection/otb/MJDDateTime.h b/Utilities/otbossim/include/ossim/projection/otb/MJDDateTime.h deleted file mode 100644 index 697a7339e3..0000000000 --- a/Utilities/otbossim/include/ossim/projection/otb/MJDDateTime.h +++ /dev/null @@ -1,83 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - -#ifndef MJDDateTime_h -#define MJDDateTime_h - -class CivilDateTime; -/** - * @brief This class represents an MJD date (Modified Julian date) - */ -class MJDDateTime -{ -public: - /** - * @brief constructor - */ - MJDDateTime(); - /** - * @brief Destructor - */ - ~MJDDateTime(); - /** - * @brief Copy constructor - */ - MJDDateTime(const MJDDateTime& rhs); - - /** - * @brief Constructor with date initialisation - */ - MJDDateTime(long day, unsigned long second, unsigned long microsecond); - - /** - * @brief Affectation operator - */ - MJDDateTime& operator=(const MJDDateTime& rhs); - - long get_day() - { - return _day; - }; - - unsigned long get_second() - { - return _second; - }; - - unsigned long get_microsecond() - { - return _microsecond; - }; - - void set_day(long day) - { - _day = day; - }; - - void set_second(unsigned long second) - { - _second = second; - }; - - void set_microsecond(unsigned long microsecond) - { - _microsecond = microsecond; - }; -protected: - - long _day; - unsigned long _second; - unsigned long _microsecond; - - -private: -}; -#endif diff --git a/Utilities/otbossim/include/ossim/projection/otb/PlatformPosition.h b/Utilities/otbossim/include/ossim/projection/otb/PlatformPosition.h deleted file mode 100644 index 94df9759e6..0000000000 --- a/Utilities/otbossim/include/ossim/projection/otb/PlatformPosition.h +++ /dev/null @@ -1,105 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - -#ifndef PlatformPosition_h -#define PlatformPosition_h - -#include <JSDDateTime.h> - -class Ephemeris; -class ossimKeywordlist; - -/** - * @ingroup SARModel - * @brief This class handles the platform position - */ -class PlatformPosition -{ -public: - /** - * @brief Constructor - */ - PlatformPosition(); - /** - * @brief Destructor - */ - ~PlatformPosition(); - /** - * @brief Copy constructor - */ - PlatformPosition(const PlatformPosition& rhs); - - /** - * @brief Constructor with initialisation - * @param data Ephemeris - * @param nbrData Number of Ephemeris in data - * @remarks All the ephemeris have to be in the same coordinates system - * @remarks This constructor copy the content of data, so it's the - * calling fonction that have to manage the memory of data. - */ - PlatformPosition(Ephemeris** data, int nbrData); - - /** - * @brief Affectation operator - */ - PlatformPosition& operator=(const PlatformPosition& rhs); - - /** - * @brief This function interpolates its ephemeris to create a new ephemeris at the given date and time - * @param date Date and time at wich the interpolation have to be done - * @return The ephemeris at the given date, or NULL if an error occurs - */ - Ephemeris* Interpolate(JSDDateTime date); - - PlatformPosition* Clone() - { - return new PlatformPosition(*this); - }; - - void setData(Ephemeris** data, int nbrData); - - /** - * @brief Method to save object state to a keyword list. - * @param kwl Keyword list to save to. - * @param prefix added to keys when saved. - * @return true on success, false on error. - */ - bool saveState(ossimKeywordlist& kwl, - const char* prefix=0) const; - - /** - * @brief Method to the load (recreate) the state of the object from a - * keyword list. Return true if ok or false on error. - * @return true if load OK, false on error - */ - bool loadState (const ossimKeywordlist &kwl, const char *prefix=0); - -protected: - - /** - * @brief Number of platform positions - * @see _data - */ - int _nbrData; - - /** - * @brief Platform positions - */ - Ephemeris** _data; - - /** - * @brief This function deletes all the contents of the class - */ - void Clear(); -private: -}; - -#endif diff --git a/Utilities/otbossim/include/ossim/projection/otb/RectangularCoordinate.h b/Utilities/otbossim/include/ossim/projection/otb/RectangularCoordinate.h deleted file mode 100644 index 020729eccd..0000000000 --- a/Utilities/otbossim/include/ossim/projection/otb/RectangularCoordinate.h +++ /dev/null @@ -1,52 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - -#ifndef RectangularCoordinate_h -#define RectangularCoordinate_h - -#include <Coordinate.h> - -class GeodesicCoordinate; -/** - * @ingroup Date - * @brief This class represents a coordinate in a rectangular reference - */ - class RectangularCoordinate : public Coordinate - { - public: - /** - * @brief Constructor - */ - RectangularCoordinate(); - /** - * @brief Destructor - */ - ~RectangularCoordinate(); - /** - * @brief Cosntructor with initializations - */ - RectangularCoordinate(double x, double y, double z); - /** - * @brief Copy constructor - */ - RectangularCoordinate(const RectangularCoordinate& rhs); - - /** - * @brief Affectation operator - */ - RectangularCoordinate& operator=(const RectangularCoordinate& rhs); - - void AsGeodesicCoordinates(double demiGdAxe, double demiPtAxe, GeodesicCoordinate* geod); - protected: - private: - }; - - #endif diff --git a/Utilities/otbossim/include/ossim/projection/otb/RefPoint.h b/Utilities/otbossim/include/ossim/projection/otb/RefPoint.h deleted file mode 100644 index fdc9a315a9..0000000000 --- a/Utilities/otbossim/include/ossim/projection/otb/RefPoint.h +++ /dev/null @@ -1,78 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - -#ifndef RefPoint_h -#define RefPoint_h - -class Ephemeris; -class ossimKeywordlist; - -/** - * @brief This class handles the referential point - */ -class RefPoint -{ -public: - /** - * @brief Constuctor - */ - RefPoint(); - /** - * @brief Destructor - */ - ~RefPoint(); - /** - * @brief Copy constructor - */ - RefPoint(const RefPoint& rhs); - /** - * @brief Affectation operator - */ - RefPoint& operator=(const RefPoint& rhs); - - void set_ephemeris(Ephemeris* ephemeris); - void set_distance(double distance); - void set_pix_line(double pix_line); - void set_pix_col(double pix_col); - - Ephemeris* get_ephemeris(); - double get_distance() const; - double get_pix_line() const; - double get_pix_col() const; - - RefPoint* Clone() - { - return new RefPoint(*this); - }; - - /** - * @brief Method to save object state to a keyword list. - * @param kwl Keyword list to save to. - * @param prefix added to keys when saved. - * @return true on success, false on error. - */ - bool saveState(ossimKeywordlist& kwl, const char* prefix=0) const; - - /** - * @brief Method to the load (recreate) the state of the object from a - * keyword list. Return true if ok or false on error. - * @return true if load OK, false on error - */ - bool loadState (const ossimKeywordlist &kwl, const char *prefix=0); - -protected: - Ephemeris* _ephemeris; - double _distance; - double _pix_line; - double _pix_col; -private: -}; -#endif diff --git a/Utilities/otbossim/include/ossim/projection/otb/SarSensor.h b/Utilities/otbossim/include/ossim/projection/otb/SarSensor.h deleted file mode 100644 index 7854dd46f9..0000000000 --- a/Utilities/otbossim/include/ossim/projection/otb/SarSensor.h +++ /dev/null @@ -1,65 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - -#ifndef SarSensor_h -#define SarSensor_h - -#include <Sensor.h> - -class SensorParams; -class PlatformPosition; -class GeographicEphemeris; -class RectangularCoordinate; -class JSDDateTime; -/** - * @ingroup SARModel - * @brief This class provides basic location services for SAR sensors - */ -class SarSensor : Sensor -{ -public: - /** - * @brief Constructor - * - * @remarks This constructor creates a copy of params and position - */ - SarSensor(SensorParams* params, PlatformPosition* position); - /** - * @brief Destructor - */ - ~SarSensor(); - - /** - * @brief This function is able to convert image coordinates into geodetic world coordinates using a geometric SAR sensor model - * - * @param distance : Slant range of the image point - * @param time : Azimuth time of the image point - * @param height : Altitude of the world point - * @retval lon : Longitude of the world point - * @retval lat : Latitude of the world point - * - * @remark : the doppler frequency is set to zero in this implementation - */ - virtual int ImageToWorld(double distance, JSDDateTime time, double height, double& lon, double& lat); -protected: - - /** - * @brief This function is able to convert image coordinates into rectangular world coordinates - */ - int localisationSAR ( GeographicEphemeris PosVit , double lambda , - double dist , double fDop , int sensVisee , - double rayonEqu , double rayonPol , - double h , RectangularCoordinate* cart ); -private: -}; - - -#endif diff --git a/Utilities/otbossim/include/ossim/projection/otb/Sensor.h b/Utilities/otbossim/include/ossim/projection/otb/Sensor.h deleted file mode 100644 index fa135a6fa9..0000000000 --- a/Utilities/otbossim/include/ossim/projection/otb/Sensor.h +++ /dev/null @@ -1,57 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - -#ifndef Services_h -#define Services_h - -#include <JSDDateTime.h> - -class SensorParams; -class PlatformPosition; -class JSDDateTime; - -/** - * @ingroup SARModel - * @brief This class provides basic location services - */ -class Sensor -{ -public: - /** - * @brief Constructor - * - * @remarks This constructor creates a copy of the sensor model (params and position) - */ - Sensor(SensorParams* params, PlatformPosition* position); - /** - * @brief Destructor - */ - ~Sensor(); - - /** - * @brief This function is able to convert image coordinates into geodetic world coordinates using a sensor model - * - * @param distance : Slant range of the image point - * @param time : Azimuth time of the image point - * @param height : Altitude of the world point - * @retval lon : Longitude of the world point - * @retval lat : Latitude of the world point - */ - virtual int ImageToWorld(double distance, JSDDateTime time, double height, double& lon, double& lat) = 0; -protected: - SensorParams * _params; - PlatformPosition* _position; - -private: -}; - - -#endif diff --git a/Utilities/otbossim/include/ossim/projection/otb/SensorParams.h b/Utilities/otbossim/include/ossim/projection/otb/SensorParams.h deleted file mode 100644 index 64033a6187..0000000000 --- a/Utilities/otbossim/include/ossim/projection/otb/SensorParams.h +++ /dev/null @@ -1,227 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - -#ifndef SensorParams_h -#define SensorParams_h - -class ossimKeywordlist; - -/** - * @ingroup SARModel - * @brief This class handles the sensor parameters - */ - -class SensorParams -{ -public: - - enum SightDirection - { - Left = 0, - Right = 1 - }; - - /** - * @brief Constructor - */ - SensorParams(); - /** - * @brief Destructor - */ - ~SensorParams(); - - /** - *@brief Copy constructor - */ - SensorParams(const SensorParams& rhs); - - /** - * @brief Affectation operator - */ - SensorParams& operator=(const SensorParams& rhs); - - double get_prf() const - { - return _prf; - } - - double get_sf() const - { - return _sf; - } - - double get_rwl() const - { - return _rwl; - } - - void set_prf(double prf) - { - _prf = prf; - } - - void set_sf(double sf) - { - _sf = sf; - } - - void set_rwl(double rwl) - { - _rwl = rwl; - } - - SightDirection get_sightDirection() const - { - return _sightDirection; - } - - void set_sightDirection(SightDirection sight) - { - _sightDirection = sight; - } - - virtual SensorParams* Clone() - { - return new SensorParams(*this); - } - - int get_col_direction() const - { - return _col_direction; - } - - int get_lin_direction() const - { - return _lin_direction; - } - - double get_nAzimuthLook() const - { - return _nAzimuthLook ; - } - - double get_nRangeLook() const - { - return _nRangeLook ; - } - - void set_col_direction(int dir) - { - _col_direction = dir; - } - - void set_lin_direction(int dir) - { - _lin_direction = dir; - } - - void set_nAzimuthLook(double look) - { - _nAzimuthLook = look; - } - - void set_nRangeLook(double look) - { - _nRangeLook = look; - } - - double get_semiMajorAxis() const - { - return _semiMajorAxis ; - } - - double get_semiMinorAxis() const - { - return _semiMinorAxis ; - } - - void set_semiMajorAxis(double value) - { - _semiMajorAxis = value; - } - - void set_semiMinorAxis(double value) - { - _semiMinorAxis = value; - } - - /** - * @brief Method to save object state to a keyword list. - * @param kwl Keyword list to save to. - * @param prefix added to keys when saved. - * @return true on success, false on error. - */ - bool saveState(ossimKeywordlist& kwl, const char* prefix=0) const; - - /** - * @brief Method to the load (recreate) the state of the object from a - * keyword list. Return true if ok or false on error. - * @return true if load OK, false on error - */ - bool loadState (const ossimKeywordlist &kwl, const char *prefix=0); - -protected: - /** - * @brief Nominal PRF, Hz - */ - double _prf; - - /** - * @brief Sampling frequency - */ - double _sf; - - /** - * @brief Radar wave length - */ - double _rwl; - - /** - * @brief Columns direction (1=increasing, -1=decreasing) - */ - int _col_direction; - - /** - * @brief Lines direction (1=increasing, -1=decreasing) - */ - int _lin_direction; - - /** - * @brief Antenna pointing direction - */ - SightDirection _sightDirection; - - /** - * @brief Ellipsoid semi_major axis, m - * Default : WGS84 - */ - double _semiMajorAxis; - - /** - * @brief Ellipsoid semi_minor axis, m - * Default : WGS84 - */ - double _semiMinorAxis; - - /** - * @brief Number of azimuth looks - */ - double _nAzimuthLook ; - - /** - * @brief Number of range looks - */ - double _nRangeLook ; - -private: -}; - -#endif diff --git a/Utilities/otbossim/src/ossim/projection/otb/CivilDateTime.cpp b/Utilities/otbossim/src/ossim/projection/otb/CivilDateTime.cpp deleted file mode 100644 index 21c6c802a5..0000000000 --- a/Utilities/otbossim/src/ossim/projection/otb/CivilDateTime.cpp +++ /dev/null @@ -1,468 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - -#include <JulianDate.h> -#include <CivilDateTime.h> -#include <JSDDateTime.h> -#include <GMSTDateTime.h> - -#include <cmath> -#include <cstring> -#include <cstdlib> -#include <cstdio> -#include <ostream> - -const double CivilDateTime::JOURCIVIL_LENGTH = 86400.0 ; - -CivilDateTime::CivilDateTime(): - _year(0), - _month(0), - _day(0), - _second(0), - _decimal(0.0) -{ -} - -CivilDateTime::CivilDateTime(int year, int month, int day, int second, double decimal): - _year(year), - _month(month), - _day(day), - _second(second), - _decimal(decimal) -{ -} - -CivilDateTime::CivilDateTime(char* Utc) -{ - SetUtcDateTime(Utc); -} - -CivilDateTime::CivilDateTime(const char* Utc) -{ - SetUtcDateTime(Utc); -} - -CivilDateTime::~CivilDateTime() -{ -} - -CivilDateTime::CivilDateTime(const CivilDateTime& rhs): - _year(rhs._year), - _month(rhs._month), - _day(rhs._day), - _second(rhs._second), - _decimal(rhs._decimal) -{ - -} - -CivilDateTime& CivilDateTime::operator=(const CivilDateTime& rhs) -{ - _year = rhs._year; - _month = rhs._month; - _day = rhs._day; - _second = rhs._second; - _decimal = rhs._decimal; - - return *this; -} - -int CivilDateTime::AsJulianDate(JulianDate* julianDate) -{ - int etat , test ; - int an , mois , i , j ; - double b , d ; - - if (_month > 2) - { - an = _year ; - mois = _month ; - } - else - { - an = _year - 1 ; - mois = _month + 12 ; - } - - test = _year * 10000 + _month * 100 + _day ; - if ((test > 15821004) && (test < 15821015)) - etat = 1 ; - else - { - etat = 0 ; - d = (an < 0) ? 0.75 : 0.0 ; - if (test >= 15821015) - { - i = an / 100 ; - j = 2 - i + i/4 ; - b = (double)j + 1720994.5 ; - } - else - b = 1720994.5 ; - - i = (int) (365.25 * (double)an - d) ; - j = (int) (30.6001 * (double)(mois + 1)) ; - double jourJulien = (double)(i + j) + (double)_day - + ((double)_second + _decimal) / JOURCIVIL_LENGTH + b ; - - julianDate->set_julianDate(jourJulien); - } - - return etat; -} - -int CivilDateTime::SetUtcDateTime(char* Utc) -{ - char str_an[5]; - char str_day[3]; - char str_month[4]; - char str_hour[3]; - char str_min[3]; - char str_sec[3]; - char str_micro[7]; - int i; - double exposant; - - /* - * year extraction - */ - for (i = 0; i < 4; i++) - { - str_an[i] = Utc[i+7]; - } - - str_an[4] = '\0'; - _year = atoi(str_an); - if ( (_year > 2050) || (_year < 1950) ) - { - return 1; - } - - /* - * month extraction - */ - for (i = 0; i < 3; i++) - { - str_month[i] = Utc[i+3]; - } - - str_month[3] = '\0'; - if (!strcmp(str_month, "JAN")) _month = 1; - else if (!strcmp(str_month, "FEV")) _month = 2; - else if (!strcmp(str_month, "MAR")) _month = 3; - else if (!strcmp(str_month, "APR")) _month = 4; - else if (!strcmp(str_month, "MAY")) _month = 5; - else if (!strcmp(str_month, "JUN")) _month = 6; - else if (!strcmp(str_month, "JUL")) _month = 7; - else if (!strcmp(str_month, "AUG")) _month = 8; - else if (!strcmp(str_month, "SEP")) _month = 9; - else if (!strcmp(str_month, "OCT")) _month = 10; - else if (!strcmp(str_month, "NOV")) _month = 11; - else if (!strcmp(str_month, "DEC")) _month = 12; - else - { - return 1; - } - - /* - * day extraction - */ - for (i = 0; i < 2; i++) - { - str_day[i] = Utc[i]; - } - - str_day[2] = '\0'; - _day = atoi(str_day); - if ( (_day < 1) || (_day > 31) ) - { - return 1; - } - - /* - * seconds extraction - */ - for (i = 0; i < 2; i++) - { - str_hour[i] = Utc[i+12]; - str_min[i] = Utc[i+15]; - str_sec[i] = Utc[i+18]; - } - - str_hour[2] = '\0';if ( (atoi(str_hour) < 0) || (atoi(str_hour) > 23) ) - { - return 1; - } - - str_min[2] = '\0';if ( (atoi(str_min) < 0) || (atoi(str_hour) > 59) ) - { - return 1; - } - str_sec[2] = '\0';if ( (atoi(str_sec) < 0) || (atoi(str_hour) > 59) ) - { - return 1; - } - _second = 3600*atoi(str_hour) + 60*atoi(str_min) + atoi(str_sec); - - /* - * microseconds extraction - */ - for (i = 0; i < 6; i++) - { - str_micro[i] = Utc[i+21]; - } - - str_micro[6] = '\0'; - i = 0; - exposant = 10e-6; - while ((unsigned int)i < strlen(str_micro) ) - { - if (str_micro[i] == '0') exposant = exposant * 0.1; - i++; - } - - _decimal = exposant * (double) atoi(str_micro); - if ( (_decimal < 0) || (_decimal >= 1) ) - { - return 1; - } - - return 0; - -} - -int CivilDateTime::SetUtcDateTime(const char* Utc) -{ - char str_an[5]; - char str_day[3]; - char str_month[4]; - char str_hour[3]; - char str_min[3]; - char str_sec[3]; - char str_micro[7]; - int i; - double exposant; - - /* - * year extraction - */ - for (i = 0; i < 4; i++) - { - str_an[i] = Utc[i+7]; - } - - str_an[4] = '\0'; - _year = atoi(str_an); - if ( (_year > 2050) || (_year < 1950) ) - { - return 1; - } - - /* - * month extraction - */ - for (i = 0; i < 3; i++) - { - str_month[i] = Utc[i+3]; - } - - str_month[3] = '\0'; - if (!strcmp(str_month, "JAN")) _month = 1; - else if (!strcmp(str_month, "FEV")) _month = 2; - else if (!strcmp(str_month, "MAR")) _month = 3; - else if (!strcmp(str_month, "APR")) _month = 4; - else if (!strcmp(str_month, "MAY")) _month = 5; - else if (!strcmp(str_month, "JUN")) _month = 6; - else if (!strcmp(str_month, "JUL")) _month = 7; - else if (!strcmp(str_month, "AUG")) _month = 8; - else if (!strcmp(str_month, "SEP")) _month = 9; - else if (!strcmp(str_month, "OCT")) _month = 10; - else if (!strcmp(str_month, "NOV")) _month = 11; - else if (!strcmp(str_month, "DEC")) _month = 12; - else - { - return 1; - } - - /* - * day extraction - */ - for (i = 0; i < 2; i++) - { - str_day[i] = Utc[i]; - } - - str_day[2] = '\0'; - _day = atoi(str_day); - if ( (_day < 1) || (_day > 31) ) - { - return 1; - } - - /* - * seconds extraction - */ - for (i = 0; i < 2; i++) - { - str_hour[i] = Utc[i+12]; - str_min[i] = Utc[i+15]; - str_sec[i] = Utc[i+18]; - } - - str_hour[2] = '\0';if ( (atoi(str_hour) < 0) || (atoi(str_hour) > 23) ) - { - return 1; - } - - str_min[2] = '\0';if ( (atoi(str_min) < 0) || (atoi(str_hour) > 59) ) - { - return 1; - } - str_sec[2] = '\0';if ( (atoi(str_sec) < 0) || (atoi(str_hour) > 59) ) - { - return 1; - } - _second = 3600*atoi(str_hour) + 60*atoi(str_min) + atoi(str_sec); - - /* - * microseconds extraction - */ - for (i = 0; i < 6; i++) - { - str_micro[i] = Utc[i+21]; - } - - str_micro[6] = '\0'; - i = 0; - exposant = 10e-6; - while ((unsigned int)i < strlen(str_micro) ) - { - if (str_micro[i] == '0') exposant = exposant * 0.1; - i++; - } - - _decimal = exposant * (double) atoi(str_micro); - if ( (_decimal < 0) || (_decimal >= 1) ) - { - return 1; - } - - return 0; - -} - - -int CivilDateTime::AsJSDDateTime(JSDDateTime* JSDdate) -{ - int etat , k ; - JulianDate jourJulien; - double r ; - - etat = AsJulianDate(&jourJulien ); - if (etat == 0) - { - k = (int)(jourJulien.get_julianDate() - 0.5) ; - - double day0hTU = (double)k + 0.5; - JSDdate->set_day0hTU(JulianDate(day0hTU)); - - r = (jourJulien.get_julianDate() - day0hTU) * JOURCIVIL_LENGTH ; - JSDdate->set_second(floor (r)) ; - JSDdate->set_decimal(r - JSDdate->get_second()) ; - } - - return etat ; -} - -int CivilDateTime::AsGMSTDateTime(GMSTDateTime* GMST) -{ - const double DEUXPI = 6.28318530717958647693 ; - const double OMEGATERRE = 6.28318530717958647693 / 86164.09054 ; - int etat ; - JulianDate jourJulien; - double t=0.0; - double tsm0hTU=0.0; - double tsm; - CivilDateTime date0hTU(_year, _month, _day, 0, 0.0); - - - etat = date0hTU.AsJulianDate(&jourJulien ); - if (etat == 0) - { - if (GMST->get_origine() == GMSTDateTime::AN1900) - { - t = (jourJulien.get_julianDate() - 2415020.0) / 36525.0 ; - tsm0hTU = 23925.836 + t * (8640184.542 + t * 0.0929) ; - tsm0hTU = tsm0hTU * DEUXPI / JOURCIVIL_LENGTH ; - } - else if (GMST->get_origine() == GMSTDateTime::AN1950) - { - t = jourJulien.get_julianDate() - 2433281.5 ; - tsm0hTU = 1.72944494 + t * 6.3003880987 ; - } - else if (GMST->get_origine() == GMSTDateTime::AN2000) - { - t = (jourJulien.get_julianDate() - 2451545.0) / 36525.0 ; - tsm0hTU = 24110.54841 + t * (8640184.812866 + t * (0.093103 - t * 6.210e-6)) ; - tsm0hTU = tsm0hTU * DEUXPI / JOURCIVIL_LENGTH ; - } - t = tsm0hTU + ((double)_second + _decimal) * OMEGATERRE ; - tsm = fmod (t, DEUXPI) ; - - if (tsm < 0.0) - { - tsm = tsm + DEUXPI ; - } - GMST->set_tms(tsm); - } - - return etat ; -} - - -CivilDateTime::operator JulianDate() -{ - JulianDate date; - AsJulianDate(&date); - return date; -} - -CivilDateTime::operator JSDDateTime() -{ - JSDDateTime date; - AsJSDDateTime(&date); - return date; -} - -CivilDateTime::operator GMSTDateTime() -{ - GMSTDateTime date; - AsGMSTDateTime(&date); - return date; -} - -std::ostream& CivilDateTime::print(std::ostream& out) const -{ - out << "CivilDateTime:" - << "\nyear: " << _year - << "\nmonth: " << _month - << "\nday: " << _day - << "\nsecond: " << _second - << "\ndecimal: " << _decimal - << std::endl; - - return out; -} - -std::ostream& operator<<(std::ostream& out, const CivilDateTime& obj) -{ - return obj.print(out); -} diff --git a/Utilities/otbossim/src/ossim/projection/otb/Coordinate.cpp b/Utilities/otbossim/src/ossim/projection/otb/Coordinate.cpp deleted file mode 100644 index dac90ecb98..0000000000 --- a/Utilities/otbossim/src/ossim/projection/otb/Coordinate.cpp +++ /dev/null @@ -1,56 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - - -#include <Coordinate.h> - - -Coordinate::Coordinate(): - _x(0.0), - _y(0.0), - _z(0.0) -{ -} - -Coordinate::~Coordinate() -{ -} - -Coordinate::Coordinate(double x, double y, double z): - _x(x), - _y(y), - _z(z) -{ -} - -Coordinate::Coordinate(const Coordinate& rhs): - _x(rhs._x), - _y(rhs._y), - _z(rhs._z) -{ -} - -Coordinate& Coordinate::operator=(const Coordinate& rhs) -{ - _x = rhs._x; - _y = rhs._y; - _z = rhs._z; - - return *this; -} - -void Coordinate::set_coordinates(double x, double y, double z) -{ - _x = x; - _y = y; - _z = z; - -} diff --git a/Utilities/otbossim/src/ossim/projection/otb/Ephemeris.cpp b/Utilities/otbossim/src/ossim/projection/otb/Ephemeris.cpp deleted file mode 100644 index f4570863c0..0000000000 --- a/Utilities/otbossim/src/ossim/projection/otb/Ephemeris.cpp +++ /dev/null @@ -1,196 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - -#include <Ephemeris.h> -#include <ossim/base/ossimDpt3d.h> -#include <ossim/base/ossimKeywordlist.h> -#include <ossim/base/ossimNotify.h> -#include <ossim/base/ossimString.h> - -static const char PREFIX[] = "ephemeris."; -static const char DATE_JULIAN_KW[] = "date.julian"; -static const char DATE_SECOND_KW[] = "date.second"; -static const char DATE_DECIMAL_KW[] = "date.decimal"; -static const char POSITION_KW[] = "position"; -static const char VELOCITY_KW[] = "velocity"; - -Ephemeris::Ephemeris() -{ - _position[0] = 0.0; - _position[1] = 0.0; - _position[2] = 0.0; - _vitesse[0] = 0.0; - _vitesse[1] = 0.0; - _vitesse[2] = 0.0; -} - -Ephemeris::~Ephemeris() -{ -} - -Ephemeris::Ephemeris(JSDDateTime date, double pos[3], double vitesse[3]): - _date(date) -{ - _position[0] = pos[0]; - _position[1] = pos[1]; - _position[2] = pos[2]; - _vitesse[0] = vitesse[0]; - _vitesse[1] = vitesse[1]; - _vitesse[2] = vitesse[2]; -} - -Ephemeris::Ephemeris(const Ephemeris& rhs): - _date(rhs._date) -{ - _position[0] = rhs._position[0]; - _position[1] = rhs._position[1]; - _position[2] = rhs._position[2]; - _vitesse[0] = rhs._vitesse[0]; - _vitesse[1] = rhs._vitesse[1]; - _vitesse[2] = rhs._vitesse[2]; -} - -Ephemeris& Ephemeris::operator=(const Ephemeris& rhs) -{ - _position[0] = rhs._position[0]; - _position[1] = rhs._position[1]; - _position[2] = rhs._position[2]; - _vitesse[0] = rhs._vitesse[0]; - _vitesse[1] = rhs._vitesse[1]; - _vitesse[2] = rhs._vitesse[2]; - _date = rhs._date; - - return *this; -} - -bool Ephemeris::saveState(ossimKeywordlist& kwl, const char* prefix) const -{ - std::string pfx; - if (prefix) - { - pfx = prefix; - } - pfx += PREFIX; - - ossimDpt3d pos(_position[0], _position[1], _position[2]); - ossimDpt3d vit(_vitesse[0], _vitesse[1], _vitesse[2]); - JulianDate jd = _date.get_day0hTU(); - - kwl.add(pfx.c_str(), DATE_JULIAN_KW, jd.get_julianDate()); - kwl.add(pfx.c_str(), DATE_SECOND_KW, _date.get_second()); - kwl.add(pfx.c_str(), DATE_DECIMAL_KW, _date.get_decimal()); - kwl.add(pfx.c_str(), POSITION_KW, pos.toString(15).c_str()); - kwl.add(pfx.c_str(), VELOCITY_KW, vit.toString(15).c_str()); - - return true; -} - -bool Ephemeris::loadState(const ossimKeywordlist& kwl, const char* prefix) -{ - static const char MODULE[] = "Ephemeris::loadState"; - - bool result = true; - - std::string pfx; - if (prefix) - { - pfx = prefix; - } - pfx += "ephemeris."; - - const char* lookup = 0; - ossimString s; - double d; - - lookup = kwl.find(pfx.c_str(), DATE_JULIAN_KW); - if (lookup) - { - s = lookup; - d = s.toDouble(); - JulianDate jd(d); - _date.set_day0hTU(jd); - } - else - { - ossimNotify(ossimNotifyLevel_WARN) - << MODULE << " Keyword not found: " << DATE_JULIAN_KW << "\n"; - - result = false; - } - - lookup = kwl.find(pfx.c_str(), DATE_SECOND_KW); - if (lookup) - { - s = lookup; - d = s.toDouble(); - _date.set_second(d); - } - else - { - ossimNotify(ossimNotifyLevel_WARN) - << MODULE << " Keyword not found: " << DATE_SECOND_KW << "\n"; - result = false; - } - - lookup = kwl.find(pfx.c_str(), DATE_DECIMAL_KW); - if (lookup) - { - s = lookup; - d = s.toDouble(); - _date.set_decimal(d); - } - else - { - ossimNotify(ossimNotifyLevel_WARN) - << MODULE << " Keyword not found: " << DATE_DECIMAL_KW << "\n"; - result = false; - } - - lookup = kwl.find(pfx.c_str(), POSITION_KW); - if (lookup) - { - std::string ps = lookup; - - ossimDpt3d pt; - pt.toPoint(ps); - - _position[0] = pt.x; - _position[1] = pt.y; - _position[2] = pt.z; - } - else - { - ossimNotify(ossimNotifyLevel_WARN) - << MODULE << " Keyword not found: " << POSITION_KW << "\n"; - result = false; - } - - lookup = kwl.find(pfx.c_str(), VELOCITY_KW); - if (lookup) - { - std::string ps = lookup; - - ossimDpt3d pt; - pt.toPoint(ps); - - _vitesse[0] = pt.x; - _vitesse[1] = pt.y; - _vitesse[2] = pt.z; - } - else - { - ossimNotify(ossimNotifyLevel_WARN) - << MODULE << " Keyword not found: " << VELOCITY_KW << "\n"; - result = false; - } - - return result; -} diff --git a/Utilities/otbossim/src/ossim/projection/otb/Equation.cpp b/Utilities/otbossim/src/ossim/projection/otb/Equation.cpp deleted file mode 100644 index dfdece6114..0000000000 --- a/Utilities/otbossim/src/ossim/projection/otb/Equation.cpp +++ /dev/null @@ -1,948 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - -#include <Equation.h> - -const double Equation::Epsilon = 1.e-12; - -Equation::Equation(): - _coefficients(NULL), - _degree(0), - _nbrSol(0), - _order(NULL), - _solutions(NULL) -{ -} - -Equation::~Equation() -{ - if (_coefficients != NULL) - delete _coefficients; - if(_order != NULL) - delete _order; - if(_solutions != NULL) - delete _solutions; -} - -Equation::Equation(int degree, std::complex<double>* coefficients): - _coefficients(NULL), - _degree(0), - _nbrSol(0), - _order(NULL), - _solutions(NULL) -{ - CreateEquation(degree, coefficients); -} - -void Equation::CreateEquation(int degree, std::complex<double>* coefficients) -{ - if (_coefficients != NULL) - { - delete _coefficients; - } - - if(_order != NULL) - delete _order; - if(_solutions != NULL) - delete _solutions; - - _coefficients = new std::complex<double>[degree+1]; - _degree = degree; - - for (int i=0;i<=degree;i++) - { - _coefficients[i] = coefficients[i]; - } -} - -Equation::Equation(const Equation& rhs) -{ - CreateEquation(rhs._degree, rhs._coefficients); -} - -Equation& Equation::operator=(const Equation& rhs) -{ - CreateEquation(rhs._degree, rhs._coefficients); - return *this; -} - -void Equation::ComputeTrueDegree() -{ - double r = 0.0; - _trueDegree = _degree +1; - while (r <= Epsilon && _trueDegree > 0) - { - _trueDegree = _trueDegree - 1 ; - r = abs(_coefficients[_trueDegree]); - } -} - -void Equation::Normalisation() -{ - int i; - - for (i=0;i<_trueDegree;i++) - { - _coefficients[i] = _coefficients[i] / _coefficients[_trueDegree]; - } - _coefficients[_trueDegree] = std::complex<double>(1.0,0.0); - - int eMax = 0; - int eMin = 0; - int e; - double r; - - /* - * Normalisation par a power of 10 - */ - for (i = 0 ; i < _trueDegree ; i++) - { - r = abs(_coefficients[i]) ; - if (r >= Epsilon) - { - r = log (r) ; - r = r / log (10.0) ; - e = ((int)r) / ((int)(_trueDegree - i)) ; - if (e > eMax) - eMax = e ; - if (e < eMin) - eMin = e ; - } - } - - /* - * Normalisation for big values - */ - if (eMax > 0) - { - /* Normalisation of the unknown for big values */ - _normalisationType = GreatValues; - _normalisationCoefficient = pow (10.0, (double)eMax) ; - r = 1.0 ; - for (i = _trueDegree-1 ; i >= 0 ; i--) - { - r = r * _normalisationCoefficient ; - _coefficients[i] = _coefficients[i] / std::complex<double>(r,0.0); - } - } - else if (eMin < 0) - { - /* Normalisation of the unknown for small */ - _normalisationType = SmallValues; - _normalisationCoefficient = pow(10.0,(double)(-eMin)) ; - r = 1.0 ; - for (i = _trueDegree-1 ; i >= 0 ; i--) - { - r = r * _normalisationCoefficient ; - _coefficients[i] = _coefficients[i] * std::complex<double>(r,0.0); - } - } -} - -void Equation::DeNormalisation() -{ - if (_normalisationType == GreatValues) - { - for (int i=0;i<_nbrSol;i++) - { - _solutions[i] = _solutions[i] * std::complex<double>(_normalisationCoefficient,0.0); - } - } - else - { - for (int i=0;i<_nbrSol;i++) - { - _solutions[i] = _solutions[i] / std::complex<double>(_normalisationCoefficient,0.0); - } - } -} -std::complex<double> Equation::Proche(std::complex<double> z, double epsilon) -{ - double x, y, ax, ay ; - std::complex<double> result ; - - x = z.real(); - y = z.imag(); - ax = fabs(x); - ay = fabs(y); - - if (ax < epsilon && ay < epsilon) - result = std::complex<double>(0.0, 0.0) ; - else if (ay < epsilon) - result = std::complex<double>(x, 0.0) ; - else if (ax < epsilon) - result = std::complex<double>(0.0, y) ; - else - { - if ((ay / ax) < epsilon) - result = std::complex<double>(x, 0.0) ; - else if ((ax / ay) < epsilon) - result = std::complex<double>(0.0,y) ; - else - result = z ; - } - - return result ; -} - -void Equation::Solve() -{ - ComputeTrueDegree(); - Normalisation(); - - if(_trueDegree == 1) - { - Solve1(); - } - else if(_trueDegree == 2) - { - Solve2(); - } - else if(_trueDegree == 3) - { - Solve3(); - } - else if(_trueDegree == 4) - { - Solve4(); - } - DeNormalisation(); -} - -void Equation::Solve1() -{ - _nbrSol = 1; - if(_order != NULL) - delete _order; - - _order = new int[1]; - _order[0] = 1; - - if(_solutions != NULL) - delete _solutions; - _solutions = new std::complex<double>[1]; - _solutions[0] = Proche(-_coefficients[0], Epsilon); -} - -void Equation::Solve2() -{ - double r1, r2 ; - // double epsilon = 1.e-12 ; - std::complex<double> t1, t2, d, z ; - std::complex<double> aa[2] ; - - aa[0] = _coefficients[0]/ _coefficients[2]; - aa[1] = _coefficients[1]/ _coefficients[2]; - - t1 = aa[1]* aa[1] ; - t2 = aa[0]* std::complex<double>(4.0, 0.0) ; - r1 = abs(t1) ; - r2 = abs(t2) ; - if (r2 > r1) - r1 = r2 ; - if (r1 > Epsilon) - { - d = t1- t2 ; - t1 = d/std::complex<double>(r1, 0.0) ; - } - else - { - d = std::complex<double>(0.0, 0.0) ; - t1 = std::complex<double>(0.0, 0.0) ; - } - r1 = abs (t1) ; - - if (r1 <= Epsilon) - { - /* 1 double root */ - - if(_solutions != NULL) - delete _solutions; - _solutions = new std::complex<double>[1]; - - if(_order != NULL) - delete _order; - _order = new int[1]; - - - _nbrSol = 1 ; - z = aa[1]/std::complex<double>(-2.0, 0.0); - _solutions[0] = Proche (z, Epsilon) ; - _order[0] = 2 ; - } - else - { - /* 2 simple roots */ - - if(_solutions != NULL) - delete _solutions; - _solutions = new std::complex<double>[2]; - - if(_order != NULL) - delete _order; - _order = new int[2]; - - - _nbrSol = 2 ; - d = sqrt(d) ; - z = (d-aa[1])/std::complex<double>(2.0, 0.0) ; - _solutions[0] = Proche (z, Epsilon) ; - z = (d+aa[1])/std::complex<double>(-2.0, 0.0); - _solutions[1] = Proche (z, Epsilon) ; - _order[0] = 1 ; - _order[1] = 1 ; - } -} - -void Equation::Solve3(int d4) -{ - int i1, i2, i3 ; - int d3_1r3 , d3_1r2_1r1 ; - double r1, r2, ra[3] ; - // double epsilon = 1.e-12 ; - std::complex<double> j, j2 ; - std::complex<double> d, q, r, s, t, u, v, w ; - std::complex<double> aa[3], zProv[3][3] ; - - - j = std::complex<double>(-0.5, sqrt (3.0) / 2.0) ; - j2 = std::complex<double>(-0.5, -sqrt (3.0) / 2.0) ; - - /* Normalisation of coefficients */ - for (i1 = 0; i1 < 3; i1++) - aa[i1] = _coefficients[i1]/_coefficients[3]; - - if ( d4 == 0 ) - { - /* Test of existence of a triple root */ - d3_1r3 = TestDegree3Triple(aa, Epsilon) ; - - /* Test of existence of 1 doubleroot + 1 simple root */ - d3_1r2_1r1 = TestDegree3SimpleDouble(aa, Epsilon) ; - } - else - { - d3_1r3 = 0 ; - d3_1r2_1r1 = 0 ; - } - - - if (d3_1r3 == 1) - { - /* 1 triple root */ - if(_solutions != NULL) - delete _solutions; - _solutions = new std::complex<double>[1]; - - if(_order != NULL) - delete _order; - _order = new int[1]; - - _nbrSol = 1 ; - _solutions[0] = Proche (aa[2]/std::complex<double>(-3.0, 0.0) , Epsilon) ; - _order[0] = 3 ; - } - else if (d3_1r2_1r1 == 1) - { - /* 1 simple root + 1 double root */ - - if(_solutions != NULL) - delete _solutions; - _solutions = new std::complex<double>[2]; - - if(_order != NULL) - delete _order; - _order = new int[2]; - - u = (aa[1]* aa[2])/ std::complex<double>(6.0, 0.0) ; - v = aa[0]/ std::complex<double> (2.0, 0.0); - w = pow(aa[2], 3.0)/ std::complex<double>(27.0, 0.0); - r = (u-v)- w ; - u = pow (r, 1.0 / 3.0) ; - w = aa[2]/ std::complex<double>(3.0, 0.0); - zProv[0][0] = -u; - zProv[0][1] = u * std::complex<double>(2.0,0.0); - zProv[1][0] = u * (j + std::complex<double>(1.0, 0.0)); - zProv[1][1] = u * (j2* std::complex<double>(2.0, 0.0)); - zProv[2][0] = u * (j2+ std::complex<double>(1.0, 0.0)); - zProv[2][1] = u * (j * std::complex<double>(2.0, 0.0)); - for (i1 = 0; i1 <= 2; i1++) - { - zProv[i1][0] = zProv[i1][0]- w; - zProv[i1][1] = zProv[i1][1]- w; - } - for (i2 = 0; i2 < 3; i2++) - { - u = std::complex<double>(1.0, 0.0) ; - - for (i1 = 2; i1 >= 0; i1--) - u = u*zProv[i2][0]+aa[i1] ; - - r1 = abs (u) ; - u = std::complex<double>(1.0, 0.0) ; - - for (i1 = 2; i1 >= 0; i1--) - u = u*zProv[i2][1]+ aa[i1] ; - - r2 = abs (u) ; - ra[i2] = r1 * r1 + r2 * r2 ; - } - i3 = IndiceMin(3, ra) ; - _solutions[0] = Proche ( zProv[i3][0] , Epsilon ) ; - _solutions[1] = Proche ( zProv[i3][1] , Epsilon ) ; - _nbrSol = 2 ; - _order[0] = 2 ; - _order[1] = 1 ; - } - else - { - /* 3 simple roots */ - u = aa[1]/ std::complex<double>(3.0, 0.0); - v = (aa[2]* aa[2]) / std::complex<double>(9.0, 0.0) ; - q = u- v ; - u = (aa[1]* aa[2]) / std::complex<double>(6.0, 0.0) ; - v = aa[0]/ std::complex<double>(2.0, 0.0) ; - w = pow (aa[2], 3.0) / std::complex<double>(27.0, 0.0); - r = (u-v) - w ; - d = sqrt(pow (q, 3.0) + pow (r, 2.0)) ; - s = pow ((r+ d) , 1.0 / 3.0) ; - t = pow ((r- d) , 1.0 / 3.0) ; - w = aa[2]/ std::complex<double>(3.0, 0.0); - - zProv[0][0] = s+ t; - zProv[0][1] = (j* s) + (j2* t) ; - zProv[0][2] = (j2* s) + (j* t) ; - zProv[1][0] = s + (j* t); - zProv[1][1] = (j* s) + t; - zProv[1][2] = j2 * (s+ t) ; - zProv[2][0] = s + (j2* t) ; - zProv[2][1] = j * (s+ t); - zProv[2][2] = (j2* s) + t; - for (i1 = 0; i1 < 3; i1++) - { - for (i2 = 0; i2 < 3; i2++) - zProv[i1][i2] = zProv[i1][i2]- w; - } - for (i3 = 0; i3 < 3; i3++) - { - ra[i3] = 0.0 ; - for (i2 = 0; i2 < 3; i2++) - { - u = std::complex<double>(1.0, 0.0) ; - for (i1 = 2; i1 >= 0; i1--) - u = (u* zProv[i3][i2]) + aa[i1] ; - - r1 = abs (u) ; - ra[i3] = ra[i3] + r1 * r1 ; - } - } - i1 = IndiceMin(3, ra) ; - - - if(_solutions != NULL) - delete _solutions; - _solutions = new std::complex<double>[3]; - - if(_order != NULL) - delete _order; - _order = new int[3]; - - _nbrSol = 3 ; - for (i3 = 0; i3 < 3; i3++) - _solutions[i3] = Proche (zProv[i1][i3] , Epsilon) ; - _order[0] = 1 ; - _order[1] = 1 ; - _order[2] = 1 ; - } -} - -void Equation::Solve4() -{ - int i1, i2 ; - int d4_1r4, d4_2r2, d4_1r3_1r1, d4_1r2_2r1 ; - int d4 = 1 ; - double epsilon = 1.e-12 ; - double r, h[4] ; - std::complex<double> d, u, v, w, x, y ; - std::complex<double> aa[4], k[4], b[4], zProv[2][4] ; - - - /* Normalisation of coefficients */ - for (i1 = 0; i1 < 4; i1++) - aa[i1] = _coefficients[i1]/ _coefficients[4]; - - /* Equation reduction : on the form */ - /* (x-s)**4 + p(x-s)**2 + q(x-s) + r = 0 */ - /* these coefficients are inserted into table k : */ - /* k[0] = s */ - /* k[1] = p */ - /* k[2] = q */ - /* k[3] = r */ - k[0] = aa[3]/ std::complex<double>(-4.0, 0.0) ; - u = aa[2] ; - v = ((aa[3]* std::complex<double>(3.0, 0.0)) * (aa[3]/ std::complex<double>(8.0, 0.0))) ; - h[0] = abs (u) ; - h[1] = abs (v) ; - - if (h[0] < h[1]) - h[0] = h[1] ; - if (h[0] > Epsilon) - k[1] = u- v; - else - k[1] = std::complex<double>(0.0, 0.0) ; - - u = aa[1] ; - v = (aa[2]* aa[3]) / std::complex<double>(2.0, 0.0) ; - w = pow (aa[3], 3.0) / std::complex<double>(8.0, 0.0) ; - h[0] = abs (u) ; - h[1] = abs (v) ; - h[2] = abs (w) ; - h[0] = h[IndiceMax(3, h)] ; - if (h[0] > Epsilon) - k[2] = (u- v)+ w ; - else - k[2] = std::complex<double>(0.0, 0.0) ; - u = aa[0] ; - v = (aa[1]* aa[3]) / std::complex<double>(4.0, 0.0); - w = (aa[2]* aa[3]) * (aa[3]/ std::complex<double>(16.0, 0.0)) ; - x = pow (aa[3], 4.0) * std::complex<double>(3.0 / 256.0, 0.0) ; - h[0] = abs (u) ; - h[1] = abs (v) ; - h[2] = abs (w) ; - h[3] = abs (x) ; - h[0] = h[IndiceMax(4, h)] ; - - if (h[0]>Epsilon) - k[3] = (u- v) + (w- x) ; - else - k[3] = std::complex<double>(0.0, 0.0) ; - - /* Test of existence of a quadruple root */ - d4_1r4 = TestDegree4Quad (k, epsilon) ; - - /* Test of existence of 2 double roots */ - d4_2r2 = TestDegree4DoubleDouble (aa, k, epsilon) ; - - /* Test of existence of 1 triple root + 1 simple root */ - d4_1r3_1r1 = TestDegree4SimpleTriple (aa, k, epsilon) ; - - /* Test of existence of 1 double root + 2 simple roots */ - d4_1r2_2r1 = TestDegreeSimpleSimpleDouble (k, epsilon) ; - - - if (d4_1r4 == 1) - { - /* 1 quadruple root */ - - if(_solutions != NULL) - delete _solutions; - _solutions = new std::complex<double>[1]; - - if(_order != NULL) - delete _order; - _order = new int[1]; - - _nbrSol = 1 ; - _solutions[0] = Proche (k[0], Epsilon) ; - _order[0] = 4 ; - } - else if (d4_2r2 == 1) - { - /* 2 double roots */ - - if(_solutions != NULL) - delete _solutions; - _solutions = new std::complex<double>[2]; - - if(_order != NULL) - delete _order; - _order = new int[2]; - - u = sqrt (k[1]/ std::complex<double>(-2.0, 0.0)) ; - _solutions[0] = Proche ((k[0]+ u) , Epsilon) ; - _solutions[1] = Proche ((k[0]- u) , Epsilon) ; - _nbrSol = 2 ; - _order[0] = 2 ; - _order[1] = 2 ; - } - else if (d4_1r3_1r1 == 1) - { - /* 1 triple root + 1 simple root */ - - if(_solutions != NULL) - delete _solutions; - _solutions = new std::complex<double>[2]; - - if(_order != NULL) - delete _order; - _order = new int[2]; - - u = (k[2]* std::complex<double>(-3.0, 0.0)) / (k[1]* std::complex<double>(4.0, 0.0)) ; - v = u * std::complex<double>(-3.0, 0.0); - _solutions[0] = Proche ((k[0]+ u) , Epsilon) ; - _solutions[1] = Proche ((k[0]+ v) , Epsilon) ; - _nbrSol = 2 ; - _order[0] = 3 ; - _order[1] = 1 ; - } - else if (d4_1r2_2r1 == 1) - { - /* 1 double root + 2 simple roots */ - - if(_solutions != NULL) - delete _solutions; - _solutions = new std::complex<double>[3]; - - if(_order != NULL) - delete _order; - _order = new int[3]; - - if (abs (k[1]) <= Epsilon) - { - u = (k[3]* std::complex<double>(-4.0, 0.0)) / (k[2]* std::complex<double>(3.0, 0.0)); - v = sqrt ((u* std::complex<double>(-2.0, 0.0)) * u) ; - _solutions[0] = Proche ((k[0]+ u) , Epsilon) ; - _solutions[1] = Proche ((k[0] + (v- u)) , Epsilon) ; - _solutions[2] = Proche ((k[0] - (v+ u)) , Epsilon) ; - } - else - { - v = (k[2]* k[2]) * std::complex<double>(9.0, 0.0) ; - w = (k[1]* k[3]) * std::complex<double>(32.0, 0.0) ; - u = sqrt((v- w)) ; - v = (k[2] * std::complex<double>(-3.0, 0.0)) ; - w = (k[1] * std::complex<double>(4.0, 0.0)) ; - x = ((v+ u) / w) ; - y = ((v- u) / w) ; - u = ((x* x) * std::complex<double>(-2.0, 0.0)) ; - u = sqrt((u- k[1])) ; - v = ((y* y) * std::complex<double>(-2.0, 0.0)) ; - v = sqrt((v- k[1])) ; - zProv[0][0] = (k[0]+ x) ; - zProv[0][1] = (k[0] - (x- u)) ; - zProv[0][2] = (k[0] - (x+ u)) ; - zProv[1][0] = (k[0]+ y) ; - zProv[1][1] = (k[0] - (y- v)) ; - zProv[1][2] = (k[0] - (y+ v)) ; - h[0] = 0.0 ; - h[1] = 0.0 ; - for (i1 = 0; i1 < 3; i1++) - { - u = std::complex<double>(1.0, 0.0) ; - for (i2 = 3; i2 >= 0; i2--) - u = ((u* zProv[0][i1])+ aa[i2]) ; - - r = abs (u) ; - h[0] = h[0] + r * r ; - u = std::complex<double>(1.0, 0.0) ; - for (i2 = 3; i2 >= 0; i2--) - u = ((u* zProv[1][i1])+ aa[i2]) ; - r = abs (u) ; - h[1] = h[1] + r * r ; - } - i1 = IndiceMin (2, h) ; - for (i2 = 0; i2 < 3; i2++) - _solutions[i2] = Proche (zProv[i1][i2] , Epsilon) ; - } - _nbrSol = 3 ; - _order[0] = 2 ; - _order[1] = 1 ; - _order[2] = 1 ; - } - else - { - /* 4 simple roots */ - u = ((aa[0]* aa[2]) * std::complex<double>(4.0, 0.0)) ; - v = (aa[1] * aa[1]) ; - w = ((aa[0]* aa[3]) * aa[3]) ; - b[0] = (u - (v+ w)) ; - b[1] = ((aa[1]* aa[3]) - (aa[0]* std::complex<double>(4.0, 0.0))) ; - b[2] = -aa[2] ; - b[3] = std::complex<double>(1.0, 0.0) ; - - /* The third degree equation is solved by forcing 3 distinct roots (computation precision problem) */ - Equation eq(3,b); - eq.Solve3(d4); - - //Solve3(d4); - h[0] = abs ((eq.get_solutions()[1]- eq.get_solutions()[2])) ; /* the root the most distant to */ - h[1] = abs ((eq.get_solutions()[0]- eq.get_solutions()[2])) ; /* the 2 others is selected */ - h[2] = abs ((eq.get_solutions()[0]- eq.get_solutions()[1])) ; - i1 = IndiceMin (3, h) ; - u = eq.get_solutions()[i1] ; - v = ((aa[2]- u) * std::complex<double>(4.0, 0.0)) ; - v = sqrt(((aa[3]* aa[3]) - v)) ; - w = sqrt(((u* u) - (aa[0]* std::complex<double>(4.0, 0.0)))) ; - x = ((aa[3]+ v) / std::complex<double>(2.0, 0.0)) ; - y = ((u+ w) / std::complex<double>(2.0, 0.0)) ; - d = sqrt(((x* x) - (y* std::complex<double>(4.0, 0.0)))) ; - zProv[0][0] = ((x- d) / std::complex<double>(-2.0, 0.0)) ; - zProv[0][1] = ((x+ d) / std::complex<double>(-2.0, 0.0)) ; - - x = ((aa[3]- v) / std::complex<double>(2.0, 0.0)) ; - y = ((u- w) / std::complex<double>(2.0, 0.0)) ; - d = sqrt((x*x) - (y* std::complex<double>(4.0, 0.0))) ; - zProv[0][2] = ((x- d) / std::complex<double>(-2.0, 0.0)) ; - zProv[0][3] = ((x+ d) / std::complex<double>(-2.0, 0.0)) ; - - x = ((aa[3]+ v) / std::complex<double>(2.0, 0.0)) ; - y = ((u- w) / std::complex<double>(2.0, 0.0)) ; - d = sqrt(((x*x) - (y* std::complex<double>(4.0, 0.0)))) ; - zProv[1][0] = ((x- d) / std::complex<double>(-2.0, 0.0)) ; - zProv[1][1] = ((x+ d) / std::complex<double>(-2.0, 0.0)) ; - - x = ((aa[3]- v) / std::complex<double>(2.0, 0.0)) ; - y = ((u+ w) / std::complex<double>(2.0, 0.0)) ; - d = sqrt((x*x) - (y* std::complex<double>(4.0, 0.0))) ; - zProv[1][2] = ((x- d) / std::complex<double>(-2.0, 0.0)) ; - zProv[1][3] = ((x+ d) / std::complex<double>(-2.0, 0.0)) ; - - h[0] = 0.0 ; - h[1] = 0.0 ; - for (i1 = 0; i1 < 4; i1++) - { - u = std::complex<double>(1.0, 0.0) ; - - for (i2 = 3; i2 >= 0; i2--) - u = ((u* zProv[0][i1])+ aa[i2]) ; - - r = abs (u) ; - h[0] = h[0] + r * r ; - u = std::complex<double>(1.0, 0.0) ; - - for (i2 = 3; i2 >= 0; i2--) - u = ((u* zProv[1][i1])+ aa[i2]) ; - - r = abs(u) ; - h[1] = h[1] + r * r ; - } - i1 = IndiceMin (2, h) ; - - if(_solutions != NULL) - delete _solutions; - _solutions = new std::complex<double>[4]; - - if(_order != NULL) - delete _order; - _order = new int[4]; - - for (i2 = 0; i2 < 4; i2++) - { - _solutions[i2] = Proche (zProv[i1][i2] , Epsilon) ; - _order[i2] = 1 ; - } - _nbrSol = 4 ; - } - -} - -int Equation::TestDegree3Triple(std::complex<double>* a, double epsilon) -{ - double d, dp[2], q, r ; - std::complex<double> u, v ; - - - u = a[2]* a[2] ; - v = a[1]*std::complex<double>(3.0, 0.0) ; - dp[0] = abs (u) ; - dp[1] = abs (v) ; - d = (dp[0] > dp[1]) ? dp[0] : dp[1] ; - q = (d > epsilon) ? abs((u- v)/ std::complex<double> (d, 0.0)) - : 0.0 ; - - u = a[1]* a[2]; - v = a[0]* std::complex<double>(9.0, 0.0) ; - dp[0] = abs (u) ; - dp[1] = abs (v) ; - d = (dp[0] > dp[1]) ? dp[0] : dp[1] ; - r = (d > epsilon) ? abs ((u-v)/std::complex<double>(d, 0.0)) - : 0.0 ; - - return ((q <= epsilon) && (r <= epsilon)) ? 1 : 0 ; -} - -int Equation::TestDegree3SimpleDouble(std::complex<double>* a, double epsilon) -{ - int i ; - double d, k, r[5] ; - std::complex<double> u, t[5] ; - - - u = a[1]*a[2] ; - t[0] = pow (a[1], 3.0)*std::complex<double>(4.0, 0.0) ; - t[1] = a[0]*a[0]* std::complex<double>(27.0, 0.0); - t[2] = a[0]* std::complex<double>(4.0, 0.0)*pow (a[2], 3.0) ; - t[3] = -(u* u) ; - t[4] = std::complex<double>(-18.0, 0.0)* a[0] * u; - - for (i = 0 ; i < 5 ; i++) - r[i] = abs (t[i]) ; - - k = r[IndiceMax(5, r)] ; - - for (i = 1 ; i < 5 ; i++) - t[0] = t[0]+t[i]; - - d = (k > epsilon) ? abs (t[0]/std::complex<double>(k,0.0)) - : 0.0 ; - - return (d <= epsilon) ? 1 : 0 ; -} - -int Equation::IndiceMin ( int n , double *list ) -{ - int i, iMin ; - double xMin ; - - iMin = 0 ; - xMin = list[0] ; - for (i = 1; i < n; i++) - { - if ( list[i] < xMin ) - { - iMin = i ; - xMin = list[i] ; - } - } - return iMin ; -} - - -int Equation::IndiceMax ( int n , double *list) -{ - int i, iMax ; - double xMax ; - - iMax = 0 ; - xMax = list[0] ; - for (i = 1; i < n; i++) - { - if ( list[i] > xMax ) - { - iMax = i ; - xMax = list[i] ; - } - } - return iMax ; -} - -int Equation::TestDegree4Quad ( std::complex<double> *a , double epsilon ) -{ - double r1, r2, r3 ; - - r1 = abs (a[1]) ; - r2 = abs (a[2]) ; - r3 = abs (a[3]) ; - - return ((r1 < epsilon) && (r2 < epsilon) && (r3 < epsilon)) ? 1 : 0 ; -} - -int Equation::TestDegree4DoubleDouble ( std::complex<double> *a , std::complex<double> *k , double epsilon ) -{ - int i ; - int d4 ; - double r0, r1, r2, h[5] ; - std::complex<double> u, t[5] ; - - - u = (a[3]* a[3]) ; - t[0] = (u* u) * std::complex<double>(3.0 / 16.0, 0.0); - t[1] = a[0] * std::complex<double>(4.0,0.0); - t[2] = a[3] * a[1]; - t[3] = u * a[2]; - t[4] = a[2] * a[2]; - for (i = 0 ; i < 5 ; i++) - h[i] = abs (t[i]) ; - - r1 = h[IndiceMax(5, h)] ; - u = (t[0]- t[1]) + t[2]; - u = u - (t[3]- t[4]) ; - r2 = (r1 > epsilon) ? abs (u) / r1 : 0.0 ; - - r1 = abs (k[2]) ; - r0 = abs (k[1]) ; - - if ((r0 >= epsilon) && (r1 < epsilon) && (r2 < epsilon)) - d4 = 1 ; - else - d4 = 0 ; - - return d4 ; -} - -int Equation::TestDegree4SimpleTriple ( std::complex<double> *a , std::complex<double> *k , double epsilon ) -{ - int i ; - int d4 ; - double r, r0, r1, r2, h[4] ; - std::complex<double> u, t[4] ; - - - t[0] = a[2] * a[2] ; - t[1] = a[0] * std::complex<double>(12.0, 0.0); - t[2] = (a[1]* a[3]) * std::complex<double>(3.0, 0.0) ; - for (i = 0 ; i < 3 ; i++) - h[i] = abs (t[i]) ; - - r = h[IndiceMax(3, h)] ; - u = t[0] + (t[1]- t[2]) ; - r1 = (r > epsilon) ? abs (u) / r : 0.0 ; - - t[0] = a[1] * a[1]; - t[1] = (a[0]* a[2]) * std::complex<double>(4.0, 0.0) ; - u = a[3]* std::complex<double>(3.0, 0.0) ; - t[2] = (u* u) * (a[0]* std::complex<double>(3.0, 0.0)) ; - t[3] = (a[2]* a[2]) * a[2] ; - for (i = 0 ; i < 4 ; i++) - h[i] = abs (t[i]) ; - r = h[IndiceMax(4, h)] ; - u = ((t[0]- t[1])* std::complex<double>(27.0, 0.0))+ (t[2]- t[3]) ; - r2 = (r > epsilon) ? abs (u) / r : 0.0 ; - - r0 = abs (k[1]) ; - - if ((r0 >= epsilon) && (r1 < epsilon) && (r2 < epsilon)) - d4 = 1 ; - else - d4 = 0 ; - - return d4 ; -} - -int Equation::TestDegreeSimpleSimpleDouble( std::complex<double> *a , double epsilon ) -{ - double r[3] ; - std::complex<double> u, v, w ; - - - u = (a[1]* a[1]) - (a[3]* std::complex<double>(4.0, 0.0)) ; - u = u* a[3] * u * std::complex<double>(16.0, 0.0); - r[0] = abs (u) ; - - w = pow (a[1], 3.0) * std::complex<double>(4.0, 0.0) ; - v = (a[2]* a[2]) * std::complex<double>(27.0, 0.0) , - v = (w+ v) * (a[2]* a[2]) ; - r[1] = abs (v) ; - - w = (a[1]* a[2]) * (a[2]* a[3]) ; - w = w * std::complex<double>(144.0, 0.0) ; - r[2] = abs (w) ; - - r[1] = r[IndiceMax(3, r)] ; - if (r[1] < epsilon) - r[0] = 0.0 ; - else if (r[1] <= 1.0) - r[0] = abs ((u- v)+ w) ; - else - r[0] = abs (((u- v)+ w)/ std::complex<double>(r[1], 0.0)) ; - - return (r[0] < (2.0 * epsilon)) ? 1 : 0 ; -} diff --git a/Utilities/otbossim/src/ossim/projection/otb/GMSTDateTime.cpp b/Utilities/otbossim/src/ossim/projection/otb/GMSTDateTime.cpp deleted file mode 100644 index cabc5dea41..0000000000 --- a/Utilities/otbossim/src/ossim/projection/otb/GMSTDateTime.cpp +++ /dev/null @@ -1,46 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - -#include <GMSTDateTime.h> -#include <CivilDateTime.h> - -GMSTDateTime::GMSTDateTime(): - _tms(0) -{ -} - -GMSTDateTime::~GMSTDateTime() -{ -} - -GMSTDateTime::GMSTDateTime(const GMSTDateTime& rhs): - _tms(rhs._tms), - _origine(rhs._origine) -{ -} - -GMSTDateTime::GMSTDateTime(double tms, Ori_TSM_Green origine): - _tms(tms), - _origine(origine) -{ -} - -GMSTDateTime::GMSTDateTime(CivilDateTime& rhs) -{ - rhs.AsGMSTDateTime(this); -} - -GMSTDateTime& GMSTDateTime::operator=(const GMSTDateTime& rhs) -{ - _tms = rhs._tms; - _origine = rhs._origine; - return *this; -} diff --git a/Utilities/otbossim/src/ossim/projection/otb/GalileanEphemeris.cpp b/Utilities/otbossim/src/ossim/projection/otb/GalileanEphemeris.cpp deleted file mode 100644 index b8f4b16dd5..0000000000 --- a/Utilities/otbossim/src/ossim/projection/otb/GalileanEphemeris.cpp +++ /dev/null @@ -1,289 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - -#include <GalileanEphemeris.h> -#include <GeographicEphemeris.h> - -#include <GMSTDateTime.h> - -#include <cmath> - -GalileanEphemeris::GalileanEphemeris() -{ - -} - -GalileanEphemeris::~GalileanEphemeris() -{ - -} - -GalileanEphemeris::GalileanEphemeris(JSDDateTime date, double pos[3], double vitesse[3]) : Ephemeris(date, pos, vitesse) -{ - -} - -GalileanEphemeris::GalileanEphemeris(const GalileanEphemeris& rhs) : Ephemeris(rhs) -{ - -} - -GalileanEphemeris& GalileanEphemeris::operator=(const GalileanEphemeris& rhs) -{ - ((Ephemeris)*this) = ((Ephemeris)rhs); - return *this; -} - -void GalileanEphemeris::ToGeographic(GeographicEphemeris* vGeo) -{ - const double OMEGATERRE = 6.28318530717958647693 / 86164.09054 ; - GMSTDateTime h; - h.set_origine(GMSTDateTime::AN1950); - double s,c; - - double pos[3]; - double vitesse[3]; - - _date.AsGMSTDateTime(&h) ; - c = cos (h.get_tms()) ; - s = sin (h.get_tms()) ; - vGeo->set_date(_date); - - pos[0] = _position[0] * c + _position[1] * s ; - pos[1] = - _position[0] * s + _position[1] * c ; - pos[2] = _position[2] ; - vitesse[0] = _vitesse[0] * c + _vitesse[1] * s - OMEGATERRE * (_position[0] * s - _position[1] * c) ; - vitesse[1] = - _vitesse[0] * s + _vitesse[1] * c - OMEGATERRE * (_position[0] * c + _position[1] * s) ; - vitesse[2] = _vitesse[2] ; - - vGeo->set_position(pos); - vGeo->set_vitesse(vitesse); -} - -void GalileanEphemeris::ToGeographic(double greenwich,GeographicEphemeris* vGeo) -{ - const double OMEGATERRE = 6.28318530717958647693 / 86164.09054 ; - int etat, ierr ; - double p[10],pd[10]; - double day; - - etat = 0 ; - - vGeo->set_date(this->_date); - - - day= this->_date.get_day0hTU().get_julianDate(); - - ierr = p2nutt( 2, greenwich, day, p, pd ) ; - - double position[3]; - double vitesse[3]; - - position[0] = _position[0]*p[1] + _position[1]*p[4] + _position[2]*p[7] ; - - position[1] = _position[0]*p[2] + _position[1]*p[5] + _position[2]*p[8] ; - - position[2] = _position[0]*p[3] + _position[1]*p[6] + _position[2]*p[9] ; - - vitesse[0] = _vitesse[0]*p[1] +_vitesse[1]*p[4] + _vitesse[2]*p[7] + OMEGATERRE * (_position[0]*pd[1] + _position[1]*pd[4] + _position[2]*pd[7] ); - - vitesse[1] = _vitesse[0]*p[2] + _vitesse[1]*p[5] + _vitesse[2] *p[8] + OMEGATERRE * (_position[0]*pd[2] + _position[1]*pd[5] + _position[2]*pd[8] ); - - vitesse[2] = _vitesse[0]*p[3] + _vitesse[1]*p[6] + _vitesse[2]*p[9] + OMEGATERRE * (_position[0]*pd[3] + _position[1]*pd[6] + _position[2]*pd[9] ); - - vGeo->set_position(position); - vGeo->set_vitesse(vitesse); -} - -GalileanEphemeris::operator GeographicEphemeris() -{ - GeographicEphemeris rhs; - ToGeographic(&rhs); - return rhs; -} - -GalileanEphemeris::GalileanEphemeris(GeographicEphemeris& rhs) -{ - rhs.ToGalilean(this); -} - -int GalileanEphemeris::p2nutt(int newcmb, double greenwich, double day, - double p[], double pd[] ) -{ - const double PI = 3.14159265358979323846 ; - const double DEUXPI = 6.28318530717958647693 ; - // const double MU = 3.9860047e+14 ; - // const double JOURCIVIL_LENGTH = 86400.0 ; - // const double JOURSIDERAL = 86164.09054 ; - // const double OMEGATERRE = 6.28318530717958647693 / 86164.09054 ; - // const double CLUM = 2.99792458e+8 ; - // const double A_WGS84 = 6378137.0 ; - // const double B_WGS84 = 6356752.3141 ; -/* - - GIVES TRANSFORMATION MATRIX P(3,3) FROM QUASI-INERTIAL MEAN SYSTEM - OF DATE TO TRUE SYSTEM OF DATE OR EARTH-FIXED ROTATING SYSTEM BY - ROTATION (OPTIONAL) AND NUTATION. USES SIMPLIFIED ANALYTICAL - MODEL DERIVED FROM THE 1980 IAU WAHR THEORY OF NUTATION (REF: - ASTRONOMICAL ALMANAC 1984, PP. S23-S26) BY SKIPPING MOST TERMS BELOW - 0.03 ARCSEC. ACCURACY = 0.5D-6 RADIANS. - - DAY = Julian Day - newcmb =-1 => TO TRUE SYSTEM OF DATE - = 0 => INTERMEDIATE TRANSFORMATION TO EARTH-FIXED ROTATING - SYSTEM BUT WITHOUT NEWCOMB'S ANGLE. (NOT TRUE-OF-DATE) - = 1 => TO EARTH-FIXED ROTATING SYSTEM - - P(3,3) = ROTATION MATRIX SUCH THAT - THE TRANSFORMATION IS R(TRANSF) = P * R(INERT) - - COMMON BLOCKS FROM PEPSOC SUBROUTINE 'P2COOT' ARE USED. */ - - double arg[10] ; - double t, ff, dd, dpsi, deps; - double ecl, cecl, secl, dnu, srang; - double sra, cra, snu, cnu, sde, cde; - double facsin[10],faccos[10]; - - int i; - - /* DATA FOR NUTATION MODELLING */ - facsin[0]=0.e0; - facsin[1]=-0.8338601e-04; - facsin[2]=-0.6393238e-05; - facsin[3]=-0.1102466e-05; - facsin[4]=0.9996858e-06; - facsin[5]=0.6913443e-06; - facsin[6]=0.3451873e-06; - facsin[7]=-0.2506487e-06; - facsin[8]=-0.1871381e-06; - facsin[9]=-0.1459289e-06; - - faccos[0]=0.e0; - faccos[1]=0.4461498e-04; - faccos[2]=0.2780891e-05; - faccos[3]=0.4736630e-06; - faccos[4]=-0.4339082e-06; - faccos[5]=0.2617994e-07; - faccos[6]=-0.3393696e-08; - faccos[7]=0.1085983e-06; - faccos[8]=0.9696274e-07; - faccos[9]=0.6254096e-07; - - - /* ECL = OBLIQUITY OF ECLIPTIC AT EPOCH J2000.0 - ECL CHANGES BY -0.01300 DEG/CENTURY. - ECL = 23 DEG + 26 ' + 21.4119 " */ - ecl = PI/180.e0*(23.e0 + (26.e0 + 21.4119e0/6.e1)/6.e1); - cecl = cos(ecl); - secl = sin(ecl); - - /*t= Julian day relative to year 2000 at 12:00:00 */ - t = day-2451540. - 0.5 ; - - /* L = MEAN ANOMALY OF THE MOON */ - arg[6] = fmod( 0.2355548394e+01 + t*( 0.2280271437e+00 + t* 0.1137830e-12 ),DEUXPI); - - /*C L-PRIME = MEAN ANOMALY OF THE SUN (EARTH) */ - arg[5] = fmod( 0.6240035939e+01 + t*( 0.1720197005e-01 - t* 0.2096864e-14 ),DEUXPI); - - /* F = L - OMEGA (SEE ABOVE AND BELOW) */ - ff = fmod( 0.1627901934e+01 + t*( 0.2308957196e+00 - t* 0.4817699e-13 ),DEUXPI); - - /* D = MEAN ELONGATION OF THE MOON FROM THE SUN */ - dd = fmod( 0.5198469514e+01 + t*( 0.2127687104e+00 - t* 0.2504244e-13 ),DEUXPI); - - /* OMEGA = LONGITUDE OF MOON'S ASCENDING NODE FROM MEAN EQUINOX OF DATE */ - arg[0]=0.e0; - arg[1] = fmod( 0.2182438624e+01 - t*( 0.9242175478e-03 - t* 0.2709206e-13 ),DEUXPI); - - arg[3] = 2.e0*(ff + arg[1]); - arg[2] = arg[3] - 2.e0*dd ; - arg[4] = 2.e0*arg[1] ; - arg[7] = arg[5] + arg[2] ; - arg[8] = 2.e0*ff + arg[1] ; - arg[9] = arg[6] + arg[3] ; - - dpsi = 0.e0; - deps = 0.e0; - for ( i=1 ; i<=9; i++ ) - { - dpsi = dpsi + facsin[i] * sin(arg[i]); - deps = deps + faccos[i] * cos(arg[i]); - } - - - /* ROTATION OF -deps AROUND THE X-AXIS */ - cde=cos(deps); - sde=sin(deps); - - /* ROTATION OF DNU = dpsi*SIN(ECLIPT) AROUND THE Y-AXIS */ - dnu = dpsi*secl; - cnu=cos(dnu); - snu=sin(dnu); - - /* SELECT WHICH ROTATION IS WANTED FOR THE Z-AXIS */ - srang=0.e0; - if (newcmb == -1) - { - /* ROTATION OF SRANG = -DMU = -dpsi*COS(ECLIPT) AROUND THE Z-AXIS */ - srang = -dpsi*cecl; - } - else if ( newcmb == 0) - { - srang = 0.e0; - } - else if ( newcmb == 1 ) - { - /* SIDEREAL ANGLE, FROM 'COOT20' WITH NEWCOMB'S FORMULA:*/ - /*srang = fmod(STD20R+(OMT20R+OMQ20R*day)*day,DEUXPI);*/ - } - else if ( newcmb == 2 ) - { - /* SIDEREAL ANGLE, FROM INPUT */ - srang = fmod(greenwich*PI/180.e0,DEUXPI) ; - /*printf("srang dans p2nutt %g",greenwich);*/ - } - else - { - return -1;; - } - - - sra=sin(srang); - cra=cos(srang); - - /* ROTATION MATRIX = RZ(SRANG)*RX(-deps)*RY(DNU) */ - p[0] = 0.e0; - p[1] = cra*cnu - sra*sde*snu ; - p[2] = -sra*cnu - cra*sde*snu ; - p[3] = cde*snu ; - p[4] = sra*cde ; - p[5] = cra*cde ; - p[6] = sde ; - p[7] = -cra*snu - sra*sde*cnu ; - p[8] = sra*snu - cra*sde*cnu ; - p[9] = cde*cnu ; - - pd[0] = 0.e0; - pd[1] = -sra*cnu - cra*sde*snu ; - pd[2] = -cra*cnu + sra*sde*snu ; - pd[3] = 0. ; - pd[4] = cra*cde ; - pd[5] = -sra*cde ; - pd[6] = 0. ; - pd[7] = sra*snu - cra*sde*cnu ; - pd[8] = cra*snu + sra*sde*cnu ; - pd[9] = 0. ; - - return 1; - -} diff --git a/Utilities/otbossim/src/ossim/projection/otb/GeodesicCoordinate.cpp b/Utilities/otbossim/src/ossim/projection/otb/GeodesicCoordinate.cpp deleted file mode 100644 index 0cbace3b00..0000000000 --- a/Utilities/otbossim/src/ossim/projection/otb/GeodesicCoordinate.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - -#include <GeodesicCoordinate.h> - - -GeodesicCoordinate::GeodesicCoordinate() -{ -} - -GeodesicCoordinate::~GeodesicCoordinate() -{ -} - -GeodesicCoordinate::GeodesicCoordinate(double x, double y, double z): Coordinate(x,y,z) -{ -} - -GeodesicCoordinate::GeodesicCoordinate(const GeodesicCoordinate& rhs): Coordinate((Coordinate)rhs) -{ -} - -GeodesicCoordinate& GeodesicCoordinate::operator=(const GeodesicCoordinate& rhs) -{ - _x = rhs._x; - _y = rhs._x; - _z = rhs._x; - - return *this; -} - diff --git a/Utilities/otbossim/src/ossim/projection/otb/GeographicEphemeris.cpp b/Utilities/otbossim/src/ossim/projection/otb/GeographicEphemeris.cpp deleted file mode 100644 index c40822b10e..0000000000 --- a/Utilities/otbossim/src/ossim/projection/otb/GeographicEphemeris.cpp +++ /dev/null @@ -1,80 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - -#include <GeographicEphemeris.h> -#include <GalileanEphemeris.h> - -#include <GMSTDateTime.h> - -#include <cmath> - -GeographicEphemeris::GeographicEphemeris() : Ephemeris() -{ -} - -GeographicEphemeris::~GeographicEphemeris() -{ -} - -GeographicEphemeris::GeographicEphemeris(JSDDateTime date, double pos[3], double vitesse[3]) : Ephemeris(date, pos, vitesse) -{ -} - -GeographicEphemeris::GeographicEphemeris(const GeographicEphemeris& rhs) : Ephemeris(rhs) -{ -} - -GeographicEphemeris& GeographicEphemeris::operator=(const GeographicEphemeris& rhs) -{ - ((Ephemeris)*this) = ((Ephemeris)rhs); - return *this; -} - - -void GeographicEphemeris::ToGalilean(GalileanEphemeris* vGal) -{ - const double OMEGATERRE = 6.28318530717958647693 / 86164.09054 ; - GMSTDateTime h; - h.set_origine(GMSTDateTime::AN1950); - - double s,c; - _date.AsGMSTDateTime(&h) ; - - c = cos (h.get_tms()) ; - s = sin (h.get_tms()) ; - vGal->set_date(_date); - - double pos[3]; - double vitesse[3]; - - pos[0] = _position[0] * c - _position[1] * s ; - pos[1] = _position[0] * s + _position[1] * c ; - pos[2] = _position[2] ; - - vitesse[0] = _vitesse[0] * c - _vitesse[1] * s - OMEGATERRE * (_position[0] * s + _position[1] * c) ; - vitesse[1] = _vitesse[0] * s + _vitesse[1] * c + OMEGATERRE * (_position[0] * c - _position[1] * s) ; - vitesse[2] = _vitesse[2] ; - - vGal->set_position(pos); - vGal->set_vitesse(vitesse); -} - -GeographicEphemeris::operator GalileanEphemeris() -{ - GalileanEphemeris rhs; - ToGalilean(&rhs); - return rhs; -} - -GeographicEphemeris::GeographicEphemeris(GalileanEphemeris& rhs) -{ - rhs.ToGeographic(this); -} diff --git a/Utilities/otbossim/src/ossim/projection/otb/HermiteInterpolator.cpp b/Utilities/otbossim/src/ossim/projection/otb/HermiteInterpolator.cpp deleted file mode 100644 index 88578237be..0000000000 --- a/Utilities/otbossim/src/ossim/projection/otb/HermiteInterpolator.cpp +++ /dev/null @@ -1,262 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - -#include <HermiteInterpolator.h> - -#include <string> - -HermiteInterpolator::HermiteInterpolator(): - _nbrPoints(0), - _x(NULL), - _y(NULL), - _dy(NULL) -{ -} - -HermiteInterpolator::HermiteInterpolator(int nbrPoints, double* x, double* y, double* dy): - _nbrPoints(nbrPoints) -{ - if(x != NULL) - { - _x = new double[_nbrPoints]; - for (int i=0;i<_nbrPoints;i++) - { - _x[i] = x[i]; - } - } - else - { - _x = NULL; - } - - if(y != NULL) - { - _y = new double[_nbrPoints]; - for (int i=0;i<_nbrPoints;i++) - { - _y[i] = y[i]; - } - } - else - { - _y = NULL; - } - - if(dy != NULL) - { - _dy = new double[_nbrPoints]; - for (int i=0;i<_nbrPoints;i++) - { - _dy[i] = dy[i]; - } - } - else - { - _dy = NULL; - } -} - -HermiteInterpolator::~HermiteInterpolator() -{ - Clear(); -} - -HermiteInterpolator::HermiteInterpolator(const HermiteInterpolator& rhs): - _nbrPoints(rhs._nbrPoints) -{ - if(rhs._x != NULL) - { - _x = new double[_nbrPoints]; - for (int i=0;i<_nbrPoints;i++) - { - _x[i] = rhs._x[i]; - } - } - else - { - _x = NULL; - } - - if(rhs._y != NULL) - { - _y = new double[_nbrPoints]; - for (int i=0;i<_nbrPoints;i++) - { - _y[i] = rhs._y[i]; - } - } - else - { - _y = NULL; - } - - if(rhs._dy != NULL) - { - _dy = new double[_nbrPoints]; - for (int i=0;i<_nbrPoints;i++) - { - _dy[i] = rhs._dy[i]; - } - } - else - { - _dy = NULL; - } -} - -HermiteInterpolator& HermiteInterpolator::operator =(const HermiteInterpolator& rhs) -{ - Clear(); - _nbrPoints = rhs._nbrPoints; - if(rhs._x != NULL) - { - _x = new double[_nbrPoints]; - for (int i=0;i<_nbrPoints;i++) - { - _x[i] = rhs._x[i]; - } - } - else - { - _x = NULL; - } - - if(rhs._y != NULL) - { - _y = new double[_nbrPoints]; - for (int i=0;i<_nbrPoints;i++) - { - _y[i] = rhs._y[i]; - } - } - else - { - _y = NULL; - } - - if(rhs._dy != NULL) - { - _dy = new double[_nbrPoints]; - for (int i=0;i<_nbrPoints;i++) - { - _dy[i] = rhs._dy[i]; - } - } - else - { - _dy = NULL; - } - - return *this; -} - - -int HermiteInterpolator::Interpolate(const double x, double& y, double& dy) -{ - int k1, k2 ; - double f, d, p, q, r, s, t, p2 ; - /* - * Il n'y a pas assez de points pour faire l'interpolation - */ - if (_nbrPoints < 2) - return -1; - else - { - for (int i = 1 ; i < _nbrPoints ; i++) - { - /** - * @todo Verifier que l'interpolateur n'ai pas besoin ques les abscisses soitent strictement croissantes - */ - - /* - * Les abscisses ne sont pas croissantes - */ - if (_x[i] <= _x[i-1]) - return -2; - } - - y = 0.0 ; - dy = 0.0 ; - for (int i = 0 ; i < _nbrPoints ; i++) - { - p = 1.0 ; - q = 0.0 ; - s = 0.0 ; - for (int j = 0 ; j < i ; j++) - { - r = _x[i] - _x[j] ; - p = p * ((x - _x[j]) / r) ; - q = q + 1.0 / r ; - k1 = (i<j) ? i : j ; - k2 = (i<j) ? j : i ; - t = 1.0 ; - for (int k = 0 ; k < k1 ; k++) - t = t * (x - _x[k]) / (_x[i] - _x[k]) ; - for (int k = k1+1 ; k < k2 ; k++) - t = t * (x - _x[k]) / (_x[i] - _x[k]) ; - for (int k = k2+1 ; k < _nbrPoints ; k++) - t = t * (x-_x[k]) / (_x[i]-_x[k]) ; - s = s + t / r ; - } - - for (int j = i+1 ; j < _nbrPoints ; j++) - { - r = _x[i] - _x[j] ; - p = p * ((x - _x[j]) / r) ; - q = q + 1.0 / r ; - k1 = (i < j) ? i : j ; - k2 = (i < j) ? j : i ; - t = 1.0 ; - for (int k = 0 ; k < k1 ; k++) - t = t * (x - _x[k]) / (_x[i] - _x[k]) ; - for (int k = k1+1 ; k < k2 ; k++) - t = t * (x - _x[k]) / (_x[i] - _x[k]) ; - for (int k = k2+1 ; k < _nbrPoints ; k++) - t = t * (x - _x[k]) / (_x[i] - _x[k]) ; - s = s + t / r ; - } - - r = x - _x[i] ; - p2 = p * p ; - f = p2 * (1.0 - 2. * q * r) ; - d = p2 * r ; - y = y + f * _y[i] + d * _dy[i] ; - f = 2.0 * p * (s * (1.0 - 2.0 * q * r) - p * q) ; - d = p * (p + 2.0 * r * s) ; - dy = dy + f * _y[i] + d * _dy[i] ; - } - - } - return 0; -} - -void HermiteInterpolator::Clear() -{ - if (_x != NULL) - { - delete[] _x; - _x = NULL; - } - - if (_y != NULL) - { - delete[] _y; - _y = NULL; - } - - if (_dy != NULL) - { - delete[] _dy; - _dy = NULL; - } - - _nbrPoints = 0; -} diff --git a/Utilities/otbossim/src/ossim/projection/otb/JSDDateTime.cpp b/Utilities/otbossim/src/ossim/projection/otb/JSDDateTime.cpp deleted file mode 100644 index 8827f68958..0000000000 --- a/Utilities/otbossim/src/ossim/projection/otb/JSDDateTime.cpp +++ /dev/null @@ -1,231 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - -#include <JSDDateTime.h> -#include <CivilDateTime.h> -#include <JulianDate.h> -#include <GMSTDateTime.h> - -#include <Arithmetic.h> - -#include <cmath> -#include <cstring> -#include <cstdlib> -#include <cstdio> - -JSDDateTime::JSDDateTime(): - _day0hTU(0), - _second(0.0), - _decimal(0.0) -{ -} - -JSDDateTime::~JSDDateTime() -{ -} - -JSDDateTime::JSDDateTime(const JSDDateTime& rhs): - _day0hTU(rhs._day0hTU), - _second(rhs._second), - _decimal(rhs._decimal) -{ -} - -JSDDateTime::JSDDateTime(JulianDate day0hTU, double second, double decimal): - _day0hTU(day0hTU), - _second(second), - _decimal(decimal) -{ -} - -JSDDateTime::JSDDateTime(CivilDateTime& rhs) -{ - rhs.AsJSDDateTime(this); -} - -JSDDateTime::JSDDateTime(JulianDate& rhs) -{ - rhs.AsJSDDateTime(this); -} - - -JSDDateTime::JSDDateTime(MJDDateTime& rhs) -{ - CivilDateTime referenceCiv; - - /* Initialisation of the MJD reference day (01/01/2000, 0h00) */ - referenceCiv.set_year(2000); - referenceCiv.set_month(01); - referenceCiv.set_day(01); - referenceCiv.set_second(0); - referenceCiv.set_decimal(0.0); - - /* JSD day of the ref. MJD date */ - JSDDateTime referenceJSD(referenceCiv); - - /* JSD day computation */ - JulianDate JD((double) rhs.get_day()); - - _day0hTU = referenceJSD.get_day0hTU() + JD; - _second = referenceJSD.get_second() + (double) rhs.get_second(); - _decimal = referenceJSD.get_decimal() + 0.000001 * (double) rhs.get_microsecond(); - - this->NormDate(); -} - -JSDDateTime& JSDDateTime::operator=(const JSDDateTime& rhs) -{ - _day0hTU = rhs._day0hTU; - _second = rhs._second; - _decimal = rhs._decimal; - - return *this; -} - -int JSDDateTime::AsJulianDate(JulianDate* julian) -{ - double jourJulien = _day0hTU.get_julianDate() + (_second + _decimal) / CivilDateTime::JOURCIVIL_LENGTH ; - julian->set_julianDate(jourJulien); - - return 0 ; -} - -int JSDDateTime::AsGMSTDateTime(GMSTDateTime* GMST) -{ - const double DEUXPI = 6.28318530717958647693 ; - const double OMEGATERRE = 6.28318530717958647693 / 86164.09054 ; - - int etat ; - JulianDate jourJulien; - double t = 0.0; - double tsm0hTU = 0.0; - double tsm = 0.0; - JSDDateTime date0hTU ; - - - date0hTU = *this ; - date0hTU.set_second(0); - date0hTU.set_decimal(0.0); - - etat = date0hTU.AsJulianDate(&jourJulien ) ; - - if (etat == 0) - { - if (GMST->get_origine() == GMSTDateTime::AN1900) - { - t = (jourJulien.get_julianDate() - 2415020.0) / 36525.0 ; - tsm0hTU = 23925.836 + t * (8640184.542 + t * 0.0929) ; - tsm0hTU = tsm0hTU * DEUXPI / CivilDateTime::JOURCIVIL_LENGTH ; - } - else if (GMST->get_origine() == GMSTDateTime::AN1950) - { - t = jourJulien.get_julianDate() - 2433281.5 ; - tsm0hTU = 1.72944494 + t * 6.3003880987 ; - } - else if (GMST->get_origine() == GMSTDateTime::AN2000) - { - t = (jourJulien.get_julianDate() - 2451545.0) / 36525.0 ; - tsm0hTU = 24110.54841 + t * (8640184.812866 - + t * (0.093103 - t * 6.210e-6)) ; - tsm0hTU = tsm0hTU * DEUXPI / CivilDateTime::JOURCIVIL_LENGTH ; - } - t = tsm0hTU + (_second + _decimal) * OMEGATERRE ; - tsm = fmod (t,DEUXPI) ; - if (tsm < 0.0) - { - tsm = tsm + DEUXPI ; - } - - GMST->set_tms(tsm); - } - - return etat ; -} - -void JSDDateTime::NormDate() -{ - const double epsilon = 1.0e-12 ; - - int k, iu, iv, iw ; - double u, v, w, ru, rv, rw ; - - - w = _day0hTU.get_julianDate() - 0.5 ; - if (fabs (w - fnint (w)) < epsilon) - { - iw = (int)inint(w) ; - rw = 0.0 ; - } - else - { - iw = (int)w ; - rw = w - (double)iw ; - if ((iw < 0) && (rw != 0.0)) - { - iw = iw - 1 ; - rw = rw + 1.0 ; - } - } - - v = _second + rw * CivilDateTime::JOURCIVIL_LENGTH ; - if (fabs(v - fnint (v)) < epsilon) - { - iv = (int)inint (v) ; - rv = 0.0 ; - } - else - { - iv = (int)v ; - rv = v - (double)iv ; - if ((iv < 0) && (rv != 0.0)) - { - iv = iv - 1 ; - rv = rv + 1.0 ; - } - } - - u = _decimal + rv ; - iu = (int)u ; - ru = u - (double)iu ; - if ((iu < 0) && (ru != 0.0)) - { - iu = iu - 1 ; - ru = ru + 1.0 ; - } - - iv = iv + iu ; - k = iv / ((int)inint(CivilDateTime::JOURCIVIL_LENGTH)) ; - iw = iw + k ; - iv = iv - k * ((int)inint(CivilDateTime::JOURCIVIL_LENGTH)) ; - if (iv < 0) - { - iw = iw - 1 ; - iv = iv + (int)inint(CivilDateTime::JOURCIVIL_LENGTH) ; - } - - _decimal = ru ; - _second = (double)iv ; - _day0hTU = (double)iw + 0.5 ; -} - -JSDDateTime::operator JulianDate() -{ - JulianDate date; - this->AsJulianDate(&date); - return date; -} - -JSDDateTime::operator GMSTDateTime() -{ - GMSTDateTime date; - this->AsGMSTDateTime(&date); - return date; -} diff --git a/Utilities/otbossim/src/ossim/projection/otb/JulianDate.cpp b/Utilities/otbossim/src/ossim/projection/otb/JulianDate.cpp deleted file mode 100644 index 49eace995a..0000000000 --- a/Utilities/otbossim/src/ossim/projection/otb/JulianDate.cpp +++ /dev/null @@ -1,141 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - -#include <CivilDateTime.h> -#include <JulianDate.h> -#include <JSDDateTime.h> -#include <GMSTDateTime.h> - - -#include <cmath> -#include <cstring> -#include <cstdlib> -#include <cstdio> - -JulianDate::JulianDate(): - _julianDate(0.0) -{ -} - -JulianDate::JulianDate(CivilDateTime& rhs) -{ - rhs.AsJulianDate(this); -} - -JulianDate::JulianDate(double julianDate): - _julianDate(julianDate) -{ -} - -JulianDate::JulianDate(JSDDateTime& rhs) -{ - rhs.AsJulianDate(this); -} - -JulianDate::~JulianDate() -{ -} - -JulianDate::JulianDate(const JulianDate& rhs): - _julianDate(rhs._julianDate) -{ -} - -JulianDate& JulianDate::operator=(const JulianDate& rhs) -{ - _julianDate = rhs._julianDate; - return *this; -} - -JulianDate& JulianDate::operator+(const JulianDate& rhs) -{ - _julianDate += rhs._julianDate; - return *this; -} - -int JulianDate::AsJSDDateTime(JSDDateTime* JSDdate) -{ - int k ; - double r ; - - k = (int)(_julianDate - 0.5) ; - double jJul0hTU = (double)k + 0.5; - - JSDdate->set_day0hTU (jJul0hTU); - r = (_julianDate - jJul0hTU) * CivilDateTime::JOURCIVIL_LENGTH ; - JSDdate->set_second(floor (r)); - JSDdate->set_decimal(r - JSDdate->get_second()) ; - - return 0 ; -} - -int JulianDate::AsGMSTDateTime(GMSTDateTime* GMST) -{ - const double DEUXPI = 6.28318530717958647693 ; - const double OMEGATERRE = 6.28318530717958647693 / 86164.09054 ; - - int etat=0 , n ; - double j0hTU = 0.0; - double tsm0hTU = 0.0; - double t = 0.0; - double d = 0.0; - double tsm = 0.0; - - - n = (int)(_julianDate - 0.5) ; - j0hTU = (double)n + 0.5 ; - d = _julianDate - j0hTU ; - - if (etat == 0) - { - if (GMST->get_origine() == GMSTDateTime::AN1900) - { - t = (j0hTU - 2415020.0) / 36525.0 ; - tsm0hTU = 23925.836 + t * (8640184.542 + t * 0.0929) ; - tsm0hTU = tsm0hTU * DEUXPI / CivilDateTime::JOURCIVIL_LENGTH ; - } - else if (GMST->get_origine() == GMSTDateTime::AN1950) - { - t = j0hTU - 2433281.5 ; - tsm0hTU = 1.72944494 + t * 6.3003880987 ; - } - else if (GMST->get_origine() == GMSTDateTime::AN2000) - { - t = (j0hTU - 2451545.0) / 36525.0 ; - tsm0hTU = 24110.54841 + t * (8640184.812866 + t * (0.093103 - t * 6.210e-6)) ; - tsm0hTU = tsm0hTU * DEUXPI / CivilDateTime::JOURCIVIL_LENGTH ; - } - t = tsm0hTU + d * CivilDateTime::JOURCIVIL_LENGTH * OMEGATERRE ; - tsm = fmod (t,DEUXPI) ; - if (tsm < 0.0) - { - tsm = tsm + DEUXPI ; - } - - GMST->set_tms(tsm); - } - - return etat ; -} - -JulianDate::operator JSDDateTime() -{ - JSDDateTime date; - AsJSDDateTime(&date); - return date; -} - -JulianDate::operator GMSTDateTime() -{ - GMSTDateTime date; - AsGMSTDateTime(&date); - return date; -} diff --git a/Utilities/otbossim/src/ossim/projection/otb/MJDDateTime.cpp b/Utilities/otbossim/src/ossim/projection/otb/MJDDateTime.cpp deleted file mode 100644 index da70df5e21..0000000000 --- a/Utilities/otbossim/src/ossim/projection/otb/MJDDateTime.cpp +++ /dev/null @@ -1,46 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - -#include <MJDDateTime.h> - -MJDDateTime::MJDDateTime(): - _day(0), - _second(0), - _microsecond(0) -{ -} - -MJDDateTime::~MJDDateTime() -{ -} - -MJDDateTime::MJDDateTime(const MJDDateTime& rhs): - _day(rhs._day), - _second(rhs._second), - _microsecond(rhs._microsecond) -{ -} - -MJDDateTime::MJDDateTime(long day, unsigned long second, unsigned long microsecond): - _day(day), - _second(second), - _microsecond(microsecond) -{ -} - -MJDDateTime& MJDDateTime::operator=(const MJDDateTime& rhs) -{ - _day = rhs._day; - _second = rhs._second; - _microsecond = rhs._microsecond; - - return *this; -} diff --git a/Utilities/otbossim/src/ossim/projection/otb/PlatformPosition.cpp b/Utilities/otbossim/src/ossim/projection/otb/PlatformPosition.cpp deleted file mode 100644 index 7b14012fb2..0000000000 --- a/Utilities/otbossim/src/ossim/projection/otb/PlatformPosition.cpp +++ /dev/null @@ -1,246 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - - -#include <PlatformPosition.h> -#include <Ephemeris.h> -#include <HermiteInterpolator.h> -#include <ossim/base/ossimKeywordlist.h> - -#include <iostream> -#include <string> -#include <cmath> - -static const char NUMBER_PLATFORM_POSITIONS_KW[] = "platform_positions_count"; - -PlatformPosition::PlatformPosition(): - _nbrData(0), - _data(NULL) -{ -} - -PlatformPosition::~PlatformPosition() -{ - Clear(); -} - -void PlatformPosition::Clear() -{ - if(_data != NULL) - { - for (int i=0;i<_nbrData;i++) - { - delete _data[i]; - } - delete _data; - } - _data = NULL; - _nbrData = 0; -} - -PlatformPosition::PlatformPosition(const PlatformPosition& rhs) -{ - _data = new Ephemeris*[rhs._nbrData]; - _nbrData = rhs._nbrData; - for (int i=0;i<rhs._nbrData;i++) - { - _data[i] = rhs._data[i]->Clone(); - } -} - -PlatformPosition& PlatformPosition::operator=(const PlatformPosition& rhs) -{ - Clear(); - _data = new Ephemeris*[rhs._nbrData]; - _nbrData = rhs._nbrData; - for (int i=0;i<rhs._nbrData;i++) - { - _data[i] = rhs._data[i]->Clone(); - } - - return *this; -} - -PlatformPosition::PlatformPosition(Ephemeris** data, int nbrData): - _nbrData(nbrData) -{ - _data = new Ephemeris*[_nbrData]; - for (int i=0;i<_nbrData;i++) - { - _data[i] = data[i]->Clone(); - } -} - -Ephemeris* PlatformPosition::Interpolate(JSDDateTime date) -{ - const double JOURCIVIL_LENGTH = 86400.0 ; - Ephemeris* ephem = NULL; - if (_nbrData<=1) - { - std::cout << "a..." << std::endl; - ephem = NULL; - } - else - { - /* - * The first element of the list is cloned to ensure that the output ephemeris is expressed in the same coordinate system as input ones - */ - ephem = _data[0]->Clone(); - - /* NORMAL CASE */ - /*------------*/ - double * x = new double[_nbrData]; - double * y = new double[_nbrData]; - double * yd = new double[_nbrData]; - double dt = 0.0; - bool echIrreg = false; - double d; - - x[0] = 0.0 ; - for (int i = 1 ; i < _nbrData ; i++) - { - x[i] = (_data[i]->get_date().get_day0hTU().get_julianDate() - _data[0]->get_date().get_day0hTU().get_julianDate()) - * JOURCIVIL_LENGTH - + _data[i]->get_date().get_second() - _data[0]->get_date().get_second() - + _data[i]->get_date().get_decimal() - _data[0]->get_date().get_decimal(); - d = x[i] - x[i-1] ; - - /* - * Non increasing time - */ - if (d <= 0.0)/* Non increasing time */ - { - delete ephem; - ephem = NULL; - } - else if (i == 1) - { - dt = d ; - } - else if (fabs (d-dt) >= 1.0e-4) /* Irregular sampling */ - { - echIrreg = true; - } - } - - if (ephem != NULL) - { - ephem->set_date(date); - - dt = (date.get_day0hTU().get_julianDate() - _data[0]->get_date().get_day0hTU().get_julianDate()) * JOURCIVIL_LENGTH - + date.get_second() - _data[0]->get_date().get_second() - + date.get_decimal() - _data[0]->get_date().get_decimal(); - - /* If nPts odd or if the searched date is not situated in the middle of the ephemeris list -> Lagrange */ - d = (dt - x[_nbrData/2-1]) / (x[_nbrData/2] - x[_nbrData/2-1]) ; - - - /* Computation by Everett */ - /*---------------------*/ - double pos[3]; - double vit[3]; - for (int j = 0 ; j < 3 ; j++) - { - for (int i = 0 ; i < _nbrData ; i++) - { - y[i] = _data[i]->get_position()[j] ; - yd[i] = _data[i]->get_vitesse()[j] ; - } - HermiteInterpolator interpolator(_nbrData,x,y,yd); - interpolator.Interpolate(dt, pos[j], vit[j]); - - } - ephem->set_position(pos); - ephem->set_vitesse(vit); - - } - - delete[] x; - delete[] y; - delete[] yd; - - } - return ephem; -} - -void PlatformPosition::setData(Ephemeris** data, int nbrData) -{ - Clear(); - _data = data; - _nbrData = nbrData; -} - -bool PlatformPosition::saveState(ossimKeywordlist& kwl, - const char* prefix) const -{ - kwl.add(prefix, NUMBER_PLATFORM_POSITIONS_KW, _nbrData); - - std::string s1; - if (prefix) - { - s1 = prefix; - } - - for (int i = 0; i < _nbrData; ++i) - { - std::string s2 = s1; - s2 += "platform_position["; - s2 += ossimString::toString(i); - s2+= "]"; - _data[i]->saveState(kwl, s2.c_str()); - } - - return true; -} - - -bool PlatformPosition::loadState(const ossimKeywordlist& kwl, - const char* prefix) -{ - bool result = true; - - Clear(); - - const char* lookup = 0; - lookup = kwl.find(prefix, NUMBER_PLATFORM_POSITIONS_KW); - if (lookup) - { - ossimString s = lookup; - _nbrData = s.toInt(); - - if (_nbrData) - { - std::string s1; - if (prefix) - { - s1 = prefix; - } - - _data = new Ephemeris*[_nbrData]; - for (int i = 0; i < _nbrData; ++i) - { - std::string s2 = s1; - s2 += "platform_position["; - s2 += ossimString::toString(i); - s2+= "]"; - - _data[i] = new Ephemeris(); - _data[i]->loadState(kwl, s2.c_str()); - } - } - } - else - { - result = false; - } - - return result; -} diff --git a/Utilities/otbossim/src/ossim/projection/otb/RectangularCoordinate.cpp b/Utilities/otbossim/src/ossim/projection/otb/RectangularCoordinate.cpp deleted file mode 100644 index 37086122fb..0000000000 --- a/Utilities/otbossim/src/ossim/projection/otb/RectangularCoordinate.cpp +++ /dev/null @@ -1,102 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - -#include <RectangularCoordinate.h> -#include <GeodesicCoordinate.h> - -#include <cmath> - -RectangularCoordinate::RectangularCoordinate() -{ -} - -RectangularCoordinate::~RectangularCoordinate() -{ -} - -RectangularCoordinate::RectangularCoordinate(double x, double y, double z): Coordinate(x,y,z) -{ -} - -RectangularCoordinate::RectangularCoordinate(const RectangularCoordinate& rhs): Coordinate((Coordinate)rhs) -{ -} - -RectangularCoordinate& RectangularCoordinate::operator=(const RectangularCoordinate& rhs) -{ - _x = rhs._x; - _y = rhs._x; - _z = rhs._x; - - return *this; -} - -void RectangularCoordinate::AsGeodesicCoordinates(double demiGdAxe, double demiPtAxe, GeodesicCoordinate* geod) -{ - const double PI = 3.14159265358979323846 ; - const int itmax = 40 ; - const double epsilon = 1.0e-6 ; - - int fin , iter ; - double u, a2_b2, d, e, f, df, c, s, p, q ; - - double coordCart[3]; - double coordGeod[3]; - - coordCart[0] = _x; - coordCart[1] = _y; - coordCart[2] = _z; - - u = sqrt (coordCart[0] * coordCart[0] + coordCart[1] * coordCart[1]) ; - if (u < epsilon) - { - coordGeod[0] = 0.0 ; - if (coordCart[2] >= 0.0) - coordGeod[1] = PI / 2.0 ; - else - coordGeod[1] = - PI / 2.0 ; - coordGeod[2] = fabs (coordCart[2]) - demiPtAxe ; - } - else - { - coordGeod[0] = atan2 (coordCart[1] , coordCart[0]) ; - a2_b2 = demiGdAxe * demiGdAxe - demiPtAxe * demiPtAxe ; - e = atan (coordCart[2] / u) ; - fin = 0 ; - iter = 0 ; - while (fin == 0) - { - iter++ ; - d = e ; - c = cos (e) ; - s = sin (e) ; - p = demiGdAxe * u ; - q = demiPtAxe * coordCart[2] ; - f = p * s - q * c - a2_b2 * s * c ; - df = p * c + q * s - a2_b2 * (c * c - s * s) ; - e = e - f / df ; - d = fabs (e - d) ; - if ((d < epsilon) || (iter >= itmax)) - fin = 1 ; - } - coordGeod[1] = atan (tan (e) * demiGdAxe / demiPtAxe) ; - - p = cos(coordGeod[1]) ; - - if (fabs(coordGeod[1]) <= (PI * 0.5)) - coordGeod[2] = (u - demiGdAxe * cos(e)) / cos(coordGeod[1]) ; - else - coordGeod[2] = (coordCart[2] - demiPtAxe * sin(e)) / sin(coordGeod[1]) ; - - geod->set_coordinates(coordGeod[0],coordGeod[1], coordGeod[2]); - } - //return 0 ; -} diff --git a/Utilities/otbossim/src/ossim/projection/otb/RefPoint.cpp b/Utilities/otbossim/src/ossim/projection/otb/RefPoint.cpp deleted file mode 100644 index d5aa820045..0000000000 --- a/Utilities/otbossim/src/ossim/projection/otb/RefPoint.cpp +++ /dev/null @@ -1,193 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - -#include <RefPoint.h> -#include <Ephemeris.h> -#include <cstring> -#include <ossim/base/ossimKeywordlist.h> - -static const char PREFIX[] = "ref_point."; -static const char DISTANCE_KW[] = "distance"; -static const char LINE_KW[] = "line"; -static const char COL_KW[] = "col"; - -RefPoint::RefPoint(): - _ephemeris(0), - _distance(0.0), - _pix_line(0.0), - _pix_col(0.0) -{ -} - -RefPoint::~RefPoint() -{ - if(_ephemeris != 0) - { - delete _ephemeris; - } -} - -RefPoint::RefPoint(const RefPoint& rhs): - _distance(rhs._distance), - _pix_line(rhs._pix_line), - _pix_col(rhs._pix_col) -{ - _ephemeris = rhs._ephemeris->Clone(); -} - -RefPoint& RefPoint::operator=(const RefPoint& rhs) -{ - _distance = rhs._distance; - _pix_line = rhs._pix_line; - _pix_col = rhs._pix_col; - if(_ephemeris != 0) - { - delete _ephemeris; - _ephemeris = 0; - } - _ephemeris = rhs._ephemeris->Clone(); - - return *this; -} - -void RefPoint::set_ephemeris(Ephemeris* ephemeris) -{ - if(_ephemeris != 0) - { - delete _ephemeris; - _ephemeris = 0; - } - _ephemeris = ephemeris->Clone(); -} - -void RefPoint::set_distance(double distance) -{ - _distance = distance; -} - -void RefPoint::set_pix_line(double pix_line) -{ - _pix_line = pix_line; -} - -void RefPoint::set_pix_col(double pix_col) -{ - _pix_col = pix_col; -} - -Ephemeris* RefPoint::get_ephemeris() -{ - return _ephemeris; -} - -double RefPoint::get_distance() const -{ - return _distance; -} - -double RefPoint::get_pix_line() const -{ - return _pix_line; -} - -double RefPoint::get_pix_col() const -{ - return _pix_col; -} - -bool RefPoint::saveState(ossimKeywordlist& kwl, const char* prefix) const -{ - bool result = true; - - std::string pfx; - if (prefix) - { - pfx = prefix; - } - pfx += PREFIX; - - if (_ephemeris) - { - result = _ephemeris->saveState(kwl, pfx.c_str()); - } - else - { - result = false; - } - - kwl.add(pfx.c_str(), DISTANCE_KW, _distance); - kwl.add(pfx.c_str(), LINE_KW, _pix_line); - kwl.add(pfx.c_str(), COL_KW, _pix_col); - - return result; -} - -bool RefPoint::loadState(const ossimKeywordlist& kwl, const char* prefix) -{ - bool result = true; - - std::string pfx; - if (prefix) - { - pfx = prefix; - } - pfx += PREFIX; - - - if (!_ephemeris) - { - _ephemeris = new Ephemeris(); - } - - result = _ephemeris->loadState(kwl, pfx.c_str()); - - const char* lookup = 0; - ossimString s; - double d; - - lookup = kwl.find(pfx.c_str(), DISTANCE_KW); - if (lookup) - { - s = lookup; - d = s.toDouble(); - _distance = d; - } - else - { - result = false; - } - - lookup = kwl.find(pfx.c_str(), LINE_KW); - if (lookup) - { - s = lookup; - d = s.toDouble(); - _pix_line = d; - } - else - { - result = false; - } - - lookup = kwl.find(pfx.c_str(), COL_KW); - if (lookup) - { - s = lookup; - d = s.toDouble(); - _pix_col = d; - } - else - { - result = false; - } - - return result; -} diff --git a/Utilities/otbossim/src/ossim/projection/otb/SarSensor.cpp b/Utilities/otbossim/src/ossim/projection/otb/SarSensor.cpp deleted file mode 100644 index f32051fa85..0000000000 --- a/Utilities/otbossim/src/ossim/projection/otb/SarSensor.cpp +++ /dev/null @@ -1,230 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - -#include <SarSensor.h> -#include <JSDDateTime.h> -#include <Ephemeris.h> -#include <GeographicEphemeris.h> -#include <Sensor.h> -#include <SensorParams.h> -#include <PlatformPosition.h> -#include <Equation.h> -#include <RectangularCoordinate.h> -#include <GeodesicCoordinate.h> -#include <complex> - -SarSensor::SarSensor(SensorParams* params, PlatformPosition* position) : Sensor(params, position) -{ -} - -SarSensor::~SarSensor() -{ -} - -int SarSensor::ImageToWorld(double distance, JSDDateTime time, double height, double& lon, double& lat) -{ - const double DEUXPI = 6.28318530717958647693 ; - - double semiMajorAxis = _params->get_semiMajorAxis() ; // default : WGS84 - double semiMinorAxis = _params->get_semiMinorAxis() ; // default : WGS84 - - double lambda = _params->get_rwl(); - int sensVisee ; - if (_params->get_sightDirection() == SensorParams::Right) sensVisee = 1 ; - else sensVisee = -1 ; - - Ephemeris* satPosition = _position->Interpolate(time); - - GeographicEphemeris *geoEph = (GeographicEphemeris*)satPosition; - - RectangularCoordinate cart; - - // note : the Doppler frequency is set to zero - int etatLoc = localisationSAR(*geoEph, lambda, distance, 0.0, sensVisee, semiMajorAxis , semiMinorAxis , height, &cart); - - GeodesicCoordinate geo; - cart.AsGeodesicCoordinates(semiMajorAxis , semiMinorAxis, &geo); - lon = (geo.get_x())*360.0/DEUXPI; - lat = (geo.get_y())*360.0/DEUXPI; - - delete satPosition; - - return etatLoc ; -} - -int SarSensor::localisationSAR ( GeographicEphemeris PosVit , double lambda , - double dist , double fDop , int sensVisee , - double rayonEqu , double rayonPol , - double h , RectangularCoordinate* cart ) -{ - double coordCart[3]; - coordCart[0]=0.0; - coordCart[1]=0.0; - coordCart[2]=0.0; - - - int* ordre; - int etat , fin , n , i , i1 , i2 , nRac , indice[4] ; - double posX , posY , posZ , vitX , vitY , vitZ ; - double dist1 , fDop1 , he , hp ; - double rho2 , k , a , b , c , d , u , v , w ; - double x[4] , y[4] , z[4] , r[4] ; - std::complex<double> aa[5]; - std::complex<double> *racine; - GeographicEphemeris PosVitGeo ; - - - - /* Initialization of characteristical values */ - /* note : for precise computation : */ - /* - ranges are processed in mm */ - /* - velocities are processed in km/s */ - /* - frequencies are processed in kHz */ - const double KILO = 1.0e-3 ; - const double MEGA = 1.0e-6 ; - const double EPSILON = 1.0e-12 ; - - etat = 0 ; - - dist1 = dist * MEGA ; - fDop1 = fDop * KILO ; - - he = (rayonEqu + h) * MEGA ; /* Equatorial radius + h */ - hp = (rayonPol + h) * MEGA ; /* Polar radius + h */ - - posX = PosVit.get_position()[0] * MEGA ; - posY = PosVit.get_position()[1] * MEGA ; - posZ = PosVit.get_position()[2] * MEGA ; - vitX = - PosVit.get_vitesse()[0] * KILO ; - vitY = - PosVit.get_vitesse()[1] * KILO ; - vitZ = - PosVit.get_vitesse()[2] * KILO ; - - - /* Coefficients computation and equation solving */ - if (etat == 0) - { - - u = vitX * posY - vitY * posX ; - a = (vitX / u) * (1.0 - (he / hp) * (he / hp)) / 2.0 ; - b = (vitX * posZ - vitZ * posX) / u ; - rho2 = posX * posX + posY * posY + posZ * posZ ; - k = posX * vitX + posY * vitY + posZ * vitZ - - lambda * dist1 * fDop1 / 2.0 ; - c = (vitX * (he * he + rho2 - dist1 * dist1) - 2.0 * k * posX) / (2.0 * u); - - u = vitZ - b * vitY ; - v = c * vitY - k ; - w = v * v - (vitX * vitX) * (he * he - c * c) ; - aa[0] = std::complex<double>(w,0.0); /* Constant coefficient */ - w = 2.0 * (u * v - (b * c) * (vitX * vitX)) ; - aa[1] = std::complex<double>(w,0.0) ; /* First order coefficient */ - w = u * u + 2.0 * a * v * vitY + - (vitX * vitX) * ((he / hp) * (he / hp) + b * b + 2.0 * a * c) ; - aa[2] = std::complex<double>(w,0.0) ; /* Second order coefficient */ - w = 2.0 * a * (u * vitY - b * vitX * vitX) ; - aa[3] = std::complex<double>(w,0.0) ; /* Third order coefficient */ - w = (vitX * vitX + vitY * vitY) * a * a ; - aa[4] = std::complex<double>(w,0.0) ; /* Fourth order coefficient */ - - Equation eq(4,aa); /* Equation solving */ - eq.Solve(); - - n = eq.get_nbrSol(); - racine = eq.get_solutions(); - ordre = eq.get_order(); - - nRac = 0 ; - for (i = 0 ; i < n ; i++) /* Real root selection */ - { - d = fabs(racine[i].imag()) ; - if (d < EPSILON) - { - z[nRac] = racine[i].real(); - y[nRac] = (a * z[nRac] - b) * z[nRac] + c ; - x[nRac] = (k - (vitY * y[nRac] + vitZ * z[nRac])) / vitX ; - nRac = nRac + 1 ; - } - } - if (nRac == 0) - etat = 2 ; /* No root */ - } - - /* Computed roots sort */ - if (etat == 0) - { - for (i = 0 ; i < nRac ; i++) - { - /* Computation of the "distance" between roots images and equation values */ - u = x[i] - posX ; - v = y[i] - posY ; - w = z[i] - posZ ; - r[i] = fabs ((u * u + v * v + w * w) / (dist1 * dist1) - 1.0 ) ; - u = u * vitX ; - v = v * vitY ; - w = w * vitZ ; - if (fabs (fDop) > EPSILON) - r[i] = r[i] + fabs (1.0 + 2.0 * (u + v + w) / (lambda * dist1 * fDop1)); - else - r[i] = r[i] + fabs (2.0 * (u + v + w) / (lambda * dist1)) ; - u = x[i] / he ; - v = y[i] / he ; - w = z[i] / hp ; - r[i] = r[i] + fabs (u * u + v * v + w * w - 1.0) ; - indice[i] = i ; - } - - /* Roots sort by increasing differences */ - fin = 0 ; - while (fin == 0) - { - fin = 1 ; - for (i = 0 ; i < (nRac - 1) ; i++) - { - i1 = indice[i] ; - i2 = indice[i+1] ; - if (r[i2] < r[i1]) - { - indice[i] = i2 ; - indice[i+1] = i1 ; - fin = 0 ; - } - } - } - - /* Selection of the correct root (corresponding to the imaging direction) */ - fin = 0 ; - i = 0 ; - while ((fin == 0) && (i < nRac)) - { - i1 = indice[i] ; - u = posY * vitZ - posZ * vitY ; - v = posZ * vitX - posX * vitZ ; - w = posX * vitY - posY * vitX ; - a = x[i1] - posX ; - b = y[i1] - posY ; - c = z[i1] - posZ ; - d = (a * u + b * v + c * w) * sensVisee; - if (d >= 0.0) - { - coordCart[0] = x[i1] / MEGA ; /* Coordinates in the */ - coordCart[1] = y[i1] / MEGA ; /* geographic referential, */ - coordCart[2] = z[i1] / MEGA ; /* in legal units (m) */ - fin = 1 ; - } - i++ ; - } - if (fin == 0) - etat = 1 ; /* No root in the imaging direction */ - } - - cart->set_coordinates(coordCart[0], coordCart[1], coordCart[2]); - return etat ; -} diff --git a/Utilities/otbossim/src/ossim/projection/otb/Sensor.cpp b/Utilities/otbossim/src/ossim/projection/otb/Sensor.cpp deleted file mode 100644 index de06d5116a..0000000000 --- a/Utilities/otbossim/src/ossim/projection/otb/Sensor.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - -#include <Sensor.h> -#include <SensorParams.h> -#include <PlatformPosition.h> - -#include <cstring> - -Sensor::Sensor(SensorParams* params, PlatformPosition* position) -{ - _params = params->Clone(); - _position = position->Clone(); -} - -Sensor::~Sensor() -{ - if(_params != NULL) - { - delete _params; - } - - if(_position != NULL) - { - delete _position; - } -} diff --git a/Utilities/otbossim/src/ossim/projection/otb/SensorParams.cpp b/Utilities/otbossim/src/ossim/projection/otb/SensorParams.cpp deleted file mode 100644 index 12a761a5f5..0000000000 --- a/Utilities/otbossim/src/ossim/projection/otb/SensorParams.cpp +++ /dev/null @@ -1,232 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - -#include <SensorParams.h> -#include <ossim/base/ossimKeywordlist.h> -#include <ossim/base/ossimString.h> - -static const char PREFIX[] = "sensor_params."; -static const char PRF_KW[] = "prf"; -static const char SF_KW[] = "sampling_frequency"; -static const char RWL_KW[] = "radar_wave_length"; -static const char COL_DIR_KW[] = "column_direction"; -static const char LIN_DIR_KW[] = "line_direction"; -static const char SIGHT_DIR_KW[] = "sight_direction"; -static const char SEMI_MAJOR_AXIS_KW[] = "semi_major_axis"; -static const char SEMI_MINOR_AXIS_KW[] = "semi_minor_axis"; -static const char NUM_AZIMUTH_LOOKS_KW[] = "number_azimuth_looks"; -static const char NUM_RANGE_LOOKS_KW[] = "number_range_looks"; - -SensorParams::SensorParams(): - _prf(0.0), - _sf(0.0), - _rwl(0.0), - _col_direction(1), - _lin_direction(1), - _sightDirection(Right), - _semiMajorAxis(6378137.0), - _semiMinorAxis(6356752.3141), - _nAzimuthLook(1), - _nRangeLook(1) -{ -} - -SensorParams::~SensorParams() -{ -} - -SensorParams::SensorParams(const SensorParams& rhs): - _prf(rhs._prf), - _sf(rhs._sf), - _rwl(rhs._rwl), - _col_direction(rhs._col_direction), - _lin_direction(rhs._lin_direction), - _sightDirection(rhs._sightDirection), - _semiMajorAxis(rhs._semiMajorAxis), - _semiMinorAxis(rhs._semiMinorAxis), - _nAzimuthLook(rhs._nAzimuthLook), - _nRangeLook(rhs._nRangeLook) -{ -} - -SensorParams& SensorParams::operator=(const SensorParams& rhs) -{ - _prf = rhs._prf; - _sf = rhs._sf; - _rwl = rhs._rwl; - _col_direction = rhs._col_direction; - _lin_direction = rhs._lin_direction; - _sightDirection = rhs._sightDirection; - _semiMajorAxis = rhs._semiMajorAxis; - _semiMinorAxis = rhs._semiMinorAxis; - _nAzimuthLook = rhs._nAzimuthLook; - _nRangeLook = rhs._nRangeLook; - _semiMajorAxis = rhs._semiMajorAxis; - _semiMinorAxis = rhs._semiMinorAxis; - return *this; -} - -bool SensorParams::saveState(ossimKeywordlist& kwl, const char* prefix) const -{ - std::string pfx; - if (prefix) - { - pfx = prefix; - } - pfx += PREFIX; - - kwl.add(pfx.c_str(), PRF_KW, _prf); - kwl.add(pfx.c_str(), SF_KW, _sf); - kwl.add(pfx.c_str(), RWL_KW, _rwl); - kwl.add(pfx.c_str(), COL_DIR_KW, _col_direction); - kwl.add(pfx.c_str(), LIN_DIR_KW, _lin_direction); - kwl.add(pfx.c_str(), SIGHT_DIR_KW, static_cast<int>(_sightDirection)); - kwl.add(pfx.c_str(), SEMI_MAJOR_AXIS_KW, _semiMajorAxis); - kwl.add(pfx.c_str(), SEMI_MINOR_AXIS_KW, _semiMinorAxis); - kwl.add(pfx.c_str(), NUM_AZIMUTH_LOOKS_KW, _nAzimuthLook); - kwl.add(pfx.c_str(), NUM_RANGE_LOOKS_KW, _nRangeLook); - - return true; -} - -bool SensorParams::loadState(const ossimKeywordlist& kwl, const char* prefix) -{ - bool result = true; - - std::string pfx; - if (prefix) - { - pfx = prefix; - } - pfx += PREFIX; - - ossimString s; - const char* lookup = 0; - - lookup = kwl.find(pfx.c_str(), PRF_KW); - if (lookup) - { - s = lookup; - _prf = s.toDouble(); - } - else - { - result = false; - } - - lookup = kwl.find(pfx.c_str(), SF_KW); - if (lookup) - { - s = lookup; - _sf = s.toDouble(); - } - else - { - result = false; - } - - lookup = kwl.find(pfx.c_str(), RWL_KW); - if (lookup) - { - s = lookup; - _rwl = s.toDouble(); - } - else - { - result = false; - } - - lookup = kwl.find(pfx.c_str(), COL_DIR_KW); - if (lookup) - { - s = lookup; - _col_direction = s.toInt(); - } - else - { - result = false; - } - - lookup = kwl.find(pfx.c_str(), LIN_DIR_KW); - if (lookup) - { - s = lookup; - _lin_direction = s.toInt(); - } - else - { - result = false; - } - - lookup = kwl.find(pfx.c_str(), SIGHT_DIR_KW); - if (lookup) - { - s = lookup; - if ( s.toInt() == 0 ) - { - _sightDirection = SensorParams::Left; - } - else - { - _sightDirection = SensorParams::Right; - } - } - else - { - result = false; - } - - lookup = kwl.find(pfx.c_str(), SEMI_MAJOR_AXIS_KW); - if (lookup) - { - s = lookup; - _semiMajorAxis = s.toDouble(); - } - else - { - result = false; - } - - lookup = kwl.find(pfx.c_str(), SEMI_MINOR_AXIS_KW); - if (lookup) - { - s = lookup; - _semiMinorAxis = s.toDouble(); - } - else - { - result = false; - } - - lookup = kwl.find(pfx.c_str(), NUM_AZIMUTH_LOOKS_KW); - if (lookup) - { - s = lookup; - _nAzimuthLook = s.toDouble(); - } - else - { - result = false; - } - - lookup = kwl.find(pfx.c_str(), NUM_RANGE_LOOKS_KW); - if (lookup) - { - s = lookup; - _nRangeLook = s.toDouble(); - } - else - { - result = false; - } - - return result; -} -- GitLab