# [Newbies] orientation of polygons

Ralph Boland rpboland at gmail.com
Fri Mar 8 07:23:54 UTC 2019

```In Squeak should the vertices of a polygon be listed in clockwise or
counter-clockwise order?
Note that I am not concerned about which is best, just which Squeak uses.
I need to make a choice in order to compute the areas of polygons and
the algorithms
that do this negate the area if you process the vertices in the opposite order.

Note that it is not sufficient to just take the absolute value of the
result of computing the area
because I have to deal with a polygon being cut into two parts by a
line seqment (a chord).
Which of the two parts of the polygon I want the area of is determined
by the ordering
of the vertices of the polygon and also the ordering of the the
vertices of the line segment.
Reversing the ordering of the vertices of either switches the subpolygon chosen.
Reversing both has no affect because the two switches cancel.

So I have to make a choice and live with it.  I want my choice to be
consistent with
any similar choice made in Squeak code.

If none of the Squeak code depends on polygon vertices ordering then I
would like
to hear opinions on the matter so at least I can a decision that is at
least better then
arbitrary.

Note that mathematics doesn't seem to help much here.  The shoelace algorithm
for computing the area of a polygon and Green's theorem both use a
counter-clockwise
orientation.  However simple integration to determine the area under a
curve implies
a clockwise orientation (adding areas under each edge of the polygon when going
left to right and subtracting when going right to left implied a
clockwise orientation).

Thanks

Ralph Boland
```