poly_hull¶
poly_hull ermittelt die konvexe Hülle von Punkten in der Ebene.
-
rvIdx = poly_hull(x, y)
-
rvIdx = poly_hull(x, y, opt)
Returnwert
rvIdx sind die Indizes der Hülle. Im Fehlerfall ist rvIdx ein Stringvektor mit zwei Elementen. Das erste Element identifiziert den Fehler, das zweite Element ist ein Fehlermeldungstext.
Parameter
-
x
x ist ein Vektor mit den x-Koordinaten der Punkte in der Ebene.
-
y
y ist ein Vektor mit den x-Koordinaten der Punkte in der Ebene. Der Vektor muss die selbe Länge wie der x-Vektor haben. Es müssen mindestens 4 Punkte angegeben werden, die nicht auf einer Linie liegen dürfen.
-
opt
opt ist 0 (default, falls dieser Parameter nicht angegeben wurde) oder 1. Falls opt gleich 1 ist, werden Punkte auf den Kanten der Hülle nicht ignoriert.
Beispiel
* 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
idx = poly_hull(x = rand(1,1000), y = rand(1,1000));
if (type(idx) == "string") {
MessageBoxError("Error: " + idx[1] + "\n\n + idx[2]);
return 0;
}
h = plot(x[idx], y[idx])
h2 = plot(x, y, h[2])
XYShowMarker(h2[3], TRUE)
XYShowLine(h2[3], FALSE)
LayerSetAxisMinMaxDelta(h2[2], "X", -0.1, 1.1, 0.1)
LayerSetAxisMinMaxDelta(h2[2], "Y", -0.1, 1.1, 0.1)
LayerShowGrid(h2[2], "X", FALSE, FALSE)
LayerShowGrid(h2[2], "Y", FALSE, FALSE)
LayerSetAxisTitle(h2[2], "X", "")
LayerSetAxisTitle(h2[2], "Y", "")
PageReplot(h2[1])
Siehe auch
Diese Funktion verwendet qhull, siehe:
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.qhull.org/.
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: qhull@geom.umn.edu
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
qhull_bug@geom.umn.edu; the authors may or may not act on them as
they desire.
id-749714