开发者

Transform scaling doesn't seem to work

I am implementing a column-major transformation matrix that looks something like this:

|----------|        |------------|      |------------|
| 0 3 6 9  |        | RS R  R  X |      | RS R  R  X |
| 1 4 7 10 |        | R  RS R  Y |      | R  RS R  Y |
| 2 5 8 11 |        | R  R  RS Z |      | R  R  RS Z |
|----------|        |------------|      | 0  0  0  1 |
                                       |------------|

I understand that scaling is supposed to be applied to positions 0, 4, and 8,开发者_如何学Go but it doesn't seem to work. I set the orientation from a quaternion, set the position as appropriate, and then attempt to multiply in my scaling to positions 0, 4, and 8. When this transform is fed into OpenGL, my shapes stretch and squash and do not scale appropriately. Am I missing something here, I thought scaling was a simple multiplication along the diagonals? My orientation application is relatively straightforward, but adding the scaling operation to it results in strange sheering and squashing effects. What am I doing wrong?


The scaling matrix you have in mind is only useful for either only scaling, or multiplying it to an already existing transformation. As soon as the base transformation is not identity the sale factors apply on the whole upper left 3x3. Just evaluate the multiplication

/ Rxx Rxy Rxz \   / Sx  0  0  \
| Ryx Ryy Ryz | * |  0 Sy  0  |
\ Rzy Rzy Rzz /   \  0  0  Sz /

=

/ Rxx·Sx Rxy·Sy Rxz·Sz \
| Ryx·Sx Ryy·Sy Ryz·Sz |
\ Rzx·Sx Rzy·Sy Rzz·Sz /
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜