|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--MotionUtils
MotionUtils is a class with a number of static methods for findings distances and direction. All distances are given in absolute values all directions are given in radians where 0 <= r <= 2pi. in terms of the screen, direction looks like this
pi/2 | pi --x-- 0 | 3pi/2
Constructor Summary | |
MotionUtils()
|
Method Summary | |
static double |
direction(double x1,
double y1, double x2, double y2) Performs the same function as direction(Point, Point) but the arguments are integer coordinates. |
static double |
direction(HiResPoint a,
HiResPoint b) Return the direction between the given pair of HiResPoints |
static double |
direction(java.awt.Point a,
java.awt.Point b) Return the direction from point a to point b. |
static double |
distance(double x1,
double y1, double x2, double y2) Return the distance between the given pair of coordinates. |
static double |
distance(HiResPoint a,
HiResPoint b) Return the distance between the given pair of HiRes points. |
static double |
distance(java.awt.Point a,
java.awt.Point b) Return the distance between the given pair of points. |
static HiResPoint |
move(double magnitude,
double direction) Given a magnitude and a direction, return a Point whose x and y members are the deltas that would result from moving a distance of magnitude in the given direction. |
static double |
oppositeDirection(double direction)
Given a direction, return the opposite direction (eg - PI radians the other way). |
static double |
radiansToDegrees(double rad)
Convert radians to degrees. |
static VectorQuantity |
resultant(double mag1,
double d1, double mag2, double d2) Given two magnitudes and two direction, return their resultant. |
Methods inherited from class java.lang.Object |
|
Constructor Detail |
public MotionUtils()
Method Detail |
public static double distance(double x1, double y1, double x2, double y2)
public static double distance(java.awt.Point a, java.awt.Point b)
public static double distance(HiResPoint a, HiResPoint b)
public static double direction(java.awt.Point a, java.awt.Point b)
a --> b gives 0 radians and b <-- a gives PI radians
public static double direction(HiResPoint a, HiResPoint b)
public static double direction(double x1, double y1, double x2, double y2)
public static HiResPoint move(double magnitude, double direction)
public static double oppositeDirection(double direction)
public static double radiansToDegrees(double rad)
rad
- an angle in radianspublic static VectorQuantity resultant(double mag1, double d1, double mag2, double d2)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |