140 likes | 262 Views
Introduction to Algorithms Contour Stitching. CSE 680 Prof. Roger Crawfis. ?. ?. Contour Stitching. Problem: Given: 2 two-dimensional closed curves Curve #1 has m points Curve #2 has n points Which point(s) does vertex i on curve one correspond to on curve two ?
E N D
Introduction to Algorithms Contour Stitching CSE 680 Prof. Roger Crawfis
? ? Contour Stitching • Problem: Given: 2 two-dimensional closed curves Curve #1 has m points Curve #2 has n points Which point(s) does vertex i on curve one correspond to on curve two? How many possible triangulations are there? i
A Solution • Fuchs, et. al. • Optimization problem • 1 stitch consists of: • 2 spans between curves • 1 contour segment • Triangles of {Pi,Qj,Pi+1} or {Qj+1,Pi,Qj} • Consistent normal directions Qj Pi Pi+1
Fuchs, et. al. • Left span • PiQj => go up • Right span (either) • Pi+1Qj => go down • PiQj+1 => go down
Fuchs, et. al. • Constraints • Each contour segment is used once and only once. • If a span appears as a left span, then it must also appear as a right span. • If a span appears as a right span, then it must also appear as a left span.
Fuchs, et. al. • This produces an acceptable surface (from a topological point of view) • No holes • We would like an optimal one in some sense.
Qj+1 Qj Pi Pi+1 Fuchs et. al. • Graph problem • Vertices Vij = span between Pi and Qj • Edges are constructed from a left span to a right span. • Only two valid right spans for a left span.
Fuchs, et. al. • Organize these edges as a grid or matrix. Q ? j i P QjPiQj+1 PiQjPi+1
Fuchs, et. al. • Acceptable graphs • Exactly one vertical arc between Pi and Pi+1 • Exactly one horiz. arc between Qj and Qj+1 • Either • indegree(Vij) = outdegree(Vij) =0 • both > 0 • (if a right, also has to be a left)
Fuchs, et. al. • Claim: • An acceptable graph, S, is weakly connected. • Lemma 2 • Only 0 or 1 vertex of S has an indegree = 2. • E.g., Two cones touching in the center. • All other vertices have indegree=1 • (recall indegree = outdegree)
Fuchs, et. al. • Thereom 1: S is an acceptable surface if and only if: • S has one and only one horizontal arc between adjacent columns. • S has one and only one vertical arc between adjacent rows. • S is Eulerian • closed walk with every arc only once. Q j i P QjPiQj+1 PiQjPi+1
Fuchs, et. al. • Number of arcs is thus m+n. • Many possible solutions still!!! • Associate costs with each edge • Area of resulting triangle • Aspect ratio of resulting triangle
Fuchs, et. al. • Note that Vi0 is in S for some i. • Note that V0j is in S for some j. • With the weights (costs), we can compute the minimum path from a starting node Vi0. • Since we do not know which Vi0, we compute the paths for all of them and take the minimum. • Some cost saving are achievable.
Fuchs, et. al. • Note, that once a search hits the optimal path, it will not cross it, it must follow it.