org.opensourcephysics.display3d.simple3d
Class AbstractTile

java.lang.Object
  extended by org.opensourcephysics.display3d.simple3d.Element
      extended by org.opensourcephysics.display3d.simple3d.AbstractTile
All Implemented Interfaces:
Element, InteractionSource
Direct Known Subclasses:
ElementBox, ElementCone, ElementCylinder, ElementEllipsoid, ElementPlane, ElementSurface, ElementTessellation, ElementTetrahedron

public abstract class AbstractTile
extends Element

This is the basic class for all Elements which consist of a sequence of 3D colored tiles: Ellipsoid, Cylinder, Box, ... A tile is basically a collection of rectangles. NOT YET FINISHED!!!!!


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.opensourcephysics.display3d.core.Element
Element.Loader
 
Field Summary
protected  double[][][] corners
           
protected  int numberOfTiles
           
 
Fields inherited from class org.opensourcephysics.display3d.simple3d.Element
targetPosition, targetSize
 
Fields inherited from interface org.opensourcephysics.display3d.core.Element
TARGET_POSITION, TARGET_SIZE
 
Constructor Summary
AbstractTile()
           
 
Method Summary
protected abstract  void computeCorners()
          This will be used by subclasses whenever there is a need to recompute the actual values of the corners before drawing.
 double getDisplacementFactor()
          Gets the displacement factor
protected  InteractionTarget getTargetHit(int x, int y)
          Gets the target that is under the (x,y) position of the screen
protected  void projectPoints()
           
 void setColorBelowWhenEqual(boolean belowWhenEqual)
          Whether a value equal to one of the thresholds should be drawn using the color below or above
 void setColorOriginAndDirection(double[] origin, double[] direction)
          Sets the origin and direction of the color change.
 void setColorRegions(double[] thresholds, java.awt.Color[] colors)
          Set the levels and color for regional color separation
protected  void setCorners(double[][][] _data)
           
 void setDisplacementFactor(double factor)
          Sets an optional displacement factor to apply to the tiles when computing their distance to the eye.
 void setDrawQuickInterior(boolean draw, int transparency)
          Draw a transparent interior when in quickDraw mode.
 
Methods inherited from class org.opensourcephysics.display3d.simple3d.Element
addInteractionListener, getAxesMode, getDrawingPanel3D, getHotSpotBodyCoordinates, getInteractionTarget, getName, getSizeX, getSizeY, getSizeZ, getStyle, 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
 

Field Detail

numberOfTiles

protected int numberOfTiles

corners

protected double[][][] corners
Constructor Detail

AbstractTile

public AbstractTile()
Method Detail

setDisplacementFactor

public void setDisplacementFactor(double factor)
Sets an optional displacement factor to apply to the tiles when computing their distance to the eye. Setting it to a number bigger that 1 (say 1.03) is useful when you want to draw anything on top of an object.

Parameters:
factor - the desired displacement factor

getDisplacementFactor

public double getDisplacementFactor()
Gets the displacement factor

Returns:
the current displacement factor
See Also:
#setDisplacementFactor()

setDrawQuickInterior

public void setDrawQuickInterior(boolean draw,
                                 int transparency)
Draw a transparent interior when in quickDraw mode. Default is false

Parameters:
draw - the value desired
transparency - the desired level of transparency (from 0=fully transparent to 255=opaque)

setColorBelowWhenEqual

public void setColorBelowWhenEqual(boolean belowWhenEqual)
Whether a value equal to one of the thresholds should be drawn using the color below or above

Parameters:
belowWhenEqual - true to use the color below, false to use teh color above

setColorOriginAndDirection

public void setColorOriginAndDirection(double[] origin,
                                       double[] direction)
Sets the origin and direction of the color change. Default is (0,0,0) and (0,0,1), giving z-coded regions

Parameters:
origin - double[]
direction - double[]

setColorRegions

public void setColorRegions(double[] thresholds,
                            java.awt.Color[] colors)
Set the levels and color for regional color separation

Parameters:
thresholds - an array on n doubles that separate the n+1 regions. null for no region separation
colors - an array on n+1 colors, one for each of the regions

getTargetHit

protected InteractionTarget getTargetHit(int x,
                                         int y)
Description copied from class: Element
Gets the target that is under the (x,y) position of the screen

Overrides:
getTargetHit in class Element
Parameters:
x - int
y - int
Returns:
InteractionTarget

computeCorners

protected abstract void computeCorners()
This will be used by subclasses whenever there is a need to recompute the actual values of the corners before drawing. Synchronization is recomended.


setCorners

protected void setCorners(double[][][] _data)

projectPoints

protected void projectPoints()