<s>
In	O
discrete	O
geometry	O
and	O
computational	O
geometry	O
,	O
the	O
convex	B-Algorithm
hull	I-Algorithm
of	I-Algorithm
a	I-Algorithm
simple	I-Algorithm
polygon	I-Algorithm
is	O
the	O
polygon	O
of	O
minimum	O
perimeter	O
that	O
contains	O
a	O
given	O
simple	O
polygon	O
.	O
</s>
<s>
The	O
convex	B-Algorithm
hull	I-Algorithm
of	I-Algorithm
a	I-Algorithm
simple	I-Algorithm
polygon	I-Algorithm
can	O
be	O
subdivided	O
into	O
the	O
given	O
polygon	O
itself	O
and	O
into	O
polygonal	O
pockets	O
bounded	O
by	O
a	O
polygonal	O
chain	O
of	O
the	O
polygon	O
together	O
with	O
a	O
single	O
convex	O
hull	O
edge	O
.	O
</s>
<s>
The	O
convex	B-Algorithm
hull	I-Algorithm
of	I-Algorithm
a	I-Algorithm
simple	I-Algorithm
polygon	I-Algorithm
is	O
itself	O
a	O
convex	O
polygon	O
.	O
</s>
<s>
Finding	O
the	O
convex	B-Algorithm
hull	I-Algorithm
of	I-Algorithm
a	I-Algorithm
simple	I-Algorithm
polygon	I-Algorithm
can	O
be	O
performed	O
in	O
linear	O
time	O
.	O
</s>
<s>
Like	O
the	O
Graham	B-Algorithm
scan	I-Algorithm
algorithm	O
for	O
convex	O
hulls	O
of	O
point	O
sets	O
,	O
it	O
is	O
based	O
on	O
a	O
stack	B-Application
data	I-Application
structure	I-Application
.	O
</s>
<s>
As	O
it	O
does	O
,	O
it	O
stores	O
a	O
convex	O
sequence	O
of	O
vertices	O
on	O
the	O
stack	B-Application
,	O
the	O
ones	O
that	O
have	O
not	O
yet	O
been	O
identified	O
as	O
being	O
within	O
pockets	O
.	O
</s>
<s>
At	O
each	O
step	O
,	O
the	O
algorithm	O
follows	O
a	O
path	O
along	O
the	O
polygon	O
from	O
the	O
stack	B-Application
top	O
to	O
the	O
next	O
vertex	O
that	O
is	O
not	O
in	O
one	O
of	O
the	O
two	O
pockets	O
adjacent	O
to	O
the	O
stack	B-Application
top	O
.	O
</s>
<s>
Then	O
,	O
while	O
the	O
top	O
two	O
vertices	O
on	O
the	O
stack	B-Application
together	O
with	O
this	O
new	O
vertex	O
are	O
not	O
in	O
convex	O
position	O
,	O
it	O
pops	O
the	O
stack	B-Application
,	O
before	O
finally	O
pushing	O
the	O
new	O
vertex	O
onto	O
the	O
stack	B-Application
.	O
</s>
<s>
When	O
the	O
clockwise	O
traversal	O
reaches	O
the	O
starting	O
point	O
,	O
the	O
algorithm	O
is	O
completed	O
and	O
the	O
stack	B-Application
contains	O
the	O
convex	O
hull	O
vertices	O
in	O
clockwise	O
order	O
.	O
</s>
<s>
Each	O
step	O
of	O
the	O
algorithm	O
either	O
pushes	O
a	O
vertex	O
onto	O
the	O
stack	B-Application
or	O
pops	O
it	O
from	O
the	O
stack	B-Application
,	O
and	O
each	O
vertex	O
is	O
pushed	O
and	O
popped	O
at	O
most	O
once	O
,	O
so	O
the	O
total	O
time	O
for	O
the	O
algorithm	O
is	O
linear	O
.	O
</s>
<s>
A	O
similar	O
method	O
can	O
also	O
be	O
used	O
to	O
construct	O
convex	O
hulls	O
of	O
piecewise	B-Algorithm
smooth	I-Algorithm
closed	O
curves	O
in	O
the	O
plane	O
.	O
</s>
<s>
By	O
using	O
a	O
deque	B-Application
in	O
place	O
of	O
a	O
stack	B-Application
,	O
a	O
similar	O
algorithm	O
can	O
be	O
generalized	O
to	O
the	O
convex	O
hull	O
of	O
any	O
polygonal	O
chain	O
,	O
and	O
the	O
algorithm	O
for	O
simple	O
polygons	O
can	O
be	O
started	O
at	O
any	O
vertex	O
of	O
the	O
polygon	O
rather	O
than	O
requiring	O
an	O
extreme	O
vertex	O
as	O
the	O
starting	O
vertex	O
.	O
</s>
