static float calcAz ( short az0 , short az1 ) { // output in deg float azim0 = calcAngle ( az0 ) ; float azim1 = calcAngle ( az1 ) ; float d = 0.0f ; d = Math . abs ( azim0 - azim1 ) ; if ( ( az0 < 0 ) & ( az1 > 0 ) ) { d = Math . abs ( 360.0f - azim0 ) + Math . abs ( azim1 ) ; } double temp = azim0 + d * 0.5 ; if ( temp > 360.0 ) { temp -= 360.0 ; } BigDecimal bd = new BigDecimal ( temp ) ; BigDecimal result = bd . setScale ( 2 , RoundingMode . HALF_DOWN ) ; return result . floatValue ( ) ; }
Calculate azimuth of a ray