Check whether a point exists in circle sector or not . | Java 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 Program to test above function
class GFG { static void checkPoint ( int radius , int x , int y , float percent , float startAngle ) { float endAngle = 360 / percent + startAngle ; double polarradius = Math . sqrt ( x * x + y * y ) ; double Angle = Math . atan ( y / x ) ; if ( Angle >= startAngle && Angle <= endAngle && polarradius < radius ) System . out . print ( " Point " + " ( " + x + " , " + y + " ) " + " exist in the circle sectorNEW_LINE"); else System . out . print ( " Point " + " ( " + x + " , " + y + " ) " + " exist in the circle sectorNEW_LINE"); } public static void main ( String arg [ ] ) { int radius = 8 , x = 3 , y = 4 ; float percent = 12 , startAngle = 0 ; checkPoint ( radius , x , y , percent , startAngle ) ; } }