<s>
The	O
Sutherland	B-Algorithm
–	I-Algorithm
Hodgman	I-Algorithm
algorithm	I-Algorithm
is	O
an	O
algorithm	O
used	O
for	O
clipping	B-Algorithm
polygons	B-General_Concept
.	O
</s>
<s>
It	O
works	O
by	O
extending	O
each	O
line	O
of	O
the	O
convex	O
clip	O
polygon	B-General_Concept
in	O
turn	O
and	O
selecting	O
only	O
vertices	O
from	O
the	O
subject	O
polygon	B-General_Concept
that	O
are	O
on	O
the	O
visible	O
side	O
.	O
</s>
<s>
The	O
algorithm	O
begins	O
with	O
an	O
input	O
list	O
of	O
all	O
vertices	O
in	O
the	O
subject	O
polygon	B-General_Concept
.	O
</s>
<s>
Next	O
,	O
one	O
side	O
of	O
the	O
clip	O
polygon	B-General_Concept
is	O
extended	O
infinitely	O
in	O
both	O
directions	O
,	O
and	O
the	O
path	O
of	O
the	O
subject	O
polygon	B-General_Concept
is	O
traversed	O
.	O
</s>
<s>
Vertices	O
from	O
the	O
input	O
list	O
are	O
inserted	O
into	O
an	O
output	O
list	O
if	O
they	O
lie	O
on	O
the	O
visible	O
side	O
of	O
the	O
extended	O
clip	O
polygon	B-General_Concept
line	O
,	O
and	O
new	O
vertices	O
are	O
added	O
to	O
the	O
output	O
list	O
where	O
the	O
subject	O
polygon	B-General_Concept
path	O
crosses	O
the	O
extended	O
clip	O
polygon	B-General_Concept
line	O
.	O
</s>
<s>
This	O
process	O
is	O
repeated	O
iteratively	O
for	O
each	O
clip	O
polygon	B-General_Concept
side	O
,	O
using	O
the	O
output	O
list	O
from	O
one	O
stage	O
as	O
the	O
input	O
list	O
for	O
the	O
next	O
.	O
</s>
<s>
Once	O
all	O
sides	O
of	O
the	O
clip	O
polygon	B-General_Concept
have	O
been	O
processed	O
,	O
the	O
final	O
generated	O
list	O
of	O
vertices	O
defines	O
a	O
new	O
single	O
polygon	B-General_Concept
that	O
is	O
entirely	O
visible	O
.	O
</s>
<s>
Note	O
that	O
if	O
the	O
subject	O
polygon	B-General_Concept
was	O
concave	O
at	O
vertices	O
outside	O
the	O
clipping	B-Algorithm
polygon	B-General_Concept
,	O
the	O
new	O
polygon	B-General_Concept
may	O
have	O
coincident	O
(	O
i.e.	O
,	O
overlapping	O
)	O
edges	O
this	O
is	O
acceptable	O
for	O
rendering	O
,	O
but	O
not	O
for	O
other	O
applications	O
such	O
as	O
computing	O
shadows	O
.	O
</s>
<s>
The	O
Weiler	O
–	O
Atherton	O
algorithm	O
overcomes	O
this	O
by	O
returning	O
a	O
set	O
of	O
divided	O
polygons	B-General_Concept
,	O
but	O
is	O
more	O
complex	O
and	O
computationally	O
more	O
expensive	O
,	O
so	O
SutherlandHodgman	O
is	O
used	O
for	O
many	O
rendering	O
applications	O
.	O
</s>
<s>
SutherlandHodgman	O
can	O
also	O
be	O
extended	O
into	O
3D	O
space	O
by	O
clipping	B-Algorithm
the	O
polygon	B-General_Concept
paths	O
based	O
on	O
the	O
boundaries	O
of	O
planes	O
defined	O
by	O
the	O
viewing	O
space	O
.	O
</s>
<s>
Given	O
a	O
list	O
of	O
edges	O
in	O
a	O
clip	O
polygon	B-General_Concept
,	O
and	O
a	O
list	O
of	O
vertices	O
in	O
a	O
subject	O
polygon	B-General_Concept
,	O
the	O
following	O
procedure	O
clips	O
the	O
subject	O
polygon	B-General_Concept
against	O
the	O
clip	O
polygon	B-General_Concept
.	O
</s>
<s>
The	O
vertices	O
of	O
the	O
clipped	O
polygon	B-General_Concept
are	O
to	O
be	O
found	O
in	O
outputList	O
when	O
the	O
algorithm	O
terminates	O
.	O
</s>
<s>
Note	O
that	O
a	O
point	O
is	O
defined	O
as	O
being	O
inside	O
an	O
edge	O
if	O
it	O
lies	O
on	O
the	O
same	O
side	O
of	O
the	O
edge	O
as	O
the	O
remainder	O
of	O
the	O
polygon	B-General_Concept
.	O
</s>
<s>
If	O
the	O
vertices	O
of	O
the	O
clip	O
polygon	B-General_Concept
are	O
consistently	O
listed	O
in	O
a	O
counter-clockwise	O
direction	O
,	O
then	O
this	O
is	O
equivalent	O
to	O
testing	O
whether	O
the	O
point	O
lies	O
to	O
the	O
left	O
of	O
the	O
line	O
(	O
left	O
means	O
inside	O
,	O
while	O
right	O
means	O
outside	O
)	O
,	O
and	O
can	O
be	O
implemented	O
simply	O
by	O
using	O
a	O
cross	O
product	O
.	O
</s>
<s>
A	O
Python	O
implementation	O
of	O
the	O
Sutherland-Hodgman	B-Algorithm
can	O
be	O
found	O
.	O
</s>
