IRAccelerometerMouse
Keywords: wiiremotej.IRAccelerometerMouse class

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## wiiremotej
Class IRAccelerometerMouse

    java.lang.Object
      wiiremotej.WiiRemoteMouse
          wiiremotej.IRAccelerometerMouse

    public class IRAccelerometerMouse

extends WiiRemoteMouse

An interface for implementing mouse functionality using the Wii Remote through the IR sensor and accelerometer. Maps the IR camera's 1024X768 resolution to the screen. The mouse takes the average of all of the light points it sees on the screen (1, 2, 3, or 4) and uses the center point. This mouse will take into account the orientation of the remote when determining coordinates. Note that because this mouse uses absolute positioning, if sensitivity is set to be less than 1, the mouse will not be able to cover the whole screen.

Field Summary

Fields inherited from class wiiremotej.WiiRemoteMouse
`xSensitivity, ySensitivity`

Constructor Summary
`IRAccelerometerMouse(double xSensitivity, double ySensitivity, double xThreshold, double yThreshold, double rollSensitivity)` Constructs a new IRAccelerometerMouse.

Method Summary
`static IRAccelerometerMouse` | `getDefault()` Returns a basic IR + accelerometer mouse.
`double` | `getRollSensitivity()` Returns the pitch sensitivity of this "mouse." Pitch sensitivity is precision to which pitch will be rounded to when determining remote orientation.
`void` | `processMouseEvent(WRIREvent evt, WRAccelerationEvent evt2)` Processes the given WRIREvent and moves the mouse if necessary based on user settings and input.
`void` | `setRollSensitivity(double rollSensitivity)` Sets the pitch sensitivity of this "mouse" to the given value.

Methods inherited from class wiiremotej.WiiRemoteMouse
`getXSensitivity, getYSensitivity, moveMouse, setXSensitivity, setYSensitivity`

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

Constructor Detail

### IRAccelerometerMouse

    public IRAccelerometerMouse(double xSensitivity,
                                double ySensitivity,
                                double xThreshold,
                                double yThreshold,
                                double rollSensitivity)
                         throws java.awt.AWTException,
                                java.lang.SecurityException,
                                java.lang.IllegalArgumentException

  Constructs a new IRAccelerometerMouse.

  Parameters:
    `xSensitivity` - the modifier to multiply the X offset (from the center of the screen) by. A negative modifier will move the mouse the opposite way.
    `ySensitivity` - the modifier to multiply the Y offset (from the center of the screen) by. A negative modifier will move the mouse the opposite way.
    `xThreshold` - the percent (0 to 1 scale) different the X coordinate must be to be counted as a change (and thus trigger mouse movement).
    `yThreshold` - the percent (0 to 1 scale) different the Y coordinate must be to be counted as a change (and thus trigger mouse movement).
    `rollSensitivity` - the precision to which roll will be rounded to when determining remote orientation. Used to reduce jumpiness.
  Throws:
    `java.awt.AWTException` - if the platform configuration does not allow low-level input control. This exception is always thrown when GraphicsEnvironment.isHeadless() returns true.
    `java.lang.SecurityException` - if createRobot permission is not granted.
    `java.lang.IllegalArgumentException` - if xThreshold or yThreshold or rollSensitivity is less than 0.

Method Detail

### getDefault

    public static IRAccelerometerMouse getDefault()
                                           throws java.awt.AWTException,
                                                  java.lang.SecurityException

  Returns a basic IR + accelerometer mouse. xSensitivity: 1.45. ySensitivity: 1.45. xThreshold: 0.02. yThreshold: 0.02. rollSensitivity: PI/4.

  Returns:
    a basic IR + accelerometer mouse.
  Throws:
    `java.awt.AWTException` - if the platform configuration does not allow low-level input control. This exception is always thrown when GraphicsEnvironment.isHeadless() returns true.
    `java.lang.SecurityException` - if createRobot permission is not granted.

### processMouseEvent

    public void processMouseEvent(WRIREvent evt,
                                  WRAccelerationEvent evt2)

  Processes the given WRIREvent and moves the mouse if necessary based on user settings and input. Maps the IR camera's 1024X768 resolution to the screen. The mouse takes the average of two points it sees on the screen and uses the center point. If there are more than two lights, it won't work. It also uses acceleration information to help determine its orientation.

  Parameters:
    `evt` - the IR event to use when calculating mouse movement.
    `evt2` - the acceleration event to use when calculating mouse movement.

### getRollSensitivity

    public double getRollSensitivity()

  Returns the pitch sensitivity of this "mouse." Pitch sensitivity is precision to which pitch will be rounded to when determining remote orientation. The rounding is done using the half-up rounding method.

  Returns:
    the pitch sensitivity of this "mouse."

### setRollSensitivity

    public void setRollSensitivity(double rollSensitivity)

  Sets the pitch sensitivity of this "mouse" to the given value.

  Parameters:
    `rollSensitivity` - the new pitch sensitivity value.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD