Skip to main content
gamedev.net
🔒 Locked

4*4 Matrix rotation?

Started by Mitchell314 Feb 27, 2008 at 6:18 PM 3 replies 1.1k views
Original Post
Mitchell314
Mitchell314
Can somebody show me the 4*4 matrices for rotation around the three axis? I use Y=M*X, where Y is output, M is the operational (rotation) matrix, and X is the input matrix. I've seen 3*3 matrices for rotation, but they don't work with a 4*4. Thanks.
CodeMunkie
CodeMunkie
Just add an additional row and column:
r r r 0r r r 0r r r 00 0 0 1

where
r r rr r rr r r

was your original 3x3 matrix.
"When you die, if you get a choice between going to regular heaven or pie heaven, choose pie heaven. It might be a trick, but if it's not, mmmmmmm, boy."
How to Ask Questions the Smart Way.
Mitchell314
Mitchell314
Oh. Alright. Does this work for any 3*3 matrix?
CodeMunkie
CodeMunkie
Quote:
Oh. Alright. Does this work for any 3*3 matrix?

In the context of a 3x3 rotation matrix that is constructed in the typical fashion (as illustrated above), then yeah, it should work. As far as a "general" approach, it would depend on what you are doing.
Alternatively, if all you are interested in is the rotation part of the matrix, then you could convert your 4x4 matrix to a 3x3 matrix. That would save you some adds and divides when you do the matrix math.
"When you die, if you get a choice between going to regular heaven or pie heaven, choose pie heaven. It might be a trick, but if it's not, mmmmmmm, boy."
How to Ask Questions the Smart Way.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.