Commit 5ec521dd authored by Jesse Mapel's avatar Jesse Mapel
Browse files

Modified SpiceRotation to use the PiecewisePolynomial class. Fixes #5029.

parent 14758c9f
Loading
Loading
Loading
Loading
+3 −7
Original line number Diff line number Diff line
@@ -596,12 +596,6 @@ namespace Isis {
        }
      }

      // Load one more table entry with the time adjustments for the fit equation
      // t = (et - baseTime)/ timeScale
      record[0] = p_baseTime;
      record[1] = p_timeScale;
      record[2] = (double) p_degree;

      CacheLabel(table);
      PolynomialLabel(table);
      table += record;
@@ -943,7 +937,6 @@ namespace Isis {

    // If fitting a polynomial over hermite data, then do not fit the polynomial,
    // just set the knots and move on.
    // TODO Should poly over hermite allow multiple segments? JAM
    if ( type == PolyFunctionOverHermiteConstant ) {
      if ( m_segments > 1 ) {
        std::vector<double> knots;
@@ -1011,6 +1004,9 @@ namespace Isis {
    // Compute the base time
    ComputeBaseTime();

    // Adjust the polynomial degree if needed
    SetPolynomialDegree(p_degree);

    // Save the coefficients
    std::vector< std::vector<double> > segmentCoefficients;
    segmentCoefficients.push_back(XC);
+290 −249

File changed.

Preview size limit exceeded, changes collapsed.

+12 −4
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@
#include "Angle.h"
#include "Table.h"
#include "PolynomialUnivariate.h"
#include "PiecewisePolynomial.h"
#include "Quaternion.h"

#define J2000Code    1
@@ -345,6 +346,7 @@ namespace Isis {

      Table Cache(const QString &tableName);
      void CacheLabel(Table &table);
      void PolynomialLabel(Table &table);

      void LoadTimeCache();

@@ -358,7 +360,8 @@ namespace Isis {
      void SetPolynomial(const std::vector<double> &abcAng1,
                         const std::vector<double> &abcAng2,
                         const std::vector<double> &abcAng3,
                         const Source type = PolyFunction);
                         const Source type = PolyFunction,
                         const int segment = 0);

      void usePckPolynomial();
      void setPckPolynomial(const std::vector<Angle> &raCoeff,
@@ -367,7 +370,8 @@ namespace Isis {

      void GetPolynomial(std::vector<double> &abcAng1,
                         std::vector<double> &abcAng2,
                         std::vector<double> &abcAng3);
                         std::vector<double> &abcAng3,
                         const int segment = 0);

      void getPckPolynomial(std::vector<Angle> &raCoeff,
                            std::vector<Angle> &decCoeff,
@@ -375,6 +379,9 @@ namespace Isis {

      // Set the polynomial degree
      void SetPolynomialDegree(int degree);
      void setPolynomialSegments(int segmentCount);
      int numPolynomialSegments() const;
      std::vector<double> polynomialKnots() const;
      Source GetSource();
      void SetSource(Source source);
      void ComputeBaseTime();
@@ -425,6 +432,7 @@ namespace Isis {
                                                      coefficients of polynomial
                                                      fit to rotation angles.*/
      int p_degree;                     //!< Degree of fit polynomial for angles
      int m_segments;                   //!< Number of segments in the polynomial
      int p_axis1;                      //!< Axis of rotation for angle 1 of rotation
      int p_axis2;                      //!< Axis of rotation for angle 2 of rotation
      int p_axis3;                      //!< Axis of rotation for angle 3 of rotation
@@ -461,8 +469,8 @@ namespace Isis {
      bool p_degreeApplied;               /**< Flag indicating whether or not a polynomial
                                               of degree p_degree has been created and
                                               used to fill the cache*/
      std::vector<double> p_coefficients[3];  /**< Coefficients defining functions fit 
                                                   to 3 pointing angles*/
      PiecewisePolynomial m_polynomial;   /**< Piecewise polynomial fit over
                                               the 3 pointing angles.*/
      bool p_noOverride;                  //!< Flag to compute base time;
      double p_overrideBaseTime;          //!< Value set by caller to override computed base time
      double p_overrideTimeScale;         //!< Value set by caller to override computed time scale