Subject: Re: [geometry] Douglas Peucker on 3D lines
From: Barend Gehrels (barend_at_[hidden])
Date: 2012-06-26 14:24:57
On 26-6-2012 18:35, Simonson, Lucanus J wrote:
> Resegment line segments that are too long after DP. You may need to construct a new linestring rather than try to insert points into existing linestring. If your data structure is a vector construction of a new vector is often cheaper than repeated insertion into and existing vector.
> -----Original Message-----
> From: geometry-bounces_at_[hidden] [mailto:geometry-bounces_at_[hidden]] On Behalf Of Stephan Menzel
> Sent: Tuesday, June 26, 2012 4:32 AM
> To: Boost.Geometry library mailing list
> Subject: Re: [geometry] Douglas Peucker on 3D lines
> an additional just arose here, if I may.
> Is there a way to make Douglas Peucker less agressive?
> I have a use case in where it takes out large chunks of a line string that are in line. Just what it's supposed to be, no question here.
> But the rest of my application can get into trouble if the points are too far apart so I'm looking for a way to limit it somewhat and make it not remove points if the resulting segment would be longer than any constant value. I haven't found anything...
> If that doesn't work, maybe I can put additional points in long segments afterwards? But segment is not mutable during iteration and linestring::append can only append points at the end.
> Is there any way to achieve this?
Unfortunately not, it is not there.
There are two (not trivial) ways to achieve it:
1: you can write an own strategy for simplification, based on DP but
with this extra constraint. Basically the information is there - two
points (a segment) is there and a third point is considered each time,
if that third point is "too far away" it should be selected.
2: do it afterwards indeed as you and Luke suggest. There is not yet a
ready-made algorithm for it (I had it once - called "densify", this
would be useful)
Geometry list run by mateusz at loskot.net