1
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
2
<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
4
<LANGUAGE>eng</LANGUAGE>
5
<TITLE>convex_hull</TITLE>
6
<TYPE>Scilab function</TYPE>
7
<DATE>September 1996</DATE>
8
<SHORT_DESCRIPTION name="convex_hull"> convex hull of a set of points in the plane</SHORT_DESCRIPTION>
10
<CALLING_SEQUENCE_ITEM>[nhull,ind] = convex_hull(xy) </CALLING_SEQUENCE_ITEM>
15
<PARAM_NAME>xy</PARAM_NAME>
17
<SP>: 2 x n real matrix</SP>
21
<PARAM_NAME>nhull</PARAM_NAME>
27
<PARAM_NAME>ind</PARAM_NAME>
29
<SP>: integer row vector</SP>
35
<P><VERB>convex_hull</VERB> finds the convex hull of a given set of n points in
36
the plane. <VERB>xy</VERB> is the 2 x n matrix of the (x,y) coordinates of
37
the given points. <VERB>convex_hull</VERB> returns in <VERB>nhull</VERB> the number
38
of the points of the boundary of the convex hull and in <VERB>ind</VERB> the
39
row vector (of size <VERB>nhull</VERB>) giving the indices in <VERB>xy</VERB> of the
40
points of the boundary. The order in <VERB>ind</VERB> corresponds to
41
consecutive points on the boundary.</P>
45
ta=[27 27 3 12 11 12 27 26 26 25 25 24 23 23 21 22 21 20 19 18 18];
46
ta=[ta 16 15 15 14 12 9 10 6 9 17 8 17 10 20 11 23 23 12 18 28];
47
he=[ 1 2 2 4 5 11 13 1 25 22 24 22 22 19 13 13 14 16 16 9 16];
48
he=[he 10 10 11 12 2 6 5 5 7 8 7 9 6 11 4 18 13 3 28 17];
49
g=make_graph('foo',0,28,ta,he);
50
xx=[46 120 207 286 366 453 543 544 473 387 300 206 136 250 346 408];
51
g('node_x')=[xx 527 443 306 326 196 139 264 55 58 46 118 513];
52
yy=[36 34 37 40 38 40 35 102 102 98 93 96 167 172 101 179];
53
g('node_y')=[yy 198 252 183 148 172 256 259 258 167 109 104 253];
55
xy=[g('node_x');g('node_y')];
56
[nhull,ind] = convex_hull(xy)