python packing circles

Solutions on MaxInterview for python packing circles by the best coders in the world

showing results for - "python packing circles"
Sam
13 Jan 2020
1from pprint import pprint
2import circlify
3circles = circlify.circlify([9, 8, 7, 6, 5, 4, 3, 2, 1], show_enclosure=True, target_enclosure=circlify.Circle(x=0, y=0, r=1))
4	# (necessary) data: A list of positive values sorted from largest to smallest
5  	# (optional) target_enclosure: A target enclosure where the packed circles should fit (default to the unit circle (0, 0, 1))
6  	# (optional) show_enclosure: A boolean indicating if the target enclosure should be appended to the output (default to False)
7pprint(circles)
8circlify.bubbles(circles=circles) # Graph of the packed circles