Check whether given circle resides in boundary maintained by two other circles | function to check if given circle fit in boundary or not ; Distance from the center ; Checking the corners of circle ; driver program Radius of outer circle and inner circle respectively ; Co - ordinates and radius of the circle to be checked
function fitOrNotFit ( R , r , x , y , rad ) { var val = Math . sqrt ( Math . pow ( x , 2 ) + Math . pow ( y , 2 ) ) ; if ( val + rad <= R && val - rad >= R - r ) document . write ( " " ) ; else document . write ( " " ) ; } var R = 8 , r = 4 ; var x = 5 , y = 3 , rad = 3 ; fitOrNotFit ( R , r , x , y , rad ) ;