File: Convex-Hull.html

package info (click to toggle)
octave 10.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 145,388 kB
  • sloc: cpp: 335,976; ansic: 82,241; fortran: 20,963; objc: 9,402; sh: 8,756; yacc: 4,392; lex: 4,333; perl: 1,544; java: 1,366; awk: 1,259; makefile: 659; xml: 192
file content (152 lines) | stat: -rw-r--r-- 9,704 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.1.1, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Convex Hull (GNU Octave (version 10.3.0))</title>

<meta name="description" content="Convex Hull (GNU Octave (version 10.3.0))">
<meta name="keywords" content="Convex Hull (GNU Octave (version 10.3.0))">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">

<link href="index.html" rel="start" title="Top">
<link href="Concept-Index.html" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Geometry.html" rel="up" title="Geometry">
<link href="Interpolation-on-Scattered-Data.html" rel="next" title="Interpolation on Scattered Data">
<link href="Voronoi-Diagrams.html" rel="prev" title="Voronoi Diagrams">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
div.center {text-align:center}
div.example {margin-left: 3.2em}
span:hover a.copiable-link {visibility: visible}
strong.def-name {font-family: monospace; font-weight: bold; font-size: larger}
ul.mark-bullet {list-style-type: disc}
-->
</style>
<link rel="stylesheet" type="text/css" href="octave.css">


</head>

<body lang="en">
<div class="section-level-extent" id="Convex-Hull">
<div class="nav-panel">
<p>
Next: <a href="Interpolation-on-Scattered-Data.html" accesskey="n" rel="next">Interpolation on Scattered Data</a>, Previous: <a href="Voronoi-Diagrams.html" accesskey="p" rel="prev">Voronoi Diagrams</a>, Up: <a href="Geometry.html" accesskey="u" rel="up">Geometry</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<h3 class="section" id="Convex-Hull-1"><span>30.3 Convex Hull<a class="copiable-link" href="#Convex-Hull-1"> &para;</a></span></h3>

<p>The convex hull of a set of points is the minimum convex envelope
containing all of the points.  Octave has the functions <code class="code">convhull</code>
and <code class="code">convhulln</code> to calculate the convex hull of 2-dimensional and
N-dimensional sets of points.
</p>
<a class="anchor" id="XREFconvhull"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-convhull"><span><code class="def-type"><var class="var">H</var> =</code> <strong class="def-name">convhull</strong> <code class="def-code-arguments">(<var class="var">x</var>, <var class="var">y</var>)</code><a class="copiable-link" href="#index-convhull"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-convhull-1"><span><code class="def-type"><var class="var">H</var> =</code> <strong class="def-name">convhull</strong> <code class="def-code-arguments">(<var class="var">x</var>, <var class="var">y</var>, <var class="var">z</var>)</code><a class="copiable-link" href="#index-convhull-1"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-convhull-2"><span><code class="def-type"><var class="var">H</var> =</code> <strong class="def-name">convhull</strong> <code class="def-code-arguments">(<var class="var">x</var>)</code><a class="copiable-link" href="#index-convhull-2"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-convhull-3"><span><code class="def-type"><var class="var">H</var> =</code> <strong class="def-name">convhull</strong> <code class="def-code-arguments">(&hellip;, <var class="var">options</var>)</code><a class="copiable-link" href="#index-convhull-3"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-convhull-4"><span><code class="def-type">[<var class="var">H</var>, <var class="var">V</var>] =</code> <strong class="def-name">convhull</strong> <code class="def-code-arguments">(&hellip;)</code><a class="copiable-link" href="#index-convhull-4"> &para;</a></span></dt>
<dd><p>Compute the convex hull of a 2-D or 3-D set of points.
</p>
<p>The hull <var class="var">H</var> is a linear index vector into the original set of points
that specifies which points form the enclosing hull.  For 2-D inputs only,
the output is ordered in a counterclockwise manner around the hull.
</p>
<p>The input <var class="var">x</var> may also be a matrix with two or three columns where the
first column contains x-data, the second y-data, and the optional third
column contains z-data.
</p>
<p>An optional final argument, which must be a string or cell array of strings,
contains options passed to the underlying qhull command.
See the documentation for the Qhull library for details
<a class="url" href="http://www.qhull.org/html/qh-quick.htm#options">http://www.qhull.org/html/qh-quick.htm#options</a>.
The default option is <code class="code">{&quot;Qt&quot;}</code>.
</p>
<p>If <var class="var">options</var> is not present or <code class="code">[]</code> then the default arguments are
used.  Otherwise, <var class="var">options</var> replaces the default argument list.
To append user options to the defaults it is necessary to repeat the
default arguments in <var class="var">options</var>.  Use a null string to pass no arguments.
</p>
<p>If the second output <var class="var">V</var> is requested the volume of the enclosing
convex hull is calculated.
</p>

<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFconvhulln">convhulln</a>, <a class="ref" href="Delaunay-Triangulation.html#XREFdelaunay">delaunay</a>, <a class="ref" href="Voronoi-Diagrams.html#XREFvoronoi">voronoi</a>.
</p></dd></dl>


<a class="anchor" id="XREFconvhulln"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-convhulln"><span><code class="def-type"><var class="var">h</var> =</code> <strong class="def-name">convhulln</strong> <code class="def-code-arguments">(<var class="var">pts</var>)</code><a class="copiable-link" href="#index-convhulln"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-convhulln-1"><span><code class="def-type"><var class="var">h</var> =</code> <strong class="def-name">convhulln</strong> <code class="def-code-arguments">(<var class="var">pts</var>, <var class="var">options</var>)</code><a class="copiable-link" href="#index-convhulln-1"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-convhulln-2"><span><code class="def-type">[<var class="var">h</var>, <var class="var">v</var>] =</code> <strong class="def-name">convhulln</strong> <code class="def-code-arguments">(&hellip;)</code><a class="copiable-link" href="#index-convhulln-2"> &para;</a></span></dt>
<dd><p>Compute the convex hull of the set of points <var class="var">pts</var>.
</p>
<p><var class="var">pts</var> is a matrix of size [n, dim] containing n points in a space of
dimension dim.
</p>
<p>The hull <var class="var">h</var> is an index vector into the set of points and specifies
which points form the enclosing hull.
</p>
<p>An optional second argument, which must be a string or cell array of
strings, contains options passed to the underlying qhull command.  See the
documentation for the Qhull library for details
<a class="url" href="http://www.qhull.org/html/qh-quick.htm#options">http://www.qhull.org/html/qh-quick.htm#options</a>.
The default options depend on the dimension of the input:
</p>
<ul class="itemize mark-bullet">
<li>2D, 3D, 4D: <var class="var">options</var> = <code class="code">{&quot;Qt&quot;}</code>

</li><li>5D and higher: <var class="var">options</var> = <code class="code">{&quot;Qt&quot;, &quot;Qx&quot;}</code>
</li></ul>

<p>If <var class="var">options</var> is not present or <code class="code">[]</code> then the default arguments are
used.  Otherwise, <var class="var">options</var> replaces the default argument list.
To append user options to the defaults it is necessary to repeat the
default arguments in <var class="var">options</var>.  Use a null string to pass no arguments.
</p>
<p>If the second output <var class="var">v</var> is requested the volume of the enclosing
convex hull is calculated.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFconvhull">convhull</a>, <a class="ref" href="Delaunay-Triangulation.html#XREFdelaunayn">delaunayn</a>, <a class="ref" href="Voronoi-Diagrams.html#XREFvoronoin">voronoin</a>.
</p></dd></dl>


<p>An example of the use of <code class="code">convhull</code> is
</p>
<div class="example">
<div class="group"><pre class="example-preformatted">x = -3:0.05:3;
y = abs (sin (x));
k = convhull (x, y);
plot (x(k), y(k), &quot;r-&quot;, x, y, &quot;b+&quot;);
axis ([-3.05, 3.05, -0.05, 1.05]);
</pre></div></div>

<p>The output of the above can be seen in <a class="ref" href="#fig_003aconvhull">Figure 30.5</a>.
</p>
<div class="float" id="fig_003aconvhull">
<div class="center"><img class="image" src="convhull.png" alt="convhull">
</div><div class="caption"><p><strong class="strong">Figure 30.5: </strong>The convex hull of a simple set of points</p></div></div>
</div>
<hr>
<div class="nav-panel">
<p>
Next: <a href="Interpolation-on-Scattered-Data.html">Interpolation on Scattered Data</a>, Previous: <a href="Voronoi-Diagrams.html">Voronoi Diagrams</a>, Up: <a href="Geometry.html">Geometry</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>