How do I detect intersections between a circle and any other circle in the same plane?

前端 未结 7 2223
走了就别回头了
走了就别回头了 2020-11-28 05:54

I\'m looking for an algorithm to detect if a circle intersects with any other circle in the same plane (given that there can be more than one circle in a plane).

One

相关标签:
7条回答
  • 2020-11-28 06:19

    Assuming filled circle intersection (ie: One circle inside another is an intersection).

    Where:

    • x0,y0,r0 = Center and radius of circle 0.
    • x1,y1,r1 = Center and radius of circle 1.

    Code:

    boolean intersects = Math.hypot(x0-x1, y0-y1) <= (r0 + r1);
    
    0 讨论(0)
提交回复
热议问题