get Line Angle - Java java.lang

Java examples for java.lang:Math Geometry Line

Description

get Line Angle

Demo Code


//package com.java2s;
import java.awt.*;

public class Main {
    public static double getAngle(Point p1, Point p2) {
        double deltaX = p2.x - p1.x;
        double deltaY = p2.y - p1.y;
        return Math.atan2(deltaY, deltaX) * 180 / Math.PI;
    }//  ww w  .  j ava  2 s . co  m
}

Related Tutorials