Here you can find the source of absoluteBearing(Point2D source, Point2D target)
public static double absoluteBearing(Point2D source, Point2D target)
//package com.java2s; // This code is released under the RoboWiki Public Code Licence (RWPCL), datailed on: import java.awt.geom.*; public class Main { public static double absoluteBearing(Point2D source, Point2D target) { if (source == null || target == null) { return 0; }//from w w w .j a v a2s . c om return Math.atan2(target.getX() - source.getX(), target.getY() - source.getY()); } }