| 256 | |
| 257 | template <typename IndexType, typename ValueType> |
| 258 | ValueType ParametricFunction<IndexType, ValueType>::interpolate(IndexType index) const { |
| 259 | if (Base::empty()) |
| 260 | return ValueType(); |
| 261 | |
| 262 | if (m_interpolationMode == InterpolationMode::HalfStep) { |
| 263 | return parametricInterpolate2(Base::indexes(), Base::values(), index, StepWeightOperator<IndexType>(), m_boundMode); |
| 264 | |
| 265 | } else if (m_interpolationMode == InterpolationMode::Linear) { |
| 266 | return parametricInterpolate2( |
| 267 | Base::indexes(), Base::values(), index, LinearWeightOperator<IndexType>(), m_boundMode); |
| 268 | |
| 269 | } else if (m_interpolationMode == InterpolationMode::Cubic) { |
| 270 | // ParametricFunction uses CubicWeights with linear extrapolation (not |
| 271 | // configurable atm) |
| 272 | return parametricInterpolate4( |
| 273 | Base::indexes(), Base::values(), index, Cubic4WeightOperator<IndexType>(true), m_boundMode); |
| 274 | |
| 275 | } else { |
| 276 | throw MathException("Unsupported interpolation type in ParametricFunction::interpolate"); |
| 277 | } |
| 278 | } |
| 279 | |
| 280 | template <typename IndexType, typename ValueType> |
| 281 | ValueType ParametricFunction<IndexType, ValueType>::operator()(IndexType index) const { |