jmasterx
jmasterx

Reputation: 54153

Inverse Interpolation with angles greater than Pi?

I'm making an API for skeletal animation. Right now it works fine, except Lets say you want to go from 2.0f to 1.0f. It will end up doing almost a full circle when it should only do about 1/6th of one.

I think I've got a way to find it it should go counter clockwise but I'm not sure how to use it with this:

    bool CCW = fmod( (endKeyFrame->getAngle() - 
            startKeyFrame->getAngle() + TWO_PI), TWO_PI) > 3.141592;


        remainingInterpolationFrames = endKeyFrame->getFrame() - startKeyFrame->getFrame();

        //Linear interpolation

            curIncreaseAngle = (endKeyFrame->getAngle() - 
                startKeyFrame->getAngle()) / remainingInterpolationFrames;

Thanks

Upvotes: 0

Views: 280

Answers (1)

Lior Kogan
Lior Kogan

Reputation: 20658

I think this may help. Especially sections 8,9 and 30.

Upvotes: 1

Related Questions