In Python, how would one find all integer points common to two circles?
For example, imagine a Venn diagram-like intersection of two (equally sized) circles, with center-points (x1,y1)
and (x2,y2)
and radii r1=r2
. Additionally, we already know the two points of intersection of the circles are (xi1,yi1)
and (xi2,yi2)
.
How would one generate a list of all points (x,y)
contained in both circles in an efficient manner? That is, it would be simple to draw a box containing the intersections and iterate through it, checking if a given point is within both circles, but is there a better way?
Two circles will touch if the distance between their centres, , is equal to the sum of their radii, or the difference between their radii. The centre of one circle will lie on the other circle when d = r 1 or d = r 2 .
If two circles have at least 3 points in common then they are the same circle. These three points can't be collinear, since a line only intersects a circle twice. Since they are not collinear they form a triangle and both circles circumscribe the triangle.
Two circles may intersect in two imaginary points, a single degenerate point, or two distinct points. The intersections of two circles determine a line known as the radical line.
Keep in mind that there are four cases here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With