diff --git a/Utilities/otbossimplugins/ossim/otb/HermiteInterpolator.cpp b/Utilities/otbossimplugins/ossim/otb/HermiteInterpolator.cpp index 7a2c06904cc038d9a65798f6908dab67f9c711b5..828baecaefa61103003d30e490ef9d4912e5fbf8 100644 --- a/Utilities/otbossimplugins/ossim/otb/HermiteInterpolator.cpp +++ b/Utilities/otbossimplugins/ossim/otb/HermiteInterpolator.cpp @@ -32,6 +32,8 @@ HermiteInterpolator::HermiteInterpolator(): HermiteInterpolator::HermiteInterpolator(int nbrPoints, double* x, double* y, double* dy): theNPointsAvailable(nbrPoints), + prodC(NULL), + sumC(NULL), isComputed(false) { if(x != NULL) @@ -95,6 +97,8 @@ HermiteInterpolator::~HermiteInterpolator() HermiteInterpolator::HermiteInterpolator(const HermiteInterpolator& rhs): theNPointsAvailable(rhs.theNPointsAvailable), + prodC(NULL), + sumC(NULL), isComputed(false) { if(rhs.theXValues != NULL) @@ -180,6 +184,8 @@ HermiteInterpolator& HermiteInterpolator::operator =(const HermiteInterpolator& { thedYValues = NULL; } + prodC = NULL; + sumC = NULL; return *this; } diff --git a/Utilities/otbossimplugins/ossim/otb/PlatformPosition.cpp b/Utilities/otbossimplugins/ossim/otb/PlatformPosition.cpp index 527e9abcff3af28904357ecde5671f8ddf47ba7a..74a55f5e59102675ebbe032d22b7fc243bfa556a 100644 --- a/Utilities/otbossimplugins/ossim/otb/PlatformPosition.cpp +++ b/Utilities/otbossimplugins/ossim/otb/PlatformPosition.cpp @@ -12,6 +12,7 @@ #include <iostream> #include <string> #include <cmath> +#include <iomanip> #include <otb/PlatformPosition.h> #include <otb/Ephemeris.h> @@ -21,7 +22,6 @@ namespace ossimplugins { - static const char NUMBER_PLATFORM_POSITIONS_KW[] = "platform_positions_count"; PlatformPosition::PlatformPosition(): @@ -29,7 +29,8 @@ PlatformPosition::PlatformPosition(): _data(NULL), _t(NULL), _p(NULL), - _dp(NULL) + _dp(NULL), + _interpolator(NULL) { } @@ -56,10 +57,13 @@ void PlatformPosition::Clear() for (int j=0; j<3; ++j) { delete[] _p[j]; delete[] _dp[j]; + delete _interpolator[j]; } } delete[] _p; delete[] _dp; + + delete[] _interpolator; } PlatformPosition::PlatformPosition(const PlatformPosition& rhs) @@ -96,6 +100,7 @@ void PlatformPosition::InitAuxiliaryData() _t = new double[_nbrData]; _p = new double*[3]; _dp = new double*[3]; + _interpolator = new HermiteInterpolator*[3]; for (int j=0; j<3; ++j) { _p[j] = new double[_nbrData]; _dp[j] = new double[_nbrData]; @@ -106,8 +111,8 @@ void PlatformPosition::InitAuxiliaryData() { _t[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(); + + _data[i]->get_date().get_second() - _data[0]->get_date().get_second() + + _data[i]->get_date().get_decimal() - _data[0]->get_date().get_decimal(); } for (int j = 0; j < 3; j++) @@ -117,7 +122,9 @@ void PlatformPosition::InitAuxiliaryData() _p[j][i] = _data[i]->get_position()[j]; _dp[j][i] = _data[i]->get_speed()[j]; } + _interpolator[j] = new HermiteInterpolator(_nbrData, _t, _p[j], _dp[j]); } + } Ephemeris* PlatformPosition::Interpolate(JSDDateTime date) const @@ -155,8 +162,7 @@ Ephemeris* PlatformPosition::Interpolate(JSDDateTime date) const double speed[3]; for (int j = 0; j < 3; j++) { - HermiteInterpolator interpolator(_nbrData, _t, _p[j], _dp[j]); - interpolator.Interpolate(dt, pos[j], speed[j]); + _interpolator[j]->Interpolate(dt, pos[j], speed[j]); } ephem->set_position(pos); ephem->set_speed(speed); diff --git a/Utilities/otbossimplugins/ossim/otb/PlatformPosition.h b/Utilities/otbossimplugins/ossim/otb/PlatformPosition.h index 8695213bf7ab721d3d6473d1e6eb32b8e5c76183..ea6bf78c8d8a2d0fc0dd852f561620ffa336fdcc 100644 --- a/Utilities/otbossimplugins/ossim/otb/PlatformPosition.h +++ b/Utilities/otbossimplugins/ossim/otb/PlatformPosition.h @@ -22,6 +22,7 @@ namespace ossimplugins class Ephemeris; +class HermiteInterpolator; /** @@ -119,7 +120,7 @@ private: double * _t; double ** _p; double ** _dp; - + HermiteInterpolator ** _interpolator; }; }