libefgy, Release 1 and 2


A set of C++ header-only templates. Mostly maths, but also some other fun things.


A lot of the programmes on this site - and some of the related sites - deal with maths. Lots of it. So over time I've been accumulating math-y C++ templates. So far these templates had all been available in this site's GIT repository. But that led to all sorts of consistency problems, with the headers getting replicated and slightly modified in several projects.

So, naturally, the time has come to fix this. By releasing the most current version of the templates properly. This was, in part, motivated by me trying to release a proper version of Topologic's CLI variant. More on that in a separate post. And yeah, I know the name is bollocks, but c'mon, what was I gonna use instead? libmath? libmathtemplates? libtemplatemagic? Yeah right.

The headers include templates for fractional arithmetic, big integers (and thus "big fractions"), calculating π, e, some calculations with those (think trigonometrics), matrix manipulations, tuples, polar and euclidian spaces in arbitrary dimensions, (perspective) projections and colour space manipulations in RGB and HSL. Also assorted other things. Not so much documentation as of yet, sorry about that. Enjoy your maths ;D.

Update (2013-10-10): version 2 is out, which fixes some bugs and includes a lot of cleanups. Also sierpinski gaskets and carpets.


This is a template library, so you won't actually compile this code and then install it as you would with most other libraries. Instead all you have to do is copy the header files to your compiler's default include path - i.e. copy the directory include/ to /usr/include. There's a makefile macro that does this for you, too.

To obtain the source code, either grab this source tarball for release 2, or grab the sources with git at As usual you can browse the sources via gitweb at Then just untar the whole thing and either copy the headers you need, or do something like this:

$ cd libefgy-1
$ sudo make PREFIX=/usr install

Substitute sudo as appropriate. Et voila, enjoy!

Oh yeah, do note the MIT/X-style licence in the COPYING file and browse through the README while you're at it.

Last Modified: 2013-10-10T20:55:00Z

Since you came this far, why not follow jyujinX on Twitter

comments powered by Disqus
Written by Magnus Achim Deininger