Package mgui.geometry

Class Box3D

java.lang.Object
mgui.geometry.Shape3D
mgui.geometry.Box3D
All Implemented Interfaces:
java.lang.Cloneable, Shape, XMLObject
Direct Known Subclasses:
Grid3D

public class Box3D
extends Shape3D
Box in R3 with base point and three orthogonal axis vectors (denoted by S, T, and R, respectively).
Since:
1.0
Version:
1.0
Author:
Andrew Reid
  • Field Details

    • sAxis

      protected org.jogamp.vecmath.Vector3f sAxis
    • tAxis

      protected org.jogamp.vecmath.Vector3f tAxis
    • rAxis

      protected org.jogamp.vecmath.Vector3f rAxis
    • basePt

      protected org.jogamp.vecmath.Point3f basePt
  • Constructor Details

    • Box3D

      public Box3D()
    • Box3D

      public Box3D​(org.jogamp.vecmath.Point3f basept, org.jogamp.vecmath.Vector3f saxis, org.jogamp.vecmath.Vector3f taxis, org.jogamp.vecmath.Vector3f raxis)
    • Box3D

      public Box3D​(Box3D copy)
  • Method Details

    • setFromBox

      public void setFromBox​(Box3D copy)
    • getEdges

      public org.jogamp.vecmath.Point3f[][] getEdges()
      Returns a set of edges from this box. Dimension of return array is [12][2]
      Returns:
    • setSAxis

      public void setSAxis​(org.jogamp.vecmath.Vector3f axis)
    • setSDim

      public void setSDim​(float d)
    • setTAxis

      public void setTAxis​(org.jogamp.vecmath.Vector3f axis)
    • setTDim

      public void setTDim​(float d)
    • setRAxis

      public void setRAxis​(org.jogamp.vecmath.Vector3f axis)
    • setRDim

      public void setRDim​(float d)
    • getSDim

      public float getSDim()
      Returns the geometric size of the x (S) dimension
      Returns:
    • getTDim

      public float getTDim()
      Returns the geometric size of the y (T) dimension
      Returns:
    • getRDim

      public float getRDim()
      Returns the geometric size of the z (R) dimension
      Returns:
    • setBasePt

      public void setBasePt​(org.jogamp.vecmath.Point3f p)
    • getBasisTransform

      public org.jogamp.vecmath.Matrix4f getBasisTransform()
      Returns a matrix which will transform a vector expressed in world (model) coordinates to one expressed with respect to this box's coordinate space. Note that basis vectors must be orthonormal for this to return a valid coordinate. TODO implement a general function to transform into any coordinate space (including non-orthonormal)
      Returns:
    • setFromBasisTransform

      public void setFromBasisTransform​(org.jogamp.vecmath.Matrix4f T, float s_dim, float t_dim, float r_dim)
      Sets the axes and origin from the specified matrix T, and the three dimensions
      Parameters:
      T - Basis transform
      s_dim - Dimension of box in S
      t_dim - Dimension of box in T
      r_dim - Dimension of box in R
    • getCenter

      public org.jogamp.vecmath.Point3f getCenter()
      Overrides:
      getCenter in class Shape3D
    • getSide

      public java.util.ArrayList<org.jogamp.vecmath.Point3f> getSide​(int which, int dir)
      Returns 4 points representing a side of this box.
      Parameters:
      which - side relative to base point. 0 is same side as b.p., 1 is opposite
      dir - axis normal to the side. 0 = sAxis, 1 = tAxis, 2 = rAxis
      Returns:
      ArrayList of 4 points
    • getBasePt

      public org.jogamp.vecmath.Point3f getBasePt()
      Returns a copy of this box's base point.
      Returns:
    • getSAxis

      public org.jogamp.vecmath.Vector3f getSAxis()
      Returns a copy of this box's S-axis (analogous to X-axis).
      Returns:
    • getTAxis

      public org.jogamp.vecmath.Vector3f getTAxis()
      Returns a copy of this box's T-axis (analogous to Y-axis).
      Returns:
    • getRAxis

      public org.jogamp.vecmath.Vector3f getRAxis()
      Returns a copy of this box's R-axis (analogous to Z-axis).
      Returns:
    • getCoords

      public float[] getCoords()
      Specified by:
      getCoords in interface Shape
      Specified by:
      getCoords in class Shape3D
    • getVertex

      public org.jogamp.vecmath.Point3f getVertex​(int i)
      Description copied from class: Shape3D
      Returns the vertex at the specified index as a Point3f. This vertex is a copy, so operations performed on it will not affect this shape.

      Note: subclasses may want to provide a more efficient implementation of this method.

      Specified by:
      getVertex in class Shape3D
      Returns:
    • setCoords

      public void setCoords​(float[] coords)
      Specified by:
      setCoords in interface Shape
      Specified by:
      setCoords in class Shape3D
    • contains

      public boolean contains​(org.jogamp.vecmath.Point3f p)
      Description copied from class: Shape3D
      Determines whether this shape contains point. Whether this shape can contain a point is particular to the subclass.
      Overrides:
      contains in class Shape3D
      Returns:
      true if this shape contains point; false otherwise.
    • getNonzeroAxes

      protected org.jogamp.vecmath.Vector3f[] getNonzeroAxes()
    • getVertices

      public java.util.ArrayList<org.jogamp.vecmath.Point3f> getVertices()
      Description copied from class: Shape3D
      Returns a list of this shape's nodes as Point3f's. This list is a copy, so operations performed on these nodes will not affect this shape.
      Specified by:
      getVertices in class Shape3D
      Returns:
    • setVertices

      public void setVertices​(java.util.ArrayList<org.jogamp.vecmath.Point3f> vertices)
      Specified by:
      setVertices in class Shape3D
    • clone

      public java.lang.Object clone()
      Overrides:
      clone in class Shape3D
    • getLocalName

      public java.lang.String getLocalName()
      Description copied from interface: XMLObject
      Returns the local name associated with this XML object.
      Specified by:
      getLocalName in interface XMLObject
      Overrides:
      getLocalName in class Shape3D
      Returns:
    • getOppPt

      public org.jogamp.vecmath.Point3f getOppPt()
    • getMinPt

      public org.jogamp.vecmath.Point3f getMinPt()
    • getMaxPt

      public org.jogamp.vecmath.Point3f getMaxPt()
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object