MCPcopy Create free account
hub / github.com/ImageEngine/cortex / evaluator

Method evaluator

src/IECore/Ramp.cpp:297–338  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

295
296template<typename X, typename Y>
297IECore::Spline<X,Y> Ramp<X,Y>::evaluator() const
298{
299 using ResultType = IECore::Spline<X,Y>;
300 ResultType result;
301
302 result.points = points;
303
304 if( interpolation == RampInterpolation::Linear )
305 {
306 result.basis = ResultType::Basis::linear();
307 }
308 else if( interpolation == RampInterpolation::CatmullRom )
309 {
310 result.basis = ResultType::Basis::catmullRom();
311 }
312 else if( interpolation == RampInterpolation::BSpline )
313 {
314 result.basis = ResultType::Basis::bSpline();
315 }
316 else if( interpolation == RampInterpolation::MonotoneCubic )
317 {
318 monotoneCubicCVsToBezierCurve< Ramp<X,Y> >( points, result.points );
319 result.basis = ResultType::Basis::bezier();
320 }
321 else if( interpolation == RampInterpolation::Constant )
322 {
323 result.basis = ResultType::Basis::constant();
324 }
325
326 int multiplicity = endPointMultiplicity( interpolation );
327
328 if( multiplicity && result.points.size() )
329 {
330 for( int i = 0; i < multiplicity - 1; ++i )
331 {
332 result.points.insert( *result.points.begin() );
333 result.points.insert( *result.points.rbegin() );
334 }
335 }
336
337 return result;
338}
339
340template<typename X, typename Y>
341void Ramp<X,Y>::fromOSL( const std::string &basis, const std::vector<X> &positions, const std::vector<Y> &values, const std::string &identifier )

Callers 2

testDeprecatedSplinesMethod · 0.80
testEvaluatorMethod · 0.80

Calls 4

endPointMultiplicityFunction · 0.85
insertMethod · 0.80
sizeMethod · 0.45
beginMethod · 0.45

Tested by 2

testDeprecatedSplinesMethod · 0.64
testEvaluatorMethod · 0.64