You are on page 1of 19

JAMES

“TEKNIK INFORMATIKA UNITOMO”

JET JOEL/2007420074
ALDINO/2007420084
MICHAEL/2007420044
EGY/2007420076
SHOFIN/2007420007
*Class Canvas3D
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Canvas
|
+--javax.media.j3d.Canvas3D
public class Canvas3D
extends java.awt.Canvas
The Canvas3D class provides a drawing canvas for 3D rendering. It is an extension of the
AWT Canvas class that users may further subclass to implement additional functionality.
Java 3D will render to all canvases that are attached to an active View object.
See Also:
Screen3D, View, Serialized Form
Field Summary
static i FIELD_ALL
nt Specifies a single-field rendering loop.
static i FIELD_LEFT
nt Specifies the left field of a field-sequential stereo rendering loop.
static i FIELD_RIGHT
nt Specifies the right field of a field-sequential stereo rendering loop.

Fields inherited from class java.awt.Component


BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT,
TOP_ALIGNMENT

Constructor Summary
Canvas3D(java.awt.GraphicsConfiguration graphicsConfiguration)
Constructs and initializes a new Canvas3D object that Java 3D can render into.

Method Summary
void addNotify()
Canvas3D uses the addNotify callback to track when it is added to
a container.
void getCenterEyeInImagePlate(Point3d position)
Retrieves the actual position of the center eye in image-plate
coordinates and copies that value into the object provided.
boolean getDoubleBufferAvailable()
Returns a status flag indicating whether or not double buffering is
available.
boolean getDoubleBufferEnable()
Returns a status flag indicating whether or not double buffering is
enabled.

1
JAMES

GraphicsConte getGraphicsContext3D()
xt3D Get the immediate mode 3D graphics context associated with this
Canvas3D.
void getImagePlateToVworld(Transform3D t)
Retrieves the current ImagePlate coordinates to Virtual World
coordinates transform and places it into the specified object.
void getLeftEyeInImagePlate(Point3d position)
Retrieves the actual position of the left eye in image-plate
coordinates and copies that value into the object provided.
void getLeftManualEyeInImagePlate(Point3d position)
Retrieves the position of the user-specified, manual left eye in
image-plate coordinates and copies that value into the object provided.
double getPhysicalHeight()
Retrieves the physical height of this canvas window in meters.
double getPhysicalWidth()
Retrieves the physical width of this canvas window in meters.
void getPixelLocationInImagePlate(int x, int y, Point3d position)
Computes the position of the specified AWT pixel value in image-
plate coordinates and copies that value into the object provided.
void getRightEyeInImagePlate(Point3d position)
Retrieves the actual position of the right eye in image-plate
coordinates and copies that value into the object provided.
void getRightManualEyeInImagePlate(Point3d position)
Retrieves the position of the user-specified, manual right eye in
image-plate coordinates and copies that value into the object provided.
boolean getSceneAntialiasingAvailable()
Returns a status flag indicating whether or not scene antialiasing is
available.
Screen3D getScreen3D()
Retrieve the Screen3D object that this Canvas3D is attached to.
boolean getStereoAvailable()
Returns a status flag indicating whether or not stereo is available.
boolean getStereoEnable()
Returns a status flag indicating whether or not stereo is enabled.
View getView()
Gets view that points to this Canvas3D.
void getVworldToImagePlate(Transform3D t)
Retrieves the current Virtual World coordinates to ImagePlate
coordinates transform and places it into the specified object.
void paint(java.awt.Graphics g)
Canvas3D uses the paint callback to track when it is possible to
render into the canvas.
void postRender()
This routine is called by the Java 3D rendering loop after
completing all rendering to the canvas for this frame and before the
buffer swap.
void postSwap()
This routine is called by the Java 3D rendering loop after
completing all rendering to the canvas, and all other canvases associated
with this view, for this frame following the buffer swap.
void preRender()
This routine is called by the Java 3D rendering loop after clearing
the canvas and before any rendering has been done for this frame.
void removeNotify()
Canvas3D uses the removeNotify callback to track when it is
removed from a container.

2
JAMES

void renderField(int fieldDesc)


This routine is called by the Java 3D rendering loop during the
execution of the rendering loop.
void setDoubleBufferEnable(boolean flag)
Turns double buffering on or off.
void setLeftEyeInImagePlate(Point3d position)
Deprecated. Use setLeftManualEyeInImagePlate instead.
void setLeftManualEyeInImagePlate(Point3d position)
Sets the position of the manual left eye in image-plate coordinates.
void setRightEyeInImagePlate(Point3d position)
Deprecated. Use setRightManualEyeInImagePlate instead.
void setRightManualEyeInImagePlate(Point3d position)
Sets the position of the manual right eye in image-plate
coordinates.
void setStereoEnable(boolean flag)
Turns stereo on or off.
void startRenderer()
Start the Java 3D renderer on this Canvas3D object.
void stopRenderer()
Stop the Java 3D renderer on this Canvas3D object.
void swap()
Synchronize and swap buffers on a double buffered canvas for this
Canvas3D object.

Constructor Summary
Transform3D()
Constructs and initializes a transform to the identity matrix.
Transform3D(double[] matrix)
Constructs and initializes a transform from the double precision array of length 16; the top row
of the matrix is initialized to the first four elements of the array, and so on.
Transform3D(float[] matrix)
Constructs and initializes a transform from the float array of length 16; the top row of the matrix
is initialized to the first four elements of the array, and so on.
Transform3D(GMatrix m1)
Constructs a transform and initializes it to the upper 4x4 of the GMatrix argument.
Transform3D(Matrix3d m1, Vector3d t1, double s)
Constructs and initializes a transform from the rotation matrix, translation, and scale values.
Transform3D(Matrix3f m1, Vector3d t1, double s)
Constructs and initializes a transform from the rotation matrix, translation, and scale values.
Transform3D(Matrix3f m1, Vector3f t1, float s)
Constructs and initializes a transform from the rotation matrix, translation, and scale values.
Transform3D(Matrix4d m1)
Constructs and initializes a transform from the 4x4 matrix.
Transform3D(Matrix4f m1)
Constructs and initializes a transform from the 4x4 matrix.
Transform3D(Quat4d q1, Vector3d t1, double s)
Constructs and initializes a transform from the quaternion, translation, and scale values.
Transform3D(Quat4f q1, Vector3d t1, double s)
Constructs and initializes a transform from the quaternion, translation, and scale values.
Transform3D(Quat4f q1, Vector3f t1, float s)
Constructs and initializes a transform from the quaternion, translation, and scale values.
Transform3D(Transform3D t1)

3
JAMES

Constructs and initializes a transform from the Transform3D object.

Method Summary
void add(Transform3D t1)
Adds this transform to transform t1 and places the result into this: this =
this + t1.
void add(Transform3D t1, Transform3D t2)
Adds transforms t1 and t2 and places the result into this transform.
double determinant()
Calculates and returns the determinant of this transform.
boolean epsilonEquals(Transform3D t1, double epsilon)
Returns true if the L-infinite distance between this matrix and matrix m1 is
less than or equal to the epsilon parameter, otherwise returns false.
boolean equals(java.lang.Object o1)
Returns true if the Object o1 is of type Transform3D and all of the data
members of o1 are equal to the corresponding data members in this Transform3D.
boolean equals(Transform3D t1)
Returns true if all of the data members of transform t1 are equal to the
corresponding data members in this Transform3D.
void frustum(double left, double right, double bottom, double top,
double near, double far)
Creates a perspective projection transform that mimics a standard, camera-
based, view-model.
void get(double[] matrix)
Places the values of this transform into the double precision array of length
16.
void get(float[] matrix)
Places the values of this transform into the single precision array of length
16.
void get(Matrix3d m1)
Places the normalized rotational component of this transform into the 3x3
matrix argument.
double get(Matrix3d m1, Vector3d t1)
Places the normalized rotational component of this transform into the
matrix parameter; place the translational component into the vector parameter.
void get(Matrix3f m1)
Places the normalized rotational component of this transform into the 3x3
matrix argument.
double get(Matrix3f m1, Vector3d t1)
Places the normalized rotational component of this transform into the
matrix parameter; place the translational component into the vector parameter.
float get(Matrix3f m1, Vector3f t1)
Places the normalized rotational component of this transform into the
matrix parameter; place the translational component into the vector parameter.
void get(Matrix4d matrix)
Places the values of this transform into the double precision matrix
argument.
void get(Matrix4f matrix)
Places the values of this transform into the single precision matrix
argument.
void get(Quat4d q1)
Places the quaternion equivalent of the normalized rotational component of
this transform into the quaternion parameter.
double get(Quat4d q1, Vector3d t1)
Places the quaternion equivalent of the normalized rotational component of

4
JAMES

this transform into the quaternion parameter; places the translational component
into the Vector parameter.
void get(Quat4f q1)
Places the quaternion equivalent of the normalized rotational component of
this transform into the quaternion parameter.
double get(Quat4f q1, Vector3d t1)
Places the quaternion equivalent of the normalized rotational component of
this transform into the quaternion parameter; places the translational component
into the Vector parameter.
float get(Quat4f q1, Vector3f t1)
Places the quaternion equivalent of the normalized rotational component of
this transform into the quaternion parameter; places the translational component
into the Vector parameter.
void get(Vector3d trans)
Retrieves the translational components of this transform.
void get(Vector3f trans)
Retrieves the translational components of this transform.
boolean getAutoNormalize()
Returns the state of auto-normalization.
int getBestType()
Returns the least general type of this matrix; the order of generality from
least to most is: ZERO, IDENTITY, SCALE/TRANSLATION, ORTHOGONAL,
RIGID, CONGRUENT, AFFINE.
boolean getDeterminantSign()
Returns the sign of the determinant of this matrix; a return value of true
indicates a positive determinant; a return value of false indicates a negative
determinant.
void getRotationScale(Matrix3d m1)
Gets the upper 3x3 values of this matrix and places them into the matrix
m1.
void getRotationScale(Matrix3f m1)
Gets the upper 3x3 values of this matrix and places them into the matrix
m1.
double getScale()
Returns the uniform scale factor of this matrix.
void getScale(Vector3d scale)
Gets the possibly non-uniform scale components of the current transform
and places them into the scale vector.
int getType()
Returns the type of this matrix as an or'ed bitmask of of all of the type
classifications to which it belongs.
int hashCode()
Returns a hash number based on the data values in this object.
void invert()
Inverts this transform in place.
void invert(Transform3D t1)
Sets the value of this transform to the inverse of the passed Transform3D
parameter.
void lookAt(Point3d eye, Point3d center, Vector3d up)
Helping function that specifies the position and orientation of a view
matrix.
void mul(double scalar)
Multiplies each element of this transform by a scalar.
void mul(double scalar, Transform3D t1)
Multiplies each element of transform t1 by a scalar and places the result
into this.

5
JAMES

void mul(Transform3D t1)


Sets the value of this transform to the result of multiplying itself with
transform t1 (this = this * t1).
void mul(Transform3D t1, Transform3D t2)
Sets the value of this transform to the result of multiplying transform t1 by
transform t2 (this = t1*t2).
void mulInverse(Transform3D t1)
Multiplies this transform by the inverse of transform t1.
void mulInverse(Transform3D t1, Transform3D t2)
Multiplies transform t1 by the inverse of transform t2.
void mulTransposeBoth(Transform3D t1, Transform3D t2)
Multiplies the transpose of transform t1 by the transpose of transform t2
and places the result into this transform (this = transpose(t1) * transpose(t2)).
void mulTransposeLeft(Transform3D t1, Transform3D t2)
Multiplies the transpose of transform t1 by transform t2 and places the
result into this matrix (this = transpose(t1) * t2).
void mulTransposeRight(Transform3D t1, Transform3D t2)
Multiplies transform t1 by the transpose of transform t2 and places the
result into this transform (this = t1 * transpose(t2)).
void normalize()
Normalizes the rotational components (upper 3x3) of this matrix in place
using a Singular Value Decomposition.
void normalize(Transform3D t1)
Normalizes the rotational components (upper 3x3) of transform t1 in place
using a Singular Value Decomposition.
void normalizeCP()
Normalizes the rotational components (upper 3x3) of this transform in
place using a Cross Product (CP) normalization.
void normalizeCP(Transform3D t1)
Normalizes the rotational components (upper 3x3) of transform t1 using a
Cross Product (CP) normalization and places the values into this transform.
void ortho(double left, double right, double bottom, double top,
double near, double far)
Creates an orthographic projection transform that mimics a standard,
camera-based, view-model.
void perspective(double fovx, double aspect, double zNear,
double zFar)
Creates a perspective projection transform that mimics a standard, camera-
based, view-model.
void rotX(double angle)
Sets the value of this transform to a counter clockwise rotation about the x
axis.
void rotY(double angle)
Sets the value of this transform to a counter clockwise rotation about the y
axis.
void rotZ(double angle)
Sets the value of this transform to a counter clockwise rotation about the z
axis.
void scaleAdd(double s, Transform3D t1)
Scales this transform by a Uniform scale matrix with scale factor s and then
adds transform t1 (this = S*this + t1).
void scaleAdd(double s, Transform3D t1, Transform3D t2)
Scales transform t1 by a Uniform scale matrix with scale factor s and then
adds transform t2 (this = S*t1 + t2).
void set(AxisAngle4d a1)
Sets the value of this transform to the matrix conversion of the double
precision axis-angle argument; all of the matrix values are modified.
6
JAMES

void set(AxisAngle4f a1)


Sets the value of this transform to the matrix conversion of the single
precision axis-angle argument; all of the matrix values are modified.
void set(double scale)
Sets the value of this transform to a uniform scale; all of the matrix values
are modified.
void set(double[] matrix)
Sets the matrix values of this transform to the matrix values in the double
precision array parameter.
void set(double scale, Vector3d v1)
Sets the value of this transform to a scale and translation matrix; the scale is
not applied to the translation and all of the matrix values are modified.
void set(float[] matrix)
Sets the matrix values of this transform to the matrix values in the single
precision array parameter.
void set(float scale, Vector3f v1)
Sets the value of this transform to a scale and translation matrix; the scale is
not applied to the translation and all of the matrix values are modified.
void set(GMatrix matrix)
Sets the matrix values of this transform to the matrix values in the upper
4x4 corner of the GMatrix parameter.
void set(Matrix3d m1)
Sets the rotational component (upper 3x3) of this transform to the matrix
values in the double precision Matrix3d argument; the other elements of this
transform are initialized as if this were an identity matrix (ie, affine matrix with
no translational component).
void set(Matrix3d m1, Vector3d t1, double s)
Sets the value of this matrix from the rotation expressed by the rotation
matrix m1, the translation t1, and the scale s.
void set(Matrix3f m1)
Sets the rotational component (upper 3x3) of this transform to the matrix
values in the single precision Matrix3f argument; the other elements of this
transform are initialized as if this were an identity matrix (ie, affine matrix with
no translational component).
void set(Matrix3f m1, Vector3d t1, double s)
Sets the value of this matrix from the rotation expressed by the rotation
matrix m1, the translation t1, and the scale s.
void set(Matrix3f m1, Vector3f t1, float s)
Sets the value of this matrix from the rotation expressed by the rotation
matrix m1, the translation t1, and the scale s.
void set(Matrix4d m1)
Sets the matrix values of this transform to the matrix values in the double
precision Matrix4d argument.
void set(Matrix4f m1)
Sets the matrix values of this transform to the matrix values in the single
precision Matrix4f argument.
void set(Quat4d q1)
Sets the value of this transform to the matrix conversion of the double
precision quaternion argument; the non-rotational components are set as if this
were an identity matrix.
void set(Quat4d q1, Vector3d t1, double s)
Sets the value of this matrix from the rotation expressed by the quaternion
q1, the translation t1, and the scale s.
void set(Quat4f q1)
Sets the value of this transform to the matrix conversion of the single
precision quaternion argument; the non-rotational components are set as if this
were an identity matrix.

7
JAMES

void set(Quat4f q1, Vector3d t1, double s)


Sets the value of this matrix from the rotation expressed by the quaternion
q1, the translation t1, and the scale s.
void set(Quat4f q1, Vector3f t1, float s)
Sets the value of this matrix from the rotation expressed by the quaternion
q1, the translation t1, and the scale s.
void set(Transform3D t1)
Sets the matrix, type, and state of this transform to the matrix, type, and
state of transform t1.
void set(Vector3d trans)
Sets the translational value of this matrix to the Vector3d paramter values,
and sets the other components of the matrix as if this transform were an identity
matrix.
void set(Vector3d v1, double scale)
Sets the value of this transform to a scale and translation matrix; the
translation is scaled by the scale factor and all of the matrix values are modified.
void set(Vector3f trans)
Sets the translational value of this matrix to the Vector3f parameter values,
and sets the other components of the matrix as if this transform were an identity
matrix.
void set(Vector3f v1, float scale)
Sets the value of this transform to a scale and translation matrix; the
translation is scaled by the scale factor and all of the matrix values are modified.
void setAutoNormalize(boolean autoNormalize)
Performs an automatic SVD normalization of the rotational components
(upper 3x3) of this matrix after every subsequent matrix operation on this object,
unless the boolean is subsequently set to false.
void setEuler(Vector3d euler)
Sets the rotational component (upper 3x3) of this transform to the rotation
matrix converted from the Euler angles provided; the other non-rotational
elements are set as if this were an identity matrix.
void setIdentity()
Sets this transform to the identity matrix.
void setNonUniformScale(double xScale, double yScale, double zScale)
Deprecated. Use setScale(Vector3d) instead of setNonUniformScale; note
that the setScale only modifies the scale component
void setRotation(AxisAngle4d a1)
Sets the rotational component (upper 3x3) of this transform to the matrix
equivalent values of the axis-angle argument; the other elements of this transform
are unchanged; any pre-existing scale in the transform is preserved.
void setRotation(AxisAngle4f a1)
Sets the rotational component (upper 3x3) of this transform to the matrix
equivalent values of the axis-angle argument; the other elements of this transform
are unchanged; any pre-existing scale in the transform is preserved.
void setRotation(Matrix3d m1)
Sets the rotational component (upper 3x3) of this transform to the matrix
values in the double precision Matrix3d argument; the other elements of this
transform are unchanged; any pre-existing scale will be preserved; the argument
matrix m1 will be checked for proper normalization when this transform is
internally classified.
void setRotation(Matrix3f m1)
Sets the rotational component (upper 3x3) of this transform to the matrix
values in the single precision Matrix3f argument; the other elements of this
transform are unchanged; any pre-existing scale will be preserved; the argument
matrix m1 will be checked for proper normalization when this transform is
internally classified.
void setRotation(Quat4d q1)
Sets the rotational component (upper 3x3) of this transform to the matrix
8
JAMES

equivalent values of the quaternion argument; the other elements of this transform
are unchanged; any pre-existing scale in the transform is preserved.
void setRotation(Quat4f q1)
Sets the rotational component (upper 3x3) of this transform to the matrix
equivalent values of the quaternion argument; the other elements of this transform
are unchanged; any pre-existing scale in the transform is preserved.
void setRotationScale(Matrix3d m1)
Replaces the upper 3x3 matrix values of this transform with the values in
the matrix m1.
void setRotationScale(Matrix3f m1)
Replaces the upper 3x3 matrix values of this transform with the values in
the matrix m1.
void setScale(double scale)
Sets the scale component of the current transform; any existing scale is first
factored out of the existing transform before the new scale is applied.
void setScale(Vector3d scale)
Sets the possibly non-uniform scale component of the current transform;
any existing scale is first factored out of the existing transform before the new
scale is applied.
void setTranslation(Vector3d trans)
Replaces the translational components of this transform to the values in the
Vector3d argument; the other values of this transform are not modified.
void setTranslation(Vector3f trans)
Replaces the translational components of this transform to the values in the
Vector3f argument; the other values of this transform are not modified.
void setZero()
Sets this transform to all zeros.
void sub(Transform3D t1)
Subtracts transform t1 from this transform and places the result into this:
this = this - t1.
void sub(Transform3D t1, Transform3D t2)
Subtracts transform t2 from transform t1 and places the result into this: this
= t1 - t2.
java.lang.String toString()
Returns the matrix elements of this transform as a string.
void transform(Point3d point)
Transforms the point parameter with this transform and places the result
back into point.
void transform(Point3d point, Point3d pointOut)
Transforms the point parameter with this transform and places the result
into pointOut.
void transform(Point3f point)
Transforms the point parameter with this transform and places the result
back into point.
void transform(Point3f point, Point3f pointOut)
Transforms the point parameter with this transform and places the result
into pointOut.
void transform(Vector3d normal)
Transforms the normal parameter by this transform and places the value
back into normal.
void transform(Vector3d normal, Vector3d normalOut)
Transforms the normal parameter by this transform and places the value
into normalOut.
void transform(Vector3f normal)
Transforms the normal parameter by this transform and places the value
back into normal.

9
JAMES

void transform(Vector3f normal, Vector3f normalOut)


Transforms the normal parameter by this transform and places the value
into normalOut.
void transform(Vector4d vec)
Transform the vector vec using this Transform and place the result back
into vec.
void transform(Vector4d vec, Vector4d vecOut)
Transform the vector vec using this transform and place the result into
vecOut.
void transform(Vector4f vec)
Transform the vector vec using this Transform and place the result back
into vec.
void transform(Vector4f vec, Vector4f vecOut)
Transform the vector vec using this Transform and place the result into
vecOut.
void transpose()
Transposes this matrix in place.
void transpose(Transform3D t1)
Transposes transform t1 and places the value into this transform.

Method Summary void getHeadTrackerToLeftImagePlate(Transform3D t)


Retrieves the head-tracker coordinate system to left image-plate coordinate system
transform and copies it into the specified Transform3D object. void
getHeadTrackerToRightImagePlate(Transform3D t)
Retrieves the head-tracker coordinate system to right image-plate coordinate
system transform and copies it into the specified Transform3D object. double
getPhysicalScreenHeight()
Retrieves the the screen's physical height in meters. double
getPhysicalScreenWidth()
Retrieves the screen's physical width in meters. java.awt.Dimension getSize()
Get screen's(imageplate's) width and height in pixels void
getTrackerBaseToImagePlate(Transform3D t)
Retrieves the tracker-base coordinate system to image-plate coordinate system
transform and copies it into the specified Transform3D object. void
setHeadTrackerToLeftImagePlate(Transform3D t)
Sets the head-tracker coordinate system to left image-plate coordinate system
transform. void setHeadTrackerToRightImagePlate(Transform3D t)
Sets the head-tracker coordinate system to right image-plate coordinate system
transform. void setPhysicalScreenHeight(double height)
Sets the screen physical height in meters. void
setPhysicalScreenWidth(double width)
Sets the screen physical width in meters. void
setTrackerBaseToImagePlate(Transform3D t)
Sets the tracker-base coordinate system to image-plate coordinate system
transform.

Methods inherited from class java.awt.Component action, add, addComponentListener,


addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener,
addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains,
contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable,
enableEvents, enableInputMethods, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds,
getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget,
getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocale,
getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPeer,
getPreferredSize, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide,
imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque,
isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize,
mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString,
postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent,
processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent,
remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener,
10
JAMES
removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener,
repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds,
setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation,
setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, update, validate

Methods inherited from class java.lang.Object


clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Field Detail
ZERO
public static final int ZERO
A zero matrix.
IDENTITY
public static final int IDENTITY
An identity matrix.
SCALE
public static final int SCALE
A Uniform scale matrix with no translation or other off-diagonal components.
TRANSLATION
public static final int TRANSLATION
A translation-only matrix with ones on the diagonal.
ORTHOGONAL
public static final int ORTHOGONAL
The four row vectors that make up an orthogonal matrix form a basis, meaning that they
are mutually orthogonal; an orthogonal matrix with positive determinant is a pure
rotation matrix; a negative determinant indicates a rotation and a reflection.
RIGID
public static final int RIGID
This matrix is a rotation and a translation with unity scale; The upper 3x3 of the matrix is
orthogonal, and there is a translation component.
CONGRUENT
public static final int CONGRUENT
This is an angle and length preserving matrix, meaning that it can translate, rotate, and
reflect about an axis, and scale by an amount which is uniform in all directions. These
operations preserve the distance between any two points and the angle between any two
intersecting lines.
AFFINE
public static final int AFFINE
An affine matrix can translate, rotate, reflect, scale anisotropically, and shear. Lines
remain straight, and parallel lines remain parallel, but the angle between intersecting
lines can change. Inorder for a transform to classified as affine the 4th row must * be: [0,
0, 0, 1].
NEGATIVE_DETERMINANT
public static final int NEGATIVE_DETERMINANT
This matrix has a negative determinant; an orthogonal matrix with a positive determinant
is a rotation matrix; an orthogonal matrix with a negative determinant is a reflection and
rotation matrix.

Constructor Detail
Transform3D
public Transform3D(Matrix4f m1)
Constructs and initializes a transform from the 4x4 matrix. The type of the constructed
transform will be classified automatically.
Parameters:
m1 - the 4x4 transformation matrix
Transform3D
public Transform3D(Matrix4d m1)
Constructs and initializes a transform from the 4x4 matrix. The type of the constructed
transform will be classified automatically.
Parameters:
m1 - the 4x4 transformation matrix
Transform3D
public Transform3D(Transform3D t1)
Constructs and initializes a transform from the Transform3D object.
Parameters:
t1 - the transformation object to be copied
11
JAMES
Transform3D
public Transform3D()
Constructs and initializes a transform to the identity matrix.
Transform3D
public Transform3D(float[] matrix)
Constructs and initializes a transform from the float array of length 16; the top row of the
matrix is initialized to the first four elements of the array, and so on. The type of the
transform object is classified internally.
Parameters:
matrix - a float array of 16
Transform3D
public Transform3D(double[] matrix)
Constructs and initializes a transform from the double precision array of length 16; the
top row of the matrix is initialized to the first four elements of the array, and so on. The
type of the transform is classified internally.
Parameters:
matrix - a float array of 16
Transform3D
public Transform3D(Quat4d q1,
Vector3d t1,
double s)
Constructs and initializes a transform from the quaternion, translation, and scale values.
The scale is applied only to the rotational components of the matrix (upper 3x3) and not
to the translational components of the matrix.
Parameters:
q1 - The quaternion value representing the rotational component
t1 - The translational component of the matrix
s - The scale value applied to the rotational components
Transform3D
public Transform3D(Quat4f q1,
Vector3d t1,
double s)
Constructs and initializes a transform from the quaternion, translation, and scale values.
The scale is applied only to the rotational components of the matrix (upper 3x3) and not
to the translational components of the matrix.
Parameters:
q1 - The quaternion value representing the rotational component
t1 - The translational component of the matrix
s - The scale value applied to the rotational components
Transform3D
public Transform3D(Quat4f q1,
Vector3f t1,
float s)
Constructs and initializes a transform from the quaternion, translation, and scale values.
The scale is applied only to the rotational components of the matrix (upper 3x3) and not
to the translational components of the matrix.
Parameters:
q1 - The quaternion value representing the rotational component
t1 - The translational component of the matrix
s - The scale value applied to the rotational components
Transform3D
public Transform3D(GMatrix m1)
Constructs a transform and initializes it to the upper 4x4 of the GMatrix argument. If the
parameter matrix is smaller than 4x4, the remaining elements in the transform matrix are
assigned to zero.
Transform3D
public Transform3D(Matrix3f m1,
Vector3d t1,
double s)
Constructs and initializes a transform from the rotation matrix, translation, and scale
values. The scale is applied only to the rotational component of the matrix (upper 3x3)
and not to the translational component of the matrix.
Parameters:
m1 - The rotation matrix representing the rotational component
t1 - The translational component of the matrix
s - The scale value applied to the rotational components
Transform3D
12
JAMES
public Transform3D(Matrix3d m1,
Vector3d t1,
double s)
Constructs and initializes a transform from the rotation matrix, translation, and scale
values. The scale is applied only to the rotational components of the matrix (upper 3x3)
and not to the translational components of the matrix.
Parameters:
m1 - The rotation matrix representing the rotational component
t1 - The translational component of the matrix
s - The scale value applied to the rotational components
Transform3D
public Transform3D(Matrix3f m1,
Vector3f t1,
float s)
Constructs and initializes a transform from the rotation matrix, translation, and scale
values. The scale is applied only to the rotational components of the matrix (upper 3x3)
and not to the translational components of the matrix.
Parameters:
m1 - The rotation matrix representing the rotational component
t1 - The translational component of the matrix
s - The scale value applied to the rotational components

Constructor Detail

TransparencyAttributes
public TransparencyAttributes()
Constructs a TransparencyAttributes object with default parameters. The default values
are as follows:
transparency mode : NONE
transparency value : 0.0

TransparencyAttributes
public TransparencyAttributes(int tMode,
float tVal)
Construct TransparencyAttributes object with specified values.
Parameters:
tMode - the transparency mode.
tVal - the transparency value.

Field Detail
FIELD_LEFT
public static final int FIELD_LEFT
Specifies the left field of a field-sequential stereo rendering loop. A left field always
precedes a right field.
FIELD_RIGHT
public static final int FIELD_RIGHT
Specifies the right field of a field-sequential stereo rendering loop. A right field always
follows a left field.
FIELD_ALL
public static final int FIELD_ALL

Specifies a single-field rendering loop.

Constructor Detail
Canvas3D
public Canvas3D(java.awt.GraphicsConfiguration graphicsConfiguration)
Constructs and initializes a new Canvas3D object that Java 3D can render into. The
following Canvas3D attributes are initialized to default values as shown:
left manual eye in image plate : (0.142, 0.135, 0.4572)
right manual eye in image plate : (0.208, 0.135, 0.4572)
stereo enable : true
double buffer enable : true
13
JAMES
Parameters:
graphicsConfiguration - a valid GraphicsConfiguration object that will be used to create the
canvas.
See Also:
GraphicsConfiguration
Method Detail
paint
public void paint(java.awt.Graphics g)
Canvas3D uses the paint callback to track when it is possible to render into the canvas.
Subclasses of Canvas3D that override this method need to call super.paint() in thier paint
method for Java 3D to function properly.
Overrides:
paint in class java.awt.Canvas
addNotify
public void addNotify()
Canvas3D uses the addNotify callback to track when it is added to a container.
Subclasses of Canvas3D that override this method need to call super.addNotify() in thier
addNotify() method for Java 3D to function properly.
Overrides:
addNotify in class java.awt.Canvas
removeNotify
public void removeNotify()
Canvas3D uses the removeNotify callback to track when it is removed from a container.
Subclasses of Canvas3D that override this method need to call super.removeNotify() in
their removeNotify() method for Java 3D to function properly.
Overrides:
removeNotify in class java.awt.Component
getScreen3D
public final Screen3D getScreen3D()
Retrieve the Screen3D object that this Canvas3D is attached to.
Returns:
the 3D screen object that this Canvas3D is attached to
getGraphicsContext3D
public final GraphicsContext3D getGraphicsContext3D()
Get the immediate mode 3D graphics context associated with this Canvas3D. A new
graphics context object is created if one does not already exist.
Returns:
a GraphicsContext3D object that can be used for immediate mode rendering to this
Canvas3D.
preRender
public void preRender()
This routine is called by the Java 3D rendering loop after clearing the canvas and before
any rendering has been done for this frame. Applications that wish to perform operations
in the rendering loop, prior to any actual rendering may override this function.
NOTE: Applications should not call this method.

postRender
public void postRender()
This routine is called by the Java 3D rendering loop after completing all rendering to the
canvas for this frame and before the buffer swap. Applications that wish to perform
operations in the rendering loop, following any actual rendering may override this
function.
NOTE: Applications should not call this method.
postSwap
public void postSwap()
This routine is called by the Java 3D rendering loop after completing all rendering to the
canvas, and all other canvases associated with this view, for this frame following the
buffer swap. Applications that wish to perform operations at the very end of the rendering
loop may override this function.
NOTE: Applications should not call this method.
renderField
public void renderField(int fieldDesc)
This routine is called by the Java 3D rendering loop during the execution of the rendering
loop. It is called once for each field (i.e., once per frame on a mono system or once each
for the right eye and left eye on a two-pass stereo system. This is intended for use by
14
JAMES
applications that want to mix retained/compiled-retained mode rendering with some
immediate mode rendering. Applications that wish to perform operations during the
rendering loop, may override this function.
NOTE: Applications should not call this method.
Parameters:
fieldDesc - field description, one of: FIELD_LEFT, FIELD_RIGHT or FIELD_ALL. Applications
that wish to work correctly in stereo mode should render the same image for both
FIELD_LEFT and FIELD_RIGHT calls. If Java 3D calls the renderer with FIELD_ALL then the
immediate mode rendering only needs to be done once.
stopRenderer
public final void stopRenderer()
Stop the Java 3D renderer on this Canvas3D object. If the Java 3D renderer is currently
running, the rendering will be synchronized before being stopped. No further rendering
will be done to this canvas by Java 3D until the renderer is started again. In pure
immediate mode this method should be called prior to adding this canvas to an active
View object.
startRenderer
public final void startRenderer()
Start the Java 3D renderer on this Canvas3D object. If the Java 3D renderer is not
currently running, any rendering to other Canvas3D objects sharing the same View will be
synchronized before this Canvas3D's renderer is (re)started. When a Canvas3D is created,
it is initially marked as being started. This means that as soon as the Canvas3D is added
to an active View object, the rendering loop will render the scene graph to the canvas.
swap
public final void swap()
Synchronize and swap buffers on a double buffered canvas for this Canvas3D object. This
method should only be called if the Java 3D renderer has been stopped. In the normal
case, the renderer automatically swaps the buffer. If the Java 3D renderer is running for
this canvas then a RestrictedAccessException exception is thrown.
Throws:
RestrictedAccessException - if the Java 3D renderer is running.
See Also:
stopRenderer()
setLeftEyeInImagePlate
public final void setLeftEyeInImagePlate(Point3d position)
Deprecated. Use setLeftManualEyeInImagePlate instead.
setRightEyeInImagePlate
public final void setRightEyeInImagePlate(Point3d position)
Deprecated. Use setRightManualEyeInImagePlate instead.
setLeftManualEyeInImagePlate
public final void setLeftManualEyeInImagePlate(Point3d position)
Sets the position of the manual left eye in image-plate coordinates. This value determines
eye placement when a head tracker is not in use and the application is directly controlling
the eye position in image-plate coordinates. In head-tracked mode or when the
windowEyePointPolicy is RELATIVE_TO_FIELD_OF_VIEW, this value is ignored. When the
windowEyepointPolicy is RELATIVE_TO_WINDOW only the Z value is used.
Parameters:
position - the new manual left eye position
setRightManualEyeInImagePlate
public final void setRightManualEyeInImagePlate(Point3d position)
Sets the position of the manual right eye in image-plate coordinates. This value
determines eye placement when a head tracker is not in use and the application is
directly controlling the eye position in image-plate coordinates. In head-tracked mode or
when the windowEyePointPolicy is RELATIVE_TO_FIELD_OF_VIEW, this value is ignored.
When the windowEyepointPolicy is RELATIVE_TO_WINDOW only the Z value is used.
Parameters:
position - the new manual right eye position
getLeftManualEyeInImagePlate
public final void getLeftManualEyeInImagePlate(Point3d position)
Retrieves the position of the user-specified, manual left eye in image-plate coordinates
and copies that value into the object provided.
Parameters:
position - the object that will receive the position
getRightManualEyeInImagePlate
public final void getRightManualEyeInImagePlate(Point3d position)
Retrieves the position of the user-specified, manual right eye in image-plate coordinates
and copies that value into the object provided.

15
JAMES
Parameters:
position - the object that will receive the position
getLeftEyeInImagePlate
public final void getLeftEyeInImagePlate(Point3d position)
Retrieves the actual position of the left eye in image-plate coordinates and copies that
value into the object provided. This value is a function of the windowEyepointPolicy, the
tracking enable flag, and the manual left eye position.
Parameters:
position - the object that will receive the position
getRightEyeInImagePlate
public final void getRightEyeInImagePlate(Point3d position)
Retrieves the actual position of the right eye in image-plate coordinates and copies that
value into the object provided. This value is a function of the windowEyepointPolicy, the
tracking enable flag, and the manual right eye position.
Parameters:
position - the object that will receive the position
getCenterEyeInImagePlate
public final void getCenterEyeInImagePlate(Point3d position)
Retrieves the actual position of the center eye in image-plate coordinates and copies that
value into the object provided. The center eye is the fictional eye half-way between the
left and right eye. This value is a function of the windowEyepointPolicy, the tracking
enable flag, and the manual right and left eye positions.
Parameters:
position - the object that will receive the position
See Also:
View.setMonoscopicViewPolicy(int)
getImagePlateToVworld
public final void getImagePlateToVworld(Transform3D t)
Retrieves the current ImagePlate coordinates to Virtual World coordinates transform and
places it into the specified object.
Parameters:
t - the Transform3D object that will receive the transform
getPixelLocationInImagePlate
public final void getPixelLocationInImagePlate(int x,
int y,
Point3d position)
Computes the position of the specified AWT pixel value in image-plate coordinates and
copies that value into the object provided.
Parameters:
x - the X coordinate of the pixel relative to the upper-left hand corner of the window.
y - the Y coordinate of the pixel relative to the upper-left hand corner of the window.
position - the object that will receive the position in physical image plate coordinates
(relative to the lower-left corner of the screen).
getPhysicalWidth
public final double getPhysicalWidth()
Retrieves the physical width of this canvas window in meters.
Returns:
the physical window width in meters.
getPhysicalHeight
public final double getPhysicalHeight()
Retrieves the physical height of this canvas window in meters.
Returns:
the physical window height in meters.
getVworldToImagePlate
public final void getVworldToImagePlate(Transform3D t)
Retrieves the current Virtual World coordinates to ImagePlate coordinates transform and
places it into the specified object.
Parameters:
t - the Transform3D object that will receive the transform
getView
public final View getView()
Gets view that points to this Canvas3D.
Returns:
view object that points to this Canvas3D
getStereoAvailable
public final boolean getStereoAvailable()
Returns a status flag indicating whether or not stereo is available.
16
JAMES
Returns:
a flag indicating whether stereo is available
setStereoEnable
public final void setStereoEnable(boolean flag)
Turns stereo on or off. Note that this attribute is used only when stereo is available.
Enableing stereo on a Cavas3D that does not support stereo has no effect.
Parameters:
flag - enables or disables the display of stereo
getStereoEnable
public final boolean getStereoEnable()
Returns a status flag indicating whether or not stereo is enabled.
Returns:
a flag indicating whether stereo is enabled
getDoubleBufferAvailable
public final boolean getDoubleBufferAvailable()
Returns a status flag indicating whether or not double buffering is available.
Returns:
a flag indicating whether double buffering is available.
setDoubleBufferEnable
public final void setDoubleBufferEnable(boolean flag)
Turns double buffering on or off. If double buffering is off, all drawing is to the front buffer
and no buffer swap is done between frames. It should be stressed that running Java 3D
with double buffering disabled is not recommended.
Parameters:
flag - enables or disables double buffering.
getDoubleBufferEnable
public final boolean getDoubleBufferEnable()
Returns a status flag indicating whether or not double buffering is enabled.
Returns:
a flag indicating if double buffering is enabled.
getSceneAntialiasingAvailable
public final boolean getSceneAntialiasingAvailable()
Returns a status flag indicating whether or not scene antialiasing is available.
Returns:
a flag indicating whether scene antialiasing is available.

Transform3D
public Transform3D(Quat4f q1,
Vector3f t1,
float s)
Constructs and initializes a transform from the quaternion, translation, and scale values.
The scale is applied only to the rotational components of the matrix (upper 3x3) and not
to the translational components of the matrix.
Parameters:
q1 - The quaternion value representing the rotational component
t1 - The translational component of the matrix
s - The scale value applied to the rotational components

Transform3D
public Transform3D(double[] matrix)
Constructs and initializes a transform from the double precision array of length 16; the
top row of the matrix is initialized to the first four elements of the array, and so on. The
type of the transform is classified internally.
Parameters:
matrix - a float array of 16

ortho
public void ortho(double left,
double right,
double bottom,
double top,
double near,
double far)
Creates an orthographic projection transform that mimics a standard, camera-based,
view-model. This transform maps coordinates from Eye Coordinates (EC) to Clipping
Coordinates (CC). Note that unlike the similar function in OpenGL, the clipping

17
JAMES
coordinates generated by the resulting transform are in a right-handed coordinate system
(as are all other coordinate systems in Java 3D).
Parameters:
left - the vertical line on the left edge of the near clipping plane mapped to the left edge
of the graphics window
right - the vertical line on the right edge of the near clipping plane mapped to the right
edge of the graphics window
bottom - the horizontal line on the bottom edge of the near clipping plane mapped to the
bottom edge of the graphics window
top - the horizontal line on the top edge of the near clipping plane mapped to the top
edge of the graphics window
near - the distance to the frustum's near clipping plane. (the value -near is the location of
the near clip plane)
far - the distance to the frustum's far clipping plane.

frustum
public void frustum(double left,
double right,
double bottom,
double top,
double near,
double far)
Creates a perspective projection transform that mimics a standard, camera-based,
view-model. This transform maps coordinates from Eye Coordinates (EC) to
Clipping Coordinates (CC). Note that unlike the similar function in OpenGL, the
clipping coordinates generated by the resulting transform are in a right-handed
coordinate system (as are all other coordinate systems in Java 3D).

The frustum function-call establishes a view model with the eye at the apex of a symmetric
view frustum. The arguments define the frustum and its associated perspective projection: (left,
bottom, -near) and (right, top, -near) specify the point on the near clipping plane that maps onto
the lower-left and upper-right corners of the window respectively, assuming the eye is located at
(0, 0, 0).

Parameters:

left - the vertical line on the left edge of the near clipping plane mapped to the
left edge of the graphics window

right - the vertical line on the right edge of the near clipping plane mapped to the
right edge of the graphics window

bottom - the horizontal line on the bottom edge of the near clipping plane mapped
to the bottom edge of the graphics window

top - the horizontal line on the top edge of the near

near - the distance to the frustum's near clipping plane. This value must be
positive, (the value -near is the location of the near clip plane).

far - the distance to the frustum's far clipping plane. This value must be positive,
and must be greater than near.

perspective
public void perspective(double fovx,
double aspect,
double zNear,
double zFar)
Creates a perspective projection transform that mimics a standard, camera-based, view-
model. This transform maps coordinates from Eye Coordinates (EC) to Clipping
Coordinates (CC). Note that unlike the similar function in OpenGL, the clipping
coordinates generated by the resulting transform are in a right-handed coordinate system
(as are all other coordinate systems in Java 3D). Also note that the field of view is
specified in radians.
Parameters:
18
JAMES
fovx - specifies the field of view in the x direction, in radians
aspect - specifies the aspect ratio and thus the field of view in the x direction. The aspect
ratio is the ratio of x to y, or width to height.
zNear - the distance to the frustum's near clipping plane. This value must be positive, (the
value -zNear is the location of the near clip plane).
zFar - the distance to the frustum's far clipping plane.

getRotationScale
public final void getRotationScale(Matrix3f m1)
Gets the upper 3x3 values of this matrix and places them into the matrix m1.
Parameters:
m1 - The matrix that will hold the values

getRotationScale
public final void getRotationScale(Matrix3d m1)
Gets the upper 3x3 values of this matrix and places them into the matrix m1.
Parameters:
m1 - The matrix that will hold the values

lookAt
public void lookAt(Point3d eye,
Point3d center,
Vector3d up)
Helping function that specifies the position and orientation of a view matrix.
Parameters:
eye - the location of the eye
center - a point in the virtual world where the eye is looking
up - an up vector specifying the frustum's up direction

getTransform
public final void getTransform(Transform3D t1)
Copies the transform component of this TransformGroup into the passed transform object.
Parameters:
t1 - the transform object to be copied into.
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of
live or compiled scene graph

19

You might also like