220 likes | 247 Views
Explore a new O(n2) time algorithm for reconstructing a simple polygon from visibility angles and vertex lists, optimizing reconstruction from geometric observations.
E N D
An Improved Algorithm for Reconstructing a Simple Polygon from the Visibility Angles Danny Z. Chen and Haitao Wang University of Notre Dame Indiana, USA
Visibility Angles • Consider a simple polygon P: For vertex v, four visibility angles around v a3 a2 a4 a1 v
The Visibility Graph of P Connect all pairs of visible vertices
What is the Problem? • The cyclically ordered vertex list is given v6 v4 v7 v5 v2 v1 v3 The vertex list: v1, v2, v3, v4, v5, v6, v7
What is the Problem? • All visibility angles are given v6 v4 v7 v5 v2 v1 v3
What is the Problem? • Input: • A cyclically ordered vertex list of P • Visibility angles around every vertex of P • Goal: • Reconstruct the simple polygon P (up to similarity)
Previous Work and Our Result • Disser, Mihalak, and Widmayer [SWAT 2010]: • The polygon P can be uniquely determined, up to similarity. • An O(n3log n) time algorithm for reconstructing P is given. • Our result: • An O(n2) time algorithm for reconstructing P • Worst case optimal • Based on new geometric observations
What is the Difficulty for the Reconstruction? • Every vertex v sees some vertices, but cannot identify them, i.e., their vertex labels are not known to v. v6 v4 v7 v5 v2 v1 v3
The Reconstruction Algorithm • Construct the visibility graph G • The key part • Reconstructing P from G • Generally, a long-standing open problem (in PSPACE), • but easy in our setting (O(n2) time) with • angle data information • the ordered vertex list of P
Constructing the Visibility Graph G • For every two vertices vi and vj, determine whether they are visible to each other • An observation: vi is visible to vj if and only if there exists a vertex v in the red part such that Δvivjv does not intersect P\{vi,vj,v} vj vj v v vi vi
vj v vi An Observation (cont.) • vi’: The last visible vertex to vj in the blue part counterclockwise • vj’: The first visible vertex to vi in the blue part counterclockwise vj vj’ triangle witness vi’ v vj’ vi’ vi vi is visible to vj if and only if the sum of the three angles is 180 degree
A Preliminary Algorithm • For every pair of vertices vi and vj, to determine whether they are visible to each other: • Check every vertex to see whether there exists a triangle witness • Running time: • There are O(n2) pairs of vertices • O(n) time is needed for each pair • O(n3) time is needed
A New Observation • Do not check every vertex in the red part • It is sufficient to check one particular vertex (to see whether it is a triangle witness) • Specifically, check the last visible vertex to vi counterclockwise in the red part
A New Observation (cont.) vj v vi vi is visible to vj if and only if v is a triangle witness
The Proof • Goal: vi is visible to vj if and only if v is a triangle witness • If v is a triangle witness, then vi is visible to vj by the previous observation • If vi is visible to vj, then v is a triangle witness • The key is to prove vis also visible to vj vj v vi
The Proof • Goal: vi is visible to vj if and only if v is a triangle witness • If v is a triangle witness, then vi is visible to vj by the previous observation • If vi is visible to vj, then v is a triangle witness • The key is to prove vis also visible to vj vj v vi
The Algorithm Implementation • There are n/2 iterations • In the k-th iteration (k=1…n/2), we check for each i=1…n whether vi is visible to vi+k • It takes O(1) time to check the visibility of every pair of vertices • By using some arrays and auxiliary variables • Overall running time: O(n2)
Preprocess • The visibility array for v: A[1,2,3,4]={a1,a2,a3,a4} • Preprocessing: • Given any i and j with i≤j, the value A[i,j] = A[i]+A[i+1]+…+A[j] can be computed in O(1) time, a3 a2 a4 a1 v
vj v vi An implementation detail • vj’: The first visible vertex to vi in the blue part counterclockwise • Determine the angle x between viv and vivj’ • Suppose v is the t-th visible vertex of vi along the red part • Suppose b is the number of visibility vertices of vi that have been identified so far (in the red part) • Both t and b are already known • The angle x is A[t,b+1], where A is the visibility array for vi vj vj’ y y v vj’ x x vi
Conclusions • Given the visibility angles around every vertex of a simple polygon P and its cyclically ordered vertex list, • we give an algorithm for reconstructing P in O(n2) time
Thank you Questions?