Class Plane

java.lang.Object
eu.svjatoslav.sixth.e3d.geometry.Plane

public class Plane extends Object
Represents an infinite plane in 3D space using the Hesse normal form.

Planes are fundamental to BSP (Binary Space Partitioning) tree operations in CSG. They divide 3D space into two half-spaces.

See Also:
  • Field Details

    • EPSILON

      public static final double EPSILON
      Epsilon value used for floating-point comparisons in BSP operations. Smaller values provide higher precision but may cause issues with near-coplanar polygons. 1e-5 is a good balance for most 3D geometry.
      See Also:
    • normal

      public Point3D normal
      The unit normal vector perpendicular to the plane surface.
    • distance

      public double distance
      The signed distance from the origin to the plane along the normal.
  • Constructor Details

    • Plane

      public Plane(Point3D normal, double distance)
      Creates a plane with the given normal and distance.
      Parameters:
      normal - the unit normal vector
      distance - the signed distance from origin to the plane
  • Method Details

    • fromPoints

      public static Plane fromPoints(Point3D a, Point3D b, Point3D c)
      Creates a plane from three non-collinear points.
      Parameters:
      a - the first point on the plane
      b - the second point on the plane
      c - the third point on the plane
      Returns:
      a new Plane passing through the three points
    • clone

      public Plane clone()
      Creates a deep clone of this plane.
      Overrides:
      clone in class Object
      Returns:
      a new Plane with the same normal and distance
    • flip

      public void flip()
      Flips the plane orientation by negating the normal and distance.
    • splitPolygon

      public void splitPolygon(SolidPolygon polygon, List<SolidPolygon> coplanarFront, List<SolidPolygon> coplanarBack, List<SolidPolygon> front, List<SolidPolygon> back)
      Splits a polygon by this plane, classifying and potentially dividing it.
      Parameters:
      polygon - the polygon to classify and potentially split
      coplanarFront - list to receive coplanar polygons with same-facing normals
      coplanarBack - list to receive coplanar polygons with opposite-facing normals
      front - list to receive polygons in the front half-space
      back - list to receive polygons in the back half-space