Check whether a point exists in circle sector or not . | Javascript program to check if a point lies inside a circle sector . ; Calculate endAngle ; Calculate polar co - ordinates ; Check whether polarradius is less then radius of circle or not and Angle is between startAngle and endAngle or not ; Driver code
function checkPoint ( radius , x , y , percent , startAngle ) { let endAngle = 360 / percent + startAngle ; let polarradius = Math . sqrt ( x * x + y * y ) ; let Angle = Math . atan ( y / x ) ; if ( Angle >= startAngle && Angle <= endAngle && polarradius < radius ) document . write ( " " + " " + x + " " + y + " " + " " ) ; else document . write ( " " + " " + x + " " + y + " " + " " ) ; } let radius = 8 , x = 3 , y = 4 ; let percent = 12 , startAngle = 0 ; checkPoint ( radius , x , y , percent , startAngle ) ;