java.lang.Object
eu.svjatoslav.sixth.e3d.geometry.Box
All Implemented Interfaces:
Cloneable

public class Box extends Object implements Cloneable
Same as: 3D rectangle, rectangular box, rectangular parallelopiped, cuboid, rhumboid, hexahedron, rectangular prism.
  • Field Details

    • p1

      public final Point3D p1
      The first point of the box.
    • p2

      public final Point3D p2
      The second point of the box.
  • Constructor Details

    • Box

      public Box()
      Creates a new box with two points at the origin.
    • Box

      public Box(Point3D p1, Point3D p2)
      Creates a new box with two points at the specified coordinates.
  • Method Details

    • enlarge

      public Box enlarge(double border)
      Enlarges the box by the specified border in all directions.
      Parameters:
      border - The border to enlarge the box by. If the border is negative, the box will be shrunk.
      Returns:
      The current box.
    • clone

      public Box clone()
      Overrides:
      clone in class Object
    • getDepth

      public double getDepth()
      Returns:
      The depth of the box. The depth is the distance between the two points on the z-axis.
    • getHeight

      public double getHeight()
      Returns:
      The height of the box. The height is the distance between the two points on the y-axis.
    • getWidth

      public double getWidth()
      Returns:
      The width of the box. The width is the distance between the two points on the x-axis.
    • setBoxSize

      public void setBoxSize(Point3D size)
      Sets the size of the box. The box will be centered at the origin. Previous size and position of the box will be lost.
      Parameters:
      size - Point3D specifies box size in x, y and z axis.