this seem like good way to interpolate rotation matrices?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
ChaiRuiPeng
Posts: 363
Joined: Thu Dec 16, 2010 8:50 pm
Location: Somewhere in the clouds.. drinking pink lemonade and sunshine..

this seem like good way to interpolate rotation matrices?

Post by ChaiRuiPeng »

okay so i am writing a small 3d puzzle action game. the characters has to jump around on platforms, swings from bars and whatnot, well it gets a little boring with no moving platforms.

i want to write a simple animation system based on key frames where this

Code: Select all

//pseudo code

struct PlatFormKeyframe
{

u32 time_slot; //at what time in the platforms local animation timeline this keyframe is

btTransform; //the transform at that time slot

}
now obviously i am going to need some sort of interpolation for _smooth_ motion of platforms between key frames.

something like this

Code: Select all

//pseudo

//2d matrices for ease of reading

matrix2 mat_keyframe1;

matrix2 mat_keyframe2;

mat_keyframe1 += mat_keyframe2;

//multiply each matrix element by the interpolation fraction e.g. 1/2, 1/4, 3/5 etc.

//get each component vector of the sum matrix and normalize it

so far on paper all my calculations have looked correct, but is there any hidden dangers i need to be aware of? i don't think so... since rotation matrices are stable and that is why i like dealing with them directly.

also, i have bullet integrate with my project and i know bullet interpolates, but is there a easy way i could access those interpolation methods?

thank you

EDIT: after searching a bit it seems it should work alright. i already found someone else who uses this method.

here it is for anyone with a similar problem:

http://www.gamedev.net/topic/313474-mat ... rpolation/
ent1ty wrote: success is a matter of concentration and desire
Butler Lampson wrote: all problems in Computer Science can be solved by another level of indirection
at a cost measure in computer resources ;)
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Post by mongoose7 »

I think the point of the other thread was to find the rotation matrix that rotated from the first rotation matrix to the second. I don't think linear interpolation is any good, though it may work for you. For example, the average of the two matrices M and -M is 0, which cannot be normalised. Generally, the linear sum of two rotation matrices cannot be made into a rotation matrix.

Maybe you are using translation matrices?
ChaiRuiPeng
Posts: 363
Joined: Thu Dec 16, 2010 8:50 pm
Location: Somewhere in the clouds.. drinking pink lemonade and sunshine..

Post by ChaiRuiPeng »

yes if i have two platforms with x and z uniform, and y exactly 180 degrees then it gives me matrix filled with zeros, i looked a little bit deeper after i posted this yesterday. i will try to find a better method for quadratic or cubic interpolation, which will make the transition smoother between keyframes, although i do not see an immediate need for it in my application
ent1ty wrote: success is a matter of concentration and desire
Butler Lampson wrote: all problems in Computer Science can be solved by another level of indirection
at a cost measure in computer resources ;)
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

You should be able to write mat_keyframe1.interpolate(mat_keyframe2, percent0to1); to interpolate between two matrices.

Travis
Post Reply