Versor (libvsr) A (Fast) C++ library for Conformal Geometric Algebra – Mac and Linux

Versor (libvsr), A (Fast) C++ library for Conformal Geometric Algebra. Currently tested on Linux and Mac OS X

Developer: Pablo Colapinto, gmail: wolftype

As long as algebra and geometry have been separated, their progress have been slow and their uses limited; but when these two sciences have been united, they have lent each mutual forces, and have marched together towards perfection.
-Joseph Louis Lagrange

No attention should be paid to the fact that algebra and geometry are different in appearance.
-Omar Khayyám

L’algèbre n’est qu’une géométrie écrite; la géométrie n’est qu’une algèbre figurée.
-Sophie Germain

If you want to see, learn how to act
-Heinz von Foerster


  1. To INSTALL please read the INSTALL file
  2. The current document is a work-in-progress! For specific questions please do not hesitate to contact me: wolftype (at) gmail dot com


This package provides operations and draw routines for conformal geometric algebra, a relatively new spatial computing model used by physicists, engineers, and artists. Versor is designed to make graphical experimentation of conformal geometric algebra within a C++ environment easier. You can use this library to draw geometrical things, explore spherical and hyperbolic spaces, transformations, design robots, etc. I am using it for my PhD on bio-inspired engineering.

I first developed Versor while reading “Geometric Algebra for Computer Science” by Leo Dorst, Daniel Fontijne, and Stephen Mann. It’s a fantastic book and if you’re reading this you should also consider reading that.

Built to aid in my modelling of organic forms, the initial development was funded in large part by the Olivia Long Converse Fellowship for Botanic research, courtesy of the Graduate Division at the University of California in Santa Barbara. So this software is under a UC Regents General Public License.

See also the links below for more information, including some videos. The Doc folder has a doxygen which I periodically tidy up. Lots of test files too.

A full-fledged tutorial is in the works … but a basic intro follows

One quick word: clifford algebras and the spatial relationships they embody can often feel abstract and daunting. But it’s a twisty, boosty ride, full of weird discoveries. You’re bound to make some, so have fun!


The homogenous 5D CGA model used here was initially proposed by David Hestenes, Hongbo Li, and Alan Rockwood in 2001, and given full form and weight through the excellent and careful work of Leo Dorst, Joan and Anthony Lasenby, and Eduardo Bayro-Corrochano, and others. These researchers’ writings have helped me quite a bit. CGA is particular breed of Clifford Algebras (also known as Geometric Algebras), which operate upon combinatoric hypercomplex vector spaces that emerged from William Clifford’s attempt to fuse Hamilton’s quaternions with Grassmans’ extension algebras. Thus transformations were married with a system of abstraction. For more information, take a look at the links to the sites at the bottom of this page. For instance, for practical applications in robotics and “Geometric Cybernetics”, see Eduardo Bayro-Corrochano’s work. For some very helpful algorithms in rigid body dynamics and gravitational physics see the variety of publications by Joan and Anthony Lasenby. To get at the beginning of it all, read David Hestenes’ New Foundations for Classical Mechanics.


This software is licensed under a general UC Regents General Public License. If you’re planning on using CGA inside a sellable product you should be aware that there is a vague patent on the use of 5D CGA which may limit its commercial use when encoding robotic control mechanisms, or may just limit your ability to patent the model itself. I hope and imagine it is the latter. Though powerful, elegant, and brilliant, the heart of CGA is just a quadratic equation and the arguments for the use of 5D CGA are that it is foundational and universal, the very two characteristics of a system which would make it un-patentable. The Clifford Algebras on which it is based are from the 19th century.


Typical matrix operation libraries have templated inlined functions for Vector and Matrix multiplication. Versor is similar, but on steroids, where vectors and sparse matrices of various sizes are all just called multivectors and represent geometric elements beyond just xyz directions and transformation matrices. Circles, lines, spheres, planes, points are all algebraic elements, as are operators that spin, twist, dilate, and bend those variables. Both these elements and operators are multivectors which multiply together in many many many different ways.

The backbone of Versor’s library is a precomputation table of the most likely (though not all) multiplications you could possibly hope to use.
It is a highly templatized and inlined extravaganza of function calls. Of course, there are also many useful algorithms included for manipulating geometric elements. Most of these useful algorithms are located in thevsr_op.h file.

A Circle, for instance, can be outer-multiplied by a Plane to get the Point Pair where they intersect.

The current version of Versor is built for operational speed, with the expense of slightly longer compile times.
The makefile builds the STATIC version of this library, which currently gives up a bit of abstraction (no inherited generic Multivector class) in exchange for a 5x speed boost (and 10x decrease in file size).

Future versions will likely use jit compilation to take care of this (i.e. combine speed with lightweight implementation), by hooking into luajit for instance. I am working on that with Graham Wakefield and his thoughtful guidance and tutelage. Additionally, there is a trade off I am working on where you have an MVBase class with which you can make arbitrary functions. This requires a bunch of pointer being copied and has led to code bloat. GA is a tricky world of unknown return types.
The C++11 standards should help (for instance, “auto” return types), but are not implemented here.


Source: Email from P. Dechant ( 13 Sep. 2013,


Leave a comment

Filed under Software

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s