Calculate convex hull of scattered data? [message #3767] |
Mon, 13 March 1995 09:26  |
art.croucher
Messages: 11 Registered: March 1995
|
Junior Member |
|
|
I'm trying to calculate the convex hull which encloses a scattered data
set. The JHU/APL CONVEXHULL routine didn't work, presumably because
the data set isn't a polygon. Does anyone have a routine that will
calculate either a convex hull or a polygon suitable for input to
CONVEXHULL?
Thanks,
Art Croucher JHU/APL
art.croucher@jhuapl.edu
|
|
|
Re: Calculate convex hull of scattered data? [message #3820 is a reply to message #3767] |
Fri, 17 March 1995 10:10  |
sterner
Messages: 106 Registered: February 1991
|
Senior Member |
|
|
art.croucher@jhuapl.edu writes:
> I'm trying to calculate the convex hull which encloses a scattered data
> set. The JHU/APL CONVEXHULL routine didn't work, presumably because
> the data set isn't a polygon. Does anyone have a routine that will
> calculate either a convex hull or a polygon suitable for input to
> CONVEXHULL?
I posted a solution to this but just recieved email from David
Stern with a much simpler and faster solution. Here it is:
------------------------------------------------------------ ----------
I saw your messages RE convex hulls on the newsgroup. The TRIANGULATE
procedure returns the indices of the points on the convex hull as an
optional parameter. It is efficient, O(n log(n)), and simple. Here's
an example:
n = 1000 ;Make some random data
x = randomn(seed, n)
y = randomn(seed, n)
triangulate, x, y, tr, b ;b contains the vertices on the hull
plot, x, y, psym=1
b = [b, b(0)] ;Close the polygon
plots, x(b), y(b) ;Plot the convex hull
end
Hope this helps...
David
------------------------------------------------------------ ----------
I tried 10000 points and it only took a few seconds (unlike my
convexhull routine which takes a few minutes for that number of
points).
Ray Sterner sterner@tesla.jhuapl.edu
The Johns Hopkins University North latitude 39.16 degrees.
Applied Physics Laboratory West longitude 76.90 degrees.
Laurel, MD 20723-6099
WWW Home page: ftp://fermi.jhuapl.edu/www/s1r/people/res/res.html
|
|
|