tetrahedron_grid, an Octave code which generates a grid of points over the interior of a tetrahedron in 3D.

Starting with any 4 points A, B, C and D that define a tetrahedron, we can divide each edge of the tetrahedron into N subintervals, and create a tetrahedral grid. This defines ((N+1)*(N+2)*(N+3))/6 points that lie on the intersections of grid lines.

The library includes a routine which allows the user to pick an arbitrary tetrahedron and an arbitrary number of subdivisions. It then returns the tetrahedral gridpoints defined by that choice.


The computer code and data files described and made available on this web page are distributed under the MIT license


tetrahedron_grid is available in a C version and a C++ version and a Fortran90 version and a MATLAB version and an Octave version and a Python version.

Related Data and Programs:


octave_grid, an Octave code which generates a regular grid of points inside a variety of regions in one, two, three or many dimensions.

tetrahedron, an Octave code which carries out geometric calculations involving a general tetrahedron, including solid and facial angles, face areas, point containment, distances to a point, circumsphere and insphere, measures of shape quality, centroid, barycentric coordinates, edges and edge lengths, random sampling, and volumes.

Source Code:

Last revised on 03 April 2019.