3d geometry for computer graphics
DESCRIPTION
3D Geometry for Computer Graphics. Class 3. Last week - eigendecomposition. We want to learn how the transformation A works:. A. Last week - eigendecomposition. If we look at arbitrary vectors, it doesn’t tell us much. A. Spectra and diagonalization. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: 3D Geometry for Computer Graphics](https://reader030.vdocuments.site/reader030/viewer/2022032612/5681315c550346895d97d230/html5/thumbnails/1.jpg)
3D Geometry forComputer Graphics
Class 3
![Page 2: 3D Geometry for Computer Graphics](https://reader030.vdocuments.site/reader030/viewer/2022032612/5681315c550346895d97d230/html5/thumbnails/2.jpg)
2
Last week - eigendecomposition
A
We want to learn how the transformation A works:
![Page 3: 3D Geometry for Computer Graphics](https://reader030.vdocuments.site/reader030/viewer/2022032612/5681315c550346895d97d230/html5/thumbnails/3.jpg)
3
Last week - eigendecomposition
A
If we look at arbitrary vectors, it doesn’t tell us much.
![Page 4: 3D Geometry for Computer Graphics](https://reader030.vdocuments.site/reader030/viewer/2022032612/5681315c550346895d97d230/html5/thumbnails/4.jpg)
4
Spectra and diagonalization
A
If A is symmetric, the eigenvectors are orthogonal (and there’s always an eigenbasis).
A = UUT
n
2
1
= Aui = i ui
![Page 5: 3D Geometry for Computer Graphics](https://reader030.vdocuments.site/reader030/viewer/2022032612/5681315c550346895d97d230/html5/thumbnails/5.jpg)
5
In real life…
Matrices that have eigenbasis are rare – general transformations involve also rotations, not only scalings.
We want to understand how general transformations behave.
Need a generalization of eigendecomposition
SVD: A = UVT
Before we learn SVD, we’ll see Principal Component Analysis – usage of spectral analysis to analyze the shape and dimensionality of scattered data.
![Page 6: 3D Geometry for Computer Graphics](https://reader030.vdocuments.site/reader030/viewer/2022032612/5681315c550346895d97d230/html5/thumbnails/6.jpg)
6
The plan for today
First we’ll see some applications of PCA Then look at the theory.
![Page 7: 3D Geometry for Computer Graphics](https://reader030.vdocuments.site/reader030/viewer/2022032612/5681315c550346895d97d230/html5/thumbnails/7.jpg)
7
PCA finds an orthogonal basis that best represents given data set.
The sum of distances2 from the x’ axis is minimized.
PCA – the general idea
x
y
x’
y’
![Page 8: 3D Geometry for Computer Graphics](https://reader030.vdocuments.site/reader030/viewer/2022032612/5681315c550346895d97d230/html5/thumbnails/8.jpg)
8
PCA – the general idea
PCA finds an orthogonal basis that best represents given data set.
PCA finds a best approximating plane (again, in terms of distances2)
3D point set instandard basis
x y
z
![Page 9: 3D Geometry for Computer Graphics](https://reader030.vdocuments.site/reader030/viewer/2022032612/5681315c550346895d97d230/html5/thumbnails/9.jpg)
9
PCA – the general idea
PCA finds an orthogonal basis that best represents given data set.
PCA finds a best approximating plane (again, in terms of distances2)
3D point set instandard basis
![Page 10: 3D Geometry for Computer Graphics](https://reader030.vdocuments.site/reader030/viewer/2022032612/5681315c550346895d97d230/html5/thumbnails/10.jpg)
10
Application: finding tight bounding box
An axis-aligned bounding box: agrees with the axes
x
y
minX maxX
maxY
minY
![Page 11: 3D Geometry for Computer Graphics](https://reader030.vdocuments.site/reader030/viewer/2022032612/5681315c550346895d97d230/html5/thumbnails/11.jpg)
11
Usage of bounding boxes (bounding volumes)
Serve as very simple “approximation” of the object Fast collision detection, visibility queries Whenever we need to know the dimensions (size) of the object
The models consist of thousands of polygons
To quickly test that they don’t intersect, the bounding boxes are tested
Sometimes a hierarchy of BB’s is used
The tighter the BB – the less “false alarms” we have
![Page 12: 3D Geometry for Computer Graphics](https://reader030.vdocuments.site/reader030/viewer/2022032612/5681315c550346895d97d230/html5/thumbnails/12.jpg)
12
Finding cluster representatives
![Page 13: 3D Geometry for Computer Graphics](https://reader030.vdocuments.site/reader030/viewer/2022032612/5681315c550346895d97d230/html5/thumbnails/13.jpg)
13
Finding cluster representatives
![Page 14: 3D Geometry for Computer Graphics](https://reader030.vdocuments.site/reader030/viewer/2022032612/5681315c550346895d97d230/html5/thumbnails/14.jpg)
14
Application: finding tight bounding box
Oriented bounding box: we find better axes!
x’y’
![Page 15: 3D Geometry for Computer Graphics](https://reader030.vdocuments.site/reader030/viewer/2022032612/5681315c550346895d97d230/html5/thumbnails/15.jpg)
15
Application: finding tight bounding box
This is not the optimal bounding box
x y
z
![Page 16: 3D Geometry for Computer Graphics](https://reader030.vdocuments.site/reader030/viewer/2022032612/5681315c550346895d97d230/html5/thumbnails/16.jpg)
16
Application: finding tight bounding box
Oriented bounding box: we find better axes!
![Page 17: 3D Geometry for Computer Graphics](https://reader030.vdocuments.site/reader030/viewer/2022032612/5681315c550346895d97d230/html5/thumbnails/17.jpg)
17
Managing high-dimensional data
Data base of face scans (3D geometry + texture)
10,000 points in each scan x, y, z, R, G, B 6 numbers for each point Thus, each scan is a 10,000*6 = 60,000-dimensional vector!
![Page 18: 3D Geometry for Computer Graphics](https://reader030.vdocuments.site/reader030/viewer/2022032612/5681315c550346895d97d230/html5/thumbnails/18.jpg)
18
Managing high-dimensional data
How to find interesting axes is this 60000-dimensional space? axes that measures age, gender, etc… There is hope: the faces are likely to be governed by a small set
of parameters (much less than 60,000…)
age axis gender axis
FaceGen demo
![Page 19: 3D Geometry for Computer Graphics](https://reader030.vdocuments.site/reader030/viewer/2022032612/5681315c550346895d97d230/html5/thumbnails/19.jpg)
19
Notations
Denote our data points by x1, x2, …, xn Rd
11 11 2
22 21 2
1 2
, , ,
n
n
dd dn
xx x
xx x
xx x
1 2 dx x x
![Page 20: 3D Geometry for Computer Graphics](https://reader030.vdocuments.site/reader030/viewer/2022032612/5681315c550346895d97d230/html5/thumbnails/20.jpg)
20
The origin is zero-order approximation of our data set (a point)
It will be the center of mass:
It can be shown that:
The origin of the new axes
1
1
n
ini
m x
2
1
argminn
ii
x
m x - x
![Page 21: 3D Geometry for Computer Graphics](https://reader030.vdocuments.site/reader030/viewer/2022032612/5681315c550346895d97d230/html5/thumbnails/21.jpg)
21
Scatter matrix
Denote yi = xi – m, i = 1, 2, …, n
where Y is dn matrix with yk as columns (k = 1, 2, …,
n)
TS YY
1 1 1 1 21 2 1 1 12 2 2 1 21 2 2 2 2
1 21 2
dn
dn
d d d dn n n n
y y y y y y
y y y y y yS
y y y y y y
Y YT
![Page 22: 3D Geometry for Computer Graphics](https://reader030.vdocuments.site/reader030/viewer/2022032612/5681315c550346895d97d230/html5/thumbnails/22.jpg)
22
Variance of projected points
In a way, S measures variance (= scatterness) of the data in different directions.
Let’s look at a line L through the center of mass m, and project our
points xi onto it. The variance of the projected points x’i is:
Original set Small variance Large variance
21
1
var( ) || ||n
ini
L
x m
L L L L
![Page 23: 3D Geometry for Computer Graphics](https://reader030.vdocuments.site/reader030/viewer/2022032612/5681315c550346895d97d230/html5/thumbnails/23.jpg)
23
Variance of projected points
Given a direction v, ||v|| = 1, the projection of xi onto L = m + vt is:
|| || , || || , Ti i i ix m v x m v v y v y
vm
xi
x’iL
![Page 24: 3D Geometry for Computer Graphics](https://reader030.vdocuments.site/reader030/viewer/2022032612/5681315c550346895d97d230/html5/thumbnails/24.jpg)
24
Variance of projected points
So,
2 2 21 1 1
1 1
21 1 1 1 1
var( ) || || ( ) || ||
|| || , ,
n n
n n ni i
T T Tn n n n n
L Y
Y Y Y YY S S
T Ti i
T T T
x -m v y v
v v v v v v v v v
2 21 1 1 1
1 22 2 2 2
2 1 2 1 2 21 2
1 1
1 2
( ) || ||
i n
n nT d di n
i i
d d d di n
y y y y
y y y yv v v v v v Y
y y y y
Tiv y v
![Page 25: 3D Geometry for Computer Graphics](https://reader030.vdocuments.site/reader030/viewer/2022032612/5681315c550346895d97d230/html5/thumbnails/25.jpg)
25
Directions of maximal variance
So, we have: var(L) = <Sv, v> Theorem:
Let f : {v Rd | ||v|| = 1} R,
f (v) = <Sv, v> (and S is a symmetric matrix).
Then, the extrema of f are attained at the eigenvectors of S.
So, eigenvectors of S are directions of maximal/minimal variance!
![Page 26: 3D Geometry for Computer Graphics](https://reader030.vdocuments.site/reader030/viewer/2022032612/5681315c550346895d97d230/html5/thumbnails/26.jpg)
26
Summary so far
We take the centered data points y1, y2, …, yn Rd
Construct the scatter matrix S measures the variance of the data points Eigenvectors of S are directions of maximal variance.
TS YY
![Page 27: 3D Geometry for Computer Graphics](https://reader030.vdocuments.site/reader030/viewer/2022032612/5681315c550346895d97d230/html5/thumbnails/27.jpg)
27
Scatter matrix - eigendecomposition
S is symmetric
S has eigendecomposition: S = VVT
S = v2v1 vd
1
2
d
v2
v1
vd
The eigenvectors formorthogonal basis
![Page 28: 3D Geometry for Computer Graphics](https://reader030.vdocuments.site/reader030/viewer/2022032612/5681315c550346895d97d230/html5/thumbnails/28.jpg)
28
Principal components
Eigenvectors that correspond to big eigenvalues are the directions in which the data has strong components (= large variance).
If the eigenvalues are more or less the same – there is no preferable direction.
![Page 29: 3D Geometry for Computer Graphics](https://reader030.vdocuments.site/reader030/viewer/2022032612/5681315c550346895d97d230/html5/thumbnails/29.jpg)
29
Principal components
There’s no preferable direction
S looks like this:
Any vector is an eigenvector
There is a clear preferable direction
S looks like this:
is close to zero, much smaller than .
TVV
![Page 30: 3D Geometry for Computer Graphics](https://reader030.vdocuments.site/reader030/viewer/2022032612/5681315c550346895d97d230/html5/thumbnails/30.jpg)
30
How to use what we got
For finding oriented bounding box – we simply compute the bounding box with respect to the axes defined by the eigenvectors. The origin is at the mean point m.
v2v1
v3
![Page 31: 3D Geometry for Computer Graphics](https://reader030.vdocuments.site/reader030/viewer/2022032612/5681315c550346895d97d230/html5/thumbnails/31.jpg)
31
For approximation
x
yv1
v2
x
y
This line segment approximates the original data set
The projected data set approximates the original data set
x
y
![Page 32: 3D Geometry for Computer Graphics](https://reader030.vdocuments.site/reader030/viewer/2022032612/5681315c550346895d97d230/html5/thumbnails/32.jpg)
32
For approximation
In general dimension d, the eigenvalues are sorted in descending order:
1 2 … d The eigenvectors are sorted accordingly. To get an approximation of dimension d’ < d, we
take the d’ first eigenvectors and look at the subspace they span (d’ = 1 is a line, d’ = 2 is a plane…)
![Page 33: 3D Geometry for Computer Graphics](https://reader030.vdocuments.site/reader030/viewer/2022032612/5681315c550346895d97d230/html5/thumbnails/33.jpg)
33
For approximation
To get an approximating set, we project the original data points onto the chosen subspace:
xi = m + 1v1 + 2v2 +…+ d’vd’ +…+dvd
Projection:
xi’ = m + 1v1 + 2v2 +…+ d’vd’ +0vd’+1+…+ 0 vd
![Page 34: 3D Geometry for Computer Graphics](https://reader030.vdocuments.site/reader030/viewer/2022032612/5681315c550346895d97d230/html5/thumbnails/34.jpg)
34
Optimality of approximation
The approximation is optimal in least-squares sense. It gives the minimal of:
The projected points have maximal variance.
2
1
n
k kk
x x
Original set projection on arbitrary line projection on v1 axis
![Page 35: 3D Geometry for Computer Graphics](https://reader030.vdocuments.site/reader030/viewer/2022032612/5681315c550346895d97d230/html5/thumbnails/35.jpg)
See you next time
![Page 36: 3D Geometry for Computer Graphics](https://reader030.vdocuments.site/reader030/viewer/2022032612/5681315c550346895d97d230/html5/thumbnails/36.jpg)
36
Technical remarks:
i 0, i = 1,…,d (such matrices are called positive semi-definite). So we can indeed sort by the magnitude of i
Theorem: i 0 <Sv, v> 0 v
Proof:
Therefore, i 0 <Sv, v> 0 v
,
( ) ( ) ,
T T T T
T T T T
S V V S S V V
V V
v v v v v v
v v v v v v
2 2 21 2, ... dS 1 2 dv v u u u