public void calcSunAndMoon ( ) { double jd = this . jd_UT ; // First the Sun double out [ ] = doCalc ( getSun ( ) ) ; sunAz = out [ 0 ] ; sunEl = out [ 1 ] ; sunrise = out [ 2 ] ; sunset = out [ 3 ] ; sunTransit = out [ 4 ] ; sunTransitElev = out [ 5 ] ; sunDist = out [ 8 ] ; double sa = sanomaly , sl = slongitude ; int niter = 3 ; // Number of iterations to get accurate rise/set/transit times sunrise = obtainAccurateRiseSetTransit ( sunrise , 2 , niter , true ) ; sunset = obtainAccurateRiseSetTransit ( sunset , 3 , niter , true ) ; sunTransit = obtainAccurateRiseSetTransit ( sunTransit , 4 , niter , true ) ; if ( sunTransit == - 1 ) { sunTransitElev = 0 ; } else { // Update Sun's maximum elevation setUTDate ( sunTransit ) ; out = doCalc ( getSun ( ) ) ; sunTransitElev = out [ 5 ] ; } // Now Moon setUTDate ( jd ) ; sanomaly = sa ; slongitude = sl ; out = doCalc ( getMoon ( ) ) ; moonAz = out [ 0 ] ; moonEl = out [ 1 ] ; moonRise = out [ 2 ] ; moonSet = out [ 3 ] ; moonTransit = out [ 4 ] ; moonTransitElev = out [ 5 ] ; moonDist = out [ 8 ] ; double ma = moonAge ; niter = 5 ; // Number of iterations to get accurate rise/set/transit times moonRise = obtainAccurateRiseSetTransit ( moonRise , 2 , niter , false ) ; moonSet = obtainAccurateRiseSetTransit ( moonSet , 3 , niter , false ) ; moonTransit = obtainAccurateRiseSetTransit ( moonTransit , 4 , niter , false ) ; if ( moonTransit == - 1 ) { moonTransitElev = 0 ; } else { // Update Moon's maximum elevation setUTDate ( moonTransit ) ; getSun ( ) ; out = doCalc ( getMoon ( ) ) ; moonTransitElev = out [ 5 ] ; } setUTDate ( jd ) ; sanomaly = sa ; slongitude = sl ; moonAge = ma ; }
Calculates everything for the Sun and the Moon .