Java Angle Calculate calculateAngle(float x, float y, float x1, float y1)

Here you can find the source of calculateAngle(float x, float y, float x1, float y1)

Description

From x,y -> x1,y1

License

Open Source License

Return

The value is in radians.

Declaration

public static float calculateAngle(float x, float y, float x1, float y1) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*from  w  w w  .  j av  a 2s.co  m*/
     * From x,y -> x1,y1
     *
     * @return The value is in radians.
     */
    public static float calculateAngle(float x, float y, float x1, float y1) {
        double angle = Math.atan2(y - y1, x - x1);
        return (float) angle + 1.5f;
    }
}

Related

  1. angleBetween(Point2D.Double vec1, Point2D.Double vec2)
  2. angleOf(Point2D a, Point2D b)
  3. anglePI(Point2D top, Point2D corner1, Point2D corner2)
  4. angleToPoint(Rectangle r, double angle)
  5. calculateAngle(double dx, double dy)
  6. calculateAngle(int a1, int b1, int a2, int b2)