Class OrientedBox

All Implemented Interfaces:
Pickable, Hintable, Renderable, Savable

public class OrientedBox extends Mesh
This primitive represents a box that has options to orient it according to its X/Y/Z axis. It is used to create an OrientedBoundingBox mostly.
  • Field Details

    • _center

      protected Vector3 _center
      Center of the Oriented Box.
    • _xAxis

      protected Vector3 _xAxis
      X axis of the Oriented Box.
    • _yAxis

      protected Vector3 _yAxis
      Y axis of the Oriented Box.
    • _zAxis

      protected Vector3 _zAxis
      Z axis of the Oriented Box.
    • _extent

      protected Vector3 _extent
      Extents of the box along the x,y,z axis.
    • _texTopRight

      protected Vector2 _texTopRight
      Texture coordintae values for the corners of the box.
    • _texTopLeft

      protected Vector2 _texTopLeft
      Texture coordintae values for the corners of the box.
    • _texBotRight

      protected Vector2 _texBotRight
      Texture coordintae values for the corners of the box.
    • _texBotLeft

      protected Vector2 _texBotLeft
      Texture coordintae values for the corners of the box.
    • _vectorStore

      public Vector3[] _vectorStore
      Vector array used to store the array of 8 corners the box has.
    • _correctCorners

      public boolean _correctCorners
      If true, the box's vectorStore array correctly represnts the box's corners.
  • Constructor Details

    • OrientedBox

      public OrientedBox()
    • OrientedBox

      public OrientedBox(String name)
      Creates a new OrientedBox with the given name.
      Parameters:
      name - The name of the new box.
  • Method Details

    • computeInformation

      public void computeInformation()
      Takes the plane and center information and creates the correct vertex,normal,color,texture,index information to represent the OrientedBox.
    • computeCorners

      public void computeCorners()
      Sets the vectorStore information to the 8 corners of the box.
    • getCenter

      public Vector3 getCenter()
      Returns the center of the box.
      Returns:
      The box's center.
    • setCenter

      public void setCenter(Vector3 center)
      Sets the box's center to the given value. Shallow copy only.
      Parameters:
      center - The box's new center.
    • getExtent

      public Vector3 getExtent()
      Returns the box's extent vector along the x,y,z.
      Returns:
      The box's extent vector.
    • setExtent

      public void setExtent(Vector3 extent)
      Sets the box's extent vector to the given value. Shallow copy only.
      Parameters:
      extent - The box's new extent.
    • getxAxis

      public Vector3 getxAxis()
      Returns the x axis of this box.
      Returns:
      This OB's x axis.
    • setXAxis

      public void setXAxis(Vector3 xAxis)
      Sets the x axis of this OB. Shallow copy.
      Parameters:
      xAxis - The new x axis.
    • getYAxis

      public Vector3 getYAxis()
      Gets the Y axis of this OB.
      Returns:
      This OB's Y axis.
    • setYAxis

      public void setYAxis(Vector3 yAxis)
      Sets the Y axis of this OB. Shallow copy.
      Parameters:
      yAxis - The new Y axis.
    • getZAxis

      public Vector3 getZAxis()
      Returns the Z axis of this OB.
      Returns:
      The Z axis.
    • setZAxis

      public void setZAxis(Vector3 zAxis)
      Sets the Z axis of this OB. Shallow copy.
      Parameters:
      zAxis - The new Z axis.
    • isCorrectCorners

      public boolean isCorrectCorners()
      Returns if the corners are set corectly.
      Returns:
      True if the vectorStore is correct.
    • 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: