Boost logo

Geometry :

Subject: [ggl] bg::unique and precision
From: V D (zedxz2)
Date: 2011-10-15 13:21:33


Hi,

Thanks,
I think I will try the simplify way first.
According to the previous bug I found with the distance calculation in the DP simplification, I guess I should pass (1e-10)*(1e-10) as the max distance right ?

Thanks,
-V

On Oct 13, 2011, at 11:05 AM, Barend Gehrels wrote:

> Hi,
>
> On 13-10-2011 7:09, Simonson, Lucanus J wrote:
>>
>>
>> From: ggl-bounces_at_[hidden] [mailto:ggl-bounces_at_[hidden]] On Behalf Of V D
>> Sent: Wednesday, October 12, 2011 9:57 PM
>> To: Generic Geometry Library Discussion
>> Subject: [ggl] bg::unique and precision
>>
>> ?
>> >And indeed, creating a polygon from this WKT and running bg::unique will not drop the duplicate point (see points in bold).
>> >Is there any way of specifying some kind of epsilon for the unique algorithm ? 1e-10 would be more than enough in my case.
>>
>> An easy thing to try is the simplify algorithm we were just discussing with a threshold of 1e-10. This would eliminate both duplicate and collinear points. If you want to retain collinear but drop duplicate then you?ll need to create your own predicate that uses an epsilon I would guess.
>>
>
> This is indeed the easiest thing to do.
>
> The unique algorithm was designed to work with a user-defined strategy as well. But there is no version yet which takes it. You might try to call
>
> dispatch::unique
> <
> typename tag<Geometry>::type,
> Geometry,
> policy
> >::apply(geometry, my_policy);
>
> where my_policy is your own policy (a strategy is a policy - in Boost.Geometry strategies are normally coordinate system dependant, policies are not, but that is a detail). You could copy it from geometry::equal_to and give it a tolerance. This will be harder of course than just call simplify, but if you have it, it is welcome to be contributed back. ;-)
>
> Regards, barend
>
> _______________________________________________
> ggl mailing list
> ggl_at_[hidden]
> http://lists.osgeo.org/mailman/listinfo/ggl


Geometry list run by mateusz at loskot.net