utils
Class BotMath

java.lang.Object
  extended byutils.BotMath

public class BotMath
extends java.lang.Object

Robot math library

Author:
Francesco Baldisserri

Constructor Summary
BotMath()
           
 
Method Summary
static double degree2radians(double degree)
           
static double getAngle(double x1, double y1, double x2, double y2)
           
static double getBearing(double heading, double x1, double y1, double x2, double y2)
          Calculates the bearing of a robot regard a point
static double normalAbsoluteAngle(double angle)
          Calulate normal absolute angle
static double normalRelativeAngle(double angle)
          Calulate normal relative angle
static double pointsDistance(double x1, double y1, double x2, double y2)
           
static double radians2degree(double radians)
           
static double shotSpeed(double power)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BotMath

public BotMath()
Method Detail

normalRelativeAngle

public static final double normalRelativeAngle(double angle)
Calulate normal relative angle

Parameters:
angle - Angle to be normalized
Returns:
Returns the angle between -180° and +180°

normalAbsoluteAngle

public static final double normalAbsoluteAngle(double angle)
Calulate normal absolute angle

Parameters:
angle - Angle to be normalized
Returns:
Returns the angle between 0° and +360°

getBearing

public static final double getBearing(double heading,
                                      double x1,
                                      double y1,
                                      double x2,
                                      double y2)
Calculates the bearing of a robot regard a point

Parameters:
heading - Robot heading
x1 - Robot X position
y1 - Robot Y position
x2 - Target X position
y2 - Target Y position
Returns:
Returns calculated bearing

getAngle

public static final double getAngle(double x1,
                                    double y1,
                                    double x2,
                                    double y2)

radians2degree

public static final double radians2degree(double radians)

degree2radians

public static final double degree2radians(double degree)

shotSpeed

public static final double shotSpeed(double power)

pointsDistance

public static final double pointsDistance(double x1,
                                          double y1,
                                          double x2,
                                          double y2)