-
Notifications
You must be signed in to change notification settings - Fork 1
/
chull.html
96 lines (63 loc) · 2.21 KB
/
chull.html
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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>R: Compute Convex Hull of a Set of Points</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="R.css">
</head><body>
<table width="100%" summary="page for chull"><tr><td>chull</td><td align="right">R Documentation</td></tr></table>
<h2>Compute Convex Hull of a Set of Points</h2>
<h3>Description</h3>
<p>Computes the subset of points which lie on the convex hull of the
set of points specified.
</p>
<h3>Usage</h3>
<pre>
chull(x, y = NULL)
</pre>
<h3>Arguments</h3>
<table summary="R argblock">
<tr valign="top"><td><code>x, y</code></td>
<td>
<p>coordinate vectors of points. This can be specified as two
vectors <code>x</code> and <code>y</code>, a 2-column matrix <code>x</code>, a list
<code>x</code> with two components, etc, see <code>xy.coords</code>.</p>
</td></tr>
</table>
<h3>Details</h3>
<p><code>xy.coords</code> is used to interpret the
specification of the points. The algorithm is that given by Eddy (1977).
</p>
<p>‘Peeling’ as used in the S function <code>chull</code> can be
implemented by calling <code>chull</code> recursively.
</p>
<h3>Value</h3>
<p>An integer vector giving the indices of the points lying on the
convex hull, in clockwise order.
</p>
<h3>References</h3>
<p>Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)
<EM>The New S Language</EM>.
Wadsworth & Brooks/Cole.
</p>
<p>Eddy, W. F. (1977) A new convex hull algorithm for planar sets.
<EM>ACM Transactions on Mathematical Software</EM>, <B>3</B>, 398–403.
</p>
<p>Eddy, W. F. (1977) Algorithm 523. CONVEX, A new convex hull
algorithm for planar sets[Z]. <EM>ACM Transactions on
Mathematical Software</EM>, <B>3</B>, 411–412.
</p>
<h3>See Also</h3>
<p><code>xy.coords</code>,<code>polygon</code></p>
<h3>Examples</h3>
<pre>
require(stats)
X <- matrix(rnorm(2000), ncol = 2)
chull(X)
## Not run:
# Example usage from graphics package
plot(X, cex = 0.5)
hpts <- chull(X)
hpts <- c(hpts, hpts[1])
lines(X[hpts, ])
## End(Not run)
</pre>
</body></html>