Java Vector to vectorTolatLonDegrees(double X, double Y, double Z)

Here you can find the source of vectorTolatLonDegrees(double X, double Y, double Z)

Description

vector Tolat Lon Degrees

License

Open Source License

Declaration

public static double[] vectorTolatLonDegrees(double X, double Y, double Z) 

Method Source Code

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

public class Main {
    private static double[] return_coordinates = new double[2];
    private static double return_result = 0;

    public static double[] vectorTolatLonDegrees(double X, double Y, double Z) {
        // Convert cartesian coordinates back to radians, and radians to degrees
        return_coordinates[0] = RadsToDegrees(Math.atan2(Y, X)); // Longitude
        double finalHypotenuse = Math.sqrt(X * X + Y * Y);
        return_coordinates[1] = RadsToDegrees(Math.atan2(Z, finalHypotenuse)); // Latitude

        return return_coordinates;
    }//  w  ww  .j  a  v a2  s. c  om

    public static double RadsToDegrees(double radians) {
        return_result = radians * (180 / Math.PI);

        return return_result;
    }
}

Related

  1. toIntArray(Vector vec)
  2. toIntArray(Vector vect)
  3. toPercent(Vector members, HashMap mapMemberToValue)
  4. vector2doubles(Vector _v)
  5. vectorToColor(float x, float y, float z)
  6. vectorToMatrixArray(int M, int N, float[] a, float[][] b)