1 / 28

Geometrische Algorithmen

Geometrische Algorithmen. Beispiel: Konvexe Hülle einer 2D-Punktmenge (1) Die Konvexe Hülle ist ein konvexes Polygon mit minimalem Umfang das sämtliche gegebenen Punkte einschliesst. Punktmenge. Konvexe Hülle. Konvexe Hülle einer 2D-Punktmenge (2) Graham-Scan O(N log N)

idola
Download Presentation

Geometrische Algorithmen

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. Helmut Schauer Educational Engineering Lab Department for Information Technology University of Zurich • Geometrische Algorithmen

  2. Helmut Schauer Educational Engineering Lab Department for Information Technology University of Zurich • Beispiel: • Konvexe Hülle einer 2D-Punktmenge (1) • Die Konvexe Hülle ist ein konvexes Polygon mit minimalem Umfang das sämtliche gegebenen Punkte einschliesst. Punktmenge Konvexe Hülle

  3. Helmut Schauer Educational Engineering Lab Department for Information Technology University of Zurich • Konvexe Hülle einer 2D-Punktmenge (2) • Graham-Scan O(N log N) • Bilde ein Polygon das die gegebenen Punkte ohne Überschneidungen verbindet • Eliminiere sämtliche "einspringenden" Eckpunkte Punktmenge Polygon Konvexe Hülle

  4. Helmut Schauer Educational Engineering Lab Department for Information Technology University of Zurich • Konvexe Hülle einer 2D-Punktmenge (3) • Polygon • Algorithmus zur Bildung eines Polygons: • Wähle einen Startpunkt (zB den untersten Punkt) und berechne zu jedem weiteren Punkt den Winkel den die Verbindung dieses Punktes und dem Startpunkt mit der Horizontalen einschliesst. • Verbinde die Punkte in steigender Reihenfolge dieser Winkel Punktmenge Polygon

  5. Helmut Schauer Educational Engineering Lab Department for Information Technology University of Zurich • Konvexe Hülle einer 2D-Punktmenge (4) • Eliminierung einspringender Eckpunkte

  6. Helmut Schauer Educational Engineering Lab Department for Information Technology University of Zurich • Theta-Funktion • double theta(Point p) { • double t; • int dx = this.x-p.x; • int dy = p.y-this.y; • if ((dx==0)&(dy==0)) t = 0; • else t = (double)dy/(double)(Math.abs(dx)+Math.abs(dy)); • if (dx<0) t = 2-t; • elseif (dy<0) t = 4+t; • return t; • }

  7. Helmut Schauer Educational Engineering Lab Department for Information Technology University of Zurich • Orientierung eines Dreiecks • publicboolean convex(Point p1, Point p2, Point p3) { • int dx1 = p2.x-p1.x; • int dx2 = p3.x-p2.x; • int dy1 = p1.y-p2.y; • int dy2 = p2.y-p3.y; • return dy2*dx1>dy1*dx2; • }

  8. Helmut Schauer Educational Engineering Lab Department for Information Technology University of Zurich • Attribute Geometrischer Algorithmen • Dimension • Orientierung • Orthogonalität • Queryobjekt

  9. Helmut Schauer Educational Engineering Lab Department for Information Technology University of Zurich • Klassifizierung Geometrischer Algorithmen • Bereichssuche • Schnittprobleme • Einschlussprobleme • Distanzprobleme

  10. Helmut Schauer Educational Engineering Lab Department for Information Technology University of Zurich • Bereichssuche (Range Searching) • eindimensional O(R+log N) • Geg: eine Menge X von x-Koordinaten, N = |X| • ein Query-Intervall [xl,xr] • Ges: {x  X: x  [xl,xr]}

  11. Helmut Schauer Educational Engineering Lab Department for Information Technology University of Zurich • 1D-Suchbaum

  12. Helmut Schauer Educational Engineering Lab Department for Information Technology University of Zurich • Range Searching Implementierung • eindimensional void range(Interval x, Visitor v) { boolean tl = x.l <= key; boolean tr = key <= x.r; if (tl) left.range(x,v); if (tl&tr) v.action(key); if (tr) right.range(x,v); }

  13. Helmut Schauer Educational Engineering Lab Department for Information Technology University of Zurich • Bereichssuche (Range Searching) • zweidimensional O(R+log N)

  14. Helmut Schauer Educational Engineering Lab Department for Information Technology University of Zurich • 2D-Suchbaum

  15. Helmut Schauer Educational Engineering Lab Department for Information Technology University of Zurich • Range Searching Implementierung • zweidimensional (2D-Tree) void range(Rectangle r, Visitor v, int level) { boolean tl, tr; if (level%2 == 0) { tl = r.x <= key.x; tr = key.x <= r.x+r.width; } else { tl = r.y <= key.y; tr = key.y <= r.y+.height; } if (tl) left.range(r,v,level+1); if (r.contains(key)) v.action(key); if (tr) right.range(r,v,level+1); }

  16. Helmut Schauer Educational Engineering Lab Department for Information Technology University of Zurich • Segmentschnitt (Segment Intersection) • orthogonal O(I+N log N)

  17. Helmut Schauer Educational Engineering Lab Department for Information Technology University of Zurich • Rechteckschnitt mittels Sweep-Line (1)

  18. Helmut Schauer Educational Engineering Lab Department for Information Technology University of Zurich • Rechteckschnitt mittels Sweep-Line (2)

  19. Helmut Schauer Educational Engineering Lab Department for Information Technology University of Zurich • Rechteckschnitt mittels Sweep-Line (3)

  20. Helmut Schauer Educational Engineering Lab Department for Information Technology University of Zurich • Rechteckschnitt mittels Sweep-Line (4)

  21. Helmut Schauer Educational Engineering Lab Department for Information Technology University of Zurich • Rechteckschnitt mittels Sweep-Line (5)

  22. Helmut Schauer Educational Engineering Lab Department for Information Technology University of Zurich • Segmentschnitt (Segment Intersection) • nicht-orthogonal O((I+N) log N)

  23. Helmut Schauer Educational Engineering Lab Department for Information Technology University of Zurich • Punkteinschluss (Point Inclusion) • O(log N) • Geg: mehrere Segmente und ein Punkt • Ges: alle Segmente die den Punkt einschliessen

  24. Helmut Schauer Educational Engineering Lab Department for Information Technology University of Zurich • Segmentbaum (Segment Tree) a c b c a a,b d b c,d b,c c a d b

  25. Helmut Schauer Educational Engineering Lab Department for Information Technology University of Zurich • Closest Pair • O(N log N)

  26. Helmut Schauer Educational Engineering Lab Department for Information Technology University of Zurich • Nearest Neighbour • O(log N)

  27. Helmut Schauer Educational Engineering Lab Department for Information Technology University of Zurich • Voronoi Diagramm • O(N log N)

  28. Helmut Schauer Educational Engineering Lab Department for Information Technology University of Zurich • Delaunay Triangulierung • O(N log N)

More Related