lecture 11: group assignment 1 review, procrustes intro

32
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

Upload: others

Post on 24-Feb-2022

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lecture 11: Group Assignment 1 Review, Procrustes Intro

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Procrustes Alignment

COMPSCI/MATH 290-04 Lecture 11: Group Assignment 1 Review, Procrustes Intro

Page 32: Lecture 11: Group Assignment 1 Review, Procrustes Intro

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