Boost logo

Geometry :

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


Hi,

On 3-9-2013 22:43, Adam Wulkiewicz wrote:
> Barend Gehrels wrote:
>>
>>>
>>>> - does it work for degenerate segments (point 1 == point 2)? Seeing
>>>> the patch it will divide by zero then?
>>>
>>> Hmm, I probably haven't thought about this particular case, only the
>>> case when the segment is parallel to the edge (the difference of
>>> coordinates for this dimension is also 0), but I've just tested it
>>> and it works.
>>
>> Because you already have this implementation ready also supporting
>> nD, we can merge it later with existing code, if convenient /
>> necessary. So yes, could you apply the patches you send? I can add
>> cases to the unit tests this weekend or so.
>
> I started to think about the edge cases, e.g. (p1 == p2) && they're on
> the box's edge, then there is division 0/0. So I propose that first
> I'll check everything and write some tests to be sure if this really
> works for all cases.
>
> Also is it defined in the C++ standard what should be the
> representation of floating point numbers? Are special values like INF
> always available? On some compilers it's possible to enable exception
> throwing for cases like division by 0 (I remember that e.g. Borland
> Builder had those). Not to mention that probably in the whole
> Boost.Geometry operations like division by 0 are avoided. So maybe it
> would be safer to add an if-check?

Yes, please, we indeed always do that...

Regards, Barend


Geometry list run by mateusz at loskot.net