Boost logo

Geometry :

Subject: Re: [geometry] point on/intersects linestring?
From: Barend Gehrels (barend_at_[hidden])
Date: 2013-09-03 13:56:53


Hi Adam,

On 3-9-2013 15:02, Adam Wulkiewicz wrote:
> Adam Wulkiewicz wrote:
>> AFAIK there isn't and intersects() for Box-Linestring isn't yet
>> implemented. There is a function calculating the comparable distance
>> of a Linestring/Segment-Box intersection but it's in the
>> index::detail so currently isn't a part of the official interface.
>> Barend should I add some parts of it to the bg::intersects()?
>
> For example something like in the patch.

Yeah, I looked at the referred website and the patch

Thanks a lot for your efforts and quick work, this looks promising.

But do we need to develop it from scratch again?

It has a considerable overlap with the current implementation of
clipping a linestring (or segment) with a box. See also
algorithms\detail\overlay\clip_linestring.hpp This file is not touched
(or looked at by me) for a long long time, I just looked at it again and
it is a bit old style. I did not test it but it seems that it
(especially the liang_barsky strategy) returns exactly if a segment is
clipped by a box, in a comparable way.

Did you write a unit-test for this when you developed this? I'm curious:
- if it works for 3d (the strategy above does not)
- does it return false when the whole segment is inside? Don't see that
in the article.
- does it work for degenerate segments (point 1 == point 2)? Seeing the
patch it will divide by zero then?

Regards, Barend


Geometry list run by mateusz at loskot.net