visad.java3d
Class MouseBehaviorJ3D

java.lang.Object
  extended by javax.media.j3d.SceneGraphObject
      extended by javax.media.j3d.Node
          extended by javax.media.j3d.Leaf
              extended by javax.media.j3d.Behavior
                  extended by visad.java3d.MouseBehaviorJ3D
All Implemented Interfaces:
MouseBehavior
Direct Known Subclasses:
WandBehaviorJ3D

public class MouseBehaviorJ3D
extends Behavior
implements MouseBehavior

MouseBehaviorJ3D is the VisAD class for mouse behaviors for Java3D


Field Summary
 
Fields inherited from class javax.media.j3d.Node
ALLOW_AUTO_COMPUTE_BOUNDS_READ, ALLOW_AUTO_COMPUTE_BOUNDS_WRITE, ALLOW_BOUNDS_READ, ALLOW_BOUNDS_WRITE, ALLOW_COLLIDABLE_READ, ALLOW_COLLIDABLE_WRITE, ALLOW_LOCAL_TO_VWORLD_READ, ALLOW_LOCALE_READ, ALLOW_PARENT_READ, ALLOW_PICKABLE_READ, ALLOW_PICKABLE_WRITE, ENABLE_COLLISION_REPORTING, ENABLE_PICK_REPORTING
 
Constructor Summary
MouseBehaviorJ3D()
          Default Constructor
MouseBehaviorJ3D(DisplayRendererJ3D r)
          Construct a MouseBehavior for the DisplayRenderer specified
MouseBehaviorJ3D(DisplayRendererJ3D r, Class mhClass)
          Construct a MouseBehavior for the DisplayRenderer specified
 
Method Summary
 VisADRay cursorRay(double[] cursor)
          Return the VisAD ray corresponding to the VisAD cursor coordinates.
 void destroy()
           
 VisADRay findRay(int screen_x, int screen_y)
          Return the VisAD ray corresponding to the component coordinates.
 MouseHelper getMouseHelper()
          Get the helper class used by this MouseBehavior.
 double[] getPlateCoords(double[] position)
          Return the screen coordinates corresponding to the VisAD coordinates.
 int[] getScreenCoords(double[] position)
          Return the screen coordinates corresponding to the VisAD coordinates.
 void initialize()
          Initialize this behavior.
 void instance_unmake_matrix(double[] rot, double[] scale, double[] trans, double[] matrix)
          Get the rotation, scale and translation parameters for the specified matrix.
 double[] make_matrix(double rotx, double roty, double rotz, double scale, double transx, double transy, double transz)
          Make a transformation matrix to perform the given rotation, scale and translation.
 double[] make_matrix(double rotx, double roty, double rotz, double scalex, double scaley, double scalez, double transx, double transy, double transz)
          Make a transformation matrix to perform the given rotation, scale and translation.
 double[] make_translate(double transx, double transy)
          Create a translation matrix.
 double[] make_translate(double transx, double transy, double transz)
          Create a translation matrix.
 double[] multiply_matrix(double[] a, double[] b)
          Multiply the two matrices together.
 void processStimulus(Enumeration criteria)
          Process a stimulus meant for this behavior.
static double[] static_make_matrix(double rotx, double roty, double rotz, double scale, double transx, double transy, double transz)
          Make a transformation matrix to perform the given rotation, scale and translation.
static double[] static_make_matrix(double rotx, double roty, double rotz, double scalex, double scaley, double scalez, double transx, double transy, double transz)
          Make a transformation matrix to perform the given rotation, scale and translation.
static double[] static_multiply_matrix(double[] a, double[] b)
          Multiply the two matrices together.
static void unmake_matrix(double[] rot, double[] scale, double[] trans, double[] matrix)
          Get the rotation, scale and translation parameters for the specified matrix.
 
Methods inherited from class javax.media.j3d.Behavior
getEnable, getNumSchedulingIntervals, getSchedulingBoundingLeaf, getSchedulingBounds, getSchedulingInterval, getView, getWakeupCondition, postId, setEnable, setSchedulingBoundingLeaf, setSchedulingBounds, setSchedulingInterval, updateNodeReferences, wakeupOn
 
Methods inherited from class javax.media.j3d.Node
cloneNode, cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, duplicateNode, getBounds, getBoundsAutoCompute, getCollidable, getLocale, getLocalToVworld, getLocalToVworld, getParent, getPickable, setBounds, setBoundsAutoCompute, setCollidable, setPickable
 
Methods inherited from class javax.media.j3d.SceneGraphObject
clearCapability, clearCapabilityIsFrequent, duplicateSceneGraphObject, getCapability, getCapabilityIsFrequent, getName, getUserData, isCompiled, isLive, setCapability, setCapabilityIsFrequent, setName, setUserData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MouseBehaviorJ3D

public MouseBehaviorJ3D()
Default Constructor


MouseBehaviorJ3D

public MouseBehaviorJ3D(DisplayRendererJ3D r)
Construct a MouseBehavior for the DisplayRenderer specified

Parameters:
r - DisplayRenderer to use

MouseBehaviorJ3D

public MouseBehaviorJ3D(DisplayRendererJ3D r,
                        Class mhClass)
Construct a MouseBehavior for the DisplayRenderer specified

Parameters:
r - DisplayRenderer to use
mhClass - MouseHelper subclass to use
Method Detail

destroy

public void destroy()

getMouseHelper

public MouseHelper getMouseHelper()
Get the helper class used by this MouseBehavior. The MouseHelper defines the actions taken based on MouseEvents.

Specified by:
getMouseHelper in interface MouseBehavior
Returns:
MouseHelper being used.

initialize

public void initialize()
Initialize this behavior. NOTE: Applications should not call this method. It is called by the Java 3D behavior scheduler.

Specified by:
initialize in class Behavior

processStimulus

public void processStimulus(Enumeration criteria)
Process a stimulus meant for this behavior. This method is invoked when a key is pressed. NOTE: Applications should not call this method. It is called by the Java 3D behavior scheduler.

Specified by:
processStimulus in class Behavior
Parameters:
criteria - an enumeration of triggered wakeup criteria

findRay

public VisADRay findRay(int screen_x,
                        int screen_y)
Return the VisAD ray corresponding to the component coordinates.

Specified by:
findRay in interface MouseBehavior
Parameters:
screen_x - x coordinate of the component
screen_y - y coordinate of the component
Returns:
corresponding VisADRay
See Also:
VisADRay, LocalDisplay.getComponent()

cursorRay

public VisADRay cursorRay(double[] cursor)
Return the VisAD ray corresponding to the VisAD cursor coordinates.

Specified by:
cursorRay in interface MouseBehavior
Parameters:
cursor - array (x,y,z) of cursor location
Returns:
corresponding VisADRay
See Also:
VisADRay, DisplayRenderer.getCursor()

getScreenCoords

public int[] getScreenCoords(double[] position)
Return the screen coordinates corresponding to the VisAD coordinates.

Specified by:
getScreenCoords in interface MouseBehavior
Parameters:
position - array of VisAD coordinates
Returns:
corresponding (x, y) screen coordinates

getPlateCoords

public double[] getPlateCoords(double[] position)
Return the screen coordinates corresponding to the VisAD coordinates.

Parameters:
position - array of VisAD coordinates
Returns:
corresponding (x, y) plate coordinates (in meters)

make_translate

public double[] make_translate(double transx,
                               double transy,
                               double transz)
Create a translation matrix.

Specified by:
make_translate in interface MouseBehavior
Parameters:
transx - x translation amount
transy - y translation amount
transz - z translation amount
Returns:
new translation matrix. This can be used to translate the current matrix
See Also:
multiply_matrix(double[] a, double[] b)

make_translate

public double[] make_translate(double transx,
                               double transy)
Create a translation matrix. no translation in Z direction (useful for 2D in Java 3D.

Specified by:
make_translate in interface MouseBehavior
Parameters:
transx - x translation amount
transy - y translation amount
Returns:
new translation matrix. This can be used to translate the current matrix
See Also:
multiply_matrix(double[] a, double[] b)

multiply_matrix

public double[] multiply_matrix(double[] a,
                                double[] b)
Multiply the two matrices together.

Specified by:
multiply_matrix in interface MouseBehavior
Parameters:
a - first matrix
b - second matrix
Returns:
new resulting matrix
See Also:
static_multiply_matrix(double[], double[])

static_multiply_matrix

public static double[] static_multiply_matrix(double[] a,
                                              double[] b)
Multiply the two matrices together. Static version of multiply_matrix.

Parameters:
a - first matrix
b - second matrix
Returns:
new resulting matrix
See Also:
multiply_matrix(double[] a, double[] b)

make_matrix

public double[] make_matrix(double rotx,
                            double roty,
                            double rotz,
                            double scale,
                            double transx,
                            double transy,
                            double transz)
Make a transformation matrix to perform the given rotation, scale and translation. This function uses the fast matrix post-concatenation techniques from Graphics Gems.

Specified by:
make_matrix in interface MouseBehavior
Parameters:
rotx - x rotation
roty - y rotation
rotz - z rotation
scale - scaling factor
transx - x translation
transy - y translation
transz - z translation
Returns:
new matrix

make_matrix

public double[] make_matrix(double rotx,
                            double roty,
                            double rotz,
                            double scalex,
                            double scaley,
                            double scalez,
                            double transx,
                            double transy,
                            double transz)
Make a transformation matrix to perform the given rotation, scale and translation. This function uses the fast matrix post-concatenation techniques from Graphics Gems.

Specified by:
make_matrix in interface MouseBehavior
Parameters:
rotx - x rotation
roty - y rotation
rotz - z rotation
scalex - x scaling factor
scaley - y scaling factor
scalez - z scaling factor
transx - x translation
transy - y translation
transz - z translation
Returns:
new matrix

static_make_matrix

public static double[] static_make_matrix(double rotx,
                                          double roty,
                                          double rotz,
                                          double scale,
                                          double transx,
                                          double transy,
                                          double transz)
Make a transformation matrix to perform the given rotation, scale and translation. This function uses the fast matrix post-concatenation techniques from Graphics Gems. Static version of make_matrix.

Parameters:
rotx - x rotation
roty - y rotation
rotz - z rotation
scale - scaling factor
transx - x translation
transy - y translation
transz - z translation
Returns:
new matrix
See Also:
make_matrix(double rotx, double roty, double rotz, double scale, double transx, double transy, double transz)

static_make_matrix

public static double[] static_make_matrix(double rotx,
                                          double roty,
                                          double rotz,
                                          double scalex,
                                          double scaley,
                                          double scalez,
                                          double transx,
                                          double transy,
                                          double transz)
Make a transformation matrix to perform the given rotation, scale and translation. This function uses the fast matrix post-concatenation techniques from Graphics Gems. Static version of make_matrix.

Parameters:
rotx - x rotation
roty - y rotation
rotz - z rotation
scalex - x scaling factor
scaley - y scaling factor
scalez - z scaling factor
transx - x translation
transy - y translation
transz - z translation
Returns:
new matrix
See Also:
make_matrix(double rotx, double roty, double rotz, double scale, double transx, double transy, double transz)

instance_unmake_matrix

public void instance_unmake_matrix(double[] rot,
                                   double[] scale,
                                   double[] trans,
                                   double[] matrix)
Get the rotation, scale and translation parameters for the specified matrix. Results are not valid for non-uniform aspect (scale).

Specified by:
instance_unmake_matrix in interface MouseBehavior
Parameters:
rot - array to hold x,y,z rotation values
scale - array to hold scale value
trans - array to hold x,y,z translation values

unmake_matrix

public static void unmake_matrix(double[] rot,
                                 double[] scale,
                                 double[] trans,
                                 double[] matrix)
Get the rotation, scale and translation parameters for the specified matrix. Results are not valid for non-uniform aspect (scale). Static version of instance_unmake_matrix.

Parameters:
rot - array to hold x,y,z rotation values
scale - array to hold scale value(s). If length == 1, assumes uniform scaling.
trans - array to hold x,y,z translation values