Java Angle from Point getAngle(Point2D startPosition, Point2D endPosition)

Here you can find the source of getAngle(Point2D startPosition, Point2D endPosition)

Description

get Angle

License

Open Source License

Declaration

public static double getAngle(Point2D startPosition, Point2D endPosition) 

Method Source Code

//package com.java2s;
/**//  w w  w .j av a2 s  .  c om
 * Copyright Tao, All Rights Reserved.
 * Confidential, do not distribute.
 *
 * Any source code displaying this header must
 * be considered closed source and confidential
 * until the project is released under an open
 * source license.
 */

import java.awt.geom.Point2D;

public class Main {
    public static double getAngle(Point2D startPosition, Point2D endPosition) {
        double deltaX = endPosition.getX() - startPosition.getX();
        double deltaY = endPosition.getY() - startPosition.getY();

        return Math.atan2(deltaY, deltaX);
    }
}

Related

  1. getAngle(double originX, double originY, double x, double y)
  2. getAngle(Point2D center, Point2D point)
  3. getAngle(Point2D origin, Point2D target)
  4. getAngle(Point2D p1, Point2D p2)
  5. getAngle(Point2D.Double vertPt, Point2D.Double edgePt)
  6. getAngleForPoint(Arc2D arc, int x, int y)