|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectrcssjava.Utils
public class Utils
Math and other utility functions that don't depend on the world state.
Method Summary | |
---|---|
static double |
acosDeg(double x)
Arccosine (in degrees) |
static double |
asinDeg(double x)
Arcsine (in degrees) |
static double |
atan2Deg(double y,
double x)
Arctangent (in degrees) of ratio |
static double |
atanDeg(double x)
Arctangent (in degrees) |
static double |
cosDeg(double angDeg)
Cosine of angle in degrees |
static int |
getBallID()
Get ball's object ID |
static double |
getBisectorTwoAngles(double ang1,
double ang2)
Bisector of smallest angle made between given angles |
static int |
getLeftPlayerID(int unum)
Get left player's ID from uniform number |
static int |
getPlayerID(int side,
int unum)
Get player's ID from side and uniform number |
static java.lang.String |
getPlayModeString(int pm)
Get text label for a playmode |
static int |
getRightPlayerID(int unum)
Get right player's ID from uniform number |
static int |
getSideFromID(int id)
Get player's or other object's side |
static int |
getUnumFromID(int id)
Get player's uniform number |
static boolean |
isBall(int id)
Is this the ball? |
static boolean |
isGoal(int id)
Is this a goal? |
static boolean |
isLeftGoal(int id)
Is this the left goal? |
static boolean |
isLeftPlayer(int id)
Is player on left team? |
static boolean |
isPlayer(int id)
Is this a player? |
static boolean |
isRightGoal(int id)
Is this the right goal? |
static boolean |
isRightPlayer(int id)
Is player on right team? |
static double |
normalizeAngle(double angDeg)
Normalize angle to be between -180 and 180 |
static int |
sign(double d)
Integer sign of value |
static double |
sinDeg(double angDeg)
Sine of angle in degrees |
static java.lang.String |
stripPath(java.lang.String filename)
Remove absolute path from filename |
static double |
tanDeg(double angDeg)
Tangent of angle in degrees |
static java.lang.String |
unescape(java.lang.String string)
Replace characters escaped using backslashes with their escaped values |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static double cosDeg(double angDeg)
angDeg
- angle in degrees
public static double sinDeg(double angDeg)
angDeg
- angle in degrees
public static double tanDeg(double angDeg)
angDeg
- angle in degrees
public static double atanDeg(double x)
x
- tangent of angle
public static double atan2Deg(double y, double x)
y
- numeratorx
- denominator
y / x
public static double acosDeg(double x)
x
- cosine of angle
public static double asinDeg(double x)
x
- sine of angle
public static double normalizeAngle(double angDeg)
-180
and 180
angDeg
- angle in degrees
public static int sign(double d)
d
- some value
1
if d > 0
and -1
otherwisepublic static double getBisectorTwoAngles(double ang1, double ang2)
ang1
- angle in degreesang2
- angle in degrees
public static boolean isLeftPlayer(int id)
id
- player ID
true
if player is on left teampublic static boolean isRightPlayer(int id)
id
- player ID
true
if player is on right teampublic static boolean isPlayer(int id)
id
- object ID
true
if the object ID refers to a playerpublic static boolean isLeftGoal(int id)
id
- object ID
true
if the object ID corresponds to the left goalpublic static boolean isRightGoal(int id)
id
- object ID
true
if the object ID corresponds to the right goalpublic static boolean isGoal(int id)
id
- object ID
true
if the object ID corresponds one of the goalspublic static boolean isBall(int id)
id
- object ID
true
if the object ID corresponds to the ballpublic static int getUnumFromID(int id)
id
- player ID
public static int getSideFromID(int id)
id
- object ID
SoccerTypes.SIDE_ILLEGAL
,
SoccerTypes.SIDE_LEFT
,
SoccerTypes.SIDE_RIGHT
public static int getBallID()
public static int getLeftPlayerID(int unum)
unum
- uniform number 1-11
public static int getRightPlayerID(int unum)
unum
- uniform number 1-11
public static int getPlayerID(int side, int unum)
side
- side as intunum
- uniform number 1-11
SoccerTypes.SIDE_ILLEGAL
,
SoccerTypes.SIDE_LEFT
,
SoccerTypes.SIDE_RIGHT
public static java.lang.String getPlayModeString(int pm)
pm
- playmode
public static java.lang.String stripPath(java.lang.String filename)
filename
- full path to file
public static java.lang.String unescape(java.lang.String string)
string
- original string
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |