Check whether a point exists in circle sector or not . | C # 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
using System . IO ; using System ; class GFG { static void checkPoint ( int radius , int x , int y , float percent , float startAngle ) { float endAngle = 360 / percent + startAngle ; float polarradius = ( float ) Math . Sqrt ( x * x + y * y ) ; float Angle = ( float ) Math . Atan ( y / x ) ; if ( Angle >= startAngle && Angle <= endAngle && polarradius < radius ) Console . Write ( " Point ▁ ( { 0 } , ▁ { 1 } ) ▁ exist ▁ in ▁ " + " the ▁ circle ▁ sector " , x , y ) ; else Console . Write ( " Point ▁ ( { 0 } , ▁ { 1 } ) ▁ does ▁ not ▁ " + " exist ▁ in ▁ the ▁ circle ▁ sector " , x , y ) ; } public static void Main ( ) { int radius = 8 , x = 3 , y = 4 ; float percent = 12 , startAngle = 0 ; checkPoint ( radius , x , y , percent , startAngle ) ; } }