Subject: [ggl] bg::unique and precision
From: Barend Gehrels (barend)
Date: 2011-10-14 02:31:55
On 13-10-2011 7:09, Simonson, Lucanus J wrote:
> [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
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. ;-)
-------------- next part --------------
An HTML attachment was scrubbed...
Geometry list run by mateusz at loskot.net