JavaFX Point angle - Java JavaFX

Java examples for JavaFX:Shape

Description

JavaFX Point angle

Demo Code


//package com.java2s;
import javafx.geometry.Point2D;

public class Main {
    public static double angle(Point2D p1, Point2D p2) {
        final double xDiff = p2.getX() - p1.getX();
        final double yDiff = p2.getY() - p1.getY();
        return Math.toDegrees(Math.atan2(yDiff, xDiff));
    }//  w  w w .ja va  2 s  .  co m
}

Related Tutorials