SourceForge Logo


Have a look at the more mature GTS library

The only documentation and test files available are the ones delivered with the source package. There are only two objects for testing union, intersection and difference. Note that some of the resulting files miss some faces. Nobody's working on the project (for more than a year now); it's been left in a development state we usually call 'alpha stage'. It isn't ready for practical use though it outputs meaningful shapes. It particularly doesn't handle coplanar faces, which is a huge flaw for engineers.

The library is supposed to handle holes: the face structure in BREP includes them, but it is untested. From the developer's point of view, the BREP data structure is difficult to understand. A better approach would not break up the split-edge abstract structure into so many C or C++ classes (depends on the version you downloaded). Moreover, there are techniques that garantee stable ouput (such as Simulation of Simplicity) which are not used within BREPLIBRARY.

If you still want to play with the code, note that you won't be able to build sub-library BREP as stand-alone since it defines functions that are implemented in sub-library CSG (CreateContour, CreateEdge, VertexCompare and VertexCompareLocation). BREP needs to interact with CSG structures and it was solved by this turn-around.

There are other libraries available that are still maintained and more robust:

GTS (LGPL license)

Open Cascade, Boolean operations component (LGPL-like, have to acknowledge use and send back modifications)

SvLis (not free)

News (June 2003)

C++ version 1.2 with minimal CSG code

News (May 2003)

C++ version with alternate input/output format (in CVS only)


Implementation of a topological data structure similar to the WINGED EDGE data structure, representing the boundary of a polyhedral solid. A core layer on top of which e.g. CSG operations or 3D model topology fixers can be implemented. Comes with a sample application for CSG.


BREP: Boundary Representation Library

The boundary (surface) of a solid is represented by means of a set of topological entities. These entities are: The BREP library maintains adjacency and containement relations between these topological entities. It provides: The BREP library does not maintain geometric or other information associated with topological entities. For instance: it does not maintain (and does not need to maintain) the coordinates of a vertex, the line equation of an edge, the plane equation of a (planar) face or the color of a shell. The library does not even assume that vertices are 3D points. It could as well be used to represent the topology of a (restricted kind of) computer network, in which e.g. an IP adres would be associated with each vertex and where wings correspond to physical wires between computers. Neither is planarity assumed: any topological structure consisting of pieces that could be laid down in a plane can be represented.

In the current C version of the library, additional information can be associated with topological entities by means of client data. A predefined set of callback functions to be implemented and registered by a user of the library will take care of allocating/disposing of storage for such client data and manipulating it.  With the upcoming C++ version of the library, inheritance will be used for this purpose.

CSG: Sample application program

Command-line application computing the CSG union/difference/intersection of two solid objects in MGF files. Illustrates how to use the BREP library. Some results are shown below.

GDT: Generic Data Types Library (needed by BREP & CSG)

Something like the C++ Standard Template Library but much less ambitious and for C programs. Relict of the past.

POOLS: Memory Management routines on top of the C runtime library storage allocator (needed by BREP & CSG)

Contains malloc() and free() replacements useful in case you have large collections of small, but equally sized, memory objects. This library groups such objects in "pools". Each pool consist of a set of "pages" allocated using standard malloc() and disposed using free(). Unlike other libraries of this kind, you can freely interleave usage of this library with malloc() and free(), for other objects not maintained by the POOLS library. Storage and computation time overhead are much lower than with the standard malloc() and free(), which do not exploit knowledge that your objects are small and of equal size. The POOLS library once made my radiosity program (which evolved into RenderPark later on) faster by a factor of two.

MGF: Greg W. Larson and co's Material and Geometry Format library (needed by CSG)

3D model input file format used by the CSG application. See the MGF web site.

CSG Example


Solid A

Solid B

Union of A and B

Intersection of A and B

Difference A minus B

Difference B minus A


Initial version, build on material dating back to the summer of 1996 - April, 12 2000
New version, C++ conversion of initial version, without POOLS nor GDT - February 2002 (only in CVS)
New version, replaced MGF I/O with a much simpler one - May 2003 (only in CVS)

To do:


GNU Library Public License.

Projects using the BREP library


The project is hosted at sourceforge. CVS repository, Mailing lists, Bug Tracker are available at the project
administrative page on sourceforge.


Philippe Bekaert, Olivier Ceulemans.

If you want to contribute, drop some code/documentation and an e-mail to the project admins.


Page maintained by the BREP Library Team.
Last update: April, 12, 2000