orientation of polygons

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

orientation of polygons

Ralph Boland
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
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: orientation of polygons

Michael Rice
Is there some purpose for this endeavor? I once wrote a program that was used to compute highway construction fill quantities. I don't remember what method I used, probably Green's theorem, as the shoelace doesn't ring any bells. One important note: the origin chosen should lie close to the center of the area one wishes to measure, for the most accurate results. 

On Fri, Mar 8, 2019 at 2:24 AM Ralph Boland <[hidden email]> wrote:
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
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners