Is an XY point inside a circle

suggest change

Tests if an [x,y] point is inside a circle.

// circle objects: {cx:,cy:,radius:,startAngle:,endAngle:}
// var circle={
//     cx:150, cy:150,  // centerpoint
//     radius:100,
// }
// Return true if the x,y point is inside the circle

function isPointInCircle(x,y,circle){
    var dx=x-circle.cx;
    var dy=y-circle.cy;
    return(dx*dx+dy*dy<circle.radius*circle.radius);
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents