Exemple #1
0
    //-----------------------------------------------------------------------
    TimeIndex Animation::_getTimeIndex(Real timePos) const
    {
        // Uncomment following statement for work as previous
        //return timePos;

        // Build keyframe time list on demand
        if (mKeyFrameTimesDirty)
        {
            buildKeyFrameTimeList();
        }

        // Wrap time
        Real totalAnimationLength = mLength;

        while (timePos > totalAnimationLength && totalAnimationLength > 0.0f)
        {
            timePos -= totalAnimationLength;
        }

        // Search for global index
        KeyFrameTimeList::iterator it =
            std::lower_bound(mKeyFrameTimes.begin(), mKeyFrameTimes.end(), timePos);

        return TimeIndex(timePos, std::distance(mKeyFrameTimes.begin(), it));
    }
    IndexedVectorArray DynamicalSystemSimulator::getMeasurementArray
                    (TimeIndex startingTime, TimeSize duration)
    {
        BOOST_ASSERT(startingTime>y_.getFirstIndex() && "ERROR: The starting time is too early, try later starting time");
        IndexedVectorArray a;

        for (TimeIndex i= startingTime; i<startingTime+TimeIndex(duration);++i)
        {
            a.setValue(getMeasurement(i),i);
        }
        return a;
    }