Class Csg

java.lang.Object
eu.svjatoslav.aukio.e3d.renderer.raster.shapes.composite.base.Csg

public final class Csg extends Object
Pure CSG (Constructive Solid Geometry) boolean engine: union, subtract and intersect over lists of SolidPolygons, built on BSP tree clip/invert sequences.

These are pure functions — they take polygon lists and return new polygon lists, touching no shape state. AbstractCompositeShape's instance methods (union/subtract/intersect) delegate here and handle the child-registry bookkeeping themselves.

All operations clone their inputs first (BSP operations mutate polygons in place), so caller lists are never modified.

  • Method Details

    • union

      public static List<SolidPolygon> union(List<SolidPolygon> a, List<SolidPolygon> b)
      Union of two polygon sets: every surface of both, interior faces removed.
      Parameters:
      a - first operand's polygons (not modified)
      b - second operand's polygons (not modified)
      Returns:
      the union result polygons
    • subtract

      public static List<SolidPolygon> subtract(List<SolidPolygon> a, List<SolidPolygon> b)
      Subtraction a - b: the cutter volume carved out of the target.
      Parameters:
      a - target polygons (not modified)
      b - cutter polygons (not modified)
      Returns:
      the difference result polygons
    • intersect

      public static List<SolidPolygon> intersect(List<SolidPolygon> a, List<SolidPolygon> b)
      Intersection of two polygon sets: only the overlapping volume remains.
      Parameters:
      a - first operand's polygons (not modified)
      b - second operand's polygons (not modified)
      Returns:
      the intersection result polygons