Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm currently using a 3x3 rotation matrix to work with 3D points.

How does this matrix differ from a 4x4 Matrix?

And how do I convert a 3x3 matrix into a 4x4?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.1k views
Welcome To Ask or Share your Answers For Others

1 Answer

A 4x4 matrix can be used to do both rotation and translation in a single matrix.

The tx, ty values down the right side of your matrix would be added to the x, y, z of the vertex you are transforming.

So to convert a 3x3 matrix to a 4x4, you simply copy in the values for the 3x3 upper left block, like so:

[ a11  a12  a13 ]
[ a21  a22  a23 ]
[ a31  a32  a33 ]

That 3x3 becomes this 4x4

[ a11  a12  a13  0 ]
[ a21  a22  a23  0 ]
[ a31  a32  a33  0 ]
[   0    0    0  1 ]

Notice in the 4x4 the upper left block got straight copied, and 0's were entered for the other new, extra entries (indicating I don't want any translation to be added).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...