Commit 0629f4e4 authored by Jesse Mapel's avatar Jesse Mapel
Browse files

Added methods to determine segment index for a given et to SpicePosition and SpiceRotation.

parent 5ec521dd
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -143,7 +143,7 @@ namespace Isis {
   * 
   * @return @b int The zero-based index of the segment.
   */
  int PiecewisePolynomial::segmentIndex(double value) {
  int PiecewisePolynomial::segmentIndex(double value) const {
    std::vector<double>::const_iterator knotIt;
    knotIt = std::upper_bound(m_knots.begin(), m_knots.end(), value);
    if (knotIt == m_knots.begin()) {
+2 −1
Original line number Diff line number Diff line
@@ -78,6 +78,8 @@ namespace Isis {
      void setDimensions(int dimensions);
      void setKnots(std::vector<double> &knots);

      int segmentIndex(double value) const;

    private:
      void validateData(const std::vector<double> &values,
                        const std::vector< std::vector<double> > &data,
@@ -93,7 +95,6 @@ namespace Isis {
                              const std::vector<double> &secondPoint);
      void computePolynomials(const std::vector<double> &values,
                              const std::vector< std::vector<double> > &data);
      int segmentIndex(double value);
      int derivativeCoefficient(int coeffOrder, int derivativeOrder);

      int m_degree; //< The degree of the polynomials.
+15 −0
Original line number Diff line number Diff line
@@ -1729,6 +1729,21 @@ namespace Isis {
  }


  /**
   * Return the index of the polynomial segment that contains a given time.
   * 
   * @param et The time to find the segment index of.
   * 
   * @return @b int The index of the polynomial segment containing the time.
   */
  int SpicePosition::polySegmentIndex(double et) const {
    // Scale the time
    double scaledTime;
    scaledTime = (p_et - p_baseTime) / p_timeScale;
    return m_polynomial.segmentIndex(scaledTime);
  }


  /**
   * Cache J2000 position over existing cached time range using
   * table
+1 −0
Original line number Diff line number Diff line
@@ -265,6 +265,7 @@ namespace Isis {

      int numPolynomialSegments() const;
      std::vector<double> polynomialKnots() const;
      int polySegmentIndex(double et) const;

      //! Return the source of the position
      Source GetSource() {
+15 −0
Original line number Diff line number Diff line
@@ -2249,6 +2249,21 @@ namespace Isis {
  }


  /**
   * Return the index of the polynomial segment that contains a given time.
   * 
   * @param et The time to find the segment index of.
   * 
   * @return @b int The index of the polynomial segment containing the time.
   */
  int SpiceRotation::polySegmentIndex(double et) const {
    // Scale the time
    double scaledTime;
    scaledTime = (p_et - p_baseTime) / p_timeScale;
    return m_polynomial.segmentIndex(scaledTime);
  }


  /** 
   * Accessor method to get the rotation frame type. 
   *
Loading