Java examples for java.lang:Math Geometry
get Earth Radius For Latitude
//package com.java2s; public class Main { private static double getEarthRadiusForLatitude(double latitude) { double equatorRadius = 6378.137; // equatorial radius in km double polarRadius = 6356.7523142; // polar radius in km return equatorRadius * Math.sqrt(Math.pow(polarRadius, 4) / Math.pow(equatorRadius, 4) * Math.pow((Math.sin(latitude)), 2) + Math.pow(Math.cos(latitude), 2)) / Math.sqrt(1/*w ww . jav a2s.co m*/ - (1 - (polarRadius * polarRadius) / (equatorRadius * equatorRadius)) * Math.pow(Math.sin(latitude), 2)); } }