Add CsgTest (9 tests) — first-ever coverage of the CSG/BSP machinery
authorSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Sun, 20 Sep 2026 09:23:16 +0000 (12:23 +0300)
committerSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Sun, 20 Sep 2026 09:23:16 +0000 (12:23 +0300)
commited0a7e9dd0c9d9d9e7b637c829484fe579ecbde0
tree4e2f8c832eeb31415c13587c3ac3a9a5906558bd
parentd0c804d95faad156c651d3ed6e5f71345e110e4a
Add CsgTest (9 tests) — first-ever coverage of the CSG/BSP machinery

Covers: union/subtract/intersect for disjoint+overlapping boxes
(interior-face and containment invariants), determinism (bit-exact
repeat runs), input immutability, and degenerate empty operands.

The test immediately caught a real defect: Csg.intersect with an empty
operand returned the FIRST operand unchanged (classic BSP sequence
degenerates: clips against an empty tree are no-ops and the inverts
cancel). Csg now guards empty operands explicitly in all three ops.
A naive polygon-count assertion in the test itself was also corrected
to the meaningful centroid invariant (BSP splits boundary faces,
making net counts meaningless).
src/main/java/eu/svjatoslav/aukio/e3d/renderer/raster/shapes/composite/base/Csg.java
src/test/java/eu/svjatoslav/aukio/e3d/renderer/raster/shapes/composite/base/CsgTest.java [new file with mode: 0644]