affine matrix interpolation / decomposition ?

hi folks,

i’m trying to do something like an interpolation between affine matrices for a planar object in 3d space. in other words, i have an object-to-world matrix for t_0, and an object-to-world matrix at t_2, and i’d like to guess where it was at t_1 (making some assumptions about limits on its movement).

i thought maybe i could decompose the matrix into component translation, rotation, scale, and skew values, and then interpolate those. but i can’t find any straightforward way of doing this. could someone help me out?


hey damian

in the new ofxMatrix4x4 there’s a decomposition method that works pretty well.

i’ve found some more methods but all of them fail when there’s a mix of scale + rotation in the matrix.

what about creating quaternions from the matrix and using slerp interpolation. then the resulting quaternion can be changed back to a matrix?

hey folks,

thanks for the replies.

i ended up using the ofxMatrix4x4 decompose method – but it turned out my matrix was reaal simple to start with, it was 4x3 to begin with so that leftmost 3x3 matrix was rotation and the last column was translation :slight_smile: