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 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Polygon hull [message #22943] Thu, 21 December 2000 12:04
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Pavel A. Romashkin (pavel.romashkin@noaa.gov) writes:

> Talking about a stable OS... My Win98 is reinstalling at home right now.
> Yesterday it found an infrared port (that I don't have *any* hardware
> for) and is trying to use it istead of the modem for dial-up. It likes
> the idea of the modern IR better than the old primitive ISA modem. I
> told you David, Win98 on my PC detects not only what's installed on the
> computer, but also what you bring close to it, so it must've detected
> that IR remote control for the TV that I forgot in the office. :-(

Uh, Pavel, I'm sending a couple of guys in white coats
over there right now. Don't be alarmed when they show
up. They are going to fix this computer for you.

> David Fanning wrote:
>
>> P.S. What I don't understand is why I don't look
>> in the book first, instead of spending 45 minutes
>> digging around in my notes. There is even an index
>> entry and everything! Sheesh.
>
> Maybe you should get one, David. Pretty good book. Amazon will deliver
> it timely :-)

I try to keep a book around, but I'm always feeling
sorry for the students (Do you see what they pay for
textbooks these days!) and I'm always selling my own
copy cheaply. The only problem with this system is the
marginalia. Notes like "Who wrote this nonsense!?"
and "What a jerk!" does not inspire great confidence. :-(

--
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
Re: Polygon hull [message #22945 is a reply to message #22943] Thu, 21 December 2000 11:14 Go to previous message
Pavel A. Romashkin is currently offline  Pavel A. Romashkin
Messages: 531
Registered: November 2000
Senior Member
Talking about a stable OS... My Win98 is reinstalling at home right now.
Yesterday it found an infrared port (that I don't have *any* hardware
for) and is trying to use it istead of the modem for dial-up. It likes
the idea of the modern IR better than the old primitive ISA modem. I
told you David, Win98 on my PC detects not only what's installed on the
computer, but also what you bring close to it, so it must've detected
that IR remote control for the TV that I forgot in the office. :-(

Cheers,
Pavel

David Fanning wrote:

> P.S. What I don't understand is why I don't look
> in the book first, instead of spending 45 minutes
> digging around in my notes. There is even an index
> entry and everything! Sheesh.

Maybe you should get one, David. Pretty good book. Amazon will deliver
it timely :-)
Re: Polygon hull [message #22990 is a reply to message #22945] Tue, 19 December 2000 05:48 Go to previous message
bcohen is currently offline  bcohen
Messages: 15
Registered: January 1996
Junior Member
> I've just been reading through my brand new copy of David Fanning's "IDL
> Programming Techniques 2nd Edition" and I came across the following, in a
> discussion of Delaunay triangulation:

Aha. My book is one of those 80 on order. I think I'll have lots to
learn from it !
Barbara


--
Re: Polygon hull [message #22993 is a reply to message #22990] Mon, 18 December 2000 16:25 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Mark Hadfield (m.hadfield@niwa.cri.nz) writes:

> "Note that you can return the convex hull of these points with the
> TRIANGULATE command too. Simply add a fourth argument to the command...and
> the points on the parameter [huh? must be perimeter] of this set of points
> will be returned to you."

Whoops! I'm going to install that damn context
checker as soon as I get a stable OS. :-(

Let's just say this has already fixed for
the next printing run. :-)

Cheers,

David

P.S. What I don't understand is why I don't look
in the book first, instead of spending 45 minutes
digging around in my notes. There is even an index
entry and everything! Sheesh.

--
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
Re: Polygon hull [message #22994 is a reply to message #22993] Mon, 18 December 2000 15:47 Go to previous message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
"Barbara A Cohen" <bcohen@lpl.arizona.edu> wrote in message
news:91jchs$ep4$1@news.ccit.arizona.edu...
> 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?

I've just been reading through my brand new copy of David Fanning's "IDL
Programming Techniques 2nd Edition" and I came across the following, in a
discussion of Delaunay triangulation:

"Note that you can return the convex hull of these points with the
TRIANGULATE command too. Simply add a fourth argument to the command...and
the points on the parameter [huh? must be perimeter] of this set of points
will be returned to you."

Here's an example:

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.4
7,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.2
2,0.16,0.16,0.08,0.08]

plot, x, y, color=0, /nodata

triangulate, x, y, triangles, b

polyfill, x[b], y[b], color=150, fill_pattern=50

plot, x, y, psym=7, color=0

---
Mark Hadfield
m.hadfield@niwa.cri.nz http://katipo.niwa.cri.nz/~hadfield/
National Institute for Water and Atmospheric Research
PO Box 14-901, Wellington, New Zealand
Re: Polygon hull [message #22998 is a reply to message #22994] Mon, 18 December 2000 13:48 Go to previous message
bcohen is currently offline  bcohen
Messages: 15
Registered: January 1996
Junior Member
Thanks David and Chris. Triangulate works great. I remade my x and y arrays
to include the error in the xy points so that the polygon encompasses them
and the actual xy points are within the perimeter, not on it. I love IDL!
Long live David Fanning! --Barbara

--
Re: Polygon hull [message #23004 is a reply to message #22998] Mon, 18 December 2000 04:18 Go to previous message
cjengo is currently offline  cjengo
Messages: 28
Registered: June 1999
Junior Member
I use qhull for all my convex hull needs. It's extremely fast (< 1-5
seconds) for a few hundred thousand points with less than 8
dimensions. Even comes with viewing software (Geomview), but it's very
easy to read the results into IDL and plot them there. May be overkill
for what you're after, but it's simple to use (but can get very complex
for complex situations).

http://www.geom.umn.edu/software/qhull/

The site also has very good discussions about convex hulls, voronois,
etc.

Chris


Sent via Deja.com
http://www.deja.com/
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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: The Book Bidness
Next Topic: Re: Zooming in Object Graphics

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

Current Time: Wed Oct 08 15:52:04 PDT 2025

Total time taken to generate the page: 0.00712 seconds