Java tutorial
//package com.java2s; //License from project: Apache License import java.awt.*; public class Main { public static double getBearing(Point posTo, Point posFrom) { double x = posTo.getX() - posFrom.getX(); double y = posTo.getY() - posFrom.getY(); return Math.atan2(x, y); } }