A simple method for testing if a given point, described by a set of coordinates in a 2D plane, falls within the area of a circle provided its X and Y coordinates and radius.

This method tests if the **x** (horizontal) difference *squared* plus the **y** (vertical) difference *squared* is less than or equal to the **radius** *squared*.

```
function pointInCircle(x, y, cx, cy, cr)
{
var squareDist = ((cx - x) * (cx - x) + (cy - y) * (cy - y));
return squareDist <= (cr * cr);
}
```