|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavoids.Common
public class Common
A class of commonly used static functions that should not apply to any specific class getDistanceXY -calculate the distance between two cartesian coordinates getDistanceM -calculate the distance between two cartesian coordinates w/ Mobeus effect smallest of XY and XY2 getQuadrantXY -calculate the relative quadrant that another sprite is in getQuadrantM -calculate the relative quadrant that another sprite is in w/ Mobeus effect getAngleOrigin -calculate the angle between two cartesian coordinates effect relative to 0 (straight up) 0..359 clockwise getAngleXY -calculate the angle between two cartesian coordinates effect relative to 0 (straight up) 0..359 clockwise getAngleM -calculate the angle between two cartesian coordinates w/ Mobeus effect relative to 0 (straight up) 0..359 clockwise target -have one sprite turn to face another sprite (instantaneous turns)
Field Summary | |
---|---|
static double |
PI2
constant for 2*PI used in calculations |
private static long |
serialVersionUID
This is the version used for serializing/deserializing (storing/retrieving) this object |
static double |
toRadians
constant to quickly convert to radian values (for calling Java's math functions that use radian values) |
static java.lang.String |
URL_SEPARATOR
constant for separating URLs |
Constructor Summary | |
---|---|
Common()
|
Method Summary | |
---|---|
static double |
getAngleM(double x1,
double y1,
double x2,
double y2,
double width,
double height)
|
static double |
getAngleOrigin(double x1,
double y1,
double x2,
double y2)
|
static double |
getAngleXY(double x1,
double y1,
double x2,
double y2)
|
static double |
getDistanceM(double x1,
double y1,
double x2,
double y2,
double width,
double height)
|
static double |
getDistanceM(Move move1,
Move move2)
|
static double |
getDistanceXY(double x1,
double y1,
double x2,
double y2)
|
static int |
getQuadrantM(double x1,
double y1,
double x2,
double y2,
double width,
double height)
|
static int |
getQuadrantXY(double x1,
double y1,
double x2,
double y2)
|
static double |
pow2(double x)
|
static void |
target(Move move1,
Move move2)
change the direction of move1 toward the location in move2 (to target that point) |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
public static java.lang.String URL_SEPARATOR
public static double PI2
public static double toRadians
Constructor Detail |
---|
public Common()
Method Detail |
---|
public static double pow2(double x)
x
- the value to square
public static double getDistanceXY(double x1, double y1, double x2, double y2)
x1
- point1's x coordinatey1
- point1's y coordinatex2
- point2's x coordinatey2
- point2's y coordinate
public static double getDistanceM(double x1, double y1, double x2, double y2, double width, double height)
x1
- point1's x coordinatey1
- point1's y coordinatex2
- point2's x coordinatey2
- point2's y coordinatewidth
- the width of the screenheight
- the height of the screen
public static int getQuadrantXY(double x1, double y1, double x2, double y2)
x1
- point1's x coordinatey1
- point1's y coordinatex2
- point2's x coordinatey2
- point2's y coordinate
public static int getQuadrantM(double x1, double y1, double x2, double y2, double width, double height)
x1
- point1's x coordinatey1
- point1's y coordinatex2
- point2's x coordinatey2
- point2's y coordinatewidth
- the width of the screenheight
- the height of the screen
public static double getAngleOrigin(double x1, double y1, double x2, double y2)
x1
- point1's x coordinatey1
- point1's y coordinatex2
- point2's x coordinatey2
- point2's y coordinate
public static double getAngleXY(double x1, double y1, double x2, double y2)
x1
- point1's x coordinatey1
- point1's y coordinatex2
- point2's x coordinatey2
- point2's y coordinate
public static double getAngleM(double x1, double y1, double x2, double y2, double width, double height)
x1
- point1's x coordinatey1
- point1's y coordinatex2
- point2's x coordinatey2
- point2's y coordinatewidth
- the width of the screenheight
- the height of the screen
public static double getDistanceM(Move move1, Move move2)
move1
- the first location informationmove2
- the second location information
public static void target(Move move1, Move move2)
move1
- the first location informationmove2
- the second location information
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |