Jump to content

Horizontal sundial calculations: Difference between revisions

Line 761:
System.out.println();
 
slat = Math.sin(degToRadMath.toRadians(lat));
System.out.printf("sine of latitude: %.3f\n", slat);
System.out.printf("diff longitude: %.3f\n\n", lng - ref);
Line 771:
hra = 15.0 * h;
hra = hra - lng + ref;
hraRad = degToRadMath.toRadians(hra);
hla = radToDegMath.toDegrees(Math.atan2(Math.sin(hraRad)*Math.sin(degToRadMath.toRadians(lat)), Math.cos(hraRad)));
System.out.printf("HR= %3d; \t HRA=%7.3f; \t HLA= %7.3f\n",
h, hra, hla);
}
}
 
private static double degToRad(double deg) {
return deg * Math.PI / 180;
}
 
private static double radToDeg(double rad) {
return rad * 180 / Math.PI;
}
}</lang>
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.