vmm.core3D
Class View3D

java.lang.Object
  extended by vmm.core.View
      extended by vmm.core3D.View3D
All Implemented Interfaces:
java.util.EventListener, javax.swing.event.ChangeListener, Decorateable, Parameterizable
Direct Known Subclasses:
ConformalMap.ConformalMapView, LatticeModel.LMView, ODE_3D.ODEView, SpaceCurveView, View3DWithLightSettings

public class View3D
extends View

Extends the View class to support three-dimensional viewing.


Field Summary
static int CROSS_EYE_STEREO_VIEW
          One of the possible values for the viewStyle, specifying a "stereograph" view.
protected  java.awt.image.BufferedImage leftStereographOSI
          Left and right offscreen images, used during stereograph viewing.
static int MONOCULAR_VIEW
          One of the possible values for the viewStyle, specifying a basic non-stereo view.
protected  ActionRadioGroup projectionCommands
          A set of two radio items for selecting between orthograhic and prespective projection.
static int RED_GREEN_STEREO_VIEW
          One of the possible values for the viewStyle, specifying "anaglyph stereo".
protected  java.awt.image.BufferedImage rightStereographOSI
          Left and right offscreen images, used during stereograph viewing.
protected  AbstractActionVMM set3DViewOptionsAction
          A menu item that will show a Set Eye Separation Multiplier dialog box.
protected  AbstractActionVMM setViewpointAction
          A menu item that will show a Set Viewpoint dialog box.
protected  StereoComposite stereoComposite
          Used when the view style is RED_GREEN_STEREO_VIEW.
static int STEREOGRAPH_VIEW
          One of the possible values for the viewStyle, specifying a "stereograph" view.
protected  Transform3D transform3D
          The current transform of this view, if it is a Transform3D.
protected  ActionRadioGroup viewStyleCommands
          A menu item for selecting one of the four possible view styles.
 
Fields inherited from class vmm.core.View
backgroundCommands, buildAnimation, buildingImageForFilmstrip, currentGraphics, decorations, directOffscreenDrawing, fullOSI, needsRedraw, offscreenImageType, parameters, showAxesAction
 
Constructor Summary
View3D()
           
 
Method Summary
 void addExtraXML(org.w3c.dom.Document containingDocument, org.w3c.dom.Element viewElement)
          Overridden to add extra transform info.
protected  void clearOSI()
          Fills the offscreen image with the background color of this View.
 boolean clip(Vector3D objectPoint)
          This method is used to test whether a point should be clipped.
protected  Axes2D createAxes()
          Returns an Axes decoration that is appropriate for this view.
protected  void createOSI(int width, int height)
          Create an offscreen image for drawing.
 void drawCollaredCurve(Vector3D[] points, boolean reversed)
          A convenience method that simply calls drawCollardCurve(points,0,points.length-1,reversed).
 void drawCollaredCurve(Vector3D[] points, int pointCount, boolean reversed)
          A convenience method that simply calls drawCollardCurve(points,0,pointCount-1,reversed).
 void drawCollaredCurve(Vector3D[] points, int startIndex, int endIndex, boolean reversed)
          Draws a curve in three-space, possibley using "collars" to produce a more three-dimensional effect.
 void drawCurve(Vector3D[] points)
          Draws a curve in three-space.
 void drawCurve(Vector3D[] points, int pointCount)
          Draws a curve in three-space.
 void drawCurve(Vector3D[] points, int startIndex, int endIndex)
          Draws a curve in three-space.
 void drawDot(Vector3D pt, double diameter)
          Draws a dot of specified diameter centered at a specified 3D point.
 void drawLine(Vector3D v1, Vector3D v2)
          This method can be called during a drawing operation, such as in Exhibit3D.doDraw3D(Graphics2D, View3D, Transform3D), to draw a line segment.
 void drawPixel(Vector3D v)
          This method can be called during a drawing operation, such as in Exhibit3D.doDraw3D(Graphics2D, View3D, Transform3D), to draw a single pixel.
 void drawPixelDirect(java.awt.Color color, int x, int y)
          Sets the pixel with pixel coordinates (x,y) to be a spelcified color.
 void drawPixels(Vector3D[] vlist)
          This method can be called during a drawing operation, such as in Exhibit3D.doDraw3D(Graphics2D, View3D, Transform3D), to draw a list of pixels.
 void drawString(java.lang.String str, Vector3D basepoint)
          This method can be called during a drawing operation, such as in Exhibit3D.doDraw3D(Graphics2D, View3D, Transform3D), to draw a string.
 void drawWireframeSurface(Grid3D surfaceData)
          Draws a surface in wireframe.
 void finish()
          Called when a view is removed from its display.
protected  void finishOSIDraw()
          This is called by methods in the View class to clean up after drawing to the off-screen image.
protected  void finishStereoView()
          To be used with setUpForLeftEye() and setUpForRightEye() to support 3D rendering.
 MouseTask getDefaultMouseTask()
          Returns a MouseTase of type BasicMouseTask3D, which is approriate for most 3D views.
 boolean getEnableThreeD()
          Gets the value of the enableThreeD property.
 boolean getOrthographicProjection()
          Returns true if this view is currently set to use an orthographic projection, and false if it is set to use a perspective projection.
protected  Transform getSavedAuxiliaryTransformForEnableThreeD()
          If 3D is enabled, this returns the saved transform that is used when 3D is disabled; if 3D is disabled, this returns the saved transform that is used when 3D is enabled.
 ActionList getSettingsCommands()
          Adds a "Set Viewpoint" command to any settings commands created by the superclass.
 Transform3D getTransform3D()
          If the transform associated with this view is a Transform3D, then that transform is returned.
 ActionList getViewCommands()
          Returns a list of view commands appropriate for a View3D.
 Vector3D getViewPoint()
          Returns the current viewpoint for this View's transform.
 int getViewStyle()
          Returns the currently selected viewstyle.
 Vector3D getViewUp()
          Returns the current imagePlaneYDirection for this View's transform.
 void moveStereographImages(int offset)
          This method moves the left- and right-eye views of the exhibit closer together or farther apart, within the limits of available space.
protected  boolean needsNewOSI(int width, int height)
          This is called by render to check whether a new offscreen image needs to be created, given the specified width and height of the drawing area.
protected  java.awt.Graphics2D prepareOSIForDrawing()
          This is called by methods in the View class to prepare the off-screen image for drawing.
protected  void putOSI(java.awt.Graphics2D g, int width, int height)
          This is called by render to copy the offscreen image to the screen.
 void readExtraXML(org.w3c.dom.Element viewInfo)
          Overridden to read back the extra transform info.
 void setBackground(java.awt.Color c)
          Set the background color that will be used for rendering this view.
 void setDisplay(Display display)
          Set the display where this view draws its exhibit.
 void setEnableThreeD(boolean enable)
          Sets the enableThreeD property.
 void setExhibit(Exhibit exhibit)
          Set the exhibit shown in this view.
 void setOrthographicProjection(boolean orthographic)
          Set to true to use an orthographic projection, and to false to use a perspective projection.
protected  void setSavedAuxiliaryTransformForEnableThreeD(Transform transform)
          If 3D is enabled this sets the saved transform that is used when 3D is disabled; if 3D is disabled, this sets the saved transform that is used when 3D is enabled.
 void setTransform(Transform transform)
          Sets the transform for this view to a specified transform, with no error checking.
protected  void setUpForLeftEye()
          To be used with the setUpForLeftEye and finishStereoView methods to support 3D rendering.
protected  void setUpForRightEye()
          To be used with setUpForLeftEye() and finishStereoView to support 3D rendering.
 void setViewPoint(Vector3D viewpoint)
          Sets the viewpoint for this View's transform.
 void setViewStyle(int style)
          Set the current view styles.
 void setViewUp(Vector3D viewUp)
          Sets the view up vector for this View's transform.
 void setWindowForUseWhileThreeDDisabled(double xmin, double xmax, double ymin, double ymax)
          Set the x and y ranges to be used when 3D has been disabled by setEnableThreeD(boolean).
 void stateChanged(javax.swing.event.ChangeEvent evt)
          React to a change by rebuilding the offscreen bit map.
 java.awt.Rectangle stereographLeftEyeRect()
          This method is used in BasicMouseTask3D to determine the rectangle that containts the left-eye image of a stereographic view.
 java.awt.Rectangle stereographRightEyeRect()
          This method is used in BasicMouseTask3D to determine the rectangle that containts the left-eye image of a stereographic view.
 void takeExhibit(View view, boolean shareTransform)
          Set this View to view the same exhibit as another specififed view.
 
Methods inherited from class vmm.core.View
addDecoration, addParameter, beginDrawToOffscreenImage, clearDecorations, doDraw, drawCurve, drawCurve, drawCurve, drawDot, drawLine, drawLine, drawLineDirect, drawPixel, drawPixel, drawPixels, drawString, drawString, endDrawToOffscreenImage, fillRectDirect, forceRedraw, getActions, getActionsForViewAndExhibit, getAdditionalAnimations, getAdditionalAnimationsForViewAndExhibit, getAntialiased, getApplyGraphics2DTransform, getBackground, getColor, getDecorations, getDisplay, getExhibit, getFastDrawing, getForeground, getImage, getName, getParameterByName, getParameters, getPreserveAspect, getRequestedWindow, getSettingsCommandsForViewAndExhibit, getShowAxes, getStatusText, getTitle, getTransform, getViewAndExhibitParameters, getWindow, parameterChanged, removeDecoration, removeParameter, render, setAntialiased, setApplyGraphics2DTransform, setColor, setFastDrawing, setFastDrawing, setForeground, setName, setPreserveAspect, setShowAxes, setStrokeSizeMultiplier, setWindow, setWindow
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MONOCULAR_VIEW

public static final int MONOCULAR_VIEW
One of the possible values for the viewStyle, specifying a basic non-stereo view. This is the default view style.

See Also:
Constant Field Values

RED_GREEN_STEREO_VIEW

public static final int RED_GREEN_STEREO_VIEW
One of the possible values for the viewStyle, specifying "anaglyph stereo". That is, left and right eye views are drawn in green and red, respectively, and the two views are composed into a single image that can be viewed with red/green or red/blue stereo glasses. In this view, the background color is forced to black.

See Also:
Constant Field Values

STEREOGRAPH_VIEW

public static final int STEREOGRAPH_VIEW
One of the possible values for the viewStyle, specifying a "stereograph" view. That is, the left and right eye views are drawn side-by-side. The user can view a 3D image by looking at a point in back of the images, to make the left and right eye views fuse into a single image.

See Also:
Constant Field Values

CROSS_EYE_STEREO_VIEW

public static final int CROSS_EYE_STEREO_VIEW
One of the possible values for the viewStyle, specifying a "stereograph" view. That is, the left and right eye views are drawn side-by-side. The user can view a 3D image by crossing his or her eyes to fuse the left ane right eye views.

See Also:
Constant Field Values

transform3D

protected Transform3D transform3D
The current transform of this view, if it is a Transform3D. This is just a reference to the same object refereced by View.getTransform(), and is here for convenience only.


stereoComposite

protected StereoComposite stereoComposite
Used when the view style is RED_GREEN_STEREO_VIEW.


leftStereographOSI

protected java.awt.image.BufferedImage leftStereographOSI
Left and right offscreen images, used during stereograph viewing.


rightStereographOSI

protected java.awt.image.BufferedImage rightStereographOSI
Left and right offscreen images, used during stereograph viewing.


viewStyleCommands

protected ActionRadioGroup viewStyleCommands
A menu item for selecting one of the four possible view styles. This is used in getViewCommands().


projectionCommands

protected ActionRadioGroup projectionCommands
A set of two radio items for selecting between orthograhic and prespective projection.


setViewpointAction

protected AbstractActionVMM setViewpointAction
A menu item that will show a Set Viewpoint dialog box. This is created in getSettingsCommands()


set3DViewOptionsAction

protected AbstractActionVMM set3DViewOptionsAction
A menu item that will show a Set Eye Separation Multiplier dialog box. This is created in getSettingsCommands()

Constructor Detail

View3D

public View3D()
Method Detail

getViewStyle

public int getViewStyle()
Returns the currently selected viewstyle.

See Also:
setViewStyle(int)

setViewStyle

public void setViewStyle(int style)
Set the current view styles. This must be one of the four constants MONOCULAR_VIEW, RED_GREEN_STEREO_VIEW, CROSS_EYE_STEREO_VIEW, or STEREOGRAPH_VIEW.

Parameters:
style - the new view style. This is ignored if it is not one of the four legal options.

moveStereographImages

public void moveStereographImages(int offset)
This method moves the left- and right-eye views of the exhibit closer together or farther apart, within the limits of available space. This method is called by BasicMouseTask3D, and will probably be used rarely if ever otherwise.

Parameters:
offset - The number of pixels to move the images. A positive value moves them closer together. A negative value moves them farther apart. However, they can't be moved closer together than when they are touching or farther apart than the border of the window permits.

stereographLeftEyeRect

public java.awt.Rectangle stereographLeftEyeRect()
This method is used in BasicMouseTask3D to determine the rectangle that containts the left-eye image of a stereographic view. It is also used in ODE_3D for transforming screen points to object points.


stereographRightEyeRect

public java.awt.Rectangle stereographRightEyeRect()
This method is used in BasicMouseTask3D to determine the rectangle that containts the left-eye image of a stereographic view. It is also used in ODE_3D for transforming screen points to object points.


getEnableThreeD

public boolean getEnableThreeD()
Gets the value of the enableThreeD property.

See Also:
setEnableThreeD(boolean)

setEnableThreeD

public void setEnableThreeD(boolean enable)
Sets the enableThreeD property. When this property is set to false, three-D related items in the Settings menu are disabled. When 3D is disabled, the view style is set to MONOCULAR, the Viewpoint is set to (1,0,0), and the projection is set to be orthographic, so any 3D drawing that is done while 3D is disabled will use a simple projection onto the yz-plane by discarding the x-coordinate. (Although in general you should not be doing any 3D drawing while 3D is disabled.) When 3D is enabled after being disabled, the view style and viewpoint settings are restored to what they were when 3D was entered unless they have been changed in the meantime.

Note that if this view has an Axes decoration, they type of Axes decoration (Axes2D or Axes3D) is set to match the new state of the enableThreeD property.

WARNING: This method does NOT do anything about mouse tasks, so you might want to change the mouse task in this View's display at the same time that you call this method.


setWindowForUseWhileThreeDDisabled

public void setWindowForUseWhileThreeDDisabled(double xmin,
                                               double xmax,
                                               double ymin,
                                               double ymax)
Set the x and y ranges to be used when 3D has been disabled by setEnableThreeD(boolean). This method can be called at any time, even while 3D is enabled -- if it is, the specified ranges only come in to effect the next time 3D is disabled.


getSavedAuxiliaryTransformForEnableThreeD

protected Transform getSavedAuxiliaryTransformForEnableThreeD()
If 3D is enabled, this returns the saved transform that is used when 3D is disabled; if 3D is disabled, this returns the saved transform that is used when 3D is enabled. This method was introduced to be used by SaveAndRestore and will probably not be used otehrwise.


setSavedAuxiliaryTransformForEnableThreeD

protected void setSavedAuxiliaryTransformForEnableThreeD(Transform transform)
If 3D is enabled this sets the saved transform that is used when 3D is disabled; if 3D is disabled, this sets the saved transform that is used when 3D is enabled. This method was introduced to be used by SaveAndRestore and will probably not be used otherwise.


getOrthographicProjection

public boolean getOrthographicProjection()
Returns true if this view is currently set to use an orthographic projection, and false if it is set to use a perspective projection.


setOrthographicProjection

public void setOrthographicProjection(boolean orthographic)
Set to true to use an orthographic projection, and to false to use a perspective projection. The default is to use a perspective projection.


getViewPoint

public Vector3D getViewPoint()
Returns the current viewpoint for this View's transform. (In the unexpected case that this view is not using a 3D transform, returns null.)

See Also:
setViewPoint(Vector3D)

setViewPoint

public void setViewPoint(Vector3D viewpoint)
Sets the viewpoint for this View's transform. (Assuming that this view is using a 3D transform -- if not, nothing is done.) Note that calling this method will also adjust the imagePlaneYDirection by projecting the current imagePlaneYDirection onto the new view plane. Note that when an Exhbit is installed, the Exhibit's default Transform replaces whatever transform already exists, so there is not much use calling this when no exhibit is installed.

See Also:
setViewUp(Vector3D), Transform3D.setViewPoint(Vector3D)

getViewUp

public Vector3D getViewUp()
Returns the current imagePlaneYDirection for this View's transform. (In the unexpected case that this view is not using a 3D transform, returns null.)

See Also:
setViewUp(Vector3D)

setViewUp

public void setViewUp(Vector3D viewUp)
Sets the view up vector for this View's transform. (Assuming that this view is using a 3D transform -- if not, nothing is done.) Note that the specified viewUp vector will have to be projected onto the image plane to give the actual imagePlaneYDirection.

See Also:
Transform3D.setImagePlaneYDirection(Vector3D)

setExhibit

public void setExhibit(Exhibit exhibit)
Set the exhibit shown in this view. It is overridden in this class to set transform3D and to manage stereographic viewing if necessary.

Overrides:
setExhibit in class View
Parameters:
exhibit - The exhibit to be installed in this View. The value can be null. In that case, no Exhibit will be associated with the View after the method executes. If exhibit is already installed in this View, then no changes are made.
See Also:
Display.install(View, Exhibit)

setTransform

public void setTransform(Transform transform)
Description copied from class: View
Sets the transform for this view to a specified transform, with no error checking. This is meant mainly for use in the SaveAndRestore class.

Overrides:
setTransform in class View

setDisplay

public void setDisplay(Display display)
Set the display where this view draws its exhibit. This is overridden in this class to put the display into stereograpic view mode, if the view is currently set to use sterographic viewing.

Overrides:
setDisplay in class View
See Also:
Display.install(View, Exhibit)

finish

public void finish()
Called when a view is removed from its display. In this case, it restores the viewStyle to MONOCULAR_VIEW to avoid leaving the display set up for stereo viewing.

Overrides:
finish in class View

takeExhibit

public void takeExhibit(View view,
                        boolean shareTransform)
Set this View to view the same exhibit as another specififed view. This is overridden here to copy the 3D transform from the specified view (if it has one) and to copy its viewStyle if it is a View3D and to properly handle the enableThreeD propety. Since a 3D View cannot make effective use of a 2D transform, the sharedTransform parameter is ignored if the transform in the given view is not a 3D transform.

Overrides:
takeExhibit in class View
Parameters:
view - The view whose Exhibit is to be copied. After the method is called, both views will be drawing the same exhibit. If null, then the exhibit of this view will also be set to null.
shareTransform - If true, the two views will share the same Transform, so that changes made to the transform in one will also result in a change in the other.

getTransform3D

public Transform3D getTransform3D()
If the transform associated with this view is a Transform3D, then that transform is returned. Otherwise, the return value is null.


createAxes

protected Axes2D createAxes()
Returns an Axes decoration that is appropriate for this view. If 3D is enabled, returns an object of type Axes3D and returns an Axes2D if 3D is disabled.

Overrides:
createAxes in class View
See Also:
setEnableThreeD(boolean)

getDefaultMouseTask

public MouseTask getDefaultMouseTask()
Returns a MouseTase of type BasicMouseTask3D, which is approriate for most 3D views.

Overrides:
getDefaultMouseTask in class View
Returns:
The value returned in the top-level View class is a BasicMouseTask2D, which allows dragging and zooming of the 2D window.
See Also:
MouseTask

setBackground

public void setBackground(java.awt.Color c)
Description copied from class: View
Set the background color that will be used for rendering this view. If the specified color is null, then the default color (white) is used. Note that the background color is automatically reset when an exhibit is installed into this View. If the exhibit is non-null, then the background color is set using Exhibit.getDefaultBackground(); if a null exhibit is installed, the background color is set to white. So, this method is only for adjusting the background color while an exhibit is displayed. Changing the background color will cause a redraw.

In addition to setting the background color, this method will set the foreground color to either black or white, depending on whehter the background color is light or dark. It is possible to change the foreground color to something else after setting the background.

Overrides:
setBackground in class View

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent evt)
React to a change by rebuilding the offscreen bit map. This overrides the method in the View class for the following reason: If the state change comes from a Transform3D, it might be a change in the "orthographicProjection" property of a Transform3D that is shared with another view, so the setting of the projectionCommands is changed to match the setting in the Transform3D.

Specified by:
stateChanged in interface javax.swing.event.ChangeListener
Overrides:
stateChanged in class View
See Also:
View.forceRedraw()

getViewCommands

public ActionList getViewCommands()
Returns a list of view commands appropriate for a View3D. This method adds commands for selecting between orthographic and perspective projection and for selecting the viewStyle to the list of commands obtained from the superclass.

Overrides:
getViewCommands in class View

getSettingsCommands

public ActionList getSettingsCommands()
Adds a "Set Viewpoint" command to any settings commands created by the superclass.

Overrides:
getSettingsCommands in class View

needsNewOSI

protected boolean needsNewOSI(int width,
                              int height)
This is called by render to check whether a new offscreen image needs to be created, given the specified width and height of the drawing area.

Overrides:
needsNewOSI in class View

putOSI

protected void putOSI(java.awt.Graphics2D g,
                      int width,
                      int height)
This is called by render to copy the offscreen image to the screen. The width and height of the drawing area are given as parameters, since they are needed in the case of stereograph views.

Overrides:
putOSI in class View

createOSI

protected void createOSI(int width,
                         int height)
Create an offscreen image for drawing. This is overridden here to handle the left- and right-eye views that are needed for anaglyph stereo and stereograph viewing. It is not meant to be called directly.

Overrides:
createOSI in class View

clearOSI

protected void clearOSI()
Fills the offscreen image with the background color of this View. This is overidden here to handle the left- and right-eye views in the case of anaglyph stereo and stereograph viewing.

Overrides:
clearOSI in class View

prepareOSIForDrawing

protected java.awt.Graphics2D prepareOSIForDrawing()
This is called by methods in the View class to prepare the off-screen image for drawing. It is overridden here to handle th special setup needed for anaglyph stereo and stereograph viewing. It is not meant to be called directly.

Overrides:
prepareOSIForDrawing in class View
Returns:
A graphics context for drawing to the off-screen image.

finishOSIDraw

protected void finishOSIDraw()
This is called by methods in the View class to clean up after drawing to the off-screen image. It is overridden here to do the cleanup necessary for anaglyph stereo viewing. It is not meant to be called directly.

Overrides:
finishOSIDraw in class View

addExtraXML

public void addExtraXML(org.w3c.dom.Document containingDocument,
                        org.w3c.dom.Element viewElement)
Overridden to add extra transform info.

Overrides:
addExtraXML in class View
Parameters:
containingDocument - The overall XML document that contains the view Element that is being created. This parameter is necessary because it is needed to create any nested subelements that are to be added to the view element.
viewElement - The XML element that is being constructed. This element already exists; the purpose of this method to add any extra information that would be needed to reconstruct this view object from the XML represenation.
See Also:
View.readExtraXML(Element)

readExtraXML

public void readExtraXML(org.w3c.dom.Element viewInfo)
                  throws java.io.IOException
Overridden to read back the extra transform info.

Overrides:
readExtraXML in class View
Parameters:
viewInfo - The <view> element from the XML file that contains the information about this view. Some methods from the SaveAndRestore class might be useful for getting the data.
Throws:
java.io.IOException - If an error is found, an exception of type IOException should be thrown. This will abort the whole processing of the XML file.

drawPixel

public void drawPixel(Vector3D v)
This method can be called during a drawing operation, such as in Exhibit3D.doDraw3D(Graphics2D, View3D, Transform3D), to draw a single pixel. This method is designed to work correctly in stereo views as well as in a standard monocular view; for stereo viewing, the pixel is drawn in both the left- and the right-eye view.

Parameters:
v - a non-null vector giving the coordinates of the pixel to be drawn, in world coordinates.
See Also:
drawPixels(Vector3D[])

drawDot

public void drawDot(Vector3D pt,
                    double diameter)
Draws a dot of specified diameter centered at a specified 3D point. This is done by calling the Graphics2D fill() command for an appropriate Ellipse2D. The diameter is specified in pixels. Note that if the preserveAspectRatio is off for this View, then the dot will can be an oval rather than a circle.


drawPixels

public void drawPixels(Vector3D[] vlist)
This method can be called during a drawing operation, such as in Exhibit3D.doDraw3D(Graphics2D, View3D, Transform3D), to draw a list of pixels. This method is designed to work correctly in stereo views as well as in a standard monocular view; for stereo viewing, each pixel is drawn in both the left- and the right-eye view. This method is more efficient than drawing each pixel individually when drawing in stereo.

Parameters:
vlist - a non-null array of vectors, where each vector contains the coordinates of the pixel to be drawn, in world coordinates. The individual vectors in the list can be null; null values in the array are ignored.

drawLine

public void drawLine(Vector3D v1,
                     Vector3D v2)
This method can be called during a drawing operation, such as in Exhibit3D.doDraw3D(Graphics2D, View3D, Transform3D), to draw a line segment. This method is designed to work correctly in stereo views as well as in a standard monocular view; for stereo viewing, the line segment is drawn in both the left- and the right-eye view.

Parameters:
v1 - a non-null vector giving the coordinates of one endpoint of the line segment, in world coordinates.
v2 - a non-null vector giving the coordinates of a second endpoint of the line segment, in world coordinates.

drawString

public void drawString(java.lang.String str,
                       Vector3D basepoint)
This method can be called during a drawing operation, such as in Exhibit3D.doDraw3D(Graphics2D, View3D, Transform3D), to draw a string. Only the basepoint of the string undergoes transformation and projection. The string itself is always drawn flat on the screen, as if it is located in the view plane. This method is designed to work correctly in stereo views as well as in a standard monocular view; for stereo viewing, the string is drawn in both the left- and the right-eye view.

Parameters:
str - the non-null string that is to be drawn.
basepoint - a non-null vector giving the coordinates of the basepoing of the string to be drawn, in world coordinates.

drawCurve

public void drawCurve(Vector3D[] points)
Draws a curve in three-space. This is a convenience method that just calls drawCurve(points,points.length).

See Also:
drawCurve(Vector3D[], int)

drawCurve

public void drawCurve(Vector3D[] points,
                      int pointCount)
Draws a curve in three-space. The curve is drawn by connecting points in a given array of 3D points with line segments. This method is designed to work correctly in stereo views as well as in a standard monocular view; for stereo viewing, the curve is drawn in both the left- and the right-eye view.

Parameters:
points - A non-null array containing the points on the curve. Null values are allowed in this array. A null value is treated as a missing point on the curve -- no connecting line segment is drawn from the missing point to the points on either side. This makes it possible for a single array to define multiple disconnected curve segments.
pointCount - The number of points on the curve. Only the points in positions 0 through pointCount-1 in the array are used when drawing the curve.

drawCurve

public void drawCurve(Vector3D[] points,
                      int startIndex,
                      int endIndex)
Draws a curve in three-space. The curve is drawn by connecting points in a given array of 3D points with line segments. This method is designed to work correctly in stereo views as well as in a standard monocular view; for stereo viewing, the curve is drawn in both the left- and the right-eye view. This version of drawCurve makes it possible to draw any contiguous sequence of points on the curve.

Parameters:
points - A non-null array containing the points on the curve. Null values are allowed in this array. A null value is treated as a missing point on the curve -- no connecting line segment is drawn from the missing point to the points on either side. This makes it possible for a single array to define multiple disconnected curve segments.
startIndex - The number of points in the array that should be used for the curve. A curve is drawn though points[startIndex], point[startIndex+1], ..., points[endIndex]. The value of startIndex is clamped to lie in the range 0 to points.length-1.
endIndex - The number of points in the array that should be used for the curve. A curve is drawn though points[startIndex], point[startIndex+1], ..., points[endIndex]. The value of endIndex is clamped to lie in the range 0 to points.length-1. If startIndex is less than or equal to endIndex, nothing is drawn.

drawCollaredCurve

public void drawCollaredCurve(Vector3D[] points,
                              boolean reversed)
A convenience method that simply calls drawCollardCurve(points,0,points.length-1,reversed).

See Also:
drawCollaredCurve(Vector3D[], int, int, boolean)

drawCollaredCurve

public void drawCollaredCurve(Vector3D[] points,
                              int pointCount,
                              boolean reversed)
A convenience method that simply calls drawCollardCurve(points,0,pointCount-1,reversed).

See Also:
drawCollaredCurve(Vector3D[], int, int, boolean)

drawCollaredCurve

public void drawCollaredCurve(Vector3D[] points,
                              int startIndex,
                              int endIndex,
                              boolean reversed)
Draws a curve in three-space, possibley using "collars" to produce a more three-dimensional effect. The collars can be used in two ways, either reversed or not reversed. If reverse is false, then the curve is drawn in monocular views by connecting points in a given array of 3D points with line segments, except that where one part of the curve passes over another, the back segment is "broken", crossing-diagram style, to show which curve is in front. (The "break" is actually the result of drawing a wide collar around the curve in the background color.) However, this crossing diagram style is only used in a monocular view, not in stereo views; for stereo viewing, a solid curve is drawn using the drawCurve(Vector3D[], int) method.

If "reversed" is true, then the curve is drawn with reversed collars in both monocular and stereo views. For a reversed collar, the curve itself is drawn in the background color, and the collar is drawn in the foreground color. This gives a nice 3D effect.

Parameters:
points - A non-null array containing the points on the curve. Null values are allowed in this array. A null value is treated as a missing point on the curve -- no connecting line segment is drawn from the missing point to the points on either side. This makes it possible for a single array to define multiple disconnected curve segments.
startIndex - The number of points in the array that should be used for the curve. A curve is drawn though points[startIndex], point[startIndex+1], ..., points[endIndex]. The value of startIndex is clamped to lie in the range 0 to points.length-1.
endIndex - The number of points in the array that should be used for the curve. A curve is drawn though points[startIndex], point[startIndex+1], ..., points[endIndex]. The value of endIndex is clamped to lie in the range 0 to points.length-1. If startIndex is less than or equal to endIndex, nothing is drawn.
reversed - tells whether or not to used reversed colors for drawing the collar.

drawWireframeSurface

public void drawWireframeSurface(Grid3D surfaceData)
Draws a surface in wireframe. In general, surfaces should be drawn using the View3DLit.drawSurface(Grid3D) and View3DLit.drawSurface(Grid3D, double, double) methods, which will render the surface either as wireframe or as patches, as appropriate for the settings in a View3DLit. However, this drawWireframeSurface method can be used to render a wireframe surface in a plain View3D or to draw a surface grid that really is intrinsically a wireframe in any 3D view.

Parameters:
surfaceData - contains a grid of points on the surface

drawPixelDirect

public void drawPixelDirect(java.awt.Color color,
                            int x,
                            int y)
Sets the pixel with pixel coordinates (x,y) to be a spelcified color. Note that this by-passes the support in the View3D class for stereo viewing (that is, x and y are used as untransformed pixel coordinates). The pixel is set in the current off-screen image, which can be either the fullOSI for monocular viewing or either the left or right OSI for stereo viewing. This method is meant mainly for use by lower level drawing methods, such as the phong lighting.

Overrides:
drawPixelDirect in class View
Parameters:
color - the color for the pixel; if null, the current drawing color is used.
x - the horizontal pixel coordinate.
y - the vertical pixel coordinate.
See Also:
drawPixel(Vector3D)

setUpForLeftEye

protected void setUpForLeftEye()
To be used with the setUpForLeftEye and finishStereoView methods to support 3D rendering. When rendering in one of the three stereo view styles, the image needs to be rendered twice, once for the left eye and once for the right eye. The setUpForLeftEye methods should be called first; this sets up the transform and current graphics context for rendering from the viewpoint of the left eye into the left eye image. Next comes the code for drawing the object. then setUpForRightEye, followed by a repeat of the code for drawing the object. Finally, calling finshStereoView must be called to restore the original drawing context. These three methods must always be used in this way. Note that most programmers will not have to worry about this -- these methods will only be used when writing methods for rendering new graphics primitives such as lines and surfaces in this class and its subclasses.


setUpForRightEye

protected void setUpForRightEye()
To be used with setUpForLeftEye() and finishStereoView to support 3D rendering.


finishStereoView

protected void finishStereoView()
To be used with setUpForLeftEye() and setUpForRightEye() to support 3D rendering.


clip

public final boolean clip(Vector3D objectPoint)
This method is used to test whether a point should be clipped. It is valid only during a 3D rendering operation. It is needed in Grid3D and in IFS.