问题
I am trying to develop a gesture based transform function.
I am just confused about merging many transformation matrices by their own pivot point.
Actually I am trying to use some functions like this:
matrix4x4 transform(matrix4x4 prevMatrix, vector3 pivot, vector3 deltaTranslation, float deltaRotation, float deltaScale){
'magic is here..
}
'First call
var temp = transform(identity, (.5,.5,0), (0.1,0.2), 0.1, 105deg);
renderCanvas(temp);
'Second call
temp = transform(temp, (0, 0), (-1, 2), -.8, 120deg);
renderCanvas(temp);
When I apply the matrix transformation (first call) on canvas it works, because there is no previous rotation or scale.
But for second call, because of rotation, translation looks on wrong axis (say, you swipe right but you see canvas translated to bottom)
So, is there any solution for that, or should I be more clear?
来源:https://stackoverflow.com/questions/22121600/merging-multiple-transformation-matrices