1 / 22

Computational Geometry

Computational Geometry. Ken George COT 4810 4/19/2008. Computational Geometry. Primary purpose was to further computer graphics, computer-aided design, and computer-aided manufacturing Used in several classical problems, as well

chyna
Télécharger la présentation

Computational Geometry

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. Computational Geometry Ken George COT 4810 4/19/2008

  2. Computational Geometry • Primary purpose was to further computer graphics, computer-aided design, and computer-aided manufacturing • Used in several classical problems, as well • Can be applied to any situation where the problem can be expressed in geometric terms

  3. Three Problem Classes • The field of computational geometry can be divided into three general classes of problems • Static • Geometric Queries • Dynamic

  4. Static Problems • Given input, construct the corresponding output • Examples • Finding the closest pair of points • Determining convex hulls • Polygonal Triangulation • Creating a Voronoi Diagram

  5. Closest Points • Given a set of points, find the closest two • Brute force: O(n2) For every point p For every point q If p!=q and distance(p, q) < distance(p1,p2) p1=p p2=q • Recursive Divide and Conquer: O(nlog2n)

  6. Pseudocode CP(X, Y) if X.length <= 3 return the closest pair else Divide into: XL, YL, XR, YR dL= CP(XL, YL) dR= CP(XR, YR) d = min(dL, dR) Create Y strip d strip= something big for all points a in Y strip for all points b in Y strip “near” a abDist = dist(Y strip[a], Y strip[b]) if abDist = d strip then d strip= abDist Return min(d, d strip )

  7. Convex Hull • Given a set of points, create a minimal convex set which contains all points • The elastic band analogy:

  8. Gift-wrapping Algorithm • Begin at the leftmost point (in this example) • From vertical line, sweep clockwise until point is encountered • Continue sweep from current angle at next point • O(nh) • O(n2)

  9. Graham Scan • Sort points by angle in respect to first point • further sort equal angles by distance • O(n) time if the points are already sorted • O(n logn) otherwise Stack.push(Points[1]); Stack.push(Points[2]); FOR i = 3 TO Points.length WHILE (Stack.length >= 2 and Cross_product(Stack.second, Stack.top, Points[i]) <= 0) Stack.pop; Stack.push(Points[i]);

  10. Graham Scan • Walk points from bottom • Move only counterclockwise • If clockwise move is found, remove last step

  11. Polygonal Triangulation • Breaking a polygon into triangular sections • Can be used for modeling terrain and other objects • Euclidean minimum spanning tree is a subset of the Delaunay Triangulation (naïve runtime O(n2))

  12. Voronoi Diagrams • Given a set of points, partition according to closest point • Many useful applications • http://www.diku.dk/hjemmesider/studerende/duff/Fortune/

  13. Geometric Queries • Geometric searching problems • Given a search space and query set • Examples • Range Searching • Ray Tracing

  14. Range Searching • Determine the number of points inside of a polygonal query section

  15. Ray Tracing • Computer graphics applications • Can simulate accurate reflection and refraction • Functions like backwards photon mapping

  16. Ray Tracing For each pixel in image { Create ray from eyepoint passing through this pixel Initialize NearestT to INFINITY and NearestObject to NULL For every object in scene { If ray intersects this object { If t of intersection is less than NearestT { Set NearestT to t of the intersection Set NearestObject to this object } } } If NearestObject is NULL { Fill this pixel with background color } Else { Shoot a ray to each light source to check if in shadow If surface is reflective, generate reflection ray: recurse If surface is transparent, generate refraction ray: recurse Use NearestObject and NearestT to compute shading function Fill this pixel with color result of shading function } } (Wikipedia)

  17. Dynamic Problems • Modification of a Computational Geometry problem to a dynamic one • Input elements may be added, removed, or modified • Examples • Dynamic Range Search (Geometric Query) • Dynamic Convex Hull (Static Problem)

  18. Variations • A fourth class of problems • Modifications of the previous three classes • Example • Point-in-Polygon • Static or Geometric Query, depending on the situation

  19. Point-in-Polygon • Given a point and a polygon, determine whether or not the point lies within the polygon • Ray casting • Not the same as ray tracing! • Even-odd test

  20. Another PiP test • Computing the winding number • WN !=0 -> point is inside polygon • Doesn’t work well for complex polygons • (Θ(1)-Θ(0))/2π

  21. References • www.cs.wustl.edu/~rlg1/cse502/handouts/fastclosest.pdf • Images. www.commons.wikimedia.org • http://www.diku.dk/hjemmesider/studerende/duff/Fortune/

  22. Homework • What is the winding number for point P in relation to the polygon in the image below?

More Related