Example #1
0
 /**
  * Returns the back-as-front heading of the robot of given snapshot in degrees.
  *
  * @param snapshot snapshot of robot
  * @return back-as-front heading of robot
  */
 public static double getBackAsFrontHeading(Snapshot snapshot) {
   double bafHeading = snapshot.getHeadingRoboDegrees();
   if (snapshot.getVelocity() < 0) {
     bafHeading = normalizeDegrees(bafHeading + 180);
   }
   return bafHeading;
 }
Example #2
0
 /**
  * Returns the Robocode angle between 0 and 360 degrees from one robot snapshot to another.
  *
  * @param fromRobot from snapshot
  * @param toRobot to snapshot
  * @return Robocode angle from one snapshot to the other
  */
 public static double getRobocodeAngle(Snapshot fromRobot, Snapshot toRobot) {
   return getRobocodeAngle(fromRobot.getX(), fromRobot.getY(), toRobot.getX(), toRobot.getY());
 }