Day 9 - Observation Assignment, Pathways Ch. 2, Word Stress Intro
Lecture 11: Group Assignment 1 Review, Procrustes Intro
Transcript of Lecture 11: Group Assignment 1 Review, Procrustes Intro
![Page 1: Lecture 11: Group Assignment 1 Review, Procrustes Intro](https://reader031.fdocuments.net/reader031/viewer/2022022516/6217b1c8066eda5a3e3159e4/html5/thumbnails/1.jpg)
Lecture 11: Group Assignment 1 Review,Procrustes Intro
COMPSCI/MATH 290-04
Chris Tralie, Duke University
2/18/2016
COMPSCI/MATH 290-04 Lecture 11: Group Assignment 1 Review, Procrustes Intro
![Page 2: Lecture 11: Group Assignment 1 Review, Procrustes Intro](https://reader031.fdocuments.net/reader031/viewer/2022022516/6217b1c8066eda5a3e3159e4/html5/thumbnails/2.jpg)
Table of Contents
I Assignment Concepts Review
B PCA New Convention
B Procrustes Distance
COMPSCI/MATH 290-04 Lecture 11: Group Assignment 1 Review, Procrustes Intro
![Page 3: Lecture 11: Group Assignment 1 Review, Procrustes Intro](https://reader031.fdocuments.net/reader031/viewer/2022022516/6217b1c8066eda5a3e3159e4/html5/thumbnails/3.jpg)
Code Layout: Recursive Scene Graph Traversal
f(node, mvMatrix):for c in node.children:
if (’mesh’ in node) {//Do some stuff if this isn’t a dummy node
}f(c, mat4.mul(mvMatrix, node.transform));
Call this function with “scene” to start the recursion
COMPSCI/MATH 290-04 Lecture 11: Group Assignment 1 Review, Procrustes Intro
![Page 4: Lecture 11: Group Assignment 1 Review, Procrustes Intro](https://reader031.fdocuments.net/reader031/viewer/2022022516/6217b1c8066eda5a3e3159e4/html5/thumbnails/4.jpg)
Code Layout: Meshes (What Is A Mesh??)
var mesh = node.mesh;//Loop through facesfor (var f = 0; f < mesh.faces.length; f++) {
//"Pointer" to facevar face = mesh.faces[f];//For each face get vertices in CCW ordervar verts = face.getVerticesPos();//Do stuff with the vertices...
}
COMPSCI/MATH 290-04 Lecture 11: Group Assignment 1 Review, Procrustes Intro
![Page 5: Lecture 11: Group Assignment 1 Review, Procrustes Intro](https://reader031.fdocuments.net/reader031/viewer/2022022516/6217b1c8066eda5a3e3159e4/html5/thumbnails/5.jpg)
Code Layout: Image Sources
scene.imsources = [scene.source];for (order = 1:k):
for s in scene.imsources:if s.order == order-1 {
//Reflect (call recursive scene treefunction)
//Generate a bunch of images snewsnew.parent = ssnew.genFace = face reflected
}
COMPSCI/MATH 290-04 Lecture 11: Group Assignment 1 Review, Procrustes Intro
![Page 6: Lecture 11: Group Assignment 1 Review, Procrustes Intro](https://reader031.fdocuments.net/reader031/viewer/2022022516/6217b1c8066eda5a3e3159e4/html5/thumbnails/6.jpg)
Reflections / Projections
Plane: (~q, ~n)Point: ~pReflection: ~p − 2((~p − ~q) · n)~n
COMPSCI/MATH 290-04 Lecture 11: Group Assignment 1 Review, Procrustes Intro
![Page 7: Lecture 11: Group Assignment 1 Review, Procrustes Intro](https://reader031.fdocuments.net/reader031/viewer/2022022516/6217b1c8066eda5a3e3159e4/html5/thumbnails/7.jpg)
Reflections / Projections
Plane: (~q, ~n)Point: ~pReflection: ~p − 2((~p − ~q) · n)~n
COMPSCI/MATH 290-04 Lecture 11: Group Assignment 1 Review, Procrustes Intro
![Page 8: Lecture 11: Group Assignment 1 Review, Procrustes Intro](https://reader031.fdocuments.net/reader031/viewer/2022022516/6217b1c8066eda5a3e3159e4/html5/thumbnails/8.jpg)
Ray Intersect Plane
( ~p0 + t~v − ~q) · ~n = 0
t =(~q − ~p0) · n
~v · ~n
COMPSCI/MATH 290-04 Lecture 11: Group Assignment 1 Review, Procrustes Intro
![Page 9: Lecture 11: Group Assignment 1 Review, Procrustes Intro](https://reader031.fdocuments.net/reader031/viewer/2022022516/6217b1c8066eda5a3e3159e4/html5/thumbnails/9.jpg)
Ray Intersect Plane
( ~p0 + t~v − ~q) · ~n = 0
t =(~q − ~p0) · n
~v · ~n
COMPSCI/MATH 290-04 Lecture 11: Group Assignment 1 Review, Procrustes Intro
![Page 10: Lecture 11: Group Assignment 1 Review, Procrustes Intro](https://reader031.fdocuments.net/reader031/viewer/2022022516/6217b1c8066eda5a3e3159e4/html5/thumbnails/10.jpg)
Ray Intersect Plane
( ~p0 + t~v − ~q) · ~n = 0
t =(~q − ~p0) · n
~v · ~n
COMPSCI/MATH 290-04 Lecture 11: Group Assignment 1 Review, Procrustes Intro
![Page 11: Lecture 11: Group Assignment 1 Review, Procrustes Intro](https://reader031.fdocuments.net/reader031/viewer/2022022516/6217b1c8066eda5a3e3159e4/html5/thumbnails/11.jpg)
Point Inside Convex Polygon: Area Test
1
2
3
4
56
7
COMPSCI/MATH 290-04 Lecture 11: Group Assignment 1 Review, Procrustes Intro
![Page 12: Lecture 11: Group Assignment 1 Review, Procrustes Intro](https://reader031.fdocuments.net/reader031/viewer/2022022516/6217b1c8066eda5a3e3159e4/html5/thumbnails/12.jpg)
Convex Polygon Area?
1
2
3
4
56
7
COMPSCI/MATH 290-04 Lecture 11: Group Assignment 1 Review, Procrustes Intro
![Page 13: Lecture 11: Group Assignment 1 Review, Procrustes Intro](https://reader031.fdocuments.net/reader031/viewer/2022022516/6217b1c8066eda5a3e3159e4/html5/thumbnails/13.jpg)
Convex Polygon Area: Triangle Fan
1
2
3
4
56
7
COMPSCI/MATH 290-04 Lecture 11: Group Assignment 1 Review, Procrustes Intro
![Page 14: Lecture 11: Group Assignment 1 Review, Procrustes Intro](https://reader031.fdocuments.net/reader031/viewer/2022022516/6217b1c8066eda5a3e3159e4/html5/thumbnails/14.jpg)
Extra Stuff: Binaural Sound
COMPSCI/MATH 290-04 Lecture 11: Group Assignment 1 Review, Procrustes Intro
![Page 15: Lecture 11: Group Assignment 1 Review, Procrustes Intro](https://reader031.fdocuments.net/reader031/viewer/2022022516/6217b1c8066eda5a3e3159e4/html5/thumbnails/15.jpg)
Extra Stuff: Transmission1
2
3
(r |t)∗
COMPSCI/MATH 290-04 Lecture 11: Group Assignment 1 Review, Procrustes Intro
![Page 16: Lecture 11: Group Assignment 1 Review, Procrustes Intro](https://reader031.fdocuments.net/reader031/viewer/2022022516/6217b1c8066eda5a3e3159e4/html5/thumbnails/16.jpg)
Extra Stuff: Transmission (Raffle Point)
Regular expressions
(r |t)∗
1
2
3
COMPSCI/MATH 290-04 Lecture 11: Group Assignment 1 Review, Procrustes Intro
![Page 17: Lecture 11: Group Assignment 1 Review, Procrustes Intro](https://reader031.fdocuments.net/reader031/viewer/2022022516/6217b1c8066eda5a3e3159e4/html5/thumbnails/17.jpg)
Extra Stuff: Transmission (Raffle Point)
Regular expressions (r |t)∗
1
2
3
COMPSCI/MATH 290-04 Lecture 11: Group Assignment 1 Review, Procrustes Intro
![Page 18: Lecture 11: Group Assignment 1 Review, Procrustes Intro](https://reader031.fdocuments.net/reader031/viewer/2022022516/6217b1c8066eda5a3e3159e4/html5/thumbnails/18.jpg)
Extra Stuff: Frequency dependent transmission
COMPSCI/MATH 290-04 Lecture 11: Group Assignment 1 Review, Procrustes Intro
![Page 19: Lecture 11: Group Assignment 1 Review, Procrustes Intro](https://reader031.fdocuments.net/reader031/viewer/2022022516/6217b1c8066eda5a3e3159e4/html5/thumbnails/19.jpg)
Extra Stuff: Bounding Box Speedup
root
COMPSCI/MATH 290-04 Lecture 11: Group Assignment 1 Review, Procrustes Intro
![Page 20: Lecture 11: Group Assignment 1 Review, Procrustes Intro](https://reader031.fdocuments.net/reader031/viewer/2022022516/6217b1c8066eda5a3e3159e4/html5/thumbnails/20.jpg)
Table of Contents
B Assignment Concepts Review
I PCA New Convention
B Procrustes Distance
COMPSCI/MATH 290-04 Lecture 11: Group Assignment 1 Review, Procrustes Intro
![Page 21: Lecture 11: Group Assignment 1 Review, Procrustes Intro](https://reader031.fdocuments.net/reader031/viewer/2022022516/6217b1c8066eda5a3e3159e4/html5/thumbnails/21.jpg)
PCA New Convention
Organize point cloud into d × N matrix, each point along acolumn
X =
| | . . . |~v1 ~v2
... ~vN| | . . . |
Choose a unit column vector direction u ∈ Rd×1
Then
d = uT X
gives projections onto u
B More consistent with what we’ve done; points in columns
COMPSCI/MATH 290-04 Lecture 11: Group Assignment 1 Review, Procrustes Intro
![Page 22: Lecture 11: Group Assignment 1 Review, Procrustes Intro](https://reader031.fdocuments.net/reader031/viewer/2022022516/6217b1c8066eda5a3e3159e4/html5/thumbnails/22.jpg)
PCA New Convention
Organize point cloud into d × N matrix, each point along acolumn
X =
| | . . . |~v1 ~v2
... ~vN| | . . . |
Choose a unit column vector direction u ∈ Rd×1
Then
d = uT X
gives projections onto u
B More consistent with what we’ve done; points in columns
COMPSCI/MATH 290-04 Lecture 11: Group Assignment 1 Review, Procrustes Intro
![Page 23: Lecture 11: Group Assignment 1 Review, Procrustes Intro](https://reader031.fdocuments.net/reader031/viewer/2022022516/6217b1c8066eda5a3e3159e4/html5/thumbnails/23.jpg)
PCA New Convention
d = uT X
B How to express the sum of the squares of the dotproducts?
ddT
ddT = (uT X )(uT X )T = uT XX T u
Want to find u that maximizes the above quadratic form
COMPSCI/MATH 290-04 Lecture 11: Group Assignment 1 Review, Procrustes Intro
![Page 24: Lecture 11: Group Assignment 1 Review, Procrustes Intro](https://reader031.fdocuments.net/reader031/viewer/2022022516/6217b1c8066eda5a3e3159e4/html5/thumbnails/24.jpg)
PCA New Convention
d = uT X
B How to express the sum of the squares of the dotproducts?
ddT
ddT = (uT X )(uT X )T = uT XX T u
Want to find u that maximizes the above quadratic form
COMPSCI/MATH 290-04 Lecture 11: Group Assignment 1 Review, Procrustes Intro
![Page 25: Lecture 11: Group Assignment 1 Review, Procrustes Intro](https://reader031.fdocuments.net/reader031/viewer/2022022516/6217b1c8066eda5a3e3159e4/html5/thumbnails/25.jpg)
PCA New Convention
d = uT X
B How to express the sum of the squares of the dotproducts?
ddT
ddT = (uT X )(uT X )T = uT XX T u
Want to find u that maximizes the above quadratic form
COMPSCI/MATH 290-04 Lecture 11: Group Assignment 1 Review, Procrustes Intro
![Page 26: Lecture 11: Group Assignment 1 Review, Procrustes Intro](https://reader031.fdocuments.net/reader031/viewer/2022022516/6217b1c8066eda5a3e3159e4/html5/thumbnails/26.jpg)
PCA New Convention
d = uT X
B How to express the sum of the squares of the dotproducts?
ddT
ddT = (uT X )(uT X )T = uT XX T u
Want to find u that maximizes the above quadratic form
COMPSCI/MATH 290-04 Lecture 11: Group Assignment 1 Review, Procrustes Intro
![Page 27: Lecture 11: Group Assignment 1 Review, Procrustes Intro](https://reader031.fdocuments.net/reader031/viewer/2022022516/6217b1c8066eda5a3e3159e4/html5/thumbnails/27.jpg)
PCA New Convention
Use eigenvectors of A = XX T to find principal directionsmaximizing uT Au
λ1 = 422
COMPSCI/MATH 290-04 Lecture 11: Group Assignment 1 Review, Procrustes Intro
![Page 28: Lecture 11: Group Assignment 1 Review, Procrustes Intro](https://reader031.fdocuments.net/reader031/viewer/2022022516/6217b1c8066eda5a3e3159e4/html5/thumbnails/28.jpg)
PCA New Convention
Use eigenvectors of A = XX T to find principal directionsmaximizing uT Au
λ2 = 21.6
COMPSCI/MATH 290-04 Lecture 11: Group Assignment 1 Review, Procrustes Intro
![Page 29: Lecture 11: Group Assignment 1 Review, Procrustes Intro](https://reader031.fdocuments.net/reader031/viewer/2022022516/6217b1c8066eda5a3e3159e4/html5/thumbnails/29.jpg)
Table of Contents
B Assignment Concepts Review
B PCA New Convention
I Procrustes Distance
COMPSCI/MATH 290-04 Lecture 11: Group Assignment 1 Review, Procrustes Intro
![Page 30: Lecture 11: Group Assignment 1 Review, Procrustes Intro](https://reader031.fdocuments.net/reader031/viewer/2022022516/6217b1c8066eda5a3e3159e4/html5/thumbnails/30.jpg)
Procrustes Distance
http://www.procrustes.nl/gif/illustr.gif
COMPSCI/MATH 290-04 Lecture 11: Group Assignment 1 Review, Procrustes Intro
![Page 31: Lecture 11: Group Assignment 1 Review, Procrustes Intro](https://reader031.fdocuments.net/reader031/viewer/2022022516/6217b1c8066eda5a3e3159e4/html5/thumbnails/31.jpg)
Procrustes Alignment
COMPSCI/MATH 290-04 Lecture 11: Group Assignment 1 Review, Procrustes Intro
![Page 32: Lecture 11: Group Assignment 1 Review, Procrustes Intro](https://reader031.fdocuments.net/reader031/viewer/2022022516/6217b1c8066eda5a3e3159e4/html5/thumbnails/32.jpg)
Procrustes Distance
Given two point clouds {~xi}Ni=1 and {~yi}Ni=1where xi and yi are in correspondenceSeek to minimize
N∑i=1
||R(~xi +~t)− ~yi ||22
over all orthogonal matrices R and translation vectors t . ||.||2 issquared distance
COMPSCI/MATH 290-04 Lecture 11: Group Assignment 1 Review, Procrustes Intro