1 Note on QEM Implementation. 2 Algorithm Summary.

19
1 Note on QEM Implementa tion

Transcript of 1 Note on QEM Implementation. 2 Algorithm Summary.

Page 1: 1 Note on QEM Implementation. 2 Algorithm Summary.

1

Note on QEM Implementation

Page 2: 1 Note on QEM Implementation. 2 Algorithm Summary.

2

Algorithm Summary

Page 3: 1 Note on QEM Implementation. 2 Algorithm Summary.

3

2D Version

Think clearly on how 2D is done and

extrapolate how this will be done in 3D

Page 4: 1 Note on QEM Implementation. 2 Algorithm Summary.

4

Required on Data Structure

VertexPosList edgesList pairs …?!

EdgeVertex v1, v2

Preparation:Modify your sketch with the proposed data structureAble to remove points on contour

Page 5: 1 Note on QEM Implementation. 2 Algorithm Summary.

5

Visualizing Ellipsoids

Page 6: 1 Note on QEM Implementation. 2 Algorithm Summary.

6

Visualizing QCenter of ellipse:

Reference

Page 7: 1 Note on QEM Implementation. 2 Algorithm Summary.

7

Q for Initial Vertices

l 1: a 1

x+b 1y+c 1

=0 l2 : a

2 x+b2 y+c

2 =0

v

d2 (v,l1) = (a1x+b1y+c1)2 = (p1T v)2 = vT(p1p1

T) v

d2 (v,l2) = … = vT(p2p2T) v

Q (v) = vT(p1p1T + p2p2

T) v vpy

x

cbacybxa T1111111

1

1 :ionnormalizat 22 ii ba

Page 8: 1 Note on QEM Implementation. 2 Algorithm Summary.

8

Error Metric at Vertices

23323

2221312

211

332313

232212

131211

22

222

is

)1()(

qyqyqxqxyqxqQvve

symmetric

qqq

qqq

qqq

Q

Qvvvppv

vpvcbayxv

T

TTT

TT

Page 9: 1 Note on QEM Implementation. 2 Algorithm Summary.

9

Optimal Position of V

used)not is 3(equation

0

0

1

0222

0222

: optimalFor

332313

232212

131211

232212

131211

y

x

qqq

qqq

qqq

qyqxqy

e

qyqxqx

e

v

23

13

2212

1211

q

q

y

x

qq

qq

Page 10: 1 Note on QEM Implementation. 2 Algorithm Summary.

10

Valid Pairs (1:edge)

v1

v2

Q1=Q(v1) Q2

For each edge (v1v2): Compute v-bar from Q1 and Q2

Evaluate the contracting cost: vT(Q1+Q2)v

Page 11: 1 Note on QEM Implementation. 2 Algorithm Summary.

11

Valid Pair (2: aggregation)

C(n,2) to select the pair whose distance is less than

v1

v2

Q1

Q2

Computation of v-bar and cost: same as case 1

Page 12: 1 Note on QEM Implementation. 2 Algorithm Summary.

12

Info Stored in a Pair

(v1,v2, Q1, Q2, v-bar, cost)Sorted by cost value (start contracting from minimum cost)More than one pair may be associated with the same vertexWhen a vertex is changed, updates need to be done …

Page 13: 1 Note on QEM Implementation. 2 Algorithm Summary.

13

Example: update

v1,Q1

v2,Q2

v3,Q3

Pair contraction

Page 14: 1 Note on QEM Implementation. 2 Algorithm Summary.

14

Example: update

v1,Q1

v2,Q2

v3,Q3

v1, Q1+Q2

Page 15: 1 Note on QEM Implementation. 2 Algorithm Summary.

15

Example: update

v3,Q3

v1, Q1+Q2

Update all pairs involving v1

Page 16: 1 Note on QEM Implementation. 2 Algorithm Summary.

16

Iteration

Least cost pair: v1 to stay, v2 to die Update v1 position New Q for v1 = Q1+Q2 Replace occurrence of

v2 in all edges of v2 as v1

[doubly link] make v1 aware of these new edges

remove degenerate edge (for case1)

Update the pairs involving v1

v1

v2

Q1 Q2

v3

Q3

v

Page 17: 1 Note on QEM Implementation. 2 Algorithm Summary.

17

Numerical ExampleL1: y-5=0L2: x+y-8 = 0L3: x-5=0

(3,5)

(5,3)

l1l2

l3

v1

v2

5749

4

9

2505

000

501

3244

4

4

5794

9

4

3244

4

4

2550

510

000

5

0

1

,,

5

1

0

21

21

21

23

21

21

21

21

33222

23

21

21

21

21

21

21

21

22111

3

28

212

1

21

TT

TT

ppppQ

ppppQ

ppp

Page 18: 1 Note on QEM Implementation. 2 Algorithm Summary.

18

Example (cont)

11141313

1321

1312

1 :cost gContractin

3

13

13

13

21

12: Optimal

1141313

1321

1312

:gcontractinAfter

313

313

313

313

21

vQv

yxy

xv

QQQ

T

(3,5)

(5,3)

l1l2

l3

v1

v2

Page 19: 1 Note on QEM Implementation. 2 Algorithm Summary.

19

Line Equation Thru Two Pts

Reference