| 69 | } |
| 70 | |
| 71 | ConstDataPtr SampledSceneInterface::readTransform( double time ) const |
| 72 | { |
| 73 | size_t sample1, sample2; |
| 74 | double x = transformSampleInterval( time, sample1, sample2 ); |
| 75 | |
| 76 | if( x == 0 ) |
| 77 | { |
| 78 | return readTransformAtSample( sample1 ); |
| 79 | } |
| 80 | if( x == 1 ) |
| 81 | { |
| 82 | return readTransformAtSample( sample2 ); |
| 83 | } |
| 84 | |
| 85 | ConstDataPtr transformData1 = readTransformAtSample( sample1 ); |
| 86 | ConstDataPtr transformData2 = readTransformAtSample( sample2 ); |
| 87 | DataPtr transformData = runTimeCast< Data >( linearObjectInterpolation( transformData1.get(), transformData2.get(), x ) ); |
| 88 | if( !transformData ) |
| 89 | { |
| 90 | // failed to interpolate, return the closest one |
| 91 | return ( x >= 0.5 ? transformData2 : transformData1 ); |
| 92 | } |
| 93 | return transformData; |
| 94 | } |
| 95 | |
| 96 | Imath::M44d SampledSceneInterface::readTransformAsMatrix( double time ) const |
| 97 | { |
nothing calls this directly
no test coverage detected