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

Function getOSLEndPointDuplication

src/IECore/Ramp.cpp:217–243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

215}
216
217std::pair< size_t, size_t > getOSLEndPointDuplication( IECore::RampInterpolation interpolation )
218{
219 if( interpolation == IECore::RampInterpolation::CatmullRom )
220 {
221 return std::make_pair( 1, 1 );
222 }
223 else if( interpolation == IECore::RampInterpolation::BSpline )
224 {
225 return std::make_pair( 2, 2 );
226 }
227 else if( interpolation == IECore::RampInterpolation::Linear )
228 {
229 // OSL discards the first and last segment of linear curves
230 // "To maintain consistency with the other spline types"
231 // so we need to duplicate the end points to preserve all provided segments
232 return std::make_pair( 1, 1 );
233 }
234 else if( interpolation == IECore::RampInterpolation::Constant )
235 {
236 // Also, "To maintain consistency", "constant splines ignore the first and the two last
237 // data values."
238 return std::make_pair( 1, 2 );
239 }
240
241
242 return std::make_pair( 0, 0 );
243}
244
245// Removes start and end points with duplicated X values.
246//

Callers 2

toOSLMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected