Home > other >  Scaled circle to circle collision
Scaled circle to circle collision

Time:09-17

How do I make a scaled circle to circle collision? For example: ellipse to circle intersection visualisation: a white ellipse is dragged towards a white circle on a dark gray background. A triangle is drawn from the closest point on the ellipse towards the circle as the diagonal (and x, y axes as the sides). When the ellipse and circles collide the background of the ellipse turns green.

The code is a bit verbose, but commented: hopefully easy to follow. It could be refactored as needed for reuse(e.g. remove visualisation, change function so it takes arguments instead of global variables, etc.)

  • Related