Downloads: Source Code (Visual Studio 2008 SP1, C++) [Zip]


libgeometry is a computer graphics software library, which implements a wide range of graphics capabilities, primarily focusing on 3D mesh processing. For some examples of what has been done with libgeometry, see DragDropTool, CloneTool, and SegTool. Other people have successfully used libgeometry in their projects, so despite minimal documentation, it can't be that hard....

libgeometry includes the following capabilities/components (some of these are class names, others just rough categories):

  • IMesh: generic mesh interface with vert/tri iterators, multiple UV sets and scalar-value sets
  • VFTriangleMesh: vert/edge/face mesh, vertex colors, numeric element IDs for indexed access (also supports iterators), efficient append/remove/modify topology, efficient neighbour queries/iterations, nonmanifold edge tracking, edge split/flip/collapse, vertex weld,
  • MeshIO: import OBJ/OFF, export OBJ/STL/Collada (DAE)
  • VFMeshMask: transparently hide triangles in a mesh via iterators
  • VFMeshMerge: transparently combine two separate meshes via iterators
  • configurable mesh rendering classes
  • MeshSelection: selected verts & faces representation and manipulation
  • SurfaceAreaSelection: interactive face-selection support class (multi-stroke lasso, painting, grow/shrink, etc)
  • MeshPolygons: arbitrary polygon overlay for triangle mesh (to support quad/poly meshes)
  • MeshUtils: submeshes, xyz/uv copies, collapse tips/fins/short-edges/slivers, validity checks, cotan one-ring weights with mixed area, find boundary loops, map/merge boundary loops, mesh statistics, mesh transformations, connected components on triangle subsets
  • MeshInsertion: insert 2D mesh in UV-space, stitch via Delaunay triangulation, optionally project back to 3D
  • MeshGeodesic: approximate mesh geodesic curve computation (unpublished, hacky)
  • Parameterization: Discrete Exponential Map for point-sets/meshes, uniform/floater/geodesic/conformal/authalic weights for constrained-boundary, free-boundary conformal, misc other parameterization hacks
  • Spatial data structures: Axis-Aligned Bounding Volume Hierarchy for mesh triangles, (also uv-space 2D AABB BVH), uniform grid for points
  • Deformation: Laplacian deformation (positional constraints), Rotation Invariant Coordinates (position and frame constraints), COILS deformer
  • Smoothing: iterative laplacian and Taubin smoothing, variational Laplacian smoothing with uniform/cotan weights with mixed area weighting and positional constraints
  • Harmonic interpolation for scalar values on mesh vertices
  • Curves: 2D polygon/polyline/linear complex, 3D polyline, 3D laplacian curve deformation
  • 2D constrained Delaunay Triangulation (wraps TRIANGLE code)
  • generic Dijkstra front propagation
  • Data Structures: non-contiguous block-allocating vector, memory pool, linked-list pool, reference-counted vector, generic sparse array

libgeometry is built on top of the WildMagic4 Foundation library, which is included in the source distribution. WildMagic4 Foundation is a fully-featured math library developed by Dave Eberly at It includes too many capabilities list in detail, but the core components include vector math, geometric primitives, various curve/surface/mesh representations, intersection and distance tests, containment and approximate-fitting computations, various types of numerical solvers, many interpolation schemes, and some computational geometry like convex hull and delaunay algorithms. All code is double/float templated, and most things are provided for both 2D and 3D. I use WildMagic for just about everything, and so should you.

(Note that WildMagic5 is available, but the basic math library is largely unchanged save for some bug fixes. The library structure changed though, so it takes an afternoon to do the port.)

Build Instructions

To build libgeometry you will need to follow three steps:

  1. run WildMagic4\autobuild_vs2008_x64.bat (or autobuild_vs2008.bat if you have a 32-bit machine)
  2. open and build libgeometry_vc9.sln

Note that pre-compiled static libraries from my GSI solver package are included. These are built for Visual Studio 2008 SP1 and are unlikely to work with other versions (but they might - who knows!).

You could build libgeometry on OSX or linux without too much effort. There is no platform-dependent code, save for in WildMagic (which includes OSX xcodeproj and linux makefiles). However you would need to deal with the GSI solver dependency (which is also much easier in unix/posix environments than in windows).

Known Bugs

Too many to list. This is research software. It is not robust or efficient. Good luck!


This majority of this code is released under the Boost 1.0 License, so you can use it for any purpose, commercial or non-commercial. However, some of the code is taken from other sources and you will need to respect their individual licenses:

The subdirectory libgeometry\WildMagic4 is taken from the WildMagic library (version 4) developed and distributed by Dave Eberly at WildMagic contains, quite simply, the best low-level math library ever, and you should use it for everything. It is similarly under the Boost 1.0 License.

The subdirectory libgeometry\external\eigen contains the Eigen 3 distribution, a C++ headers-only math library. Eigen may be used under the LGPL3 or GPL3 licenses (FAQ).

The subdirectory libgeometry\external\SparseMatrix contains pre-compiled libraries that themselves contain compiled versions of many other math libraries, including LAPACK, BLAS, TAUCS, METIS, UMFPACK, and more. Please see the GSI page for details.

The file libgeometry\mesh_processing\Triangulator2D.cpp contains the source code to the TRIANGLE software, copyright Jonathan Richard Shewchuk. This code may not be used in commercial products without permission from the copyright owner. Please contact him, not me.

If you want to reference TRIANGLE, here is a citation:

Jonathan Richard Shewchuk, Triangle: Engineering a 2D Quality Mesh Generator and Delaunay Triangulator, in ``Applied Computational Geometry: Towards Geometric Engineering'' (Ming C. Lin and Dinesh Manocha, editors), volume 1148 of Lecture Notes in Computer Science, pages 203-222, Springer-Verlag, Berlin, May 1996. (From the First ACM Workshop on Applied Computational Geometry.) [PostScript] [HTML].



Back To
DCS Logo
DGP Logo