File Exchange

image thumbnail

ashape: a pedestrian alpha shape extractor

version 1.3 (95.4 KB) by

extracts 2d alpha shapes from a set of x/y data points

13 Downloads

Updated

View License

ASHAPE is a simple wrapper for ASLIB, which implements several (optimized) subroutines to extract and display 2d alpha shapes and alpha patches from a set of x/y data points

ASLIB returns a structure, which contains all relevant parameters, data and results including graphics handles to plotted elements

furthermore, ASLIB returns function handles to all of its computational and graphics subroutines, which can be used by a programmer to create more elaborate wrappers or guis

the latest version of ASLIB can always be attached to an existing set of parameters p by
> p.f = aslib;
or by simply re-running the data
> p = ashape(p);

for general instructions see:
> help ashape
> help aslib
for explanations of subroutines and a small glossary of terms see:
> aslib -s
for explanations of fields see:
> aslib -f
for explanations of options see:
> aslib -o

look at the accompanying published m-file for a few examples

Comments and Ratings (21)

Johannes Korsawe

I like this code and it works fine for early releases. Could it be updated to also work for 2014b?

Marek

Marek (view profile)

Hey, congrats for excellent code:]
Could you let me know where can I find the coordinates of final alpha shape? I'm asking because I don't need the line but just points.
Thanks in advance!

Catherine

Daphne, I assume you solved your earlier issue. Here is how I did it.

X=cell2mat(p.ashape);
% p.ashape contains the indices of 2 nodes for each edge; turn it into a single vector (which will have repeats).
ind=reshape(X,[],1);
indu=unique(ind,'rows'); %cancel doubles.

Now any hints for putting these in order going around the shape? I don't want to use line as in the example. I would like to manipulate the boundary to fit it to other data distributed on the boundary.

HARI KRISHNAN

thanks a lot....

HARI KRISHNAN

HARI KRISHNAN

Daphne

Daphne (view profile)

The code is really great!
In Matlab 2010b I get this comment, which you may want to address:

Warning: DELAUNAY will not support Qhull-specific options in a future release.
 Please remove these options when calling DELAUNAY.

Ajay

Ajay (view profile)

For a set of points, I would like to retrieve the index order for the alpha shape. How do I access this? Thanks!

Michael

Hello. When I try to run this I get the following error:

??? Error using ==> qhullmx

qhull precision error: 101 attempts to construct a convex hull
        with joggled input. Increase joggle above 'QJ3.5'
or modify qh_JOGGLE... parameters in user.h

While executing: | qhull d QJ Pp

Options selected for Qhull 2003.1 2003/12/30:
  delaunay Pprecision-ignore Qbbound-last-qj Pgood
  _run 101 QJoggle 3.5 _joggle-seed 1537501472 _max-width 3.5e+002
  Error-roundoff 7e-010 Width-outside 1.4e-009 _wide-facet 4.2e-009
  _narrow-hull 1.1e-010

Last point added to hull was p8420.

At error exit:

Error in ==> delaunayn at 117
t = qhullmx(x', 'd ', opt);

Error in ==> delaunay at 48
    tri = delaunayn([x(:) y(:)],options);

Error in ==> aslib>ASLIB_asdelaunay at 1199
p.dt=int32(delaunay(p.x,p.y,p.flg.qopt));

Error in ==> aslib>ASLIB_aini at 562
p=ASLIB_asdelaunay(p);

Error in ==> ashape at 72
p=p.f.aini(x,y,r,o{:});

I'm running R2008B. On another system with R2010a it works with the same data. Any thoughts?

Daphne

Daphne (view profile)

The code works really well!
I would appreciate a cheat, I am trying to get the indices of the ashape edge points and no plot. How should I call the function and what part of the structure will have the data?... Thanks!

us

us (view profile)

...Any chance of a 3D version anytime soon?...
yes, work in progress...
us

Jveer

Jveer (view profile)

Any chance of a 3D version anytime soon?

Seth Lutske

Hi Matlab People!

Please forgive me if my question is pedestrian, but im new to this community. I would love to try out this ashape and aslib code, but i can't quite figure out where to put the files in my MATLAB directory so as to get the code working and recognized in MATLAB. I have a feeling this is a FAQ, but i can't seem to find the answer to it on the site (though i am new.) Could someone point me in the right direction?

Thanks

w s

@ S. Tiuí,

shame shame shame for premature accusations.

S. Tiuí

Always the same story. Whenever comes close to get down one position ... thousands of auto-downloads.
Shame shame shame

Ruben S

It would be nice to have a matlab package of 3D version.

Thanks.

Urs (us) Schwarz

i just updated the latest release for the 3rd time in several month... it just doesn't show up! sorry for this
us

Urs (us) Schwarz

dear matthew, and others using ASHAPE
for absolutely no intelligible reason your nice and concerned email ended up in my SPAM folder (!?!?) - and, i see it only now after a casual check...
anyhow, thank you very much for alerting me to the fact that ASHAPE has NOT been updated as it was supposed to some time ago!:
going back to the FEX entry, i just realize, that the FEX update-engine missed a recent update, which was posted a few month ago and dealt just with the problem you are pointing out...
the problem is this:
- in its recent version, the output of QHULL (most unfortunately!) has changed considerably(!), which also affects the output of DELAUNAYN, the core of DELAUNAY, and other ML stock functions...
- hence, ASDELAUNAY had to be fixed...
- your preliminary fix is NOT correct (sorry for this)
- please, download the latest version as soon as it shows up on the FEX
us

Matthew Eyster

Great package, gives Matlab some much needed programs for computational geometry.

However, the asdemo.m doesn't work with Matlab 2007a. Here's the fix (for ashape.m in general):

Line 906 of aslib.m:
old: b=find(s(a,:)==1);
fixed: [garbage, b]=find(s(a,:)==1);

Jan Morovic

Very nice and user-friendly package for exploring alpha shapes.

Updates

1.3

added a programmer's section to the published M-file, which shows how to extract various alpha elements from the output; new macro; new field; version tag 13-Apr-2010 15:31:23

1.2

removed annoying colorbar message; version tag 03-Apr-2010 16:21:28

1.1

adjusted for r2010a after changes in DELAUNAY syntax; version tag 02-Apr-2010 22:58:45

recent changes in QHULL; version tag: 24-Apr-2007 15:34:15

more user requested options

added many more user requested options; graphics engines now take options as well; ver tag 14-Mar-2005 15:04:48; ver id 5.01

new version implementing alpha patches; ver tag 11-Mar-2005 17:34:12; ver id 5.0

removed implicit restriction on alpha circle radius (max was convhull); added several new options (see aslib -o); unified help system (see help aslib); current id 3.5, version tag 25-Feb-2005 19:57:47

correction of a stupid typo

updated rocky description and help engine; added a colormap option to change connected alpha shape colors; please, see help aslib; current ver tag 24-Jan-2005 21:47:34

MATLAB Release
MATLAB 7.4 (R2007a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video