Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Routines for fast, geometrically robust clipping operations and analytic volume/moment computations over polytopes in 2D and 3D (as well as experimental ND). This software forms the kernel for an exact general remeshing scheme. Also includes physically conservative voxelization (volume sampling) of polytopes to a Cartesian grid in 2D and 3D.

As described in Powell & Abel (2015) and LA-UR-15-26964. For information about the API itself, see LA-UR-15-26964. The now-deprecated version of the code used for Powell & Abel (2015) lives in deprecated.


  • Robustly clip polytopes against planes.

  • Compute volumes and moments over polytopes using the optimal recursive method of Koehl (2012).

  • Voxelize 2D and 3D polytopes onto a Cartesian grid by calculating the exact coordinate moments of the intersections between the polytope and each underlying grid cell.

  • Utility functions for orientation tests, box initialization, conversion between polyhedral representations, and more.

  • A set of rigorous unit-tests, located in tests. These tests also serve as examples of how to use r3d.

  • All declarations and documentation are located in r3d.h, v3d.h, r2d.h, and v2d.h.


  • To build, type


  • To compile into your code,

#include <r3d.h>, #include <r2d.h>, #include <v3d.h>, #include <v2d.h> as you require.

  • To link,



r3d.c, r3d.h, r2d.c, r2d.h, rNd.c, rNd.h, and contents of tests Copyright (C) 2015, DOE and Los Alamos National Security, LLC.

v3d.c, v3d.h, v2d.c, v2d.h, and contents of deprecated Copyright (C) 2015, Stanford University, through SLAC National Accelerator Laboratory.

See source file headers for full license text. All code is open-source, subject to terms of the respective license. We request that you cite Powell & Abel (2015) and LA-UR-15-26964 when using this code for research purposes.


Fast, robust polyhedral intersections, analytic integration, and conservative voxelization.



No releases published


No packages published
You can’t perform that action at this time.