You might want to look into CSG, Constructive Solid Geometry. Essentially it works along the lines of the boolean operators seen in various modelling programs. You can create a union, an addition and a subtraction.
There's a paper about it here:
http://www.leadwerks.com/files/csg.pdfThere are also LGPL libraries which can help:
http://gts.sourceforge.net/http://www.cgal.org/