View License

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

» Watch video

Highlights from
ashape: a pedestrian alpha shape extractor

Join the 15-year community celebration.

Play games and win prizes!

» Learn more

5.0 | 9 ratings Rate this file 22 Downloads (last 30 days) File Size: 95.4 KB File ID: #6760 Version: 1.3
image thumbnail

ashape: a pedestrian alpha shape extractor


us (view profile)


20 Jan 2005 (Updated )

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

| Watch this File

File Information

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

MATLAB release MATLAB 7.4 (R2007a)
Other requirements tested for earlier releases of R14
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (21)
19 Oct 2015 Johannes Korsawe

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

11 Jul 2012 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!

Comment only
15 Feb 2012 Catherine

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

% p.ashape contains the indices of 2 nodes for each edge; turn it into a single vector (which will have repeats).
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.

Comment only

thanks a lot....

Comment only
07 Jun 2011 HARI KRISHNAN  
27 May 2011 HARI KRISHNAN  
25 May 2011 HARI KRISHNAN  
15 May 2011 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.

13 May 2011 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!

Comment only
09 May 2011 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

Error in ==> aslib>ASLIB_aini at 562

Error in ==> ashape at 72

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

Comment only
19 Jan 2011 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!

15 Apr 2010 us

us (view profile)

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

Comment only
14 Apr 2010 Jveer

Jveer (view profile)

Any chance of a 3D version anytime soon?

Comment only
23 Apr 2008 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?


Comment only
08 Apr 2008 w s

@ S. Tiuí,

shame shame shame for premature accusations.

Comment only
06 Mar 2008 S. Tiuí

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

Comment only
09 Nov 2007 Ruben S

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


26 Apr 2007 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

Comment only
23 Apr 2007 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

Comment only
21 Apr 2007 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);

27 Sep 2006 Jan Morovic

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

25 Jan 2005

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

28 Jan 2005

correction of a stupid typo

28 Feb 2005

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

11 Mar 2005

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

14 Mar 2005

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

17 Mar 2005

more user requested options

27 Apr 2007

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

02 Apr 2010 1.1

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

03 Apr 2010 1.2

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

13 Apr 2010 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

Contact us