File Exchange

image thumbnail


version (11.8 MB) by Alec Jacobson
Useful functions for geometry processing, constrainted optimization and image processing.


Updated 21 Apr 2021

From GitHub

View Version History

View license on GitHub
This is a toolbox of useful matlab functions for geometry processing. There are also tools related to constrainted optimization and image processing. Typically these are utility functions that are not stand alone applications.
Here's an incomplete list of cool features this matlab toolbox contains:

- wrappers for TetGen, Triangle, QSlim, meshfix
- mesh smoothing
- mesh clean up (remove duplicates, remove unreferenced)
- geodesic distances on triangle and tetrahedral meshes
- mesh quantities and queries (normals, discrete gaussian curvature, list boundary edges, topology, angles, dihedral angles etc.)
- mesh deformation (as-rigid-as-possible (ARAP), moving least-squares, etc.)
- mesh parameterization (harmonic, least squares conformal, ARAP, etc.)
- automatic skinning weight computation (bounded biharmonic weights, bone heat)
- 2D triangle mesh from binary image
- Input/Output for many mesh formats (.obj,.off,.stl,.wrl,.ply,.mesh,.node,.ele,.poly,.smf,.bdl,.face)
- discrete differential geometry operators for triangle and tetrahedral meshes (cotangent Laplacian, gradient, divergence)
- quadratic programming, active set solver
- scribble-based image colorization, diffusion curves
- exact (un)signed distance field computation for meshes
- constructive solid geometry operations on meshes, booleans
- accelerated point location in triangle and tetrahedral meshes
- image dithering
- deep matlab function dependency

Cite As

Alec Jacobson (2021). gptoolbox (, GitHub. Retrieved .

Comments and Ratings (22)

Pierre-Marc François

Thank you for this work! Nevertheless, the function "selfintersect.m" is missing in the cleaning mesh process. Would it be possible to provide it?

Wang Jack

curve_offset working improperly in some cases
x = [0 3 2 4 4 5 6 5 7];
y = [8 12 20 22 14 8 16 20 20];

jack jack

cant install

Manca Zerovnik Mekuc

Very complicated to compile this on Windows.

Jin Yang

Is there some example or demo file to make the codes more clear? Many thx!

Guang Liang Chen

not clear enough! I have spent three days to compile, but still not succeeded.

Alec Jacobson

@Johannes I've rewritten the mex installation to use CMake, you might find that easier.

Tibor Stanko

Faez Alkadi


Many tools do not work without installing eigen and libilgl. The installation of these on a windows machine is also not well documented. I did not get it to work.

hong tianhao

Thanks for sharing!

Amirali Nojoomi

Great toolbox, However, I still have some problem compiling some of the .cpp files.

Does anyone have complied versions of 'point_mesh_squared_distance.cpp' and 'signed_distance.cpp' either in .mexw64 or .mexmaci64? It will be really helpful.

I already tried every way described on


@Helen Khambay

You have to get the newest stable versions of eigen and libigl:

You may deinstall MinGW? Not sure.
You can find more examples for other cpp functions of the gptoolbox here:

Then try following code:

path_to_eigen=['C:\dev\eigen-eigen-' eigen_version];



EIGEN_INC= ['-I' path_to_eigen];

LIBIGL_INC=['-I' path_to_libigl '\include'];

mex( ...
MEXOPTS{:}, ...

Helen Khambay

Hello, Can someone please help me compile the point_mesh_squared_distance.cpp with mex as I want to use the hausdorff function. I have installed MinGW but get the error message "point_mesh_squared_distance.cpp:5:34: fatal error: igl/matlab/MexStream.h: No such file or directory compilation terminated."
I am a novice at using MATLAB.
Many thanks in advance...


It also works on a windows machine.

At first you have to compile the point_mesh_squared_distance.cpp with mex if you want to use the hausdorff function.


It may be useful, but since I work on a Windows machine, I can't use the hausdorff script.

This submission misses two things:
1) a list of function with a one-line explanation to facilitate searching
2) a mention in the description that some things that will not work on Windows.


Great toolbox! Thanks a lot!

Some ideas:
Small examples in description of the functions would be useful.

You could reduce the file size of the zip file by compressing the "gptoolbox-logo.pdf".

Chiyu Jiang

Very helpful tool box! Great job! Thanks for sharing!

Xiao Sidao

good job!


Wonderful job and thanks for sharing with the community.

My application is that I have a closed triangulated surface in 3D. I want to use the signed distance function and apply it to a uniform 3D Cartesian grid in which the 3D triangulated closed surface lies. In other words, this 3D surface is immersed in the Cartesian uniform grid. I was able to successfully compile and build the mex file.

Would you let me know how I should use the function and find the signed distance function for my application assuming V and F are the vertices, faces of the surface and x, y, z are the coordinates of the uniform Cartesian grid. I would be very grateful.

Anton Semechko

This is a very useful toolbox for anyone working with surface meshes. Thanks for sharing!


MATLAB Release Compatibility
Created with R2014b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired by: Toolbox Graph

Inspired: Image Manipulation Toolbox

Community Treasure Hunt

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

Start Hunting!