Merging multiple transformation matrices

只谈情不闲聊 提交于 2020-01-17 01:21:09

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!