Class SolidPolygonRectangularBox

Direct Known Subclasses:
SolidPolygonCube

public class SolidPolygonRectangularBox extends AbstractCompositeShape
A solid (filled) rectangular box composed of 12 triangular polygons (2 per face, covering all 6 faces).

The box is defined by two diagonally opposite corner points in 3D space. The box is axis-aligned, meaning its edges are parallel to the X, Y, and Z axes.

Vertex layout:

         cornerB (max) ────────┐
              /│              /│
             / │             / │
            /  │            /  │
           ┌───┼───────────┐   │
           │   │           │   │
           │   │           │   │
           │   └───────────│───┘
           │  /            │  /
           │ /             │ /
           │/              │/
           └───────────────┘ cornerA (min)
 

The eight vertices are derived from the two corner points:

  • Corner A defines minimum X, Y, Z
  • Corner B defines maximum X, Y, Z
  • The other 6 vertices are computed from combinations of these coordinates

Usage examples:


 // Create a box from two opposite corners
 SolidPolygonRectangularBox box = new SolidPolygonRectangularBox(
     new Point3D(-50, -25, 100),  // cornerA (minimum X, Y, Z)
     new Point3D(50, 25, 200),    // cornerB (maximum X, Y, Z)
     Color.BLUE
 );

 // Create a cube using center + size (see SolidPolygonCube for convenience)
 double size = 50;
 SolidPolygonRectangularBox cube = new SolidPolygonRectangularBox(
     new Point3D(0 - size, 0 - size, 200 - size),  // cornerA
     new Point3D(0 + size, 0 + size, 200 + size),  // cornerB
     Color.RED
 );
 
See Also:
  • Constructor Details

    • SolidPolygonRectangularBox

      public SolidPolygonRectangularBox(Point3D cornerA, Point3D cornerB, Color color)
      Constructs a solid rectangular box between two diagonally opposite corner points in 3D space.

      The box is axis-aligned and fills the rectangular region between the two corners. The corner points do not need to be ordered (cornerA can have larger coordinates than cornerB); the constructor will determine the actual min/max bounds automatically.

      Parameters:
      cornerA - the first corner point (any of the 8 corners)
      cornerB - the diagonally opposite corner point
      color - the fill color applied to all 12 triangular polygons