undesired gaps in alphashape?

5 vues (au cours des 30 derniers jours)
thengineer
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.

Réponse acceptée

Steven Lord
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)
  1 commentaire
thengineer
thengineer le 21 Nov 2017
Sorry, my understanding of the meaning of the alpha value was wrong. Now that I am aware of the actual meaning, the sporadic gaps make sense given the minor radius of 1.0.

Connectez-vous pour commenter.

Plus de réponses (1)

John D'Errico
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
thengineer
thengineer le 21 Nov 2017
Thanks for your help. Problem is resolved (see comment to other answer). The torus was just a cooked down version of my actual geometry which I would like to mesh..
John D'Errico
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.

Connectez-vous pour commenter.

Catégories

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

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by