Generalized Gauss–Bonnet theorem: Difference between revisions

From formulasearchengine
Jump to navigation Jump to search
en>BD2412
m →‎Further generalizations: clean up, removed: {{disambiguation needed|date=December 2011}} using AWB
en>TakuyaMurata
 
Line 1: Line 1:
In [[computational geometry]], the '''gift wrapping algorithm''' is an [[algorithm]] for computing the [[convex hull]] of a given set of points.
Hello there, I am Adrianne and I totally dig that name. I am a people manager even so soon I'll be alone. Gardening is what I do every week. Guam has always been my house. See what's new on this is my website here: http://prometeu.net<br><br>Here is my page - [http://prometeu.net clash of clans hack no survey mac]
 
==Planar case==
 
In the two-dimensional case the algorithm is also known as '''Jarvis march''', after R. A. Jarvis, who published it in 1973; it has [[Big O notation|O]](''nh'') [[time complexity]], where ''n'' is the number of points and ''h'' is the number of points on the convex hull. Its real-life performance compared with other convex hull algorithms is favorable when n is small or h is expected to be very small with respect to n. In general cases the algorithm is outperformed by many others.
 
==Algorithm==
[[Image:Jarvis march convex hull algorithm diagram.svg|thumb|280px|right|Jarvis's march computing the convex hull.]]
 
For the sake of simplicity, the description below assumes that the points are in [[general position]], i.e., no three points are [[collinear]]. The algorithm may be easily modified to deal with collinearity, including the choice whether it should report only  [[extreme point]]s (vertices of the convex hull) or all points that lie on the convex hull. Also, the complete implementation must deal with [[degenerate case]]s when the convex hull has only 1 or 2 vertices, as well as with the issues of limited [[arithmetic precision]], both of computer computations and input data.
The gift wrapping algorithm begins with ''i''=0 and a point ''p<sub>0</sub>'' known to be on the convex hull, e.g., the leftmost point, and selects the point ''p<sub>i+1</sub>'' such that all points are to the right of the line ''p<sub>i</sub> p<sub>i+1</sub>''. This point may be found in O(''n'') time by comparing [[Coordinates (elementary mathematics)#Polar coordinates|polar angle]]s of all points with respect to point ''p<sub>i</sub>'' taken for the center of [[polar coordinates]]. Letting ''i''=''i''+1, and repeating with until one reaches ''p<sub>h</sub>''=''p<sub>0</sub>'' again yields the convex hull in ''h'' steps.  In two dimensions, the gift wrapping algorithm is similar to the process of winding a string (or wrapping paper) around the set of points.
 
The approach can be extended to higher dimensions.
 
==Pseudocode==
 
jarvis(S)
    pointOnHull = leftmost point in S
    i = 0
    repeat
      P[i] = pointOnHull
      endpoint = S[0]        // initial endpoint for a candidate edge on the hull
      for j from 1 to |S|
          if (endpoint == pointOnHull) or (S[j] is on left of line from P[i] to endpoint)
            endpoint = S[j]  // found greater left turn, update endpoint
      i = i+1
      pointOnHull = endpoint
    until endpoint == P[0]      // wrapped around to first hull point
 
==Complexity==
The inner loop checks every point in the set ''S'', and the outer loop repeats for each point on the hull.  Hence the total run time is <math>O(nh)</math>.  The run time depends on the size of the output, so Jarvis's march is an [[output-sensitive algorithm]].
 
However, because the running time depends [[linear time|linearly]] on the number of hull vertices, it is only faster than  <math>O(n \log n)</math> algorithms such as [[Graham scan]] when the number ''h'' of hull vertices is smaller than log&nbsp;''n''. [[Chan's algorithm]], another convex hull algorithm, combines the logarithmic dependence of Graham scan with the output sensitivity of the gift wrapping algorithm, achieving an asymptotic running time  <math>O(n \log h)</math>  that improves on both Graham scan and gift wrapping.
 
==References==
{{refbegin}}
* {{Introduction to Algorithms|2|chapter=33.3: Finding the convex hull|pages=pp. 955&ndash;956}}
 
*{{cite journal
| author = Jarvis, R. A.
| title = On the identification of the convex hull of a finite set of points in the plane
| journal = [[Information Processing Letters]]
| volume = 2
| year = 1973
| pages = 18–21
| doi = 10.1016/0020-0190(73)90020-3}}
{{refend}}
 
==External links==
* [http://www.cse.unsw.edu.au/~lambert/java/3d/giftwrap.html Gift wrapping in 2 and higher dimensions]
* [http://michal.is/projects/convex-hull-gift-wrapping-method/ Gift wrapping algorithm in C#]
 
[[Category:Polytopes]]
 
[[Category:Convex hull algorithms]]

Latest revision as of 00:17, 6 December 2014

Hello there, I am Adrianne and I totally dig that name. I am a people manager even so soon I'll be alone. Gardening is what I do every week. Guam has always been my house. See what's new on this is my website here: http://prometeu.net

Here is my page - clash of clans hack no survey mac