Java Program to Find Line Angle from Two Point

bookmark

public class Main
{
   public static void main(String[] args)
   {
       int x1 = 0;
       int y1 = 5;
       int x2 = 1;
       int y2 = 2;
      // formula to find slope
       double m = (y2-y1)/(x2-x1); 
       // formula to find the line angle
       double a = Math.atan(m); 
        System.out.println("the line angle of 2 points is " + a);  
   }
}

 


Output:

the line angle of 2 points is -1.2490457723982544