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

1 vue (au cours des 30 derniers jours)
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

Réponses (1)

Laurens Bakker
Laurens Bakker le 7 Mar 2012
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

Catégories

En savoir plus sur Bounding Regions dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by