Arrangements and Duality Sanjay Sthapit Comp290 10/6/98 Contents • Duality • Arrangements • Applications Duality • Duality is the association of a point on the primal plane with a line on the dual plane, and vice versa. Duality Transforms • – – – Some duality transforms :Slope: y = mx + b <=> p:(m, b) Polar: ax + by = 1 <=> p:(a, b) Parabolic: y = 2ax - b <=> p:(a, b) Duality Properties • * is its own inverse: (x*)* = x • Point p lies on line L iff point L* lies on line p* • Lines L1 and L2 intersect at a point p iff line p* passes thru L1* and L2* • If point p lies above line L, then line p* lies below point L* and vice-versa Geometric Interpretation of Duality • Let U = x2/2 • If p lies on U, then line p* is the tangent to U at p • If q lies directly above or below p, then q* is the line thru q and parallel to p Duality for Other Objects • For line segments, the dual of a line segment s between points p and q is the double wedge between lines p* and q* on the dual plane. Why Study Duality? • Looking at things on the dual plane provides new perspectives. • For problems dealing with points, the arrangement of their lines on the dual plane (whose structure is more apparent) can be studied to provide solutions. Arrangements • An arrangement is the subdivision of a plane (and the consequent vertices, edges, and faces induced) by a set of lines on it. Complexity of an Arrangement • The complexity of an arrangement is defined as the total number of vertices, edges, and faces of the arrangement. • An arrangement is simple if it does not contain parallel lines, and 3 or more lines with a common intersection point Properties of Arrangements • For a set L of n lines on a plane and their arrangement A(L), – number of vertices in A(L) <= n(n - 1)/2 – number of edges in A(L) <= n2 – number of faces in A(L) <= n2/2 + n/2 + 1 (Equality holds for the above iff A(L) is simple) Properties of Arrangements • For a set L of n lines on a plane and their arrangement A(L), – number of vertices in A(L) <= n(n - 1)/2 • Proof : Any pair of lines gives a maximum of 1 vertex. Properties of Arrangements • For a set L of n lines on a plane and their arrangement A(L), – number of edges in A(L) <= n2 • Proof : Max number of edges for each line is (n - 1) + 1. Therefore max number of edges is n2. Properties of Arrangements • Proof : Add an extra vertex at infinity and join all line open-ended edges to this vertex. Let nv = # of vertices, ne = # of edges, and nf = # of faces. Then by Euler’s formula for connected graphs, nv - ne + nf = 2 => nf = 2 - (nv + 1) + ne = 2 - (n(n-1)/2 + 1) + n2 = n2/2 + n/2 + 1 Properties of Arrangements • Zone theorem: The complexity of the zone of a line in an arrangement of n lines is O(n). (The zone of a line l in an arrangement is the set of faces whose closure intersects l) Properties of Arrangements • Zone theorem proof for n lines: Proof by induction. Trivial for n = 1. Assume true for n-1 lines. Adding another line adds at most 4 left edges. QED Constructing an Arrangement • Doubly-connected edge lists are well suited to represent arrangements. Doubly-Connected Edge Lists • For a subdivision of a plane by a set of lines on it, A doubly-connected edge list consists of three collections of records - for one for faces, one for half-edges, and one for vertices. Doubly-Connected Edge Lists • Half-edges : An edge E connecting p and q is thought of as 2 distinct half-edges one from p to q (e), and the other its twin from q to p (e`). Thus a half edge bounds only 1 face. Doubly-Connected Edge Lists • Vertex record : for a vertex v, it stores – coordinates – a pointer to an arbitrary half-edge with v as its origin Doubly-Connected Edge Lists • Face record : for a face f, it stores – a pointer to some edge on its boundary Doubly-Connected Edge Lists • Half-edge record : for an edge e, it stores pointers to – its origin – its twin – the face it bounds – next edge in face – previous edge in face Constructing an Arrangement • Construct a bounding box B that contains all vertices of An. • Incrementally add each line li to Ai-1 : – find leftmost intersection e with B – split face bounded by e – move on to next intersected face Constructing an Arrangement • Splitting a face f intersected by l with leftmost intersected edge e: – find the edge e` where l leaves f and its twin – create 2 new records for new faces f` and f`` created by l – create a new vertex record for vertex v` where l intersects e` – create 2 new records for half edges created by v` – delete records for e` and f – move to face bounded by twin(e`) Constructing an Arrangement ConstructArrangement(L) : 1. Compute bounding box B(L) that contains all vertices of A(L) in its interior. 2. Construct a doubly-connected edge list for subdivision induced by B(L) 3. For i = 1 to n do 4. Find edge on B(L) that contains the leftmost intersection of li and Ai-1 5. f = bounded face incident to e 6. While f is inside B(L) do 7. Split f, and set f to be next intersected face Constructing an Arrangement Running time for ConstructArrangement(L) : 1. Compute bounding box B(L) that contains all vertices of A(L) in its interior. Compute all intersections of pairs of lines and choose leftmost, rightmost, top and bottom intersection points for bounding box. Step 1 can be done in O(n2) time. Constructing an Arrangement Running time for ConstructArrangement(L) : 2. Construct a doubly-connected edge list for subdivision induced by B(L) Step 2 takes constant time. Constructing an Arrangement Running time for ConstructArrangement(L) : 4. Find edge on B(L) that contains the leftmost intersection of li and Ai-1 Step 4 takes O(n) time. Constructing an Arrangement Running time for ConstructArrangement(L) : 6. 7. While f is inside B(L) do Split f, and set f to be next intersected face Splitting a face f is linear in complexity f. By the Zone theorem, the number of faces a line intersects is O(n). Step 6 and 7 can be done in O(n) time. Constructing an Arrangement Running time for ConstructArrangement(L) : O(n2) + O(1) + n ( O(n) + O(n) ) = O(n2) Constructing a 1D Vornoi Diagram For each point x, construct an arrangement of parabolic duals for (x, x2). Project the intersections of these duals onto the x-axis. This is the Vornoi diagram. ( The process generalizes to higher order diagrams) Computing Discrepancy Discrepancy is the difference between percentage of actual area covered and percentage of sample hits in a pixel. Construct an arrangement A of the duals of the sample points and the dividing edge e in the pixel. Count the number of lines above and below e*. Other Applications • • • • • • • Computing minimum area triangles Ray-shooting Visibility graphs Hidden surface removal Ham-sandwich cuts Motion planning Etc.