at.wisch.joystick.ffeffect.direction
Class PolarDirection

java.lang.Object
  extended by at.wisch.joystick.ffeffect.direction.Direction
      extended by at.wisch.joystick.ffeffect.direction.PolarDirection

public class PolarDirection
extends Direction

The Class PolarDirection. A PolarDirection is specified by polar coordinates in degrees, clockwise, starting from NORTH.

The degree value is encoded by hundredths of a degree starting from north and turning clockwise. The cardinal directions would be:
- North: 0 (0 degrees)
- East: 9000 (90 degrees)
- South: 18000 (180 degrees)
- West: 27000 (270 degrees)

Author:
Martin Wischenbart

Field Summary
static int EAST
          The constant EAST (9000 ): force comes from right.
static int NORTH
          The constant NORTH (0 ): force comes from top.
static int NORTHEAST
          The constant NORTHEAST (4500 ): force comes from top-right.
static int NORTHWEST
          The constant NORTHWEST (31500 ): force comes from top-left.
static int SOUTH
          The constant SOUTH (18000 ) force comes from bottom.
static int SOUTHEAST
          The constant SOUTHEAST (13500 ): force comes from bottom-right.
static int SOUTHWEST
          The constant SOUTHWEST (22500 ): force comes bottom down-left.
static int WEST
          The constant WEST (27000 ): force comes from left.
 
Fields inherited from class at.wisch.joystick.ffeffect.direction.Direction
DIRECTION_CARTESIAN, DIRECTION_POLAR, DIRECTION_SPHERICAL
 
Constructor Summary
PolarDirection()
          Instantiates a new polar direction with the default direction (NORTHWEST).
PolarDirection(int polarDirection)
          Instantiates a new polar direction with the specified direction value.
 
Method Summary
 java.lang.String getName()
          Gets the direction type as a String.
 int getPolarDirection()
          Gets the polar direction value.
 void setPolarDirection(int polarDirection)
          Sets the polar direction value.
 CartesianDirection toCartesianDirection(Direction direction)
          Converts the Direction to CartesianDirection.
 PolarDirection toPolarDirection(Direction direction)
          Converts the Direction to PolarDirection.
 SphericalDirection toSphericalDirection(Direction direction)
          Converts the Direction to SphericalDirection.
 
Methods inherited from class at.wisch.joystick.ffeffect.direction.Direction
getDirectionType
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NORTH

public static final int NORTH
The constant NORTH (0 ): force comes from top.

See Also:
Constant Field Values

NORTHEAST

public static final int NORTHEAST
The constant NORTHEAST (4500 ): force comes from top-right.

See Also:
Constant Field Values

EAST

public static final int EAST
The constant EAST (9000 ): force comes from right.

See Also:
Constant Field Values

SOUTHEAST

public static final int SOUTHEAST
The constant SOUTHEAST (13500 ): force comes from bottom-right.

See Also:
Constant Field Values

SOUTH

public static final int SOUTH
The constant SOUTH (18000 ) force comes from bottom.

See Also:
Constant Field Values

SOUTHWEST

public static final int SOUTHWEST
The constant SOUTHWEST (22500 ): force comes bottom down-left.

See Also:
Constant Field Values

WEST

public static final int WEST
The constant WEST (27000 ): force comes from left.

See Also:
Constant Field Values

NORTHWEST

public static final int NORTHWEST
The constant NORTHWEST (31500 ): force comes from top-left.

See Also:
Constant Field Values
Constructor Detail

PolarDirection

public PolarDirection(int polarDirection)
Instantiates a new polar direction with the specified direction value.

Parameters:
polarDirection - the polar direction (values from 0 to 35999)

PolarDirection

public PolarDirection()
Instantiates a new polar direction with the default direction (NORTHWEST).

Method Detail

getPolarDirection

public int getPolarDirection()
Gets the polar direction value.

Returns:
the polar direction (values from 0 to 35999)

setPolarDirection

public void setPolarDirection(int polarDirection)
Sets the polar direction value.

Parameters:
polarDirection - the new polar direction (values from 0 to 35999)

getName

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

Specified by:
getName in class Direction
Returns:
the name of the direction type: "Polar"
See Also:
Direction.getDirectionType()

toCartesianDirection

public CartesianDirection toCartesianDirection(Direction direction)
Description copied from class: Direction
Converts the Direction to CartesianDirection. If the object already is of type CartesianDirection, it will return that object.

Specified by:
toCartesianDirection in class Direction
Parameters:
direction - the Direction to be converted
Returns:
the CartesianDirection

toPolarDirection

public PolarDirection toPolarDirection(Direction direction)
Converts the Direction to PolarDirection. If the object already is of type PolarDirection, it will return that object. As the Direction is a PolarDirection it returns this (not a copy, but really this object)

Specified by:
toPolarDirection in class Direction
Parameters:
direction - the Direction to be converted
Returns:
the PolarDirection

toSphericalDirection

public SphericalDirection toSphericalDirection(Direction direction)
Converts the Direction to SphericalDirection. If the object already is of type SphericalDirection, it will return that object. The as PolarDirection supports only 2 FF axes, the second angle value will be 0.

Specified by:
toSphericalDirection in class Direction
Parameters:
direction - the Direction to be converted
Returns:
the SphericalDirection