Here you can find the source of angleBetween2Lines(double l1x1, double l1y1, double l1x2, double l1y2, double l2x1, double l2y1, double l2x2, double l2y2)
public static double angleBetween2Lines(double l1x1, double l1y1, double l1x2, double l1y2, double l2x1, double l2y1, double l2x2, double l2y2)
//package com.java2s; public class Main { public static double angleBetween2Lines(double l1x1, double l1y1, double l1x2, double l1y2, double l2x1, double l2y1, double l2x2, double l2y2) { double angle1 = Math.atan2(l1y1 - l1y2, l1x1 - l1x2); double angle2 = Math.atan2(l2y1 - l2y2, l2x1 - l2x2); return angle1 - angle2; }/*w ww .ja va2 s . co m*/ }