org.opensourcephysics.displayejs
Class InteractiveCylinder

java.lang.Object
  extended by org.opensourcephysics.displayejs.AbstractInteractiveElement
      extended by org.opensourcephysics.displayejs.AbstractInteractiveTile
          extended by org.opensourcephysics.displayejs.InteractiveCylinder
All Implemented Interfaces:
Drawable, Interactive, Measurable, Body, Drawable3D, HasDataObjectInterface, InteractionSource, InteractiveElement, Measurable3D
Direct Known Subclasses:
InteractiveCone, InteractiveSphere

public class InteractiveCylinder
extends AbstractInteractiveTile

This class implements a general 3D Cylinder. The user can specify the three main axes for the Cylinder resultig, for instance in non-straight Cylinders. The Cylinder can be repositioned but cannot be resized.

See Also:
for a simpler 3D Cylinder.

Field Summary
static int USER_DEFINED
           
static int X_AXIS
           
static int Y_AXIS
           
static int Z_AXIS
           
 
Fields inherited from class org.opensourcephysics.displayejs.AbstractInteractiveElement
SENSIBILITY
 
Fields inherited from interface org.opensourcephysics.displayejs.InteractiveElement
TARGET_POSITION, TARGET_SIZE
 
Constructor Summary
InteractiveCylinder()
          Default constructor.
InteractiveCylinder(int direction)
          Constructor for a given direction.
 
Method Summary
 void copyFrom(InteractiveElement _element)
           
 Interactive findInteractive(DrawingPanel _panel, int _xpix, int _ypix)
           
 int getDirection()
          Get the element's main direction.
 int getMaxAngleU()
          Gets the maximum angle used to build the top and bottom sides of the element.
 int getMinAngleU()
          Gets the minimum angle used to build the top and bottom sides of the element.
 boolean isClosedBottom()
          Whether the element is closed at its bottom.
 boolean isClosedLeft()
          Whether the element is closed at its left side.
 boolean isClosedRight()
          Whether the element is closed at its right side.
 boolean isClosedTop()
          Whether the element is closed at its top.
 void setClosedBottom(boolean close)
          Whether the element should be closed at its bottom.
 void setClosedLeft(boolean close)
          Whether an incomplete element should be closed at its left side.
 void setClosedRight(boolean close)
          Whether an incomplete element should be closed at its right side.
 void setClosedTop(boolean close)
          Whether the element should be closed at its top.
 void setCustomAxes(double[] axesData)
          Set custom axes for the element.
 void setDirection(int direction)
          Sets the element's main direction.
 void setMaxAngleU(int angle)
          Sets the maximum angle to build the top and bottom sides of the element.
 void setMinAngleU(int angle)
          Sets the minimum angle to build the top and bottom sides of the element.
 
Methods inherited from class org.opensourcephysics.displayejs.AbstractInteractiveTile
draw, draw, drawQuickly, GetDisplacementFactor, getObjects3D, getXMax, getXMin, getYMax, getYMin, getZMax, getZMin, setColorBelowWhenEqual, setColorOriginAndDirection, setColorRegions, setDisplacementFactor, setDrawQuickInterior, setOrigin, setTransformation, toBodyFrame, toSpaceFrame
 
Methods inherited from class org.opensourcephysics.displayejs.AbstractInteractiveElement
addListener, canBeMeasured, getControl, getDataObject, getGroup, getResolution, getSensitivity, getSet, getSetIndex, getSizeX, getSizeY, getSizeZ, getStyle, getX, getY, getZ, initializeMemberOfSet, invokeActions, isEnabled, isEnabled, isGroupEnabled, isGroupEnabled, isMeasured, isVisible, needsToProject, removeAllListeners, removeListener, setControl, setDataObject, setEnabled, setEnabled, setGroup, setGroupEnabled, setGroupEnabled, setResolution, setSensitivity, setSet, setSizeX, setSizeXY, setSizeXYZ, setSizeY, setSizeZ, setVisible, setX, setXY, setXYZ, setY, setZ, toXML
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

X_AXIS

public static final int X_AXIS
See Also:
Constant Field Values

Y_AXIS

public static final int Y_AXIS
See Also:
Constant Field Values

Z_AXIS

public static final int Z_AXIS
See Also:
Constant Field Values

USER_DEFINED

public static final int USER_DEFINED
See Also:
Constant Field Values
Constructor Detail

InteractiveCylinder

public InteractiveCylinder()
Default constructor. Equals to InteractiveCylinder (InteractiveCylinder.Z_AXIS);


InteractiveCylinder

public InteractiveCylinder(int direction)
Constructor for a given direction.

Parameters:
direction - The direction for the sides of the Cylinder. Must be one of X_AXIS, Y_AXIS, or Z_AXIS.
Method Detail

copyFrom

public void copyFrom(InteractiveElement _element)
Specified by:
copyFrom in interface InteractiveElement
Overrides:
copyFrom in class AbstractInteractiveTile

setMinAngleU

public void setMinAngleU(int angle)
Sets the minimum angle to build the top and bottom sides of the element.

Parameters:
angle - the minimum angle

getMinAngleU

public int getMinAngleU()
Gets the minimum angle used to build the top and bottom sides of the element.

Returns:
the minimum angle

setMaxAngleU

public void setMaxAngleU(int angle)
Sets the maximum angle to build the top and bottom sides of the element.

Parameters:
angle - the maximum angle

getMaxAngleU

public int getMaxAngleU()
Gets the maximum angle used to build the top and bottom sides of the element.

Returns:
the maximum angle

setClosedBottom

public void setClosedBottom(boolean close)
Whether the element should be closed at its bottom.

Parameters:
closed - the desired value

isClosedBottom

public boolean isClosedBottom()
Whether the element is closed at its bottom.

Returns:
the value

setClosedTop

public void setClosedTop(boolean close)
Whether the element should be closed at its top.

Parameters:
closed - the desired value

isClosedTop

public boolean isClosedTop()
Whether the element is closed at its top.

Returns:
the value

setClosedLeft

public void setClosedLeft(boolean close)
Whether an incomplete element should be closed at its left side.

Parameters:
closed - the desired value

isClosedLeft

public boolean isClosedLeft()
Whether the element is closed at its left side.

Returns:
the value

setClosedRight

public void setClosedRight(boolean close)
Whether an incomplete element should be closed at its right side.

Parameters:
closed - the desired value

isClosedRight

public boolean isClosedRight()
Whether the element is closed at its right side.

Returns:
the value

setDirection

public void setDirection(int direction)
Sets the element's main direction.

Parameters:
direction - The direction for the sides of the element. Must be one of X_AXIS, Y_AXIS, or Z_AXIS.

getDirection

public int getDirection()
Get the element's main direction.

Returns:
the direction for the sides of the element. One of X_AXIS, Y_AXIS, or Z_AXIS. If custom axes have been set, then it returns USER_DEFINED.

setCustomAxes

public void setCustomAxes(double[] axesData)
Set custom axes for the element.

Parameters:
axesData - an array of nine doubles, three for each of the axes.

findInteractive

public Interactive findInteractive(DrawingPanel _panel,
                                   int _xpix,
                                   int _ypix)
Specified by:
findInteractive in interface Interactive
Overrides:
findInteractive in class AbstractInteractiveTile