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

Method integrateCurve

src/IECoreScene/CurvesPrimitiveEvaluator.cpp:536–559  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

534
535
536float CurvesPrimitiveEvaluator::integrateCurve( unsigned curveIndex, float vStart, float vEnd, int samples, Result& typedResult ) const
537{
538 // get first curve point:
539 (typedResult.*typedResult.m_init)( curveIndex, vStart, this );
540 Imath::V3f current;
541 Imath::V3f previous = typedResult.point();
542
543 // take ten samples along the curve, and measure the length of the resulting polyline:
544 const float vStep = ( vEnd - vStart ) / samples;
545 float length = 0;
546 float v;
547 for( int i=1; i <= samples; ++i )
548 {
549 v = vStart + vStep * i;
550 (typedResult.*typedResult.m_init)( curveIndex, v, this );
551 current = typedResult.point();
552
553 length += ( current - previous ).length();
554
555 previous = current;
556 }
557
558 return length;
559}
560
561
562float CurvesPrimitiveEvaluator::curveLength( unsigned curveIndex, float vStart, float vEnd ) const

Callers

nothing calls this directly

Calls 1

pointMethod · 0.45

Tested by

no test coverage detected