at.wisch.joystick.ffeffect.direction
Class Direction

java.lang.Object
  extended by at.wisch.joystick.ffeffect.direction.Direction
Direct Known Subclasses:
CartesianDirection, PolarDirection, SphericalDirection

public abstract class Direction
extends java.lang.Object

The Class Direction. An object Direction specifies the direction from where the force comes.

Most Controllers have 2 or 3 FF axes:
- X, Y and Z axis
- different rumble motors

The following diagram represents the cardinal directions:

                 .--.
                 |__| .-------.
                 |=.| |.-----.|
                 |--| ||     ||
                 |  | |'-----'|
                 |__|˜')_____('
                  [ COMPUTER ]
  
                     North
                       ˆ
                       |
                       |
        West <----[ HAPTIC ]----> East
                       |
                       |
                       v
                     South
  
                    [ USER ]
                      \|||/
                      (o o)
                ---ooO-(_)-Ooo---
 
Note: Because on some operating systems there is an issue with the order of the axes you might want to use PolarDirection objects to stay fully platform independent, if possible. On the other hand, be aware that some controllers, which have 3 FF axes, do not support PolarDirection.

Author:
Martin Wischenbart

Field Summary
static int DIRECTION_CARTESIAN
          The constant DIRECTION_CARTESIAN: the object is a CartesianDirection (casting is safe).
static int DIRECTION_POLAR
          The constant DIRECTION_POLAR: the object is a PolarDirection (casting is safe).
static int DIRECTION_SPHERICAL
          The constant DIRECTION_SPHERICAL: the object is a SphericalDirection (casting is safe).
 
Method Summary
 int getDirectionType()
          Gets the direction type.
abstract  java.lang.String getName()
          Gets the direction type as a String.
abstract  CartesianDirection toCartesianDirection(Direction direction)
          Converts the Direction to CartesianDirection.
abstract  PolarDirection toPolarDirection(Direction direction)
          Converts the Direction to PolarDirection.
abstract  SphericalDirection toSphericalDirection(Direction direction)
          Converts the Direction to SphericalDirection.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DIRECTION_POLAR

public static final int DIRECTION_POLAR
The constant DIRECTION_POLAR: the object is a PolarDirection (casting is safe).

See Also:
Constant Field Values

DIRECTION_SPHERICAL

public static final int DIRECTION_SPHERICAL
The constant DIRECTION_SPHERICAL: the object is a SphericalDirection (casting is safe).

See Also:
Constant Field Values

DIRECTION_CARTESIAN

public static final int DIRECTION_CARTESIAN
The constant DIRECTION_CARTESIAN: the object is a CartesianDirection (casting is safe).

See Also:
Constant Field Values
Method Detail

getDirectionType

public int getDirectionType()
Gets the direction type.

Returns:
the direction type: one of the following: DIRECTION_POLAR, DIRECTION_SPHERICAL, DIRECTION_CARTESIAN
See Also:
getName()

getName

public abstract java.lang.String getName()
Gets the direction type as a String.

Returns:
the name of the direction type: one of the following: "Polar", "Spherical" or "Cartesian"
See Also:
getDirectionType()

toPolarDirection

public abstract PolarDirection toPolarDirection(Direction direction)
Converts the Direction to PolarDirection. If the object already is of type PolarDirection, it will return that object.

Parameters:
direction - the Direction to be converted
Returns:
the PolarDirection

toSphericalDirection

public abstract SphericalDirection toSphericalDirection(Direction direction)
Converts the Direction to SphericalDirection. If the object already is of type SphericalDirection, it will return that object.

Parameters:
direction - the Direction to be converted
Returns:
the SphericalDirection

toCartesianDirection

public abstract CartesianDirection toCartesianDirection(Direction direction)
Converts the Direction to CartesianDirection. If the object already is of type CartesianDirection, it will return that object.

Parameters:
direction - the Direction to be converted
Returns:
the CartesianDirection