Package eu.svjatoslav.sixth.e3d.csg
Class CSGPolygon
java.lang.Object
eu.svjatoslav.sixth.e3d.csg.CSGPolygon
An N-gon polygon used for CSG BSP tree operations.
During BSP tree traversal, polygons may be split by planes, resulting in polygons with varying vertex counts (3 or more). The polygon stores its vertices, the plane it lies on, and material properties (color).
The color is preserved through CSG operations - split polygons inherit the color from their parent.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCSGPolygon(List<Vertex> vertices, Color color) Creates a polygon with vertices and a color. -
Method Summary
-
Field Details
-
vertices
The vertices defining this polygon's geometry. For CSG operations, this can be 3 or more vertices (N-gon). -
plane
The plane that contains this polygon. Cached for efficient BSP operations. -
color
The color of this polygon. Preserved through CSG operations; split polygons inherit this color.
-
-
Constructor Details
-
CSGPolygon
Creates a polygon with vertices and a color.- Parameters:
vertices- the vertices defining this polygon (must be at least 3)color- the color of this polygon- Throws:
IllegalArgumentException- if vertices is null or has fewer than 3 vertices
-
-
Method Details
-
clone
Creates a deep clone of this polygon.Clones all vertices and preserves the color.
-
flip
public void flip()Flips the orientation of this polygon.Reverses the vertex order and negates vertex normals. Also flips the plane. Used during CSG operations when inverting solids.
-