$include_dir="/home/hyper-archives/geometry/include"; include("$include_dir/msg-header.inc") ?>
Subject: [ggl] reversible view
From: Barend Gehrels (barend.gehrels)
Date: 2010-04-30 05:33:08
Hi,
 From the review report:
> Boolean operations: while the library provides a set of Boolean operations
> those seem to be not complete and/or robust in terms of
> clockwise/counterclockwise geometries, closed/open polygons.
To support this (clockwise/counterclockwise) in a generic way I've 
created a "reversible_view" utility. This is currently in "util", and 
might be so generic that it is useful outside Boost.Geometry too.
The idea is to create an iterator which can either iterate forward, or 
iterate reverse, without the implementation stating "rbegin" and "rend" 
everywhere (otherwise it will be if/else everywhere).
See 
<https://svn.boost.org/svn/boost/sandbox/geometry/boost/geometry/util/reversible_view.hpp>
It is currently used in the area algorithm. That one previously negated 
the result, but that is possible only for area, while the new solution 
is more generic.
See 
<https://svn.boost.org/svn/boost/sandbox/geometry/boost/geometry/algorithms/area.hpp>
To support closed/open polygons (rings), we might add another utility 
(this time it will probably be an adapted iterator) that works in a 
similar way: on closed ring it behaves like a normal iterator going from 
[begin, end), on an open ring it iterates one beyond and returns the 
starting point. Like this the algorithms all don't have to take care 
themselves. Of course only where it is applicable: for transform, e.g., 
neither clockwise behaviour nor open/close is interesting. It is only 
interesting for algorithms calculating something, like area (ccw + 
close), perimeter (only close), centroid (only close), within (ccw + 
close), and intersections (ccw + close).
For intersections and other algorithms using monotonic sections it is 
more complicated because the polygons are splitted up before, and 
sections are indexed, but however it seems to be feasible and avoids 
doing a another complete implementation of course.
Regards, Barend