

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object Direction
public class Direction
Represents a direction in the xy plane.
This class includes MANY methods of constructing and transforming directions. You can probably do all your direction calculations by calling the right method of this class!
Field Summary  

static double 
FULL_CIRCLE
Number of degrees to turn all the way around. 
Constructor Summary  

Direction(double direction)
Construct a direction at the given angle in degrees (e.g., 0 to 360 degrees, although this can handle angles outside that range). 

Direction(double x,
double y)
Construct a direction from the given vector. 
Method Summary  

static Direction 
createDirectionRadians(double radians)
Construct a direction at the given angle in radians (e.g., 0 to 2*Math.PI radians, although this can handle angles outside that range). 
static double 
distance(double x1,
double y1,
double x2,
double y2)
Convenience method to calculate the distance between two given points. 
boolean 
equals(java.lang.Object obj)

double 
getDirection()
Get the direction in degrees represented by this direction. 
double 
getDirectionRadians()
Get the direction in radians represented by this direction. 
Methods inherited from class java.lang.Object 

getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
Field Detail 

public static final double FULL_CIRCLE
Constructor Detail 

public Direction(double direction)
direction
 a direction in degreespublic Direction(double x, double y)
This method DOES handle x and y values of 0. If BOTH are 0, this just gives a direction pointing directly right.
x
 the distance in the x direction (rightward) to an object pointed
to by this directiony
 the distance in the y direction (downward) to an object pointed
to by this directionMethod Detail 

public static double distance(double x1, double y1, double x2, double y2)
x1
 the xcoord of the first pointy1
 the ycoord of the first pointx2
 the xcoord of the second pointy2
 the ycoord of the second point
public double getDirection()
public double getDirectionRadians()
public static Direction createDirectionRadians(double radians)
radians
 a direction in radians
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object


PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 