Java Angle angleTo(final int x, final int y, final int thatx, final int thaty)

Here you can find the source of angleTo(final int x, final int y, final int thatx, final int thaty)

Description

Returns the angle between this point and that point.

License

Open Source License

Return

the angle in radians (between -pi and pi) between this point and that point (0 if equal)

Declaration

public static float angleTo(final int x, final int y, final int thatx, final int thaty) 

Method Source Code

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

public class Main {
    /**/*from   w w  w.j  a va2  s. co m*/
     * Returns the angle between this point and that point.
     *
     * @return the angle in radians (between -pi and pi) between this point and that point (0 if equal)
     */
    public static float angleTo(final int x, final int y, final int thatx, final int thaty) {
        final int dx = thatx - x;
        final int dy = thaty - y;
        return (float) Math.atan2(dy, dx);
    }
}

Related

  1. angleOfLine(int x1, int y1, int x2, int y2)
  2. angleOfLineDeg(double x1, double y1, double x2, double y2)
  3. angleRadToDegClipped(final double angleRad)
  4. anglesInvalid(double sza, double vza, double saa, double vaa)
  5. angleSum(float a1, float a2)
  6. angleToCompass(double angleIn)
  7. angleToDefaultAngle(double angle)
  8. angleToFacing(float angle)
  9. angleYawinRange(float start, float end, float angle)