Computer Graphic Bing-Yu Chen National Taiwan Univerit The Univerit of Toko
Geometrical Tranformation Mathematical reliminarie 2D Tranformation Homogeneou Coorinate & Matri Repreentation 3D Tranformation Quaternion
Vector A vector i an entit that poee magnitue an irection. A ra irecte line egment, that poee poition, magnitue, an irection.
Vector vector an n-tuple of real number calar two operation: aition & multiplication Commutative Law a + b = b + a a b = b a Ientitie a + = a a = a Aociative Law a + b + c = a + b + c a b c = a b c Ditributive Law a b + c = a b + a c a + b c = a c + b c Invere a + b = b = -a
Aition of Vector parallelogram rule 7 6 3 6 3 2 3 w v v w
The Vector Dot rouct length = n v n n n v u u u u u
ropertie of the Dot rouct mmetric v w w v nonegenerate vv v onl when bilinear v u w vu v unit vector normalizing v v / v angle between the vector co v w/ v w w
rojection w u w co u v v w w v w vw
Matri Baic Definition Tranpoe Aition a a n A aij am a mn a an T C A cij aji C a m a nm C A B cij aij bij
Matri Baic Scalar-matri multiplication CA c ij a ij Matri-matri multiplication C AB c n a b ij ik kj k
Cro rouct of Vector Definition vw v2w3 v3w2 i v3w vw 3 j vw 2 v2w k i j k i,, j,, k,, where,, an are tanar unit vector: Application A normal vector to a polgon i calculate from 3 non-collinear vertice of the polgon. N vw N v w
General Tranformation A tranformation map point to other point an/or vector to other vector u v v T u T Q Q T
ipeline Implementation v u u v T tranformation from application program Tu Tv Tv Tu raterizer Tu vertice vertice piel frame buffer Tv
Repreentation We can repreent a point, in the plane a a column vector a a row vector p,
2D Tranformation 2D Tranlation 2D Scaling 2D Reflection 2D Shearing 2D Rotation
Tranlation Move tranlate, iplace a point to a new location Diplacement etermine b a vector Three egree of freeom =+
2D Tranlation 4,5 7,5 7,, ' T ' '
2D Scaling 4,5 7,5 7/2,5/4 2,5/4 ' ' ' S
2D Reflection 4,5 7,5-7,5-4,5 ' RE ' '
2D Shearing 4,5 7,5 9,5 2,5 ' SH ' h '
2D Rotation 4,5 7,5 2.,4.9 4.9,7.8 R co in in co ' ' '
2D Rotation Conier rotation about the origin b egree raiu ta the ame, angle increae b = r co f = r in f = co in = in + co = r co f = r in f
Limitation of a 2X2 matri Scaling Rotation Reflection Shearing What o we mi?
Homogeneou Coorinate Wh & What i homogeneou coorinate? if point are epree in homogeneou coorinate, all three tranformation can be treate a multiplication.,,, W uuall can not be
Homogeneou Coorinate W X W= plane Y
Homogeneou Coorinate for 2D Tranlation T ' ' ' ' ', ' T T T,, 2 2
Homogeneou Coorinate for 2D Tranlation,, 2 2 2 2 2 2 T T T T T T,,,, 2 2 2 2
Homogeneou Coorinate for 2D Scaling S ' ' ' ' ', ' S,, 2 2 2 2 2 2 S S
Homogeneou Coorinate for 2D Rotation co in in co ' ' ' R R co in in co ' ' '
ropertie of Tranformation rigi-bo tranformation rotation & tranlation preerving angle an length affine tranformation rotation & tranlation & caling preerving parallelim of line
Compoition of 2D Tranformation Original, After tranlation of to origin T, After rotation R After tranlation to original T,
Compoition of 2D Tranformation in co co in in co in co co in in co,, T R T
Right-hane Coorinate Stem z
3D Tranlation & 3D Scaling,, z z T,, z z S
3D Reflection & 3D Shearing RE RE SH h, h h h
3D Rotation co in in co R z co in in co R co in in co R z R R R z
Rotation About a Fie oint other than the Origin Move fie point to origin Rotate Move fie point back M T R T f f
Rotation About an Arbitrar Ai A rotation b about an arbitrar ai can be ecompoe into the concatenation of rotation about the,, an z ae,, are calle the Euler angle z R R R R z z z Note that rotation o not commute We can ue rotation in another orer but with ifferent angle. v
Euler Angle An Euler angle i a rotation about a ingle ai. A rotation i ecribe a a equence of rotation about three mutuall orthogonal coorinate ae fie in pace X-roll, Y-roll, Z-roll There are 6 poible wa to efine a rotation. 3! 42
Euler Angle & Interpolation Interpolation happening on each angle Multiple route for interpolation More ke for contrain R z z R 43
Interpolating Euler Angle c Natural orientation repreentation: 3 angle for 3 egree of freeom Unnatural interpolation: A rotation of 9 o firt aroun Z an then aroun Y = 2 o aroun,,. But 3 o aroun Z then Y iffer from 4 o aroun,,. b a b c a b a c = c b a b a c b b b c a c a c a 44
Solution: Quaternion Interpolation Interpolate orientation on the unit phere B analog: -, 2-, 3-DOF rotation a contraine point on -, 2-, 3- phere 47
Quaternion v Quaternion are unit vector on 3- phere in 4D Right-han rotation of raian about i q [co / 2,in / 2 v] often note [ wv, ] Require one real an three imaginar component i, j, k q q qi q2j q3k [ w, v]; w q, v q, q2, q3 2 2 2 where i j k ijk w i calle calar an v i calle vector v 49
Baic Operation Uing Quaternion Aition Multiplication * Conjugate Length Norm Invere Unit Quaternion q q [ w w, v v] qq [ w w v v, v v w v w v] q [ w, v] q w v 2 2 / 2 2 2 2 N q q w v * 2 * q q / q q / N q q i a unit quaternion if q an then q * Ientit [,,, ] when involving multiplication [,,, ] when involving aition q 5
SLER-Spherical Linear interolation Interpolate between two quaternion rotation along the hortet arc. SLER p, q, t p in t q in t in p where co w p wq v p vq t q If two orientation are too cloe, ue linear interpolation to avoi an iviion b zero. 55