Java examples for Algorithm:Number
Equatorial To Horizontal
public class EquatorialToHorizontal { public static void main(String args[]) { double altitude = 0; double azimuth = 0; double d = Math.toRadians(20); double h = Math.toRadians(5); double l = Math.toRadians(6); altitude = Math.asin(Math.sin(l) * Math.sin(d) + (Math.cos(l) * Math.cos(h) * Math.cos(d))); azimuth = Math.acos((Math.cos(l) * Math.sin(d) - (Math.cos(d) * Math.cos(h) * Math.sin(l)) / (Math.cos(altitude)))); System.out.println("Altitude is " + Math.toDegrees(altitude)); System.out.println("Azimuth is " + Math.toDegrees(azimuth)); }/*from www . jav a2 s. c o m*/ }