如何知道一个点是否位于外圆?

How to know if a point is locate at outer circle?

以(xc,yc)为圆心,以r为半径的圆,如何判断点(xp,yp)是否在下图的外圆

如果内圆的半径为r,外圆的半径为R,则可以通过距离平方比较来检查点是否在环内:

 dd = (xp - xc)^2 + (yp - yc)^2
 if (dd <= R^2) and (dd >= r^2) then 
    point is in the ring