libhex - a library for manipulating hexagonal grids.

Output to Scalable Vector Graphics (SVG) is supported. SVG can be viewed directly in most modern web-browers, or converted to PNG or JPG using readily-available utilities.

By default, the grid is orientated with the main "x" axis horizontal ('West' to 'East). The six directions are labelled A to F anti-clockwise. Direction 'A' is 'East' along the x-axis. 'B' is 'North-East' and so-on.

If you prefer a different scheme (perhaps with the main axis running 'South' to 'North', or with clockwise as the positive direction) then simply use SVG transformations to rotate or mirror the grid as necessary.

libhex is written in C++, and the main interface is in that language. A Python interface is implemented using SWIG. Other language interfaces (Ruby, TCL, whatever) could also be easily achieved with SWIG. If you do any work in these other languages, then let me know.

A JavaScript version of the library is also available (hex.js). This is a 100% re-implementation in JavaScript. It enables Ajax applications to manipulate the SVG directly.

Most libhex objects (Hexes, Areas, Paths) can be represented as simple text-strings. This makes it easy to store them, or for client-server (Ajax) applications to communicate about them in high-level terms. See the documentation for details.


Author: Alex Tingle <>

Generated on Thu Feb 21 00:00:54 2008 for libhex by  doxygen 1.5.1