Skip to content

Instantly share code, notes, and snippets.

Last active September 18, 2022 17:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slimsag/7e38961c7f9dfc2dcf8eea17b41f919e to your computer and use it in GitHub Desktop.
Save slimsag/7e38961c7f9dfc2dcf8eea17b41f919e to your computer and use it in GitHub Desktop.
Proprietary mesh triangulation in open source software

Proprietary mesh triangulation in open source software?

Recently I was looking for a solid, reliable way to do path triangulation. Looking at state-of-the-art research, I came across the UC Berkley researcher Jonathan Shewchuk's outstanding Triangle library.

Jonathan is very clear on the Triangle website, and in source code, about the project not being open-source:

This program may be freely redistributed under the condition that the copyright notices (including this entire header and the copyright notice printed when the `-h' switch is selected) are not removed, and no compensation is received. Private, research, and institutional use is free. You may distribute modified versions of this code UNDER THE CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR NOTICE IS GIVEN OF THE MODIFICATIONS.

Distribution of this code as part of a commercial system is permissible ONLY BY DIRECT ARRANGEMENT WITH THE AUTHOR. (If you are not directly supplying this code to a customer, and you are instead telling them how they can obtain it for free, then you are not required to make any arrangement with me.)

I went on to look for other open-source libraries, but found.. a large majority seem to use this Triangle library behind the scenes? I hope I'm wrong here somehow, but a quick 30 minute search turned up:

Projects using the proprietary Triangle library

(1.5k stars) PyMesh/PyMesh - this library claims MPL license on the pypi website but has an open issue where the author suggests not using it due to licensing concerns. Someone suggests using trimesh (more on that below..); these projects use PyMesh:

(2k stars) mikedh/trimesh - at least the triangulation function in this library depends on the proprietary Triangle project (it appears this is a core function used throughout this library.) These projects use trimesh:

Direct consumers of triangle.c from the Triangle project:

Copy link

mikedh commented Sep 18, 2022

Note that triangle is no longer listed in any level of trimesh requires (for versions after mikedh/trimesh#1683 >=3.15.1). Functions that used triangle were switched to a Python binding of Mapbox’s ISC licensed Earcut (pip install mapbox-earcut). It’s roughly 10x faster than triangle with the slight downside of generating meshes most suitable for visualization, as far as I can tell there's no minimum angle criteria or other mesh-quality tuning parameters. If there are any other options people have used available under a BSD/MIT license let me know!

If anyone’s interested in this issue, you might take a look at contributing to earcut.hpp and related bindings:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment