Boost logo

Geometry :

Subject: [ggl] confused by point_order clockwise/counterclockwise
From: Barend Gehrels (barend)
Date: 2011-04-14 14:33:28


On 14-4-2011 18:24, feverzsj wrote:
> hi, list
> While wrting a function to check the ring/polygon orientation by using
> the signed area algorithm, I also took a look at ggl's area
> function(with rings always presumed clockwise). The ggl area() only
> returns negative area for wrongly oriented ring with respect to the
> expected orientation, while the signed area algorithm returns negative
> area for counterclockwise ring.
>
> To my understanding, ggl algorithms are always based on "clockwise".

That was once the case, but has been changed. In the review it was
requested that counterclockwise were also supported for a generic
library. So we did.

> So, in the area() function, counterclockwise(determined by template
> parameter) rings are reversed as clockwise. And also in many other
> scene. This seems kinda different from the common computational
> geometry, which may bring some surprising, and possibly better to be
> mentioned in the first place.

I think it is mentioned in the doc's, though at some places it might be
more clear. The default orientation is still clockwise.

>
> Furthermore, correct() is very useful, but the related dynamic check
> utilites(like detect orientation, close/open) are not presented. Will
> it be a good idea to provide them?

Yes, that is a good idea.

We're currently quite busy with the Release branch, so I can and will
not extract them immediately, but sure there has to be thought of a
"valid()" or better, valid-to-some-aspect functionality.

Regards, Barend


Geometry list run by mateusz at loskot.net