comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Polygon Smoothing
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Polygon Smoothing [message #70831 is a reply to message #70823] Mon, 10 May 2010 15:46 Go to previous messageGo to previous message
Karl[1] is currently offline  Karl[1]
Messages: 79
Registered: October 2005
Member
On May 10, 2:03 pm, "Kenneth P. Bowman" <k-bow...@null.edu> wrote:
> In article <MPG.2651f81de6837386989...@news.giganews.com>,
>  David Fanning <n...@dfanning.com> wrote:
>
>> Folks,
>
>> I have a shape file describing a 2D polygon that is *extremely*
>> complex and detailed. For my puposes, overly so. I would like
>> to "simplify" or "smooth" this polygon to make it more suitable
>> for my purpose (using it as a cookie-cutter for extracting data).
>> Has anyone written a polygon smoothing routine, possibly using
>> Bézier curves, in IDL to do such a thing? Would you be willing
>> to share it?
>
>> Thanks,
>
>> David
>
> One simple algorithm is to traverse the polygon and remove
> points that are nearly collinear.  For any three sequential
> points you can get the angle at the middle point from the
> dot product.  If the curvature is less than some threshold,
> remove the middle point.  You probably want to check the
> distance between the points as well as the curvature.
>
> Apply repeatedly until satisfied.
>
> Ken

MESH_DECIMATE does this very well.

You might have to run the shape through IDLgrTessellator to generate a
mesh and get rid of any concavities or self-intersections that
invariably come up at the worst time in Shape files.

Then run it through MESH_DECIMATE. I think you can tell it to NOT
generate any new vertices, as it might do to get the optimum
solution. You can also pass it a "percentage" which will control the
amount of smoothing.

The resulting mesh will then contain a subset of your original
vertices. All you have to do is walk the connectivity list to pull
out the vertices that represent your outline.
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Possible to get name of current procedure from within procedure?
Next Topic: decimal numbers

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 19:36:08 PDT 2025

Total time taken to generate the page: 1.60248 seconds