Computer Graphics and Imaging UC Berkeley CS184/284A, Spring 2017 3D Transforms 3D Transformations
Lecture 5: Transforms (Cont) Computer Graphics and Imaging UC Berkeley CS184/284A, Spring 2017 3D Transforms 3D Transformations Use homogeneous coordinates again: • 3D point = (x, y, z, 1)T • 3D vector = (x, y, z, 0)T Use 4×4 matrices for affine transformations x abctx x y deft y ⇥ = y⇥ ⇥ z ghitz · z ⇧ 1 ⌃ ⇧000 1⌃ ⇧1⌃ ⇧ ⌃ ⇧ ⌃ ⇧ ⌃ ⇤ ⌅ ⇤ ⌅ ⇤ ⌅ CS184/284A Ren Ng 3D Transformations sx 000 Scale 0 sy 00 S(sx,sy,sz)= ⇥ 00sz 0 ⇧ 0001⌃ ⇧ ⌃ ⇤ ⌅ Translation 100tx 010ty T(tx,ty,tz)= ⇥ 001tz ⇧000 1⌃ ⇧ ⌃ ⇤ ⌅ Coordinate Change (Frame-to-world) uvwo F(u, v, w, o)= 0001 CS184/284A Ren Ng 3D Transformations Rotation around x-, y-, or z-axis y Rotation 10 0 0 around 0 cos α sin α 0 x-axis R (α)= x 0 sin α −cos α 0⇥ x ⇧00 0 1⌃ ⇧ ⌃ ⇤ ⌅ cos α 0 sin α 0 0100z R (α)= y sin α 0 cos α 0⇥ − ⇧ 0001⌃ ⇧ ⌃ ⇤ ⌅ cos α sin α 00 sin α −cos α 00 R (α)= z 0010⇥ ⇧ 0001⌃ ⇧ ⌃ CS184/284A ⇤ ⌅ Ren Ng 3D Rotations Compose any 3D rotation from Rx, Ry, Rz? Rxyz(α, ⇥, ⇤)=Rx(α) Ry(⇥) Rz(⇤) • So-called Euler angles • Often used in flight simulators: roll, pitch, yaw CS184/284A Ren Ng 3D Rotations Compose any 3D rotation from Rx, Ry, Rz? Rxyz(α, ⇥, ⇤)=Rx(α) Ry(⇥) Rz(⇤) • So-called Euler angles • Often used in flight simulators: roll, pitch, yaw • Problem: Gimbal Lock! CS184/284A Ren Ng f(x)=T (S (x)) f(x)=S (T (x)) 3,1 0.5 −− 0.5 3,1 f(x)=g(x)+b Euclidean: f(x)=T3,1(S0.5(x)) f(x)=S0.5(Tf3(,x1)(x))f(y) = x y −− | − | | − | f(x)=g(x)+b f(x)=R⇡/4S[1.5,1.5]x f(x)=T3,1(S0.5(x)) f(x)=S0.5(T3,1(x)) Euclidean: −−x = 22 f(x) f(y) = x y f(x)=g(x)+b | − | | − | x = ⇥0.51⇤ Euclidean: f(x)=R⇡/4S[1.5,1.5]x
[Show full text]