Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Gift wrapping algorithm
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==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 point]]s (vertices of the convex hull) or all points that lie on the convex hull{{citation needed|reason=Link to a resource describing the details for these degenerate cases required.|date=March 2018}}. Also, the complete implementation must choose how to 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 [[Polar coordinate system|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.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)