Algebra for 3D transformations
 All Classes Namespaces Files Functions Variables Typedefs Macros
Algebra3D Documentation


A small library to provide algebraic operations on vectors in 3D space. The package defines only 3 template classes:

Each of the template types is specialized only for double and float, i.e. only the following types can be used (these are typedefs for abbreviation):

In addition some helper functions are defined in global.h. Some of those are fully defined in the header to make it possible for the compiler to inline them.


The library can be obtained either by cloning the static Mercurial 2.8.1 repository:

hg clone algebra3d

or downloading a ZIP archive.


The library has no extra dependencies. Any extra compilation settings should be set in Makefile.config. Provided all compilation setting are set appropriately the code can be build simply by running

$ make

which creates the following files:

On MacOS if you want to move the dynamic library to another location remember that dynamic libraries on Mac have their path stored internally. To see the current information use
$ otool -L /path/to/where/it/is/lib/
To modify the install path use
$ install_name_tool -id /new/location/ /new/location/
If you want just to rename the file to libalgebra3d.dylib (to use the MacOS convention) you would also need to do the above. To save yourself trouble you can also just use the static library.

The software has been tested on:


The library has a set of unit tests based on CppUnit 1.12.1. To build the tests you need to have CppUnit available in your include path and library path. If it is not in your default paths add what is necessary to Makefile.config.

To build the tests use

$ make all_test

In addition to the results of products of the default build rule this will create test binaries:

The static and dynamic versions are exactly the same, they are both built to test static and dynamic linking. The pertinent rules in the Makefile might be of interest.


A simple program for running performance tests is available in src/timing.cpp. This is not compiled by the default make rule, but can be built by:

$ make timing

which builds two binaries:

How to cite

If you find this code useful please cite:

Jonathan S. Mitchell, Jaroslaw Glowacki, Alexandre E. Grandchamp, Robert S. Manning and John H. Maddocks,
Sequence-dependent persistence lengths of DNA

DOI: ?