class Angle { public static normalize ( angle ) { const range = 360 ; return ( ( angle % range ) + range ) % range ; } public static normalize180 ( angle ) { const range = 180 ; return ( ( angle % range ) + range ) % range ; } public static isAngleBetween ( mid , start , end ) { const formattedEnd = end - start < 0 ? end - start + 360 : end - start ; const formattedMid = mid - start < 0 ? mid - start + 360 : mid - start ; return formattedMid < formattedEnd ; } public static toRad = ( degrees ) => ( degrees * Math . PI ) / 180 ; public static toDeg = ( radians ) => ( radians * 180 ) / Math . PI ; public static getAngleBetween ( pos1 , pos2 ) { const dx = pos1 . x - pos2 . x ; const dz = pos2 . z - pos1 . z ; const angle = this . normalize ( ( Math . atan2 ( dz , dx ) * 180 ) / Math . PI ) ; return angle ; } } export default Angle ;