basic question on how to find mean distance between an interior point and all of the vertex points of the convex hull

조회 수: 1 (최근 30일)
Hi,
I know how to get the convex hull of a set of 3 dimensional points:
% Create the data.
n = 50;
X = randn(n,3);
% Plot the points.
plot3(X(:,1),X(:,2),X(:,3),'ko','markerfacecolor','k');
% Compute the convex hull.
C = convhulln(X);
I have certain interior base locations and I want to determine the average (mean) distance between the base location and all other points on the vertex of the convex hull. How do I do this easily? Thank you for your time
Andrew

답변 (1개)

Laurens Bakker
Laurens Bakker 2012년 3월 7일
Hi Andrew,
If you have the Statistics toolbox, use the pdist function to compute the distance between a vector of points and a single point. Otherwise, do it by hand:
P = unique( C, 'rows' );
dist = sqrt(sum( bsxfun(@minus,P,yourBaseLocation) .^ 2, 2 ));
I used Euclidean distance: sqrt(sum( (A - B)^2 ))
Cheers,
Laurens

카테고리

Help CenterFile Exchange에서 Bounding Regions에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by