Remove Translation from Matrix
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.
精彩评论