2022-01-14

Find the intersection points between a rectangle and a circle

having a rectangle and a circle, I would like to have a function that would return me the coordinates of the points where they collide something like this

let myrect = { x: 100, y: 100, w: 100, h: 50 };
let mycircle = { x: 156, y: 156, r: 100 };

function detectCoords(rect, circle) {
    //do something
    return [{ x: 5, y: 2}, { x: 3, y: 7}] //example
}

enter image description here



from Recent Questions - Stack Overflow https://ift.tt/3FooVou
https://ift.tt/3txOWzo

No comments:

Post a Comment