|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object vmm.core.Exhibit vmm.core3D.Exhibit3D vmm.polyhedron.IFS
public class IFS
Represents a polyhedron given in the form of a indexed face set. That is,
the data for the polyhedron consists of a list of vertices plus a list of
data for the faces of the polyhedron. A face is specified by a list of
integers, one for each vertex of the face, where each integer is an index
into the list of vertices. The vertices for a face must be listed in
counterclockwise order as viewed from the front of face. No public
method is provided for changing the indexed face set data after the
object is constructed, but subclasses can do so using the protected
method setIFSData(Vector3D[], int[][])
.
An IFS has a create animation that shows the faces of the polyhedron being drawn in back-to-front order using a simple painter's algorithm.
Nested Class Summary | |
---|---|
static class |
IFS.IFSView
|
Field Summary | |
---|---|
protected int |
edgeDivisor
When drawind the polyhedron in wireframe form, each edge is divided into this many sections. |
protected boolean |
useBackFaceFudge
When this value is set to true, a modified version of the simple painter's algorithm is used. |
Fields inherited from class vmm.core3D.Exhibit3D |
---|
defaultViewpoint, defaultViewUp, previousTransform3D |
Fields inherited from class vmm.core.Exhibit |
---|
decorations, exhibitNeedsRedraw, isMorphing, morphingView, parameters, previousTransform |
Constructor Summary | |
---|---|
protected |
IFS()
This protected constructor creates an IFS object with no data for the polyhedron. |
|
IFS(Vector3D[] vertexList,
int[][] faceData)
Create a polyhedron, using specifed lists of vertices and faces. |
Method Summary | |
---|---|
protected void |
computeDrawData3D(View3D view,
boolean exhibitNeedsRedraw,
Transform3D previousTransform3D,
Transform3D newTransform3D)
Recopmputes cached data, if necessary, for a 3D rendering of this exhibit. |
protected void |
doDraw3D(java.awt.Graphics2D g,
View3D view,
Transform3D transform)
Draws this Exhibit in a 3D view. |
ActionList |
getActionsForView(View view)
Adds to the Actions a toggle to control whether thick lines are used for drawing the wireframe form of the polyhedron. |
Animation |
getCreateAnimation(View view)
Returns an animation in which the faces of the polyhedron are drawn one at a time, in back-to-front order. |
View |
getDefaultView()
Returns a View of type IFS.IFSView . |
protected void |
setIFSData(Vector3D[] vertices,
int[][] faces)
Change the data that describes the polyhedron. |
Methods inherited from class vmm.core3D.Exhibit3D |
---|
computeDrawDataHook, doDrawHook, getDefaultTransform, getDefaultViewpoint, getDefaultViewUp, setDefaultViewpoint, setDefaultViewUp |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int edgeDivisor
Rhombohedron
.
The default value is 8; this seems to work in all cases, but the
value can be changed in a subclass if necessary. Also note that
dividing the edges into multiple segments in this way means that
an edges can be partially clipped, since clipping is applied to
segments rather than to the edge as a whole.
protected boolean useBackFaceFudge
Rhombohedron
when the unmodified painter's algorithm is used. The default value is
false, but it is set to true in the Rhombohedron class.
Constructor Detail |
---|
public IFS(Vector3D[] vertexList, int[][] faceData)
vertexList
- an array containing the vertices of the polyhedronfaceData
- describes the faces of the polyhedron. faceData[i] is a list of vertices
in the i-th face, listed in counterclockwise order as seen from in front of the face, with
each vertex specified as an index into the vertex array.protected IFS()
computeDrawData3D(View3D, boolean, Transform3D, Transform3D)
is called.
Method Detail |
---|
protected void setIFSData(Vector3D[] vertices, int[][] faces)
RegularPolyhedron
to show the various truncated forms of the polyhedron.
Each truncation has its own truncation.
protected void computeDrawData3D(View3D view, boolean exhibitNeedsRedraw, Transform3D previousTransform3D, Transform3D newTransform3D)
Exhibit3D
Exhibit.computeDrawData(View, boolean, Transform, Transform)
to say what should be drawn in a 2D view.
computeDrawData3D
in class Exhibit3D
view
- the 3D View where the Exhibit is about to be drawn.exhibitNeedsRedraw
- if true, then something about the Exhibit has changed that probably requires
recomputation of cached data. For example, this is set to true when one of the Parameters of the Exhibit
has changed since the previous redraw.previousTransform3D
- the Transform3D that was used the last time this exhibit was drawn. This can be null, if
this is the first time that the Exhibit is being drawn (in 3D).newTransform3D
- the transform that will be used to draw the Exhibit during the current drawing operation.
This parameter and the previousTransform3D parameter are provided so that the Exhbit can detect those rare
cases where cached data exists that depends on the transform. Most Exhibits will just ignore the
transform parameters.protected void doDraw3D(java.awt.Graphics2D g, View3D view, Transform3D transform)
Exhibit3D
Exhibit3D.computeDrawData3D(View3D, boolean, Transform3D, Transform3D)
has already been called, so that any cached data should be correct.
Note that this method is called only if the Exhibit is being drawn in a View3D. Exhibits that have
both two and three dimensional renderings should also override Exhibit.doDraw(Graphics2D, View, Transform)
.
When drawing a 3D exhibit, you are strongly advised to use the drawing routines supplied by the
View3D
and View3DLit
classes. These routines will automatically produce the correct results
in stereo views -- the same is not true about direct drawing to the graphics context.
doDraw3D
in class Exhibit3D
g
- the graphics context where the exhibit is being drawn.view
- The View3D in which the exhibit is being drawn. In general, it is advisable to use the view for
all drawing operations.transform
- The transform that is being used to draw the exhibit.public View getDefaultView()
IFS.IFSView
.
getDefaultView
in class Exhibit3D
public Animation getCreateAnimation(View view)
getCreateAnimation
in class Exhibit
view
- A View that is displaying this Exhibit. The animation, if any, that
is returned by this method will be installed in the View's display. If the view
is null, than a creation animation that can run independently of a view could
be returned.
public ActionList getActionsForView(View view)
getActionsForView
in class Exhibit
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |