1 / 42

Lecture 7 Geometric Modeling Approximate Nearest Neighbor Searching Monday, 4/23/01

UMass Lowell Computer Science 91.504 Advanced Algorithms Computational Geometry Prof. Karen Daniels Spring, 2001. Lecture 7 Geometric Modeling Approximate Nearest Neighbor Searching Monday, 4/23/01. Part 2. Advanced Topics Applications Manufacturing Modeling/Graphics

gay
Download Presentation

Lecture 7 Geometric Modeling Approximate Nearest Neighbor Searching Monday, 4/23/01

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. UMass Lowell Computer Science 91.504Advanced AlgorithmsComputational GeometryProf. Karen DanielsSpring, 2001 Lecture 7 Geometric Modeling Approximate Nearest Neighbor Searching Monday, 4/23/01

  2. Part 2 Advanced Topics Applications Manufacturing Modeling/Graphics Wireless Networks Visualization Techniques (de)Randomization Approximation Robustness Representations Epsilon-net Decomposition tree Part 2

  3. Literature for Part II

  4. Literature for Part II

  5. Geometric Modeling “Triangle: Engineering a 2D Quality Mesh Generator and Delaunay Triangulator” Jonathan Richard Shewchuck http://www.cs.cmu.edu/~jrs/jrspapers.html

  6. Goals • Construct 2D mesh of triangles for geometric modeling that: • avoids small angles • constrained Delaunay triangulation • is efficient in time and space • careful choice of data structures & algorithm • is robust • adaptive exact arithmetic C code at http://www.cs.cmu.edu/~quake/triangle.html

  7. Approach: Overview • Based on Ruppert’s Delaunay Refinement Algorithm • Input: Planar Straight Line Graph (PSLG) • collection of vertices and segments • Step 1: Construct Delaunay triangulation of point set

  8. Approach: Overview (continued) • Step 2: • Start with the Delaunay triangulation of the point set • Add input segments • segments become constraints • constrained Delaunay triangulation some differences

  9. Approach: Overview (continued) • Step 3: • Remove triangles from concavities • “triangle-eating virus” • Step 4: • Refine mesh to satisfy additional constraints on triangle’s minimum • angle size • area

  10. Step 1: Construct Delaunay Triangulation of Point Set • Delaunay Triangulation Algorithms: • O(nlogn) expected time: • Randomized incremental insertion • Edge flipping restores empty circle property • O(nlogn) worst-case time: • Compute Voronoi diagram, then dualize • Fortune’s plane sweep (parabolic front) • O(nlogn) worst-case time: • Divide-and-Conquer • alternating cuts deBerg handout slowest [point location bottleneck] Shewchuck experimental comparison [speed, correctness] fastest

  11. Delaunay Triangulation Algorithms:Divide-and-Conquer • O(nlogn) worst-case time • Recursively halve input vertex set • Stop when size = 2 or 3 • Triangulate small set • forms edge(s) or triangle • Merge 2 triangulations • Ghost triangles allow fast convex hull traversal • Fit together like gear teeth

  12. Step 2: Constrained Delaunay Triangulation • Force mesh to conform to input line segments • User Chooses Approach: • Recursive segment subdivision • Insert segment midpoint • Flip edges to restore Delaunay (empty circle) property • Constrained Delaunay triangulation (default) • Insert entire segment • Delete triangles it overlaps • Retriangulate regions on each side of segment • No new vertices are inserted

  13. Step 4: Mesh Refinement • Refine mesh to satisfy additional constraints on minimum triangle • angle size • area • Insert new vertices • Flip edges to restore Delaunay (empty circle) property • Halting Issue: • Halts for angle constraint <= 27o • May not halt for angle constraint >= 33.9o

  14. Step 4: Mesh Refinement (continued) • Vertex Insertion Rules: • Segment’s Diametral Circle • smallest circle containing segment • any point in the circle encroaches on segment • split encroached segment • insert vertex at midpoint • Triangle’s Circumcircle • circle through all 3 vertices • bad triangle: • angle too small • area too large • split bad triangle • insert vertex at circumcenter

  15. Step 4: Mesh Refinement (continued)

  16. triangle-based edge-based - Topologically less rich - Longer code + Faster + Less memory + Topologically richer + Elegant - Slower - More memory representation tradeoffs Implementation Issues: Representation Shewchuck preference • Ghost triangles: • connected in ring about a “vertex at infinity” • facilitate convex hull traversal

  17. Implementation Issues: Robustness incorrectness can be serious • Tests • Can influence program flow of control • Can classify entities (e.g. sweep-line events) • Depend on correctness of geometric predicates • Orientation (left/right/on) • In-Circle (in/out/on) • Each computes sign of a determinant • Constructions • Represent geometric objects • Often determine output some incorrectness can sometimes be tolerated

  18. Implementation Issues: Robustness (continued) What causes incorrectness? • Ideal Goal: real arithmetic for some operations • Challenge: compounded roundoff error in floating-point arithmetic calculations: • Tests: can cause program • to hang • to crash • to produce incorrect output • wrong topology • Constructions: • can cause approximate results

  19. exact floating-pt hybrid slow but sure fast but loose time vs. error tradeoff Implementation Issues: Robustness (continued) • Arithmetic Alternatives to Floating-Point: • Integer or rational exact arithmetic • fixed precision • extended precision • Floating point + • e-testing • robust topological decisions • filter: • identify adequate precision for an operation (bit complexity) • if expressible as multivariate polynomial, degree gives clue • floating-point comparisons except when correctness is threatened • adaptive precision: • compute quantity (e.g. sign of determinant) via successively more accurate approximations • stop when uncertainty in result is small No single solution fits all needs. Collection of techniques is needed.

  20. Implementation Issues: Robustness (continued) • Shewchuck uses: • multi-stage adaptive precision for geometric primitives • Orientation (left/right/on) • In-Circle (in/out/on) • Each • computes sign of a determinant • takes floating-pt inputs • stops when uncertainty in result is small • can reuse previous, less accurate approximations • fast arbitrary precision arithmetic • for small (yet extended) precision values For general discussion of robustness issues and alternatives, see StrategicDirections in Computational Geometry Working Group Report

  21. Approximate Nearest Neighbor Searching “An Optimal Algorithm for Approximate Nearest Neighbor Searching in Fixed Dimensions” Arya, Mount, Netanyahu, Silverman, Wu

  22. Goals • Fast nearest neighbor query in d-dimensional set of n points: • approximate nearest neighbor • distance within factor of (1+e) of true closest neighbor • preprocess using O(dnlogn) time, O(dn) space • Balanced-Box Decomposition (BDD) tree • note that space, time are indepenent of e • query in O(cd,elogn) time C++ code for simplified version is at http://www.cs.umd.edu/~mount/ANN

  23. Approach: Distance Assumptions • Use Lp (also called Minkowski) metric • assume it can be computed in O(d) time • pth root need not be computed when comparing distances • Approximate nearest neighbor • distance within factor of (1+e) of true closest neighbor p* • Can change e or metric without rebuilding data structure

  24. Approach: Overview • Preprocess points: • Balanced-Box Decomposition (BDD) tree • Query algorithm: for query point q • Locate leaf cell containing q in O(log n) time • Priority search: Enumerate leaf cells in increasing distance order from q • For each leaf cell, calculate distance from q to cell’s point • Keep track of closest point p seen so far • Stop when distance from q to leaf > dist(q,p)/(1+e) • Return p as approximate nearest neighbor to q.

  25. x4 x3 x2 y3 y2 y1 x1 >= < y3 y2 y2 y1 x1 x3 x2 x1 x4 3 4 6 9 7 5 1 2 8 Balanced Box Decomposition(BBD) Tree • Similar to kd-tree [Samet handout] • Binary tree • Tree structure stored in main memory • Cutting planes are orthogonal to axes • Alternating dimensions • O(log n) height • Subdivides space into regions of O(d) complexity using d-dimensional rectangles • Can be built in O(dn log n) time One possible kd-like tree for the above points (not a BDD tree, though)

  26. Balanced Box Decomposition(BBD) Tree (continued) subdivision • Distinguishing features of BBD tree: • Cell is either • d-dimensional rectangle or • difference of 2 d-dimensional nested rectangles • In this sense, BDD tree is like: • Optimized kd-tree: partition points into roughly = sized sets • While descending in tree, number of points on path decreases exponentially • Specialized Quadtree: aspect ratio of box is bounded by a constant • While descending in tree, size of region on path decreases exponentially • Leaf may be associated with more than 1 point in/on cell: O(n) node • Inner boxes are “sticky”: if it is close to edge, it “sticks” tree split shrink

  27. Splitting a Box: Midpoint

  28. Splitting a Box: Middle-Interval

  29. Packing Constraint

  30. Priority Search from Query Point

  31. Incremental Distance [Arya, Mount93] • Incrementally update distance from parent box to each child when split is performed • Maintain sum of appropriate powers of coordinate differences between query point and nearest point of outer box • Split: • Closer child has same distance as parent • Further child’s distance needs only 1-coordinate update (along splitting dimension) • Makes a difference in higher dimensions!

  32. Experiments Experiments generated points from a variety of probability distributions: Uniform Gaussian Laplace Correlated Gaussian Correlated Laplacian Clustered Gaussian Clustered Segments

  33. Experiments

  34. Experiments

  35. Experiments

  36. Conclusions • Algorithm is not necessarily practical for large dimensions • But, for dimensions <= ~20, does well • Shrinking helps with highly clustered datasets, but was not often needed in their experiments • Only needed for 5-20% of tree nodes • BBD tree (in paper’s form) is primarily for static point set • But, auxiliary data structure could maintain changes

  37. Project Update

  38. Project Deliverable Due DateGrade % Proposal Monday, 4/9 2% Interim Report Monday, 4/23 5% Final Presentation Monday, 5/7 8% Final Submission Monday, 5/14 10% 25% of course grade

  39. Guidelines: Final Submission • Abstract: Concise overview (at most 1 page) • Introduction: • Motivation: Why did you choose this project? • Related Work: Context with respect to CG literature • Summary of Results • Main Body of Paper: (one or more sections) • Conclusion: • Summary: What did you accomplish? • Future Work: What would you do if you had more time? • References: Bibliography (papers, books that you used) Well- written final submissions with research content may be eligible for publishing as UMass Lowell CS technical reports.

  40. Guidelines: Final Submission • Main Body of Paper: • If your project involves Theory/ Algorithm: • Informal algorithm description (& example) • Pseudocode • Analysis: • Correctness • Solutions generated by algorithm are correct • account for degenerate/boundary/special cases • If a correct solution exists, algorithm finds it • Control structures (loops, recursions,...) terminate correctly • Asymptotic Running Time and/or Space Usage

  41. Guidelines: Final Submission • Main Body of Paper: • If your project involves Implementation: • Informal description • Resources & Environment: • what language did you code in? • what existing code did you use? (software libraries, etc.) • what equipment did you use? (machine, OS, compiler) • Assumptions • parameter values • Test cases • tables, figures • representative examples

  42. Guidelines: Interim Report • Structured like Final Submission, except: • no Abstract or Conclusion • fill in only what you’ve done so far • can be revised later • include a revised proposal if needed • identify any issues you have encountered and your plan for resolving them

More Related