org.opensourcephysics.display3d.core
Interface ElementPolygon

All Superinterfaces:
Element, InteractionSource
All Known Implementing Classes:
ElementPolygon

public interface ElementPolygon
extends Element

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
static class ElementPolygon.ElementPolygonLoader
           
 
Nested 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
 double[][] getData()
          Gets ths data of the points fo the polygon
 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.
 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 Detail

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 coordinates
yArray - double[] the double[nPoints] array with the Y coordinates
zArray - 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