Class QuadBox

All Implemented Interfaces:
Pickable, Hintable, Renderable, Savable

public class QuadBox extends Mesh
QuadBox is an axis-aligned rectangular prism defined by a center point and x, y, and z extents from that center (essentially radii.)
  • Constructor Details

    • QuadBox

      public QuadBox()
      Constructs a new 1x1x1 QuadBox.
    • QuadBox

      public QuadBox(String name)
      Constructs a new 1x1x1 QuadBox with the given name.
      Parameters:
      name - the name to give this new box. This is required for identification and comparison purposes.
    • QuadBox

      public QuadBox(String name, ReadOnlyVector3 pntA, ReadOnlyVector3 pntB)
      Constructs a new QuadBox object using the given two points as opposite corners of the box. These two points may be in any order.
      Parameters:
      name - the name to give this new box. This is required for identification and comparison purposes.
      pntA - the first point
      pntB - the second point.
    • QuadBox

      public QuadBox(String name, ReadOnlyVector3 center, double xExtent, double yExtent, double zExtent)
      Constructs a new QuadBox object using the given center and extents. Since the extents represent the distance from the center of the box to the edge, the full length of a side is actually 2 * extent.
      Parameters:
      name - the name to give this new box. This is required for identification and comparison purposes.
      center - Center of the box.
      xExtent - x extent of the box
      yExtent - y extent of the box
      zExtent - z extent of the box
  • Method Details

    • getCenter

      public ReadOnlyVector3 getCenter()
      Returns:
      the current center of this box.
    • getXExtent

      public double getXExtent()
      Returns:
      the current X extent of this box.
    • getYExtent

      public double getYExtent()
      Returns:
      the current Y extent of this box.
    • getZExtent

      public double getZExtent()
      Returns:
      the current Z extent of this box.
    • setData

      public void setData(ReadOnlyVector3 pntA, ReadOnlyVector3 pntB)
      Updates the center point and extents of this box to match an axis-aligned box defined by the two given opposite corners.
      Parameters:
      pntA - the first point
      pntB - the second point.
    • setData

      public void setData(ReadOnlyVector3 center, double xExtent, double yExtent, double zExtent)
      Updates the center point and extents of this box using the defined values.
      Parameters:
      center - The center of the box.
      xExtent - x extent of the box
      yExtent - y extent of the box
      zExtent - z extent of the box
    • setVertexData

      protected void setVertexData()
      setVertexData sets the vertex positions that define the box using the center point and defined extents.
    • clone

      public QuadBox clone()
      clone creates a new QuadBox object containing the same data as this one.
      Overrides:
      clone in class Object
      Returns:
      the new QuadBox
    • computeVertices

      public Vector3[] computeVertices()
      Returns:
      a size 8 array of Vectors representing the 8 points of the box.
    • write

      public void write(OutputCapsule capsule) throws IOException
      Specified by:
      write in interface Savable
      Overrides:
      write in class Mesh
      Parameters:
      capsule - the capsule
      Throws:
      IOException - Signals that an I/O exception has occurred.
      See Also:
    • read

      public void read(InputCapsule capsule) throws IOException
      Specified by:
      read in interface Savable
      Overrides:
      read in class Mesh
      Parameters:
      capsule - the input capsule
      Throws:
      IOException - Signals that an I/O exception has occurred.
      See Also: