Java Kilometer Convert to kmToRtheta(final double x, final double y)

Here you can find the source of kmToRtheta(final double x, final double y)

Description

Converts km from radar to range/heading

License

Open Source License

Parameter

Parameter Description
x km east of the radar
y km north of the radar

Return

[range (in m), azimuth (in degrees)]

Declaration

public static double[] kmToRtheta(final double x, final double y) 

Method Source Code

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

public class Main {
    /**/*from w  w w  .j  ava2s. c  om*/
     * Converts km from radar to range/heading
     *
     * @param x km east of the radar
     * @param y km north of the radar
     * @return [range (in m), azimuth (in degrees)]
     */
    public static double[] kmToRtheta(final double x, final double y) {
        double range = 1e3 * Math.sqrt(x * x + y * y);
        double azimuth = 90 - Math.toDegrees(Math.PI / 2 - Math.atan2(x, y));
        if (azimuth < 0)
            azimuth += 360;
        return new double[] { range, azimuth };
    }
}

Related

  1. kmToKnots(int km)
  2. kmToMiles(double k)