2012年12月11日 星期二

3D 電腦圖學筆記(1)


3D Computer Graphics—Alan Watt

mathematical or geometric數學和幾何的graphics model – into 可視化—two-dimensional projection




Transformation是重要的工具in generating 3D scenes

2D view of the environment表示物件的方法是
polygon mesh model

3D geometry affine transformation




V'=Vt*D translation平移
V'=S*V scaling 縮小放大
V'=R*V rotation 旋轉

translation
v'=Tv
x' [1 0 0 Tx] [x]
[y']=[0 1 0 Ty] [y]
z' [0 0 1 Tz] [z]
1 [0 0 0 1] [1]

x'=x+Tx
y'=y+Ty
z'=z+Tz

scaling
v'=sv

s=[ Sx 0 0 0]
[ 0 Sy 0 0]
[ 0 0 Sz 0]
[ 0 0 0 1]

x'=Sx*x
y'=Sy*y
z'=Sz*z
Rx=[ 1 0 0 0 ]
[ 0 cosθ -sinθ 0]
[0 sinθ cosθ 0]
[0 0 0 1]

Ry=[ cosθ 0 sinθ 0 ]
[ 0 1 0 0]
[-sinθ 0 cosθ 0]
[ 0 0 0 1]

Rz=[cosθ -sinθ 0 0]
[sinθ cosθ 0 0]
[0 0 1 0]
[0 0 0 1]




z軸旋轉
x'=xcosθ-ysinθ
y'=xsinθ+ycosθ
z'=z

M3=M2M1

先旋轉後平移Rotation followed by translation

Vt*R


local coordinate system
1)平移至原點 T2
2)利用所需軸旋轉 R
3)平移物件至他的原點 T1

T2RT1=
[ 1 0 0 -Tx][cosθ -sinθ 0 0][1 0 0 Tx]
[ 0 1 0 -Ty][sinθ cosθ 0 0][0 1 0 Ty]
[ 0 0 1 0 ][0 0 1 0][0 0 1 0]
[ 0 0 0 1 ][0 0 0 1][0 0 0 1]


[cosθ -sinθ 0 -Txcosθ+Tysinθ+Tx]
[sinθ cosθ 0 -Txsinθ-Tycosθ+Ty]
[0 0 1 0 ]
[0 0 0 1 ]

沒有留言:

張貼留言