org.opensourcephysics.display3d.simple3d
Class ElementPolygon
java.lang.Object
org.opensourcephysics.display3d.simple3d.Element
org.opensourcephysics.display3d.simple3d.ElementPolygon
- All Implemented Interfaces:
- Element, ElementPolygon, org.opensourcephysics.display3d.core.interaction.InteractionSource
- public class ElementPolygon
- extends Element
- implements ElementPolygon
Title: ElementPolygon
Description: A Polygon using the painter's algorithm
Field Summary |
protected org.opensourcephysics.display3d.simple3d.Object3D[] |
closedObject
|
protected org.opensourcephysics.display3d.simple3d.Object3D[] |
lineObjects
|
Method Summary |
double[][] |
getData()
Gets (a copy of) the data of the points for the polygon |
void |
getExtrema(double[] min,
double[] max)
|
static XML.ObjectLoader |
getLoader()
Returns an XML.ObjectLoader to save and load object data. |
boolean |
isClosed()
Gets whether the polygon is closed |
void |
setClosed(boolean closed)
Sets whether the polygon is closed |
void |
setData(double[][] data)
Sets the data for the points of the polygon. |
Methods inherited from class org.opensourcephysics.display3d.simple3d.Element |
addInteractionListener, getHotSpotBodyCoordinates, getInteractionTarget, getName, getSizeX, getSizeY, getSizeZ, getStyle, getTargetHit, getTransformation, getX, getY, getZ, isReallyVisible, isVisible, loadUnmutableObjects, removeInteractionListener, setName, setSizeX, setSizeXYZ, setSizeXYZ, setSizeY, setSizeZ, setTransformation, setVisible, setX, setXYZ, setXYZ, setY, setZ, toBodyFrame, toSpaceFrame |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.opensourcephysics.display3d.core.Element |
getName, getSizeX, getSizeY, getSizeZ, getStyle, getTransformation, getX, getY, getZ, isVisible, loadUnmutableObjects, setName, setSizeX, setSizeXYZ, setSizeXYZ, setSizeY, setSizeZ, setTransformation, setVisible, setX, setXYZ, setXYZ, setY, setZ, toBodyFrame, toSpaceFrame |
Methods inherited from interface org.opensourcephysics.display3d.core.interaction.InteractionSource |
addInteractionListener, getInteractionTarget, removeInteractionListener |
lineObjects
protected org.opensourcephysics.display3d.simple3d.Object3D[] lineObjects
closedObject
protected org.opensourcephysics.display3d.simple3d.Object3D[] closedObject
ElementPolygon
public ElementPolygon()
setClosed
public void setClosed(boolean closed)
- Description copied from interface:
ElementPolygon
- Sets whether the polygon is closed
- Specified by:
setClosed
in interface ElementPolygon
- Parameters:
closed
- boolean
isClosed
public boolean isClosed()
- Description copied from interface:
ElementPolygon
- Gets whether the polygon is closed
- Specified by:
isClosed
in interface ElementPolygon
- Returns:
- boolean
setData
public void setData(double[][] data)
- Sets the data for the points of the polygon.
Each entry in the data array corresponds to one vertex.
If the polygon is closed, the last point will be connected
to the first one and the interior will be filled
(unless the fill color of the style is set to null).
The data array is copied, so subsequence changes to the original
array do not affect the polygon, until this setData() methos is invoked.
- Specified by:
setData
in interface ElementPolygon
- Parameters:
data
- double[][] the double[nPoints][3] array with the data
getData
public double[][] getData()
- Gets (a copy of) the data of the points for the polygon
- Specified by:
getData
in interface ElementPolygon
- Returns:
- double[][] the double[nPoints][3] array with the data
getExtrema
public void getExtrema(double[] min,
double[] max)
- Parameters:
min
- double[] A previously allocated double[3] array that will hold
the minimum pointmax
- double[] A previously allocated double[3] array that will hold
the maximum point
getLoader
public static XML.ObjectLoader getLoader()
- Returns an XML.ObjectLoader to save and load object data.
- Returns:
- the XML.ObjectLoader