Package mgui.geometry
Class Box3D
java.lang.Object
mgui.geometry.Shape3D
mgui.geometry.Box3D
- 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
-
Nested Class Summary
Nested classes/interfaces inherited from interface mgui.interfaces.xml.XMLObject
XMLObject.XMLEncoding, XMLObject.XMLType -
Field Summary
Fields Modifier and Type Field Description protected org.jogamp.vecmath.Point3fbasePtprotected org.jogamp.vecmath.Vector3frAxisprotected org.jogamp.vecmath.Vector3fsAxisprotected org.jogamp.vecmath.Vector3ftAxisFields inherited from class mgui.geometry.Shape3D
xml_count, xml_current_block, xml_encoding, xml_itr, xml_vertices -
Constructor Summary
-
Method Summary
Modifier and Type Method Description java.lang.Objectclone()booleancontains(org.jogamp.vecmath.Point3f p)Determines whether this shape containspoint.org.jogamp.vecmath.Point3fgetBasePt()Returns a copy of this box's base point.org.jogamp.vecmath.Matrix4fgetBasisTransform()Returns a matrix which will transform a vector expressed in world (model) coordinates to one expressed with respect to this box's coordinate space.org.jogamp.vecmath.Point3fgetCenter()float[]getCoords()org.jogamp.vecmath.Point3f[][]getEdges()Returns a set of edges from this box.java.lang.StringgetLocalName()Returns the local name associated with this XML object.org.jogamp.vecmath.Point3fgetMaxPt()org.jogamp.vecmath.Point3fgetMinPt()protected org.jogamp.vecmath.Vector3f[]getNonzeroAxes()org.jogamp.vecmath.Point3fgetOppPt()org.jogamp.vecmath.Vector3fgetRAxis()Returns a copy of this box's R-axis (analogous to Z-axis).floatgetRDim()Returns the geometric size of the z (R) dimensionorg.jogamp.vecmath.Vector3fgetSAxis()Returns a copy of this box's S-axis (analogous to X-axis).floatgetSDim()Returns the geometric size of the x (S) dimensionjava.util.ArrayList<org.jogamp.vecmath.Point3f>getSide(int which, int dir)Returns 4 points representing a side of this box.org.jogamp.vecmath.Vector3fgetTAxis()Returns a copy of this box's T-axis (analogous to Y-axis).floatgetTDim()Returns the geometric size of the y (T) dimensionorg.jogamp.vecmath.Point3fgetVertex(int i)Returns the vertex at the specified index as aPoint3f.java.util.ArrayList<org.jogamp.vecmath.Point3f>getVertices()Returns a list of this shape's nodes asPoint3f's.voidsetBasePt(org.jogamp.vecmath.Point3f p)voidsetCoords(float[] coords)voidsetFromBasisTransform(org.jogamp.vecmath.Matrix4f T, float s_dim, float t_dim, float r_dim)Sets the axes and origin from the specified matrixT, and the three dimensionsvoidsetFromBox(Box3D copy)voidsetRAxis(org.jogamp.vecmath.Vector3f axis)voidsetRDim(float d)voidsetSAxis(org.jogamp.vecmath.Vector3f axis)voidsetSDim(float d)voidsetTAxis(org.jogamp.vecmath.Vector3f axis)voidsetTDim(float d)voidsetVertices(java.util.ArrayList<org.jogamp.vecmath.Point3f> vertices)java.lang.StringtoString()Methods inherited from class mgui.geometry.Shape3D
getBoundBox, getDTD, getProximity, getProximityPoint, getShortXML, getSize, getXML, getXML, getXMLSchema, handleXMLElementEnd, handleXMLElementStart, handleXMLString, loadAsciiCoords, loadBinaryCoords, loadCoords, loadXMLCoord, setVertices, transform, transform, writeAsciiCoords, writeBinaryCoords, writeCoords, writeXML, writeXML, writeXMLMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
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
-
-
Method Details
-
setFromBox
-
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 matrixT, and the three dimensions- Parameters:
T- Basis transforms_dim- Dimension of box in St_dim- Dimension of box in Tr_dim- Dimension of box in R
-
getCenter
public org.jogamp.vecmath.Point3f getCenter() -
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 oppositedir- 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() -
getVertex
public org.jogamp.vecmath.Point3f getVertex(int i)Description copied from class:Shape3DReturns the vertex at the specified index as aPoint3f. 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.
-
setCoords
public void setCoords(float[] coords) -
contains
public boolean contains(org.jogamp.vecmath.Point3f p)Description copied from class:Shape3DDetermines whether this shape containspoint. Whether this shape can contain a point is particular to the subclass. -
getNonzeroAxes
protected org.jogamp.vecmath.Vector3f[] getNonzeroAxes() -
getVertices
public java.util.ArrayList<org.jogamp.vecmath.Point3f> getVertices()Description copied from class:Shape3DReturns a list of this shape's nodes asPoint3f's. This list is a copy, so operations performed on these nodes will not affect this shape.- Specified by:
getVerticesin classShape3D- Returns:
-
setVertices
public void setVertices(java.util.ArrayList<org.jogamp.vecmath.Point3f> vertices)- Specified by:
setVerticesin classShape3D
-
clone
public java.lang.Object clone() -
getLocalName
public java.lang.String getLocalName()Description copied from interface:XMLObjectReturns the local name associated with this XML object.- Specified by:
getLocalNamein interfaceXMLObject- Overrides:
getLocalNamein classShape3D- 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:
toStringin classjava.lang.Object
-