Here you can find the source of angle(double px, double py, double qx, double qy)
public static double angle(double px, double py, double qx, double qy)
//package com.java2s; //License from project: LGPL public class Main { public static double angle(double px, double py, double qx, double qy) { double deltaX = px - qx; double deltaY = py - qy; double angleInDegrees = Math.atan2(deltaY, deltaX) * 180 / Math.PI; return angleInDegrees; }//from w ww . j a v a 2 s.c o m }