src/ccstruct/quspline.cpp
int32_t QSPLINE::spline_index( // evaluate
    double x                   // coord to evaluate at
    ) const {
  int32_t index;  // segment index
  int32_t bottom; // bottom of range
  int32_t top;    // top of range

  bottom = 0;
  top = segments;
  while (top - bottom > 1) {
    index = (top + bottom) / 2; // centre of range
    if (x >= xcoords[index]) {
      bottom = index; // new min
    } else {
      top = index; // new max
    }
  }
  return bottom;
}
/**********************************************************************
 * QSPLINE::spline_index
 *
 * Return the index to the largest xcoord not greater than x.
 **********************************************************************/
:spline_index
Return the index to the largest xcoord not greater than x.
: spline_index Return the index to the largest xcoord not greater than x .
int32_t QSPLINE::spline_index( 
    double x                   
    ) const {
  int32_t index;  
  int32_t bottom; 
  int32_t top;    
  bottom = 0;
  top = segments;
  while (top - bottom > 1) {
    index = (top + bottom) / 2; 
    if (x >= xcoords[index]) {
      bottom = index; 
    } else {
      top = index; 
    }
  }
  return bottom;
}
int32_t QSPLINE :: spline_index ( double x ) const { int32_t index ; int32_t bottom ; int32_t top ; bottom = 0 ; top = segments ; while ( top - bottom > 1 ) { index = ( top + bottom ) / 2 ; if ( x >= xcoords [ index ] ) { bottom = index ; } else { top = index ; } } return bottom ; }
QSPLINE::spline_index
 Return the index to the largest xcoord not greater than x.
QSPLINE :: spline_index Return the index to the largest xcoord not greater than x .
// evaluate // coord to evaluate at // segment index // bottom of range // top of range // centre of range // new min // new max