Boost logo

Geometry :

Subject: [ggl] Polygon DP simplification
From: Barend Gehrels (barend)
Date: 2011-10-06 21:38:03


Hi,

On 30-9-2011 12:34, Mateusz Loskot wrote:
> On 30/09/11 11:32, Bruno Lalande wrote:
>> I don't remember about the details but I'm pretty sure this sqrt was
>> absent on purpose. It was pulled away from the actual calculation to
>> avoid useless square root computations when comparing distances, and it
>> is the responsibility of the caller to call sqrt.
>
> Bruno,
>
> Yes, it makes perfect sense to me.
>
>> So probably one of the
>> algorithms/operations used fails to do it, we will have to identify
>> which one. I assume adding the sqrt within pythagoras itself causes all
>> the operations that use it properly to fail unit tests.
>
> Indeed, that's why I didn't decide to commit it. The patch is fragile.
>
>> I guess Barend will have more details about the actual implementation.

There is indeed a problem there, which must have been slipped through
during rework of the distance strategy. Sorry for that. Because the unit
tests test with a distance of 1.0 it went unnoticed. It is provisonally
fixed now, such that it gives the correct results and I added a unit
test of the case of V D to avoid future regressions. The fix is
provisonally because it now calls sqrt in all comparisons, and indeed it
was intended to not do that. So I will work on this but don't know if
this will be in 1.48. Anyway, it now gives the correct results.

It (it is actually a one line change) is commited in the Trunk.

Thanks for the report and the feedback.

Regards, Barend


Geometry list run by mateusz at loskot.net