# Does anybody know how to write a function which returns the coordinates of a convex hull of a list of certain points?

조회 수: 3(최근 30일)
Does anybody know how to write a function which returns the coordinates of a convex hull of a list of certain points?
I can't figure out how to use the convhull function, is it easy to write my own function to calculate the points of a convex hull?
What I'm looking to get:
input
List = [x1 y1; x2 y2; x3 y3; etc];
function that computes the x and y coordinates of the convex hull of List
output
convexHull = [xConv1 yConv1; xConv2 yConv2; etc];

#### 댓글 수: 2

Stephen Cobeldick 3 Dec 2019
"I can't figure out how to use the convhull function..."
Try some of the convhull examples to get you started.
"...is it easy to write my own function to calculate the points of a convex hull?"
Not really, but you are welcome to try:

로그인 to comment.

### 답변 수 (2)

Fabio Freschi 3 Dec 2019
N = 20;
List = rand(N,2);
% convex hull (k is the pointer to the rows in List with the convex hull
k = convhull(List);
% convex hull points (counterclockwise)
convexHull = List(k,:);

#### 댓글 수: 0

로그인 to comment.

Walter Roberson 3 Dec 2019
convexHull = boundary(x, y, 0);

#### 댓글 수: 0

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.

Translated by