## visad.java2d
Class MouseBehaviorJ2D

    java.lang.Object
      visad.java2d.MouseBehaviorJ2D

All Implemented Interfaces:
  MouseBehavior

public class MouseBehaviorJ2D
extends Object
implements MouseBehavior

MouseBehaviorJ2D is the VisAD class for mouse behaviors for Java2D

Field Summary
`(package private) DisplayImpl` `display`
`(package private) DisplayRendererJ2D` `display_renderer` DisplayRenderer for Display
`(package private) static double` `EPS`

Constructor Summary
`MouseBehaviorJ2D(DisplayRendererJ2D r)` Construct a MouseBehavior for the DisplayRenderer specified
`MouseBehaviorJ2D(DisplayRendererJ2D 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.
`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.
`int[]` `getScreenCoords(double[] position)` Return the screen coordinates corresponding to the VisAD coordinates.
`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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### display_renderer

    DisplayRendererJ2D display_renderer

  DisplayRenderer for Display

### display

    DisplayImpl display

### EPS

    static final double EPS

See Also:
  Constant Field Values

Constructor Detail

### MouseBehaviorJ2D

    public MouseBehaviorJ2D(DisplayRendererJ2D r)

  Construct a MouseBehavior for the DisplayRenderer specified

Parameters:
  `r` - DisplayRenderer to use

### MouseBehaviorJ2D

    public MouseBehaviorJ2D(DisplayRendererJ2D r,
                            Class mhClass)

  Construct a MouseBehavior for the DisplayRenderer specified

Parameters:
  `r` - DisplayRenderer to use
  `mhClass` - MouseHelper subclass to use

Method Detail

### getMouseHelper

    public MouseHelper getMouseHelper()

  Get the helper class used by this MouseBehavior. The `MouseHelper` defines the actions taken based on `MouseEvent`s.

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

### 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) 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

### 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.

  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

### 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

### 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