undesired gaps in alphashape?
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
thengineer
le 20 Nov 2017
Commenté : John D'Errico
le 21 Nov 2017
I am having trouble to generate a "gap-free" alpha shape for the following example:
% surface points from: https://stackoverflow.com/questions/10655393
aminor = 1.; % Torus minor radius
Rmajor = 3.; % Torus major radius
sd = 24;
theta = linspace(-pi, pi, sd) ; % Poloidal angle
phi = linspace(0., 2.*pi, 2*sd) ; % Toroidal angle
[t, p] = meshgrid(phi, theta);
x = (Rmajor + aminor.*cos(p)) .* cos(t);
y = (Rmajor + aminor.*cos(p)) .* sin(t);
z = aminor.*sin(p);
I am creating the alpha shape with
alpha = 1;
shp = alphaShape(x(:),y(:),z(:), alpha);
plot(shp);
Here is the figure:

As you can see, alpha should be big enough to cover all distances between the desired surface points, yet the returned alpha shape contains some gaps.
What am I missing?
PS: I get identical results on Matlab R2016b and R2017b.
0 commentaires
Réponse acceptée
Steven Lord
le 20 Nov 2017
The criticalAlpha method computes that you should use an alpha slightly greater than 1 to get all the points in 'one-region'. Giving it a bit extra leeway, I chose to use 1.03:
alpha = 1.03;
shp = alphaShape(x(:), y(:), z(:), alpha);
crit = criticalAlpha(shp, 'one-region')
plot(shp)
Plus de réponses (1)
John D'Errico
le 20 Nov 2017
It looks like an alpha ball of radius 1 is just slightly too small. Using my own alpha shape code, written long ago, I find it works fine with an alpha ball of 1.05 radius. But when I tried a radius of 1, it all went up in smoke. The figure below is for alpha=1.05.

Personally, if all you are trying to do is make a plot, I would just create it by
surf(x,y,z)
2 commentaires
John D'Errico
le 21 Nov 2017
When you have a problem like that with an alpha shape, it means your value of alpha is too small. The alpha probe will manage to penetrate too deeply, and the entire alpha shape can quickly disintegrate.
Voir également
Catégories
En savoir plus sur Bounding Regions dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!