Class CSG2D

java.lang.Object
org.episteme.core.mathematics.geometry.csg.d2.CSG2D

public class CSG2D extends Object
Constructive Solid Geometry (CSG) implementation for 2D. This class performs 2D CSG operations (union, subtract, intersect) using a BSP tree approach with Edge objects. Unlike CSG (3D), this implementation
Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Constructor Details

    • CSG2D

      public CSG2D(List<Edge> edges)
  • Method Details

    • fromPoints

      public static CSG2D fromPoints(List<Point2D> points)
      Creates a CSG2D from a list of points representing a polygon. Assumes points are ordered counter-clockwise (CCW).
    • union

      public CSG2D union(CSG2D other)
    • subtract

      public CSG2D subtract(CSG2D other)
    • intersect

      public CSG2D intersect(CSG2D other)
    • clone

      public CSG2D clone()
      Overrides:
      clone in class Object
    • getEdges

      public List<Edge> getEdges()
      Returns the internal edge list for direct access.
    • getPolygons

      public List<List<Point2D>> getPolygons()
      Convert back to Polygons (List of point lists) if needed. This requires chaining edges.