geometry (many slides adapted from octavia camps and amitabh varshney)
Post on 19-Dec-2015
221 views
TRANSCRIPT
![Page 1: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/1.jpg)
Geometry(Many slides adapted from Octavia Camps and Amitabh
Varshney)
![Page 2: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/2.jpg)
Goals
• Represent points, lines and triangles as column vectors.
• Represent motion as matrices.
• Move geometric objects with matrix multiplication.
• Refresh memory about geometry and linear algebra
![Page 3: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/3.jpg)
Vectors
• Ordered set of numbers: (1,2,3,4)
• Example: (x,y,z) coordinates of pt in space. runit vecto a is ,1 If
),(
1
2
,,21
vv
xv
xxxvn
i i
n
![Page 4: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/4.jpg)
Vector Addition
),(),(),( 22112121 yxyxyyxx wv
vvww
V+wV+w
![Page 5: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/5.jpg)
Scalar Product
),(),( 2121 axaxxxaa v
vv
avav
![Page 6: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/6.jpg)
Inner (dot) Product
vv
ww
22112121 .),).(,(. yxyxyyxxwv
The inner product is a The inner product is a SCALAR!SCALAR!
cos||||||||),).(,(. 2121 wvyyxxwv
wvwv 0.
![Page 7: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/7.jpg)
Points
Using these facts, we can represent points. Note:
(x,y,z) = x(1,0,0) + y(0,1,0) + z(0,0,1)
x = (x,y,z).(1,0,0) y = (x,y,z).(0,1,0)
z = (x,y,z).(0,0,1)
![Page 8: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/8.jpg)
Lines• Line: y = mx + a
• Line: sum of a point and a vectorP = P1 + d
(whered is a column vector)
• Line: Affine sum of two points
P = P1 + P2, where + = 1
Line Segment: For 0 , 1, P lies between P1 and P2
• Line: set of points equidistant from the origin in the direction of a unit vector.
P1
d
P1
P2
![Page 9: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/9.jpg)
Plane and Triangle• Plane: sum of a point and two vectors
P = P1 + u + v
Plane: set of points equidistant
from origin in direction
of a vector.
• Triangle: Affine sum of three points
with i 0
P = P1 + P2 + P3,
where + + = 1
P lies between P1, P2, P3
P1u
v
P1P2
P3
![Page 10: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/10.jpg)
Generalizing ... Affine Sum of arbitrary number of points: Convex
Hull
P = P1 + P2 + … + nPn, where + + … + n = 1 and i 0
![Page 11: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/11.jpg)
Normal of a Plane Plane: sum of a point and two vectors
P = P1 + u + v
P - P1 = u + v
Ifn is orthogonal tou andv (n =u v ) :
n T P - P1) = n T u + n
T v = 0
P1u
v
uP1
v
n
![Page 12: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/12.jpg)
Implicit Equation of a Plane
n T P - P1) = 0
a x x1
Letn = b P = y P1 = y1
c z z1
Then, the equation of a plane becomes:
a (x - x1) + b (y - y1) + c (z - z1) = 0
a x + b y + c z + d = 0
Thus, the coefficients of x, y, z in a plane equation define the normal.
P1u
v
uP1
v
n
![Page 13: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/13.jpg)
Normal of a TriangleNormal of the plane containing the triangle (P1, P2 , P3 ):
n = (P2 - P1) (P3 - P1)
P1 P2
n P3
P1 P2
P3
P1 P3
P2
Normal pointing towards you Normal pointing away from you
• Models constructed with consistent ordering of triangle vertices : all clockwise or all counter-clockwise.
• Usually normals point out of the model.
![Page 14: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/14.jpg)
Normal of a Vertex in a Mesh
n1n2
n3
nk
nvnv = (n1 +n2 + … +nk) / k = ni / k = average of adjacent triangle normals
or better:
nv = i ni) / (k i) ) = area-weighted average of adjacent triangle normals
![Page 15: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/15.jpg)
Geometry Continued
• Much of last classes’ material in Appendix A
![Page 16: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/16.jpg)
Matrices
nmnn
m
m
m
mn
aaa
aaa
aaa
aaa
A
21
33231
22221
11211
mnmnmn BAC Sum:Sum:
ijijij bac
A and B must have the same A and B must have the same dimensionsdimensions
![Page 17: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/17.jpg)
Matrices
pmmnpn BAC Product:Product:
m
kkjikij bac
1
A and B must have A and B must have compatible dimensionscompatible dimensions
nnnnnnnn ABBA
Identity Matrix:
AAIIAI
100
010
001
![Page 18: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/18.jpg)
Matrices
• Associative T*(U*(V*p)) = (T*U*V)*p
• Distributive T*(u+v) = T*v + T*v
![Page 19: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/19.jpg)
Matrices
mnT
nm AC Transpose:Transpose:
jiij ac TTT ABAB )(
TTT BABA )(
IfIf AAT A is symmetricA is symmetric
![Page 20: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/20.jpg)
Matrices
Determinant:Determinant: A must be squareA must be square
3231
222113
3331
232112
3332
232211
333231
232221
131211
detaa
aaa
aa
aaa
aa
aaa
aaa
aaa
aaa
122122112221
1211
2221
1211det aaaaaa
aa
aa
aa
![Page 21: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/21.jpg)
Euclidean transformations
![Page 22: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/22.jpg)
2D Translation
tt
PP
P’P’
![Page 23: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/23.jpg)
2D Translation Equation
PP
xx
yy
ttxx
ttyy
P’P’tt
tPP ),(' yx tytx
),(
),(
yx tt
yx
t
P
![Page 24: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/24.jpg)
2D Translation using Matrices
PP
xx
yy
ttxx
ttyy
P’P’tt
),(
),(
yx tt
yx
t
P
1
1
0
0
1' y
x
t
t
ty
tx
y
x
y
xP
tt PP
![Page 25: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/25.jpg)
Scaling
PP
P’P’
![Page 26: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/26.jpg)
Scaling Equation
PP
xx
yy
s.xs.x
P’P’s.ys.y
),('
),(
sysx
yx
P
P
PP s'
y
x
s
s
sy
sx
0
0'P
SPSP '
![Page 27: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/27.jpg)
Rotation
PP
PP’’
![Page 28: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/28.jpg)
Rotation Equations
Counter-clockwise rotation by an angle Counter-clockwise rotation by an angle
y
x
y
x
cossin
sincos
'
'
PP
xx
Y’Y’PP’’
X’X’
yy R.PP'
![Page 29: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/29.jpg)
Degrees of Freedom
R is 2x2 R is 2x2 4 elements4 elements
BUT! There is only 1 degree of freedom: BUT! There is only 1 degree of freedom:
1)det(
R
IRRRR TT
The 4 elements must satisfy the following constraints:The 4 elements must satisfy the following constraints:
y
x
y
x
cossin
sincos
'
'
![Page 30: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/30.jpg)
Transformations can be composed
• Matrix multiplication is associative.
• Combine series of transformations into one matrix. (example, whiteboard).
• In general, the order matters. (example, whiteboard).
• 2D Rotations can be interchanged. Why?
![Page 31: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/31.jpg)
Rotation and Translation
cos -sin tx
sin cos ty
0 0 1
( )(x
y
1)
a -b tx
b a ty
0 0 1
( )(x
y
1)
Rotation, Scaling and Translation
![Page 32: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/32.jpg)
Rotation about an arbitrary point
• Can translate to origin, rotate, translate back. (example, whiteboard).
• This is also rotation with one translation.– Intuitively, amount of rotation is same
either way.– But a translation is added.
![Page 33: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/33.jpg)
Stretching Equation
PP
xx
yy
SSxx.x.x
P’P’SSyy.y.y
y
xs
s
ys
xs
y
x
y
x
0
0'P
),('
),(
ysxs
yx
yx
P
P
S
PSP '
![Page 34: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/34.jpg)
Linear Transformation
y
xs
s
s
y
xs
s
y
x
dc
ba
y
x
y
y
x
sincos
cossin
10
0
sincos
cossin
sincos
cossin0
0
sincos
cossin
'PSVD
![Page 35: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/35.jpg)
Affine Transformation
1
' y
x
tydc
txbaP
![Page 36: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/36.jpg)
Viewing Position
• Express world in new coordinate system.
• If origins same, this is done by taking inner product with new coordinates.
• Otherwise, we must translate.
![Page 37: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/37.jpg)
Simple 3D Rotation
n
n
n
zzz
yyy
xxx
21
21
21...
100
0cossin
0sincos
Rotation about z axis.
Rotates x,y coordinates. Leaves z coordinates fixed.
![Page 38: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/38.jpg)
Full 3D Rotation
cossin0
sincos0
001
cos0sin
010
sin0cos
100
0cossin
0sincos
R
• Any rotation can be expressed as combination of three rotations about three axes.
100
010
001TRR
• Rows (and columns) of R are orthonormal vectors.
• R has determinant 1 (not -1).
![Page 39: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/39.jpg)
3D Rotation + Translation
• Just like 2D case
![Page 40: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/40.jpg)
3D Viewing Position
• Rows of rotation matrix correspond to new coordinate axis.
![Page 41: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56649d265503460f949fdc46/html5/thumbnails/41.jpg)
Rotation about a known axis
• Suppose we want to rotate about u.
• Find R so that u will be the new z axis.– u is third row of R.– Second row is anything orthogonal to u.– Third row is cross-product of first two.– Make sure matrix has determinant 1.