|
Geometry : |
Subject: [ggl] Trying a simple linestring-linear_ring intersection
From: Barend Gehrels (Barend.Gehrels)
Date: 2010-02-28 16:34:48
Hi Elvis,
>> Indeed this is not running; it will be implemented some moment; however the
>> problem you were interested in was getting intersection points between a
>> polygon and a linestring, including their direction, right?
>>
>
> Right.
>
> However, since my last e-mail I've realized that Qt (which is the
> library I'm using for the GUI) has some rudimentary support for
> finding intersection points between lines and polygons. Since my
> requirements are pretty low (for instance all my polygons will be
> convex), I think that I'll be able to hack together the additional
> code that I need to detect if a polygon was "entered" or "leaved" as
> well as the angle of incidence. At least that's what I'm hoping.
>
OK, no problem at all. Actually I'm curious how easy it is using Qt, the
problem you describe is not a standard operation in most libraries, AFAIK.
Just because I was curious and I've said it is not much work, and it
wasn't, I enabled the linestring/polygon get_turns.
I also created a small sample of it, combined with your use case.
The sample gives this figure:
so this is basically probably what you want to know (the line goes from
lower left, via upper-center to the right)
The sample is checked in as 05_b_overlay_linestring_polygon_example. It
creates SVG and does some console output.
I realize that the sample currently contains references to the namespace
boost::geometry::detail; as soon as this is an operation that end users
have to do we have to figure out how these would look like but at least
it should not be in namespace detail... Furthermore the operations are
called like "intersection" and "union" (note: there are some more of
them!), because that is what polygon/polygon intersection would do with
them, but we might consider renaming them to... for example
entering/leaving :-)
This is actually a very nice use case of what people like to do with
Boost.Geometry. Thanks :-)
Note that polygon/linestring intersection (delivering linestrings inside
polygons) is still not yet supported.
> So as it turns out, perhaps a full-blown geometric computation library
> is overkill for my simple application.
>
> That said, support for this would of course be a nice addition to
> Boost.Geometry nonetheless. I just want you to know that my needs are
> not that urgent anymore ;)
>
Sure, it is a nice addition.
> Thanks a lot for the quick support though!
>
Welcome! Success with your project!
Regards, Barend
-------------- next part --------------
Skipped content of type multipart/related
Geometry list run by mateusz at loskot.net