Efficient access to TIN Regular square grid TIN Efficient access to TIN Let q := (x, y) be a point. We want to estimate an elevation at a point q: 1. should.

Slides:



Advertisements
Similar presentations
Polygon Triangulation
Advertisements

Spatial Information Systems (SIS) COMP Terrain modeling and geometric problems (part 2)
Nearest Neighbor Search
Yang Yang, Miao Jin, Hongyi Wu Presenter: Buri Ban The Center for Advanced Computer Studies (CACS) University of Louisiana at Lafayette 3D Surface Localization.
Approximations of points and polygonal chains
Dynamic Planar Convex Hull Operations in Near- Logarithmic Amortized Time TIMOTHY M. CHAN.
2/14/13CMPS 3120 Computational Geometry1 CMPS 3120: Computational Geometry Spring 2013 Planar Subdivisions and Point Location Carola Wenk Based on: Computational.
 Distance Problems: › Post Office Problem › Nearest Neighbors and Closest Pair › Largest Empty and Smallest Enclosing Circle  Sub graphs of Delaunay.
Searching on Multi-Dimensional Data
Brute-Force Triangulation
Label placement Rules, techniques. Labels on a map Text, name of map features No fixed geographical position Labels of point features (0-dim), line features.
UNC Chapel Hill M. C. Lin Polygon Triangulation Chapter 3 of the Textbook Driving Applications –Guarding an Art Gallery –3D Morphing.
The Divide-and-Conquer Strategy
Convex Hulls in Two Dimensions Definitions Basic algorithms Gift Wrapping (algorithm of Jarvis ) Graham scan Divide and conquer Convex Hull for line intersections.
Convex Hulls in 3-space Jason C. Yang.
Quadtrees Raster and vector.
University of Wisconsin-Milwaukee Geographic Information Science Geography 625 Intermediate Geographic Information Science Instructor: Changshan Wu Department.
Spatial Information Systems (SIS)
Query Processing in Databases Dr. M. Gavrilova.  Introduction  I/O algorithms for large databases  Complex geometric operations in graphical querying.
Query Evaluation. An SQL query and its RA equiv. Employees (sin INT, ename VARCHAR(20), rating INT, age REAL) Maintenances (sin INT, planeId INT, day.
Computational Geometry and Spatial Data Mining
1cs542g-term Notes. 2 Meshing goals  Robust: doesn’t fail on reasonable geometry  Efficient: as few triangles as possible Easy to refine later.
2-dimensional indexing structure
Half-Space Intersections
Contents Description of the big picture Theoretical background on this work The Algorithm Examples.
Point Location Computational Geometry, WS 2007/08 Lecture 5 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät für.
UNC Chapel Hill M. C. Lin Overview of Last Lecture About Final Course Project –presentation, demo, write-up More geometric data structures –Binary Space.
B + -Trees (Part 1) Lecture 20 COMP171 Fall 2006.
B + -Trees (Part 1). Motivation AVL tree with N nodes is an excellent data structure for searching, indexing, etc. –The Big-Oh analysis shows most operations.
Computing the Delaunay Triangulation By Nacha Chavez Math 870 Computational Geometry; Ch.9; de Berg, van Kreveld, Overmars, Schwarzkopf By Nacha Chavez.
Lecture 6: Point Location Computational Geometry Prof. Dr. Th. Ottmann 1 Point Location 1.Trapezoidal decomposition. 2.A search structure. 3.Randomized,
R-Trees 2-dimensional indexing structure. R-trees 2-dimensional version of the B-tree: B-tree of maximum degree 8; degree between 3 and 8 Internal nodes.
1 University of Denver Department of Mathematics Department of Computer Science.
Delaunay Triangulations Presented by Glenn Eguchi Computational Geometry October 11, 2001.
Data Structures for Computer Graphics Point Based Representations and Data Structures Lectured by Vlastimil Havran.
CPSC 335 BTrees Dr. Marina Gavrilova Computer Science University of Calgary Canada.
Minimal Spanning Trees What is a minimal spanning tree (MST) and how to find one.
1 Introduction to Approximation Algorithms. 2 NP-completeness Do your best then.
UNC Chapel Hill M. C. Lin Point Location Reading: Chapter 6 of the Textbook Driving Applications –Knowing Where You Are in GIS Related Applications –Triangulation.
Algorithms for Triangulations of a 3D Point Set Géza Kós Computer and Automation Research Institute Hungarian Academy of Sciences Budapest, Kende u
©Silberschatz, Korth and Sudarshan13.1Database System Concepts Chapter 13: Query Processing Overview Measures of Query Cost Selection Operation Sorting.
COSC 2007 Data Structures II Chapter 15 External Methods.
Computational Geometry Piyush Kumar (Lecture 10: Point Location) Welcome to CIS5930.
A Study of Balanced Search Trees: Brainstorming a New Balanced Search Tree Anthony Kim, 2005 Computer Systems Research.
CSE 589 Part VI. Reading Skiena, Sections 5.5 and 6.8 CLR, chapter 37.
Arrangements and Duality Motivation: Ray-Tracing Fall 2001, Lecture 9 Presented by Darius Jazayeri 10/4/01.
1 / 41 Convex Hulls in 3-space Jason C. Yang. 2 / 41 Problem Statement Given P: set of n points in 3-space Return: –Convex hull of P: CH (P) –Smallest.
Spatial Indexing Techniques Introduction to Spatial Computing CSE 5ISC Some slides adapted from Spatial Databases: A Tour by Shashi Shekhar Prentice Hall.
B-TREE. Motivation for B-Trees So far we have assumed that we can store an entire data structure in main memory What if we have so much data that it won’t.
UNC Chapel Hill M. C. Lin Delaunay Triangulations Reading: Chapter 9 of the Textbook Driving Applications –Height Interpolation –Constrained Triangulation.
Searching ( 搜索) 1. Introduction 2. Sequential Search 3. Binary Search 4. Comparison Trees.
February 17, 2005Lecture 6: Point Location Point Location (most slides by Sergi Elizalde and David Pritchard)
1 Point Location Strategies Idit Haran
NOTE: To change the image on this slide, select the picture and delete it. Then click the Pictures icon in the placeholder to insert your own image. Fast.
9/8/10CS 6463: AT Computational Geometry1 CS 6463: AT Computational Geometry Fall 2010 Triangulations and Guarding Art Galleries Carola Wenk.
Polygon Triangulation
Digital Elevation Models (DEMs)Constructing Grid DEMConstructing Contour Map Constructing TIN DEM Grid DEM Quality Metric A Digital Elevation Model (DEM)
CMPS 3130/6130 Computational Geometry Spring 2017
Mean Shift Segmentation
Query Processing in Databases Dr. M. Gavrilova
Chapter Trees and B-Trees
Chapter Trees and B-Trees
Efficient Distance Computation between Non-Convex Objects
The Art Gallery Problem
CMPS 3130/6130 Computational Geometry Spring 2017
The Art Gallery Problem
CSCE 441 Computer Graphics: Clipping Polygons Jinxiang Chai
CSCE 441 Computer Graphics: Clipping Polygons Jinxiang Chai
Lecture-Hashing.
CMPT 225 Lecture 16 – Heap Sort.
Presentation transcript:

Efficient access to TIN Regular square grid TIN Efficient access to TIN Let q := (x, y) be a point. We want to estimate an elevation at a point q: 1. should find a triangle of a TIN that includes q 2. use some method (like interpolation, weighted average etc.) to estimate an elevation We will discuss methods for the part 1. Compare: Regular square grid – direct access to every part of the terrain: translate (x,y) to index values in grid array. TIN – since it is a pointer structure, we should test each triangle. Inefficient.1

Access using quad trees: We will discuss three methods of efficient access to a TIN: Access using quad trees: quad tree is a regular tree of degree 4. Its nodes represent a recursive decomposition of a big square (a root) into four subsquares (the children of the root), and so on. Decomposition stops when the part of the TIN that falls in the subsquare is simple enough – only a few vertices lie inside the square. t2 t3 t1 t4 t5 t6 t7t8 t9 t10 t11 t4 x1x1 x2x2 x3x3 x4x4 y1y1 y2y2 y3y3 y4y4 y5y5 2

Access using quad trees: We will discuss three methods of efficient access to TIN: Access using quad trees: quad tree is a regular search tree of degree 4. Its nodes represent a recursive decomposition of a big square (a root) into four subsquares (the children of the root), and so on. Decomposition stops when the part of the TIN that falls in the subsquare is simple enough – only a few vertices lie inside the square. t2 t3 t1 t4 t5 t6 t7t8 t9 t10 t11 t4 t1t2t4t8t7t5t6 … … At leaf node we store a pointer to a triangle that contains the center of the square. To find a triangle that contains q: 1) go down the tree till get a triangle 2)walk in the topological structure to locate the triangle that contains the query point. x1x1 x2x2 x3x3 x4x4 y1y1 y2y2 y3y3 y4y4 x5x5 y5y5 (x 1, y 1 ),(x 5, y 5 ) (x 3, y 1 ),(x 5, y 3 ) (x 1, y 3 ),(x 3, y 5 ) 3

2) walk in the topological structure to locate the triangle that contains the query point: - start with the triangle t 1 since it contains the center of the base rectangle that contains q. - tests all the neighbor triangles of t 1 - tests all the neighbor triangles of the neighbor triangles of t 1 and so on… a base rectangle; points to the triangle that contains its center t1 In our case, we would find the queried point q in the second round. 4

Another possibility is to take the smallest enclosing axis-parallel rectangle of each triangle of the TIN: t1t1 t5t5 t4t4 t3t3 t2t2 t1t1 t2t2 t3t3 t4t4 t5t5 In our example, got five rectangles. Now we execute quad tree algorithm on them. When get a query of a point q, we will find all the rectangles (leafs) that contain q, and then, testing the triangles of those rectangles find the triangle that contains the point q. 5

Access using planar point location: Access using Jump-and-walk strategy: We choose a set of m points p 1, …, p m. When we query with a point q, we first determine the point p i closest to q and then trace the line segment p i q, starting at the triangle containing p i. Access using planar point location: For a TIN with n triangles, it is possible to construct and O(n) size data structure that allows for point location in O(log n) time. (Saw in one of the previous lectures) Access using Jump-and-walk strategy: Let p be a point of a TIN, and q be a queried point. We traverse the TIN in a straight line from p to q. We choose a set of m points p 1, …, p m. When we query with a point q, we first determine the point p i closest to q and then trace the line segment p i q, starting at the triangle containing p i. We typically encounter much fewer triangles on the way than if we would traverse the whole structure. If m ~ n 1/3, the expected query time is O(n 1/3 ) under some distribution assumptions. Example: Suppose {p 1, p 2, p 3 } is a chosen set of points and q is a query point. Since p 3 is the closest point to q, it is a start point. The triangle t 1 contains it. We can compute in O(1) which edge t 1 of intersects with p i q. This edge contains pointer to two triangles that share it – in our case t 1 and t 2. So we move to the triangle t 2 and test if it contains q. If so, stop and return the current triangle. If not, repeat the process when the staring point is the intersection point of the edge of the current triangle with p i q. t1 t2 t3 t46

Windowing: Windowing: Sometimes a user is interested in a part of a terrain, that is defined by some window. All triangles intersecting that rectangle should be located. The algorithm consists of two steps: 1) locate the position of the window on the terrain 2) locate all the TIN triangles that intersect with the window For example, we can traverse TIN from the upper left corner of the window to the upper right corner, then from the upper right corner to the bottom right corner and so on, using Jump-and-Walk strategy with given starting point. The traversal can be done in time linear in the number of triangles intersecting the window. 7

Converting between terrain models Converting between terrain models contour line grid Terrain data is entered into a GIS in various formats: - contour line, if maps are digitized by hand - grid, if data is acquired by remote sensing photo-interpretation. random terrain point sample data grid contour line TIN - random terrain point sample data There are various reasons why data in one format may need to be transformed into another: 1) grid is huge in size – high memory requirements, slow algorithms execution 2) contour line often needs to be interpreted anyway before anything useful can be done with it :) 3) TIN is visualized as a contour map 8

Conversion from point sample data to TIN: Conversion from point sample data to TIN: Suppose a set P of n points in the plane is given, each with an elevation value. To convert this information into a TIN, we can simply - triangulate the point set using Delaunay triangulation, for example – it attempts to create well-shaped triangles. - simplify a TIN to get a one with less number of points Note: It is known that the problem of computing a TIN with the minimum number of vertices, given a TIN and a maximum allowed error, is an NP-hard problem. 9

Conversion from grid to TIN: Conversion from grid to TIN: We will discuss two algorithms for converting a grid into TIN. Both have the following distinguishing features: 1) select which grid points to keep or discard 2) decide when to stop selecting or discarding 10

The drop heuristic method (by Jay Lee): The drop heuristic method (by Jay Lee): A grid can simply be triangulated to a fine regular triangulation and get TIN as a result. After this we would like to reduce number of vertices of a TIN. - takes a TIN as its input, and iteratively discard one vertex at a time. a start TIN (triangulated grid)a result TIN 11

The algorithm: The algorithm: To decide which vertex should be discarded we do the following iteration: 1. For each vertex v in the TIN: - temporarily remove v - compute the Delaunay triangulation of the appearing polygon - determine the vertical distance error(v) of v to the new TIN (v lies in one of the new triangles in the polygon, so this is easy to do) - add v back to the TIN Store error(v) for each vertex v in a balanced binary tree T, with point to v. At v we store a pointer back to the corresponding node in T. v is the vertex to removea polygon that appears after v is removed a Delaunay triangulation of the polygon 12

2. Consider the node w with smallest error(w) from T. If it is greater than the pre-specified maximum error, the algorithm stops. 3. Remove w from T and from TIN. Let w 1, … w j be the vertices adjacent to w. Triangulate the polygon defined by w 1, … w j using the Delaunay triangulation. 4. For every vertex w i {w 1, … w j } - remove error(w i ) from T. - recompute the vertical distance to the terrain as if w i was removed (like in the first step) and insert it into T. Continue at step 2. Time complexity: O(n log n) Time complexity: typical case – all vertices in the TIN have constant degree. - O(n log n) time to build T that we start with (for each node v it takes a constant time to triangulate a polygon defined by its neighbors, constant time to compute error(v) and O(log n) time to inset it into T ) - each iteration requires O(log n) time: - O(log n) time for minimum search - O(log n) time to delete w - constant time for updating T with appropriate values of error(w i ) the algorithm runs in O(n log n) time. 13

Note: suppose in current iteration a node w was discarded, and nodes {w 1, … w k } were discarded before. The error at nodes {w 1, … w k } can become bigger now :( So there is no guarantee that the error at all of the discarded vertices really is within the pre-specified error. The drop heuristic method completely forgets about vertices that are discarded. Although, at the expense of more computation, a variant of the method could still consider them. an elevation of this point is approximated by the triangle t 1 now an elevation of this point is approximated by new the triangle t 2 – the error can become bigger! t1 t214 The second method we would discuss really guarantees that the final TIN has error at most e when e is a part of an input.

Incremental refinement: Incremental refinement: takes a grid and a maximum allowed error e as its input. It starts with a coarse TIN with only a few vertices, and keep adding more points from the grid to the TIN to obtain less error. a coarse TINa final TIN with the error <= e 15

The algorithm: S The algorithm: 1. Let P be the set of midpoints of grid cells. Let S be a set of four corner points of P and P P \S. To decide which vertex should be added we do the following iteration: 2. Compute the Delaunay triangulation DT(S) of S. 3. For each v P determine in which triangle of DT(S) it falls. Store with each triangle of DT(S) a list of the points of P \S that lie in it. 4. If each v P \S is approximated with an error at most e, the algorithm stops. Otherwise, let w be the point with the maximal error. P P \ {w }, S S U {w }. Continue at step 2. a coarse TINa final TIN with the error <= e 16

The algorithm implementation: The algorithm implementation: 1. Naive implementation: - at most n times a Delaunay triangulation is computed; - for each one, the points in P are distributed among the triangles of DT(S). it takes Θ(n 3 ) tests of type “point in triangle”, if linear number of points are added to S. (for each computation of DT(S), for each node v check for each triangle t if v is in t.) 2. Fast implementation: a) Doesn’t compute the Delaunay triangulation from scratch, but updates the existing one. Assume p ∈ P is going to be removed from P and added to S. - locate the triangle t of DT(S) that contains p - find the vertices that will become neighbors of p in DT(S U {p}) (don’t explain how) - update DT(S) only for these vertices ( if k is the number of neighbors of p), it takes O(k + log n) time b) Now we have to distribute points of P \ {p} over the triangles of DT(S U {p}) (only the triangles of which p is a vertex have changed) - collect all the points of the triangles that removed by addition of p - distribute them among the new triangles ( if m is the number of points in the triangles incident to p in DT(S U {p}) ), it takes O(k m) time 17

p is the point with the maximum error an updated TIN neighbors of p in DT(S U {p}) k = 5 these points must be relocated 18

b) Last step – locating the point v ∈ P \S with a maximum error. Here we use a balanced binary tree 丆.For each triangle of the TIN determine the point of P inside it with the maximum error and store it in 丆. 丆 is sorted on error. The point p with the maximum error is the rightmost leaf of 丆, and this leaf contains a pointer to the triangle of the TIN that contains p. Now the step (a) is executed. Delete from 丆 all the points of the triangles that were destroyed. For each of the new triangles must determine in its list a point with the maximum error and store it in 丆. t1 t2 t3 t5 t4 suppose v is a point with maximum error in t1 v v q1q1 q2q2 q3q3 q1q1 q2q2 q3q3 v a binary tree 丆 that contains one point from each triangle of the TIN with the maximum error each node in 丆 has point to its triangle in the TIN each triangle has a pointer to the list of the nodes it contains p p is a point with the maximum error in the TIN – is going to be added to the TIN For more efficient locating of points that have to be removed from 丆, each point in the list contains pointer to the corresponding node in 丆 (if one exists) t1 19

it takes O(log n) time to find p and O(k log n) time to update the tree 丆. So: O(n log n) So: - in the worst case, m and k are both linear in n, giving O(n 3 ). - BUT one can expect that k is usually constant, and after a couple of iteration, m will probably be much smaller than n. the fast implementation of the algorithm takes O(n log n) time under the assumptions given. 20

Conversion from contour line to TIN: Conversion from contour line to TIN: Each region of the contour line map can be seen as a polygon with holes. It can be simply triangulated. There is the “constrained Delaunay triangulation” algorithm, that close to the standard Delaunay algorithm, and it takes as an input a set of edges that must be present in the result triangulation. 21

The end