[geos-devel] Fwd: Geometry/Rectangle Intersection: line touching rectangle

Mika Heiskanen mika.heiskanen at fmi.fi
Thu Sep 11 09:30:45 PDT 2014


On 09/11/2014 06:57 PM, Sandro Santilli wrote:
> Did you take a look at the algorithm ?
> It sounds like by the end of operations the class is left with a bunch
> of lines to work with, not much to build a result w/out going back
> to look at which sides of those lines are internal or external of the
> originals.

At the time of insertion into the builder it is known for all
linestrings whether they are part of a hole or the exterior of
a polygon. This information can be inserted into the builder
along with the linestring, and used in the rebuild phase. Currently
the logic dictates that any clipped hole must necessarily become
a part of the exterior of a polygon, and the linestrings are
connected accordingly by traveling the rectangle clockwise to
find the next linestring to connect to. Even though the orientation
of the holes was counter-clockwise, connecting to the linestring in
the original order is correct for building the exterior.

What should remain is how to detect in the reconnect
phase the special case of a linestring traveling only on the edges
of the rectangle, and to handle it accordingly. I'm not sure,
but wouldn't the boolean passed along with the linestring
(hole or not) be enough to decide whether to just throw the
linestring away or keep it in the reconnect phase? Possibly
such a linestring could be even detected during the clipping
phase by keeping track on whether all the vertices so far have
been on the edges without true intersections, and then the
linestring would not be inserted into the builder at all if it is
not of the correct type (hole/exterior).

Mika Heiskanen / FMI





More information about the geos-devel mailing list