The Half-Edge Data Structure

Slides:



Advertisements
Similar presentations
Order-k Voronoi Diagram in the Plane
Advertisements

Linear Programming Computational Geometry, WS 2006/07 Lecture 5, Part I Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik.
Line Segment Intersection Computational Geometry, WS 2007/08 Lecture 3 – Supplementary Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut.
Map Overlay Algorithm. Birch forest Wolves Map 1: Vegetation Map 2: Animals.
2/14/13CMPS 3120 Computational Geometry1 CMPS 3120: Computational Geometry Spring 2013 Planar Subdivisions and Point Location Carola Wenk Based on: Computational.
Brute-Force Triangulation
2/3/15CMPS 3130/6130 Computational Geometry1 CMPS 3130/6130 Computational Geometry Spring 2015 Triangulations and Guarding Art Galleries II Carola Wenk.
One of the most important problems is Computational Geometry is to find an efficient way to decide, given a subdivision of E n and a point P, in which.
9/12/06CS 6463: AT Computational Geometry1 CS 6463: AT Computational Geometry Fall 2006 Triangulations and Guarding Art Galleries II Carola Wenk.
Convex Hulls Computational Geometry, WS 2007/08 Lecture 2 – Supplementary Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik.
Overlay of Two Subdivisions
Mesh Representation, part II based on: Data Structures for Graphics, chapter 12 in Fundamentals of Computer Graphics, 3 rd ed. (Shirley & Marschner) Slides.
Rüdiger Westermann Lehrstuhl für Computer Graphik und Visualisierung
Lecture 7: Voronoi Diagrams Presented by Allen Miu Computational Geometry September 27, 2001.
Computational Geometry -- Voronoi Diagram
17. Computational Geometry Chapter 7 Voronoi Diagrams.
Convex Hulls Computational Geometry, WS 2006/07 Lecture 2 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät für.
Klee’s Measure Problem Computational Geometry, WS 2007/08 Group Work Prof. Dr. Thomas Ottmann Khaireel A. Mohamed Algorithmen & Datenstrukturen, Institut.
The Half-Edge Data Structure Computational Geometry, WS 2007/08 Lecture 3, Part III Prof. Dr. Thomas Ottmann Khaireel A. Mohamed Algorithmen & Datenstrukturen,
Linear Programming Computational Geometry, WS 2006/07 Lecture 5, Part IV Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik.
Orthogonal Range Searching Computational Geometry, WS 2006/07 Lecture 13 – Part II Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für.
Lecture 2 Line Segment Intersection Computational Geometry Prof.Dr.Th.Ottmann 1 Line Segment Intersection Motivation: Computing the overlay of several.
Delaunay Triangulation Computational Geometry, WS 2006/07 Lecture 11 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät.
Line Segment Intersection Computational Geometry, WS 2007/08 Lecture 3 – Part I Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik.
The Lower Envelope: The Pointwise Minimum of a Set of Functions Computational Geometry, WS 2006/07 Lecture 4 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen,
Lecture 12 : Special Case of Hidden-Line-Elimination Computational Geometry Prof. Dr. Th. Ottmann 1 Special Cases of the Hidden Line Elimination Problem.
Special Cases of the Hidden Line Elimination Problem Computational Geometry, WS 2007/08 Lecture 16 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen,
Voronoi Diagrams Computational Geometry, WS 2006/07 Lecture 10 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät.
Duality and Arrangements Computational Geometry, WS 2007/08 Lecture 6 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät.
Introduction to Computational Geometry Computational Geometry, WS 2007/08 Lecture 1 – Part II Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut.
Orthogonal Range Searching Computational Geometry, WS 2006/07 Lecture 13 – Part III Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für.
Lecture 10 : Delaunay Triangulation Computational Geometry Prof. Dr. Th. Ottmann 1 Overview Motivation. Triangulation of Planar Point Sets. Definition.
Persistent Data Structures Computational Geometry, WS 2007/08 Lecture 12 Prof. Dr. Thomas Ottmann Khaireel A. Mohamed Algorithmen & Datenstrukturen, Institut.
Polygonal Mesh – Data Structure and Smoothing
Linear Programming Computational Geometry, WS 2007/08 Lecture 7 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät.
Geometric Data Structures Computational Geometry, WS 2007/08 Lecture 13 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik.
Hidden-Line Elimination Computational Geometry, WS 2006/07 Lecture 14 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät.
Linear Programming Computational Geometry, WS 2007/08 Lecture 7, Part II Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik.
Lecture 8 : Arrangements and Duality Computational Geometry Prof. Dr. Th. Ottmann 1 Duality and Arrangements Duality between lines and points Computing.
Point Location Computational Geometry, WS 2007/08 Lecture 5 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät für.
Closest Pair of Points Computational Geometry, WS 2006/07 Lecture 9, Part II Prof. Dr. Thomas Ottmann Khaireel A. Mohamed Algorithmen & Datenstrukturen,
Polygon Triangulation Computational Geometry, WS 2007/08 Lecture 9 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät.
Linear Programming Computational Geometry, WS 2006/07 Lecture 5, Part III Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik.
Orthogonal Range Searching Computational Geometry, WS 2006/07 Lecture 13 - Part I Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für.
Lecture 6: Point Location Computational Geometry Prof. Dr. Th. Ottmann 1 Point Location 1.Trapezoidal decomposition. 2.A search structure. 3.Randomized,
Voronoi Diagrams.
Polygon Triangulation Computational Geometry, WS 2006/07 Lecture 8, Part 2 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik.
Linear Programming Computational Geometry, WS 2006/07 Lecture 5, Part II Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik.
Line Segment Intersection Computational Geometry, WS 2006/07 Lecture 3 – Part II Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik.
Art Gallery Theorem Computational Geometry, WS 2006/07 Lecture 8, Part 1 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik.
Duality and Arrangements Computational Geometry, WS 2006/07 Lecture 7 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät.
Line Segment Intersection Computational Geometry, WS 2006/07 Lecture 3 – Part I Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik.
Brute-Force Triangulation
UNC Chapel Hill M. C. Lin Line Segment Intersection Chapter 2 of the Textbook Driving Applications –Map overlap problems –3D Polyhedral Morphing.
Planar Subdivision Induced by planar embedding of a graph. Connected if the underlying graph is. edge vertex disconnected subdivision Complexity = #vertices.
Line Segment Intersection Computational Geometry, WS 2006/07 Lecture 3 – Part III Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für.
Arrangements and Duality Sanjay Sthapit Comp290 10/6/98.
Robert Pless, CS 546: Computational Geometry Lecture #3 Last Time: Plane Sweep Algorithms, Segment Intersection, + (Element Uniqueness)
Computational Geometry: Intersection Search Joseph S. B. Mitchell Stony Brook University.
An Introduction to Computational Geometry Joseph S. B. Mitchell Stony Brook University.
February 17, 2005Lecture 6: Point Location Point Location (most slides by Sergi Elizalde and David Pritchard)
9/8/10CS 6463: AT Computational Geometry1 CS 6463: AT Computational Geometry Fall 2010 Triangulations and Guarding Art Galleries Carola Wenk.
CS552: Computer Graphics Lecture 28: Solid Modeling.
CMPS 3130/6130 Computational Geometry Spring 2017
Computational Geometry
An Introduction to Computational Geometry
CMPS 3130/6130 Computational Geometry Spring 2017
Boundary Representations and Topology
Computational Geometry 2
Overlay of Two Subdivisions
Presentation transcript:

The Half-Edge Data Structure Computational Geometry, WS 2006/07 Lecture 9, Part I Prof. Dr. Thomas Ottmann Khaireel A. Mohamed Algorithmen & Datenstrukturen, Institut für Informatik Fakultät für Angewandte Wissenschaften Albert-Ludwigs-Universität Freiburg

Overview Planar subdivision representation Adjacency relationships and queries Boundary representation structure Baumgart’s winged-edge data structure Doubly-connected-edge-list (DCEL) Overlaying planar subdivisions Analyses Computational Geometry, WS 2006/07 Prof. Dr. Thomas Ottmann

Representing a Polygon Mesh We require a convenient and efficient way to represent a planar subdivision. Components in the planar subdivision: A list of vertices A list of edges A list of faces storing pointers for its vertices Must preserve adjacency relationships between components. Computational Geometry, WS 2006/07 Prof. Dr. Thomas Ottmann

Possible Adjacency Queries Point anywhere on the polygon mesh and ask: Which faces use this vertex? Which edges use this vertex? Which faces border this edge? Which edges border this face? Which faces are adjacent to this face? Planar subdivision Euler’s formular: v – e + f = 2 Computational Geometry, WS 2006/07 Prof. Dr. Thomas Ottmann

Boundary Representation Structures To represent such queries efficiently, we use the boundary representation (B-rep) structure. B-rep explicitly model the edges, vertices, and faces of the planar subdivision PLUS additional adjacency information stored inside. Two most common examples of B-rep: Baumgart’s winged-edge data structure Doubly-connect-edge-list (DCEL) Computational Geometry, WS 2006/07 Prof. Dr. Thomas Ottmann

Baumgart’s Winged-Edge DS The Edge DS is augmented with pointers to: the two vertices it touches (v1, v2), the two faces it borders (f1, f2), and pointers to four of the edges which emanate from each end point (e_v1[4], v2[4]). We can determine which faces or vertices border a given edge in constant time. Other types of queries can require more expensive processing. e v1 v2 f2 f1 e_v1[4] e_v2[4] Computational Geometry, WS 2006/07 Prof. Dr. Thomas Ottmann

The Doubly-Connected-Edge-List (DCEL) DCEL is a directed half-edge B-rep data structure. Allows all adjacency queries in constant time (per piece of information gathered). That is, for example; When querying all edges adjacent to a vertex, the operation will be linear in the number of edges adjacent to the vertex, but constant time per edge. The DCEL is excellent in representing manifold surfaces: Every edge is bordered by exactly two faces. Cross junctions and internal polygons are not allowed. Computational Geometry, WS 2006/07 Prof. Dr. Thomas Ottmann

DCEL Component – Half-edge The half-edges in the DCEL that border a face form a circular linked-list around its perimeter (anti-clockwise); i.e. each half-edge in the loop stores a pointer to the face it borders (incident). Each half-edge is directed and can be described in C as follows: struct HE_edge { HE_vert *v_orig; HE_edge *e_twin; HE_face *f; HE_edge *e_next; HE_edge *e_prev; }; HE_edge f e_next e_prev v_orig e_twin Computational Geometry, WS 2006/07 Prof. Dr. Thomas Ottmann

DCEL Component - Vertex Vertices in the DCEL stores: their actual point location, and a pointer to exactly ONE of the HE_edge, which uses the vertex as its origin. There may be several HE_edge whose origins start at the same vertex. We need only one, and it does not matter which one. HE_vert edge p=(x,y) struct HE_vert { Gdiplus::PointF p; HE_edge *edge; }; Computational Geometry, WS 2006/07 Prof. Dr. Thomas Ottmann

DCEL Component – Face I The “bare-bones” version of the face component needs only to store a single pointer to one of the half-edges it borders. In the implementation by de Berg et al. (2000), edge is the pointer to the circular loop of the OuterComponent (or the outer-most boundary) of the incident face. For the unbounded face, this pointer is NULL. struct HE_face_barebone { HE_edge *edge; }; HE_face_barebone edge Computational Geometry, WS 2006/07 Prof. Dr. Thomas Ottmann

DCEL Component – Face II All holes contained inside an incident face are considered as InnerComponents. A list of pointers to half-edges of unique holes is maintained in HE_face as follows. In the case that there are no holes in an incident face, innerComps is set to NULL. struct HE_face { HE_edge *outerComp; HE_edge **innerComps; }; HE_face outerComp innerComps[0] Computational Geometry, WS 2006/07 Prof. Dr. Thomas Ottmann

Adjacency Queries Given a half-edge edge, we can perform queries in constant time. Example: HE_vert *v1 = edgev_orig; HE_vert *v2 = edgee_twinv_orig; HE_vert *f1 = edgef; HE_vert *f2 = edge e_twinf; edge f1 v2 v1 f2 Computational Geometry, WS 2006/07 Prof. Dr. Thomas Ottmann

DCEL Example In terms of the structure definitions: Example vertex v1 = { (1, 2), h_edge(12) } face f1 = {h_edge(15), [h_edge(67)] } h_edge(54) = { v5, h_edge(45), f1, h_edge(43), h_edge(15) } In terms of the structure definitions: HE_vert v1; v1p = new Point(1,2); v1egde = e_12; HE_face f1; f1outerComp = e_15; f1innerComp[0] = e_67; HE_edge e_54; e_54v_orig = v5; e_54e_twin = e_45; e_54f = f1; e_54e_next = e_43; e_54e_prev = e_15; Computational Geometry, WS 2006/07 Prof. Dr. Thomas Ottmann

Iterated Adjacency Queries Iterating over the half-edges adjacent to a given face. Iterating over the half-edges that are adjacent to a given vertex. HE_edge *edge = faceouterComp; do { // Do something with edge. edge = edgenext; } while (edge != faceouterComp); HE_edge *edge = vertexedge; do { // Do something with edge, edgee_twin, etc. edge = edgee_twinnext; } while (edge != vertexedge); Computational Geometry, WS 2006/07 Prof. Dr. Thomas Ottmann

Face Records f Determining the boundary-type: Is a complete edge-loop (boundary-cycle) an outer-boundary, or the boundary of a hole in the face? Select the face f that we are interested in. Identify the lowest of the left-most vertex v of any edge-loop. Consider the two half-edges passing through v, and compute their angle . If  is smaller than 180°, then the edge-loop is an outer-boundary. f Computational Geometry, WS 2006/07 Prof. Dr. Thomas Ottmann

Top Level DCEL Representation Holes c8 c2 c6 c7 c5 Outside c4 Construct a graph G to representy boundary-cycles. For every boundary-cycle, there is a node in G (+ imaginary bound). An arc joins two cycles iff one is a boundary of a hole and the other has a half-edge immediately to the left of the left-most vertex of that hole. Computational Geometry, WS 2006/07 Prof. Dr. Thomas Ottmann

Splitting an Edge Given an edge e and a point p on e, we can split e into two sub-edges e1 and e2 in constant time. e p ev_orig ee_twin e2 p e2e_twin e1 ev_orig e1e_twin Computational Geometry, WS 2006/07 Prof. Dr. Thomas Ottmann

Splitting and Re-directing Edges Given an edge e and a vertex v of degree deg(v) on e, we can split and redirect the sub-edges of the DCEL at v in time O(1 + deg(v)). e Insertion of new edges into the flow: » Iterate edges at v. » Exercise. v ev_orig e2 e1 v Computational Geometry, WS 2006/07 Prof. Dr. Thomas Ottmann

Overlaying Two Planar Subdivisions Plane sweep! Event-points (maintained in balanced binary search tree): Vertices of S1 and S2 All intersections between edges in S1 and S2 Status-structure (per event): Neighbouring edges sorted in increasing x-order. Computational Geometry, WS 2006/07 Prof. Dr. Thomas Ottmann

Handling Intersections Additional handling of ‘intersection’ event points: Split and re-direct edges. Check new nearest-neighbours for intersections. Recall (from Lecture 3): 2 1 3 7 8 U(P) C(P) 4 5 P L Computational Geometry, WS 2006/07 Prof. Dr. Thomas Ottmann

Analysis For a total of n vertices in both S1 and S2: Sorting of n vertices: O(n log n) time Runtime per ‘intersection’-vertex: O(1 + deg(v)) Time to retrieve neighbouring edges per ‘interection’-vertex: O(log n) Total ‘intersection’-vertices: k Total runtime: O(n log n + k log n) Computational Geometry, WS 2006/07 Prof. Dr. Thomas Ottmann