feat(csg): add constructive solid geometry with BSP tree boolean operations
authorSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Sat, 28 Mar 2026 12:47:12 +0000 (14:47 +0200)
committerSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Sat, 28 Mar 2026 12:47:12 +0000 (14:47 +0200)
commit428d163d0b3e9d09ba42ed27862921ca1ef39cfa
tree3f51a45cfc000b434db2dfb397af58ee2f9c3faf
parent4a0d33c4cb7ca72ca8750e67432f697a7eb17fc8
feat(csg): add constructive solid geometry with BSP tree boolean operations

Add a complete CSG system that enables boolean operations (union, subtract,
intersect) on 3D solids using BSP trees. The implementation includes:

- CSG class with union/subtract/intersect/inverse operations
- CSGNode BSP tree for spatial partitioning and polygon clipping
- CSGPlane for polygon classification and splitting
- CSGPolygon N-gon type for BSP operations
- PolygonType enum for vertex classification

Integration with existing shapes via:
- extractSolidPolygons() method on AbstractCompositeShape
- SolidPolygonMesh composite for rendering CSG results
- CSG.fromCompositeShape() factory for converting existing primitives

Also includes supporting refactorings: rename coordinates field to vertices
for consistency, simplified constructors for arrow shapes with auto-calculated
tip dimensions, and Point3D/Vertex enhancements for vector math.
21 files changed:
TODO.org
doc/Axis.png [new file with mode: 0644]
src/main/java/eu/svjatoslav/sixth/e3d/csg/CSG.java [new file with mode: 0644]
src/main/java/eu/svjatoslav/sixth/e3d/csg/CSGNode.java [new file with mode: 0644]
src/main/java/eu/svjatoslav/sixth/e3d/csg/CSGPlane.java [new file with mode: 0644]
src/main/java/eu/svjatoslav/sixth/e3d/csg/CSGPolygon.java [new file with mode: 0644]
src/main/java/eu/svjatoslav/sixth/e3d/csg/PolygonType.java [new file with mode: 0644]
src/main/java/eu/svjatoslav/sixth/e3d/geometry/Point3D.java
src/main/java/eu/svjatoslav/sixth/e3d/math/Vertex.java
src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/AbstractCoordinateShape.java
src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/Billboard.java
src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/line/Line.java
src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/solidpolygon/SolidPolygon.java
src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/texturedpolygon/TexturedPolygon.java
src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/ForwardOrientedTextBlock.java
src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/base/AbstractCompositeShape.java
src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/solid/SolidPolygonArrow.java
src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/solid/SolidPolygonMesh.java [new file with mode: 0644]
src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/textcanvas/CanvasCharacter.java
src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/wireframe/WireframeArrow.java
src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/slicer/Slicer.java