views:

147

answers:

1

Is it possible to remove just the translation element from a Matrix object so that only Scale and Rotation elements remain?

Thanks

+1  A: 

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.

villintehaspam