Gift wrapping algorithm

Gift wrapping algorithm

The gift wrapping algorithm is a simple algorithm for computing the convex hull of a given set of points.

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 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

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 points (vertices of the convex hull) or all points that lie on the convex hull. Also, the complete implementation must deal with degenerate cases 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 "p0" known to be on the convex hull, e.g., the leftmost point, and selects the point "pi+1" such that all points are to the right of the line "pi pi+1". This point may be found on O("n") time by comparing polar angles of all points with respect to point "p0" taken for the center of polar coordinates. Letting "i"="i"+1, and repeating with until one reaches "ph"="p0" again yields the convex hull in "h" steps. The gift wrapping algorithm is exactly analogous to the process of winding a string (or wrapping paper) around the set of points.

def jarvis(P) i = 0 p [0] = leftmost point of P do p [i+1] = point such that all other points in P are to the right of the line p [i] p [i+1] i = i + 1 while p [i] != p [0] return p

The approach is extendable to higher dimensions.

References

*

*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

ee also

* Computational geometry
* Convex hull
* Graham scan
* Chan's algorithm


Wikimedia Foundation. 2010.

Игры ⚽ Нужна курсовая?

Look at other dictionaries:

  • Kirkpatrick–Seidel algorithm — The Kirkpatrick–Seidel algorithm, called by its authors the ultimate planar convex hull algorithm is an algorithm for computing the convex hull of a set of points in the plane, with O( n log h ) time complexity, where n is the number of input… …   Wikipedia

  • List of algorithms — The following is a list of the algorithms described in Wikipedia. See also the list of data structures, list of algorithm general topics and list of terms relating to algorithms and data structures.If you intend to describe a new algorithm,… …   Wikipedia

  • List of mathematics articles (G) — NOTOC G G₂ G delta space G networks Gδ set G structure G test G127 G2 manifold G2 structure Gabor atom Gabor filter Gabor transform Gabor Wigner transform Gabow s algorithm Gabriel graph Gabriel s Horn Gain graph Gain group Galerkin method… …   Wikipedia

  • Imaging spectroscopy — (also spectral imaging or chemical imaging)is similar to color photography, but each pixel acquires many bands of light intensity data from the spectrum, instead of just the three bands of the RGB color model. More precisely, it is the… …   Wikipedia

  • Jarvis — is a surname and, less frequently, a male given name.It can refer to:People*Jarvis, debut solo album by Jarvis Cocker * Jarvis, an R b singer * Adrian Jarvis, rugby fly half * Anna Jarvis, founder of the Mother s Day holiday in the US * Doug… …   Wikipedia

  • List of convexity topics — This is a list of convexity topics, by Wikipedia page. Alpha blending Barycentric coordinates Borsuk s conjecture Bond convexity Carathéodory s theorem (convex hull) Choquet theory Closed convex function Concavity Convex analysis Convex… …   Wikipedia

  • Envoltura convexa — Saltar a navegación, búsqueda Envoltura convexa de un conjunto de 15 puntos en el plano En matemática se define la envoltura convexa de un conjunto de puntos X de dimensión n como la intersección de todos los conjuntos convexos …   Wikipedia Español

  • Convex hull algorithms — Algorithms that construct convex hulls of various objects have a broad range of applications in mathematics and computer science, see Convex hull applications . In computational geometry, numerous algorithms are proposed for computing the convex… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”