Creating a 3 Dimensional Concave Hull

I am trying to write some code that will be able to create a concave hull around a data cloud. I am trying to create a method that will find the smallest radius possible to use in the alphavol function, whilst still creating a hull that encapsulates every data point.
So far I have been using the alphavol code available on the file exchange as a basis for solving the problem. This code can be found here: http://www.mathworks.com/matlabcentral/fileexchange/28851-alpha-shape-volume
So far, I have:
x=rand(50,1);
y=rand(50,1);
z = (x.*y);
A=pdist([x y z]);
A=squareform(A);
for i=1:size(A,1)
j = A(i,:) > 0;
p_min1(i,:)=min(A(i,j));
end
r = max(p_min1);
X=[x,y,z];
subplot(1,2,1), alphavol(X,Inf,1);
alpha(.4)
subplot(1,2,2), alphavol(X,r,1);
alpha(.4)
I have tried to write the code so that:
1) a random data cloud is generated
2) the distance between each of the datapoints is calculated
3) using the squareform of the distances between each of the data points and the for loop, the distance from each point to its nearest point is calculated. The maximum of these distances is then used as the radius for the alphavol function.
4) the data points and their hulls, based on a radius of infinity and a radius calculated in my code are then plotted and displayed.
The method that I have used to find the smallest possible radius, whilst still creating a hull around every data point, does not seem to work.
Can anyone think of a different method of finding a radius that will make sure that every data point is encapsulated, whilst still creating a concave hull? I am still very new to Matlab, so any help would be greatly appreciated.

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeBounding Regions についてさらに検索

質問済み:

2011 年 9 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by