Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Circle intersection solution in Clear category for Count Chains by flpo
from sympy.geometry import Circle
from sympy.geometry.util import intersection
def count_chains(coords):
circles = [Circle((x, y), r) for x, y, r in sorted(coords)]
def close(circle):
for other in circles:
if len(intersection(other, circle)) > 1:
circles.remove(other)
close(other)
chains = 0
while circles:
chains += 1
close(circles.pop())
return chains
March 8, 2020