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

Home » Public Forums » archive » Re: Polygon hull
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 hull [message #23005 is a reply to message #23004] Sun, 17 December 2000 15:57 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Barbara A Cohen (bcohen@lpl.arizona.edu) writes:

> Hi, I have an array of data and I want to plot a polygon that encompasses
> all the points within it. I have tried JHU's convexhull but it fails to
> encompass all the data (example below). Does anyone else have a program
> to do this?

You can find the convex hull with the Triangulate command, like
this:

x=[0.36,0.35,0.39,0.42,0.60,0.41,0.48,0.73,0.46,0.42,0.42,0. 42, $
0.47,0.44,0.47,0.49,0.54,0.64,0.65]
y=[0.19,0.26,0.26,0.26,0.14,0.22,0.15,0.10,0.16,0.30,0.27,0. 27, $
0.23,0.23,0.22,0.16,0.16,0.08,0.08]
TVLCT, [255, 255, 100], [0, 255, 100], [0, 0, 100], 1
Device, Decomposed=0
Plot, x, y, color=2, /nodata, background=3
Triangulate, x, y, triangles, hull
Plots, [x[hull],x[hull[0]]], [y[hull],y[hull[0]]], Color=1
Plots, x, y, psym=4, Color=2

Cheers,

P.S. I can't tell whether "encompass" means that the
points can't exist on the perimeter line. I still can't
ftp to the JHU site with a browser. I don't know why. :-(

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: The Book Bidness
Next Topic: Re: Zooming in Object Graphics

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

Current Time: Thu Oct 09 07:30:38 PDT 2025

Total time taken to generate the page: 0.72115 seconds