开发者

Remove Translation from Matrix

开发者 https://www.devze.com 2022-12-19 06:22 出处:网络
Is it 开发者_Go百科possible to remove just the translation element from a Matrix object so that only Scale and Rotation elements remain?

Is it 开发者_Go百科possible to remove just the translation element from a Matrix object so that only Scale and Rotation elements remain?

Thanks


Just zero out the appropriate matrix elements. In a 4x4 3D-transform matrix, these are stored as the three first elements in either in the rightmost column or bottom row, depending on whether you use pre- or post-multiplication.

If your Matrix class has a method to get the translation, it probably also has a method to add translations. In that case, just add the opposite translation of what you already have.

0

精彩评论

暂无评论...
验证码 换一张
取 消