Package mgui.geometry
Class Plane3D
java.lang.Object
mgui.geometry.Shape3D
mgui.geometry.Plane3D
public class Plane3D extends Shape3D
Represents a plane in 3 dimensions, using a Point3d and a Vector3d (normal)
- 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 boolean
flip_normal
org.jogamp.vecmath.Point3f
origin
org.jogamp.vecmath.Vector3f
xAxis
org.jogamp.vecmath.Vector3f
yAxis
Fields inherited from class mgui.geometry.Shape3D
xml_count, xml_current_block, xml_encoding, xml_itr, xml_vertices
-
Constructor Summary
Constructors Constructor Description Plane3D()
Plane3D(Plane3D plane)
Plane3D(org.jogamp.vecmath.Point3f pt1, org.jogamp.vecmath.Point3f pt2, org.jogamp.vecmath.Point3f pt3)
Plane3D(org.jogamp.vecmath.Point3f pt, org.jogamp.vecmath.Vector3f x, org.jogamp.vecmath.Vector3f y)
Plane3D(org.jogamp.vecmath.Point3f pt, org.jogamp.vecmath.Vector3f x, org.jogamp.vecmath.Vector3f y, boolean flip_normal)
-
Method Summary
Modifier and Type Method Description java.lang.Object
clone()
org.jogamp.vecmath.Vector4d
getAsVector4d()
Return plane as a Vector4d defining the plane equation:org.jogamp.vecmath.Vector3f
getAxisX()
org.jogamp.vecmath.Vector3f
getAxisY()
float[]
getCoords()
java.lang.String
getLocalName()
Returns the local name associated with this XML object.org.jogamp.vecmath.Vector3f
getNormal()
Returns the normal vector, as a unit vector, for this plane.org.jogamp.vecmath.Point3f
getOrigin()
static Plane3D
getPlaneFromNormalAndY(org.jogamp.vecmath.Point3f x0, org.jogamp.vecmath.Vector3f normal)
Return a plane containing pointx0
, having normalnormal
, and having a Y axis which is (0, 1, 0) projected onto the plane.static Plane3D
getPlaneFromNormalAndY(org.jogamp.vecmath.Point3f x0, org.jogamp.vecmath.Vector3f normal, org.jogamp.vecmath.Vector3f Y)
Return a plane containing pointx0
, having normalnormal
, and having a Y axis which isY
projected onto the plane.org.jogamp.vecmath.Point3f
getVertex(int index)
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.java.lang.String
getXML(int tab)
Returns this object's XML representation as a single string.void
handleXMLElementEnd(java.lang.String localName)
Handles the end of an XML element.void
handleXMLElementStart(java.lang.String localName, org.xml.sax.Attributes attributes, XMLObject.XMLType type)
Handles the start of an XML element.void
handleXMLString(java.lang.String s)
Handles a string within an XML element.void
setAxisX(org.jogamp.vecmath.Vector3f v)
void
setAxisY(org.jogamp.vecmath.Vector3f v)
void
setCoords(float[] f)
void
setOrigin(org.jogamp.vecmath.Point3f p)
void
setVertices(java.util.ArrayList<org.jogamp.vecmath.Point3f> n)
java.lang.String
toString()
protected void
writeCoords(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progress_bar)
Writes this shape's coordinates, according the parameters inoptions
void
writeXML(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progress_bar)
Writes the XML representation of this object to file.Methods inherited from class mgui.geometry.Shape3D
contains, getBoundBox, getCenter, getDTD, getProximity, getProximityPoint, getShortXML, getSize, getXML, getXMLSchema, loadAsciiCoords, loadBinaryCoords, loadCoords, loadXMLCoord, setVertices, transform, transform, writeAsciiCoords, writeBinaryCoords, writeXML, writeXML
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Field Details
-
origin
public org.jogamp.vecmath.Point3f origin -
xAxis
public org.jogamp.vecmath.Vector3f xAxis -
yAxis
public org.jogamp.vecmath.Vector3f yAxis -
flip_normal
public boolean flip_normal
-
-
Constructor Details
-
Plane3D
public Plane3D() -
Plane3D
public Plane3D(org.jogamp.vecmath.Point3f pt, org.jogamp.vecmath.Vector3f x, org.jogamp.vecmath.Vector3f y) -
Plane3D
public Plane3D(org.jogamp.vecmath.Point3f pt, org.jogamp.vecmath.Vector3f x, org.jogamp.vecmath.Vector3f y, boolean flip_normal) -
Plane3D
-
Plane3D
public Plane3D(org.jogamp.vecmath.Point3f pt1, org.jogamp.vecmath.Point3f pt2, org.jogamp.vecmath.Point3f pt3)
-
-
Method Details
-
getOrigin
public org.jogamp.vecmath.Point3f getOrigin() -
setOrigin
public void setOrigin(org.jogamp.vecmath.Point3f p) -
getAxisX
public org.jogamp.vecmath.Vector3f getAxisX() -
getAxisY
public org.jogamp.vecmath.Vector3f getAxisY() -
setAxisX
public void setAxisX(org.jogamp.vecmath.Vector3f v) -
setAxisY
public void setAxisY(org.jogamp.vecmath.Vector3f v) -
getPlaneFromNormalAndY
public static Plane3D getPlaneFromNormalAndY(org.jogamp.vecmath.Point3f x0, org.jogamp.vecmath.Vector3f normal)Return a plane containing pointx0
, having normalnormal
, and having a Y axis which is (0, 1, 0) projected onto the plane.- Parameters:
x0
-normal
-- Returns:
-
getPlaneFromNormalAndY
public static Plane3D getPlaneFromNormalAndY(org.jogamp.vecmath.Point3f x0, org.jogamp.vecmath.Vector3f normal, org.jogamp.vecmath.Vector3f Y)Return a plane containing pointx0
, having normalnormal
, and having a Y axis which isY
projected onto the plane.- Parameters:
x0
-normal
-Y
-- Returns:
-
getNormal
public org.jogamp.vecmath.Vector3f getNormal()Returns the normal vector, as a unit vector, for this plane.- Returns:
-
getAsVector4d
public org.jogamp.vecmath.Vector4d getAsVector4d()Return plane as a Vector4d defining the plane equation:Ax + By + Cz + D = 0
- Returns:
-
clone
public java.lang.Object clone() -
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
getXML
public java.lang.String getXML(int tab)Description copied from interface:XMLObject
Returns this object's XML representation as a single string. NOTE: this is not feasible for larger objects and containers, thus may not be implemented for these objects. Use theXMLObject.writeXML(int,java.io.Writer,mgui.io.standard.xml.XMLOutputOptions,mgui.interfaces.ProgressUpdater)
functions to write larger objects to file. -
writeXML
public void writeXML(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progress_bar) throws java.io.IOExceptionDescription copied from interface:XMLObject
Writes the XML representation of this object to file. The basic contract for this method is that it should not write a newline character at its start or end. The default format ofXMLFormat.Ascii
will be used.- Specified by:
writeXML
in interfaceXMLObject
- Overrides:
writeXML
in classShape3D
- Parameters:
tab
- The number of tabs to place before the XML textwriter
- The writeroptions
- XMLOutputOptions defining the write parametersprogress_bar
- Optional progress updater (may benull
)- Throws:
java.io.IOException
-
writeCoords
protected void writeCoords(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progress_bar) throws java.io.IOExceptionDescription copied from class:Shape3D
Writes this shape's coordinates, according the parameters inoptions
- Overrides:
writeCoords
in classShape3D
- Throws:
java.io.IOException
-
handleXMLElementEnd
public void handleXMLElementEnd(java.lang.String localName)Description copied from interface:XMLObject
Handles the end of an XML element.- Specified by:
handleXMLElementEnd
in interfaceXMLObject
- Overrides:
handleXMLElementEnd
in classShape3D
- Parameters:
localName
- Local name of the element
-
handleXMLElementStart
public void handleXMLElementStart(java.lang.String localName, org.xml.sax.Attributes attributes, XMLObject.XMLType type)Description copied from interface:XMLObject
Handles the start of an XML element.- Specified by:
handleXMLElementStart
in interfaceXMLObject
- Overrides:
handleXMLElementStart
in classShape3D
- Parameters:
localName
- Local name of the elementattributes
- Set of element attributestype
- TheXMLType
of this element
-
handleXMLString
public void handleXMLString(java.lang.String s)Description copied from interface:XMLObject
Handles a string within an XML element.- Specified by:
handleXMLString
in interfaceXMLObject
- Overrides:
handleXMLString
in classShape3D
- Parameters:
s
- String to handle
-
getLocalName
public java.lang.String getLocalName()Description copied from interface:XMLObject
Returns the local name associated with this XML object.- Specified by:
getLocalName
in interfaceXMLObject
- Overrides:
getLocalName
in classShape3D
- Returns:
-
getCoords
public float[] getCoords() -
getVertex
public org.jogamp.vecmath.Point3f getVertex(int index)Description copied from class:Shape3D
Returns 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.
-
getVertices
public java.util.ArrayList<org.jogamp.vecmath.Point3f> getVertices()Description copied from class:Shape3D
Returns 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:
getVertices
in classShape3D
- Returns:
-
setCoords
public void setCoords(float[] f) -
setVertices
public void setVertices(java.util.ArrayList<org.jogamp.vecmath.Point3f> n)- Specified by:
setVertices
in classShape3D
-