Class Parallelepiped

All Implemented Interfaces:
BoundarySource<PlaneConvexSubset>, HyperplaneBoundedRegion<Vector3D>, Splittable<Vector3D, HyperplaneBoundedRegion<Vector3D>>, Region<Vector3D>, Sized, BoundarySource3D, Linecastable3D

public final class Parallelepiped extends ConvexVolume
Class representing parallelepipeds, i.e. 3 dimensional figures formed by six parallelograms. For example, cubes and rectangular prisms are parallelepipeds.
See Also:
  • Method Details

    • unitCube

      public static Parallelepiped unitCube(org.apache.commons.numbers.core.Precision.DoubleEquivalence precision)
      Construct a new instance representing a unit cube centered at the origin. The vertices of this cube are:
       [
            (-0.5, -0.5, -0.5),
            (0.5, -0.5, -0.5),
            (0.5, 0.5, -0.5),
            (-0.5, 0.5, -0.5),
      
            (-0.5, -0.5, 0.5),
            (0.5, -0.5, 0.5),
            (0.5, 0.5, 0.5),
            (-0.5, 0.5, 0.5)
       ]
       
      Parameters:
      precision - precision context used to construct boundaries
      Returns:
      a new instance representing a unit cube centered at the origin
    • axisAligned

      public static Parallelepiped axisAligned(Vector3D a, Vector3D b, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision)
      Return a new instance representing an axis-aligned parallelepiped, ie, a rectangular prism. The points a and b are taken to represent opposite corner points in the prism and may be specified in any order.
      Parameters:
      a - first corner point in the prism (opposite of b)
      b - second corner point in the prism (opposite of a)
      precision - precision context used to construct boundaries
      Returns:
      a new instance representing an axis-aligned rectangular prism
      Throws:
      IllegalArgumentException - if the width, height, or depth of the defined prism is zero as evaluated by the precision context.
    • fromTransformedUnitCube

      public static Parallelepiped fromTransformedUnitCube(Transform<Vector3D> transform, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision)
      Construct a new instance by transforming a unit cube centered at the origin. The vertices of this input cube are:
       [
            (-0.5, -0.5, -0.5),
            (0.5, -0.5, -0.5),
            (0.5, 0.5, -0.5),
            (-0.5, 0.5, -0.5),
      
            (-0.5, -0.5, 0.5),
            (0.5, -0.5, 0.5),
            (0.5, 0.5, 0.5),
            (-0.5, 0.5, 0.5)
       ]
       
      Parameters:
      transform - transform to apply to the vertices of the unit cube
      precision - precision context used to construct boundaries
      Returns:
      a new instance created by transforming the vertices of a unit cube centered at the origin
      Throws:
      IllegalArgumentException - if the width, height, or depth of the defined shape is zero as evaluated by the precision context.
    • builder

      public static Parallelepiped.Builder builder(org.apache.commons.numbers.core.Precision.DoubleEquivalence precision)
      Return a new Parallelepiped.Builder instance to use for constructing parallelepipeds.
      Parameters:
      precision - precision context used to create boundaries
      Returns:
      a new Parallelepiped.Builder instance