Interface ElementPolygon
- All Superinterfaces:
Element
,InteractionSource
- All Known Implementing Classes:
ElementPolygon
Title: ElementPolygon
Description: A 3D polygon.
Polygons can be closed (a real polygon) or open (polylines).- Version:
- March 2005
- Author:
- Francisco Esquembre
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.opensourcephysics.display3d.core.Element
Element.Loader
-
Field Summary
Fields inherited from interface org.opensourcephysics.display3d.core.Element
TARGET_POSITION, TARGET_SIZE
-
Method Summary
Modifier and TypeMethodDescriptiondouble[][]
getData()
Gets ths data of the points fo the polygonboolean
isClosed()
Gets whether the polygon is closedvoid
setClosed
(boolean closed) Sets whether the polygon is closedvoid
setData
(double[][] data) Sets the data for the points of the polygon.void
setData
(double[] xArray, double[] yArray, double[] zArray) Sets the data for the points of the polygon.Methods inherited from interface org.opensourcephysics.display3d.core.Element
getDrawingPanel3D, 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
-
Method Details
-
setClosed
void setClosed(boolean closed) Sets whether the polygon is closed- Parameters:
closed
- boolean
-
isClosed
boolean isClosed()Gets whether the polygon is closed- Returns:
- boolean
-
setData
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).- Parameters:
data
- double[][] the double[nPoints][3] array with the data
-
setData
void setData(double[] xArray, double[] yArray, double[] zArray) 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 the setData() method is invoked. If the arrays have different lengths, the last element of the shortest array is repeated to match the longest array.- Parameters:
xArray
- double[] the double[nPoints] array with the X coordinatesyArray
- double[] the double[nPoints] array with the Y coordinateszArray
- double[] the double[nPoints] array with the Z coordinates
-
getData
double[][] getData()Gets ths data of the points fo the polygon- Returns:
- double[][] the double[nPoints][3] array with the data
-