游戏开发论坛

 找回密码
 立即注册
搜索
查看: 1634|回复: 1

question abuot exacting matrix

[复制链接]

1

主题

1

帖子

0

积分

新手上路

Rank: 1

积分
0
发表于 2004-7-10 11:06:00 | 显示全部楼层 |阅读模式
    Now I have a question about matrix extracting. As you know, 3D animation mostly use matrix to store information. And I use d3d to programe my animation. I want to extract a matrix to three sub values, translation, scaling and rotation. But I can't extract it accurately.
    The matrix in d3d is 4x4 matrix. like the matrix, M
        | 00 10 20 30 |
    M = | 01 11 21 31 |
        | 02 12 22 32 |
        | 03 13 23 33 |
    My opinion is :

    v0 = v(03,13,23), so matrix Mt can represent the translation value

         | 1 0 0 v0.x |
    Mt = | 0 1 0 v0.y |
         | 0 0 1 v0.z |
         | 0 0 0  1   |

    v1= v(00,10,20) v2 = v(01,11,21) v3= v(02,12,22)
    L1= length(v1) L2 = length(v2) L3 = length(v3)
    So Matrix ms can represent the scaling value.
    v7= v(L1,L2,L3)
         | v7.x 0   0   0 |
    Ms = | 0   v7.y 0   0 |
         | 0   0   v7.z 0 |
         | 0   0    0   1 |

    V4 = normalize(v1) V5 = normalize(v2) V6 = normalize(v3)
   
    And we can use a matrix to represent a rotation matrix.
         | V4.x V4.y V4.z 0 |
    Mr = | V5.x V5.y V5.z 0 |
         | V6.x V6.y V6.z 0 |
         | 0     0   0    0 |
   
   What I want to do is linear interpolation between two matrices. And using to a matrix including three properties,translation, scaling and rotation, I must extract the three sub values from origin matrix and make linear interpolation respectively. But the result is not what I expect. So I think that the method extract matrix, maybe, is wrong.

15

主题

73

帖子

81

积分

注册会员

Rank: 2

积分
81
发表于 2004-7-11 11:10:00 | 显示全部楼层

Re:question abuot exacting matrix

你可以看看<<OPENGL超级宝典>>中间有关于矩阵的表示,你的矩阵的格式是错误的,还有opengl与d3d的矩阵用法都是一样的。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2025-7-3 17:41

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表