Vocabulary Similarity transformations Congruence transformations.
Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D...
Transcript of Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D...
![Page 1: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/1.jpg)
Modeling Transformations
Courtesy of Adam Finkelstein, Princeton University
![Page 2: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/2.jpg)
Modeling Transformations• Specify transformations for objects
o Allows definitions of objects in own coordinate systemso Allows use of object definition multiple times in a scene
H&B Figure 109
![Page 3: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/3.jpg)
Overview• 2D Transformations
o Basic 2D transformationso Matrix representationo Matrix composition
• 3D Transformationso Basic 3D transformationso Same as 2D
• Transformation Hierarchieso Scene graphso Ray casting
![Page 4: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/4.jpg)
2D Modeling Transformations
ScaleRotate
Translate
ScaleTranslate
x
y
World Coordinates
ModelingCoordinates
![Page 5: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/5.jpg)
2D Modeling Transformations
x
y
World Coordinates
ModelingCoordinates
Let’s lookat this indetail…
![Page 6: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/6.jpg)
2D Modeling Transformations
x
y
ModelingCoordinates
![Page 7: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/7.jpg)
2D Modeling Transformations
x
y
ModelingCoordinates
Scale .3, .3Rotate -90
Translate 5, 3
![Page 8: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/8.jpg)
2D Modeling Transformations
x
y
ModelingCoordinates
Scale .3, .3Rotate -90
Translate 5, 3
![Page 9: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/9.jpg)
2D Modeling Transformations
x
y
ModelingCoordinates
Scale .3, .3Rotate -90
Translate 5, 3
World Coordinates
![Page 10: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/10.jpg)
Basic 2D Transformations• Translation:
o x’ = x + txo y’ = y + ty
• Scale:o x’ = x * sx o y’ = y * sy
• Shear:o x’ = x + hx*yo y’ = y + hy*x
• Rotation:o x’ = x*cosΘ - y*sinΘo y’ = x*sinΘ + y*cosΘ
![Page 11: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/11.jpg)
Basic 2D Transformations• Rotation:
o x’ = x*cosΘ - y*sinΘo y’ = x*sinΘ + y*cosΘ
Trigonometric identity for the sum of two angles:sin(φ+θ) = sin φ cos θ + cos φ sin θcos(φ+θ) = cos φ cos θ - sin φ sin θ
(x*,y*)
(x’,y’)
φθ
r
![Page 12: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/12.jpg)
Basic 2D Transformations• Translation:
o x’ = x + txo y’ = y + ty
• Scale:o x’ = x * sx o y’ = y * sy
• Shear:o x’ = x + hx*yo y’ = y + hy*x
• Rotation:o x’ = x*cosΘ - y*sinΘo y’ = x*sinΘ + y*cosΘ
Transformations can be combined
(with simple algebra)
![Page 13: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/13.jpg)
Basic 2D Transformations• Translation:
o x’ = x + txo y’ = y + ty
• Scale:o x’ = x * sx o y’ = y * sy
• Shear:o x’ = x + hx*yo y’ = y + hy*x
• Rotation:o x’ = x*cosΘ - y*sinΘo y’ = x*sinΘ + y*cosΘ
![Page 14: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/14.jpg)
Basic 2D Transformations• Translation:
o x’ = x + txo y’ = y + ty
• Scale:o x’ = x * sxo y’ = y * sy
• Shear:o x’ = x + hx*yo y’ = y + hy*x
• Rotation:o x’ = x*cosΘ - y*sinΘo y’ = x*sinΘ + y*cosΘ
x’ = x*sxy’ = y*syx’ = x*sxy’ = y*sy
(x,y)(x’,y’)
![Page 15: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/15.jpg)
Basic 2D Transformations• Translation:
o x’ = x + txo y’ = y + ty
• Scale:o x’ = x * sx o y’ = y * sy
• Shear:o x’ = x + hx*yo y’ = y + hy*x
• Rotation:o x’ = x*cosΘ - y*sinΘo y’ = x*sinΘ + y*cosΘ
x’ = (x*sx)*cosΘ − (y*sy)*sinΘy’ = (x*sx)*sinΘ + (y*sy)*cosΘx’ = (x*sx)*cosΘ − (y*sy)*sinΘy’ = (x*sx)*sinΘ + (y*sy)*cosΘ
(x’,y’)
![Page 16: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/16.jpg)
Basic 2D Transformations• Translation:
o x’ = x + txo y’ = y + ty
• Scale:o x’ = x * sx o y’ = y * sy
• Shear:o x’ = x + hx*yo y’ = y + hy*x
• Rotation:o x’ = x*cosΘ - y*sinΘo y’ = x*sinΘ + y*cosΘ
x’ = ((x*sx)*cosΘ − (y*sy)*sinΘ) + txy’ = ((x*sx)*sinΘ + (y*sy)*cosΘ) + tyx’ = ((x*sx)*cosΘ − (y*sy)*sinΘ) + txy’ = ((x*sx)*sinΘ + (y*sy)*cosΘ) + ty
(x’,y’)
![Page 17: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/17.jpg)
Basic 2D Transformations• Translation:
o x’ = x + txo y’ = y + ty
• Scale:o x’ = x * sx o y’ = y * sy
• Shear:o x’ = x + hx*yo y’ = y + hy*x
• Rotation:o x’ = x*cosΘ - y*sinΘo y’ = x*sinΘ + y*cosΘ
x’ = ((x*sx)*cosΘ − (y*sy)*sinΘ) + txy’ = ((x*sx)*sinΘ + (y*sy)*cosΘ) + tyx’ = ((x*sx)*cosΘ − (y*sy)*sinΘ) + txy’ = ((x*sx)*sinΘ + (y*sy)*cosΘ) + ty
![Page 18: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/18.jpg)
Overview• 2D Transformations
o Basic 2D transformationso Matrix representationo Matrix composition
• 3D Transformationso Basic 3D transformationso Same as 2D
• Transformation Hierarchieso Scene graphso Ray casting
![Page 19: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/19.jpg)
Matrix Representation• Represent 2D transformation by a matrix
• Multiply matrix by column vector⇔ apply transformation to point
=
yx
dcba
yx''
dcba
dycxybyaxx
+=+=
''
![Page 20: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/20.jpg)
Matrix Representation• Transformations combined by multiplication
=
yx
lkji
hgfe
dcba
yx
''
Matrices are a convenient and efficient way to represent a sequence of transformations!
![Page 21: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/21.jpg)
=
yx
dcba
yx''
2x2 Matrices• What types of transformations can be
represented with a 2x2 matrix?
2D Identity?
yyxx
==''
=
yx
yx
1001
''
2D Scale around (0,0)?
ysyyxsxx
*'*'
==
=
yx
dcba
yx''
=
yx
sysx
yx
00
''
![Page 22: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/22.jpg)
2x2 Matrices• What types of transformations can be
represented with a 2x2 matrix?
2D Rotate around (0,0)?
yxyyxx
*cos*sin'*sin*cos'
Θ+Θ=Θ−Θ=
=
yx
dcba
yx''
ΘΘΘ−Θ=
yx
yx
cossinsincos
''
2D Shear?
yxshyyyshxxx
+=+=
*'*'
=
yx
dcba
yx''
=
yx
shyshx
yx
11
''
![Page 23: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/23.jpg)
2x2 Matrices• What types of transformations can be
represented with a 2x2 matrix?
2D Mirror over Y axis?
yyxx
=−=
''
=
yx
dcba
yx''
−=
yx
yx
1001
''
2D Mirror over (0,0)?
yyxx
−=−=
''
=
yx
dcba
yx''
−−=
yx
yx
1001
''
![Page 24: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/24.jpg)
=
yx
dcba
yx''
2x2 Matrices• What types of transformations can be
represented with a 2x2 matrix?
2D Translation?
tyyytxxx
+=+=
''
Only linear 2D transformations can be represented with a 2x2 matrix
NO!
![Page 25: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/25.jpg)
Linear Transformations• Linear transformations are combinations of …
o Scale,o Rotation,o Shear, ando Mirror
• Properties of linear transformations:o Satisfies:o Origin maps to origino Lines map to lineso Parallel lines remain parallelo Ratios are preservedo Closed under composition
)()()( 22112211 pppp TsTsssT +=+
=
yx
dcba
yx
''
![Page 26: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/26.jpg)
2D Translation• 2D translation represented by a 3x3 matrix
o Point represented with homogeneous coordinates
tyyytxxx
+=+=
''
=
11001001
1''
yx
tytx
yx
![Page 27: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/27.jpg)
Homogeneous Coordinates• Add a 3rd coordinate to every 2D point
o (x, y, w) represents a point at location (x/w, y/w)o (x, y, 0) represents a point at infinityo (0, 0, 0) is not allowed
1 2
1
2 (2,1,1) or (4,2,2) or (6,3,3)
Convenient coordinate system to represent many useful transformations
x
y
![Page 28: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/28.jpg)
Basic 2D Transformations• Basic 2D transformations as 3x3 matrices
ΘΘΘ−Θ
=
11000cossin0sincos
1''
yx
yx
=
11001001
1''
yx
tytx
yx
=
11000101
1''
yx
shyshx
yx
Translate
Rotate Shear
=
11000000
1''
yx
sysx
yx
Scale
![Page 29: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/29.jpg)
Affine Transformations• Affine transformations are combinations of …
o Linear transformations, ando Translations
• Properties of affine transformations:o Origin does not necessarily map to origino Lines map to lineso Parallel lines remain parallelo Ratios are preservedo Closed under composition
=
wyx
fedcba
wyx
100''
![Page 30: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/30.jpg)
Projective Transformations• Projective transformations …
o Affine transformations, ando Projective warps
• Properties of projective transformations:o Origin does not necessarily map to origino Lines map to lineso Parallel lines do not necessarily remain parallelo Ratios are not preserved (but “cross-ratios” are)o Closed under composition
=
wyx
ihgfedcba
wyx
'''
![Page 31: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/31.jpg)
Overview• 2D Transformations
o Basic 2D transformationso Matrix representationo Matrix composition
• 3D Transformationso Basic 3D transformationso Same as 2D
• Transformation Hierarchieso Scene graphso Ray casting
![Page 32: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/32.jpg)
Matrix Composition• Transformations can be combined by
matrix multiplication
ΘΘΘ−Θ
=
wyx
sysx
tytx
wyx
1000000
1000cossin0sincos
1001001
'''
p’ = T(tx,ty) R(Θ) S(sx,sy) p
![Page 33: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/33.jpg)
Matrix Composition• Matrices are a convenient and efficient way to
represent a sequence of transformationso General purpose representationo Hardware matrix multiplyo Efficiency with premultiplication
» Matrix multiplication is associative
p’ = (T * (R * (S*p) ) )p’ = (T*R*S) * p
![Page 34: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/34.jpg)
Matrix Composition• Be aware: order of transformations matters
» Matrix multiplication is not commutative
p’ = T * R * S * p
“Global” “Local”
![Page 35: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/35.jpg)
Matrix Composition• Rotate by Θ around arbitrary point (a,b)
o M=T(a,b) * R(Θ) * T(-a,-b)
• Scale by sx,sy around arbitrary point (a,b)o M=T(a,b) * S(sx,sy) * T(-a,-b)
(a,b)
(a,b)
The trick:First, translate (a,b) to the origin.Next, do the rotation about origin.Finally, translate back.
(Use the same trick.)
![Page 36: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/36.jpg)
Overview• 2D Transformations
o Basic 2D transformationso Matrix representationo Matrix composition
• 3D Transformationso Basic 3D transformationso Same as 2D
• Transformation Hierarchieso Scene graphso Ray casting
![Page 37: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/37.jpg)
3D Transformations• Same idea as 2D transformations
o Homogeneous coordinates: (x,y,z,w) o 4x4 transformation matrices
=
wzyx
ponmlkjihgfedcba
wzyx
''''
![Page 38: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/38.jpg)
Basic 3D Transformations
=
wzyx
wzyx
1000010000100001
'''
=
wzyx
tztytx
wzyx
1000100010001
'''
=
wzyx
szsy
sx
wzyx
1000000000000
'''
−=
wzyx
wzyx
1000010000100001
'''
Identity Scale
Translation Mirror over X axis
![Page 39: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/39.jpg)
Basic 3D Transformations
ΘΘΘ−Θ
=
wzyx
wzyx
1000010000cossin00sincos
'''
Rotate around Z axis:
ΘΘ
Θ−Θ=
wzyx
wzyx
10000cos0sin00100sin0cos
'''
Rotate around Y axis:
ΘΘΘ−Θ=
wzyx
wzyx
10000cossin00sincos00001
'''
Rotate around X axis:
![Page 40: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/40.jpg)
Overview• 2D Transformations
o Basic 2D transformationso Matrix representationo Matrix composition
• 3D Transformationso Basic 3D transformationso Same as 2D
• Transformation Hierarchieso Scene graphso Ray casting
![Page 41: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/41.jpg)
Angel Figures 8.8 & 8.9
Transformation Hierarchies• Scene may have hierarchy of coordinate systems
o Each level stores matrixrepresenting transformation from parent’s coordinate system
Base[M1]
Upper Arm[M2]
Lower Arm[M3]
Robot Arm
![Page 42: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/42.jpg)
Transformation Example 1
Rose et al. `96
• Well-suited for humanoid characters
Root
LHip
LKnee
LAnkle
RHip
RKnee
RAnkle
Chest
LCollar
LShld
LElbow
LWrist
LCollar
LShld
LElbow
LWrist
Neck
Head
![Page 43: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/43.jpg)
Transformation Example 1
Mike Marr, COS 426, Princeton University, 1995
![Page 44: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/44.jpg)
Transformation Example 2• An object may appear in a scene multiple times
Draw same 3D data with different transformations
![Page 45: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/45.jpg)
Transformation Example 2
Building
Floor 4 Floor5Floor 3Floor 2Floor 1
Chair KBookshelf 1
Desk ChairBookshelf
Desk 1 Desk 2 Chair 1
Floor Furniture
Office NOffice 1
Office Furniture
DefinitionsDefinitions
InstancesInstances
![Page 46: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/46.jpg)
Angel Figures 8.8 & 8.9
Ray Casting With Hierarchies• Transform rays, not primitives
o For each node ...» Transform ray by inverse of matrix» Intersect with primitives» Transform hit by matrix
Base[M1]
Upper Arm[M2]
Lower Arm[M3]
Robot Arm
![Page 47: Transformationsvis.ucsd.edu/courses/ece104/current/Transformations.pdf · oRay casting. 3D Transformations • Same idea as 2D transformations oHomogeneous coordinates: (x,y,z,w)](https://reader034.fdocuments.us/reader034/viewer/2022042406/5f208f3cd7b21e310c19b18c/html5/thumbnails/47.jpg)
Summary• Coordinate systems
o World coordinateso Modeling coordinates
• Representations of 3D modeling transformationso 4x4 Matrices
» Scale, rotate, translate, shear, projections, etc.» Not arbitrary warps
• Composition of 3D transformationso Matrix multiplication (order matters)o Transformation hierarchies