Package mgui.geometry

Class Plane3D

java.lang.Object
mgui.geometry.Shape3D
mgui.geometry.Plane3D
All Implemented Interfaces:
java.lang.Cloneable, Shape, XMLObject

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
  • 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

      public Plane3D​(Plane3D plane)
    • 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 point x0, having normal normal, 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 point x0, having normal normal, and having a Y axis which is Y 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()
      Overrides:
      clone in class Shape3D
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.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 the XMLObject.writeXML(int,java.io.Writer,mgui.io.standard.xml.XMLOutputOptions,mgui.interfaces.ProgressUpdater) functions to write larger objects to file.
      Specified by:
      getXML in interface XMLObject
      Overrides:
      getXML in class Shape3D
      Parameters:
      tab - The number of tabs to place before the opening XML wrapper
      Returns:
    • writeXML

      public void writeXML​(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progress_bar) throws java.io.IOException
      Description 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 of XMLFormat.Ascii will be used.
      Specified by:
      writeXML in interface XMLObject
      Overrides:
      writeXML in class Shape3D
      Parameters:
      tab - The number of tabs to place before the XML text
      writer - The writer
      options - XMLOutputOptions defining the write parameters
      progress_bar - Optional progress updater (may be null)
      Throws:
      java.io.IOException
    • writeCoords

      protected void writeCoords​(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progress_bar) throws java.io.IOException
      Description copied from class: Shape3D
      Writes this shape's coordinates, according the parameters in options
      Overrides:
      writeCoords in class Shape3D
      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 interface XMLObject
      Overrides:
      handleXMLElementEnd in class Shape3D
      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 interface XMLObject
      Overrides:
      handleXMLElementStart in class Shape3D
      Parameters:
      localName - Local name of the element
      attributes - Set of element attributes
      type - The XMLType 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 interface XMLObject
      Overrides:
      handleXMLString in class Shape3D
      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 interface XMLObject
      Overrides:
      getLocalName in class Shape3D
      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 index)
      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:
    • 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:
    • setCoords

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

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