poly_hull calculates the convex hull in the x/y plane.
rvIdx are the hull indices. In case of an error rvIdx is a string vector with two elements. The first element identifies the error, the second element is the error text. .. us.params
x is a vector with x coordinates. The vector must have the same number of elements as the vector y.
y is a vector with y coordinates. The vector must have the same number of elements as the vector x. At least 4 elements are necessary.
* poly_hull([0,1,1,0,0], [0,0,1,1,0]) 1.0000 2.0000 3.0000 4.0000 1.0000
* poly_hull(rand(1,1000), rand(1,1000)) 443.0000 970.0000 939.0000 591.0000 526.0000 776.0000 584.0000 92.0000 536.0000 877.0000 580.0000 238.0000 50.0000 875.0000 338.0000 230.0000 44.0000 288.0000 243.0000 443.0000
* poly_hull([1,1,1],[1,1,1]) 2,x-poly-error Singular Input Data (e.g. Points form a line)
idx = poly_hull(x = rand(1,1000), y = rand(1,1000)) h = plot(x[idx], y[idx]) h2 = plot(x, y, h) XYShowMarker(h2, TRUE) XYShowLine(h2, FALSE) LayerSetAxisMinMaxDelta(h2, "X", -0.1, 1.1, 0.1) LayerSetAxisMinMaxDelta(h2, "Y", -0.1, 1.1, 0.1) LayerShowGrid(h2, "X", FALSE, FALSE) LayerShowGrid(h2, "Y", FALSE, FALSE) LayerSetAxisTitle(h2, "X", "") LayerSetAxisTitle(h2, "Y", "") PageReplot(h2)
This function uses the qhull algorithm see:
Barber, C.B., Dobkin, D.P., and Huhdanpaa, H.T., “The Quickhull algorithm for convex hulls,” ACM Trans. on Mathematical Software, Dec 1996. http://www.geom.umn.edu/software/qhull.
Qhull, Copyright (c) 1993-2002 The National Science and Technology Research Center for Computation and Visualization of Geometric Structures (The Geometry Center) University of Minnesota 400 Lind Hall 207 Church Street S.E. Minneapolis, MN 55455 USA email: email@example.com This software includes Qhull from The Geometry Center. Qhull is copyrighted as noted above. Qhull is free software and may be obtained via http from www.geom.umn.edu. It may be freely copied, modified, and redistributed under the following conditions: 1. All copyright notices must remain intact in all files. 2. A copy of this text file must be distributed along with any copies of Qhull that you redistribute; this includes copies that you have modified, or copies of programs or other software products that include Qhull. 3. If you modify Qhull, you must include a notice giving the name of the person performing the modification, the date of modification, and the reason for such modification. 4. When distributing modified versions of Qhull, or other software products that include Qhull, you must provide notice that the original source code may be obtained as noted above. 5. There is no warranty or other guarantee of fitness for Qhull, it is provided solely "as is". Bug reports or fixes may be sent to firstname.lastname@example.org; the authors may or may not act on them as they desire.