Given the coordinates of several points on a plane, and the radius of a circle surrounding each point, draw polygons representing the circles and the edges where the circles meet. Straight edges will always fall along circle-circle intersection lines, but might not follow the full length of these lines.
Per mbomb007's suggestion, imagine the behavior of 2D soap bubbles. That's technically wrong, because soap bubbles would always meet at 120° angles to minimize energy, while these circles may meet at any angle.
This is a Voronoi diagram, minus a defined area plane. Thanks Andreas. This is actually a generalization of a Voronoi diagram called a power diagram.
Examples
For example, given two points and two radii, the output might look like this:
Add another point and radius and the output might look like this:
Input
You can structure the input however you wish. Please post results with the following inputs.
Test 1
- x: 10, y: 10, r: 10
- x: 25, y: 12, r: 8
Test 2
- x: 8, y: 10, r: 6
- x: 20, y: 8, r: 4
- x: 18, y: 20, r: 12
Output
Output should be graphical and should include polygon borders, but nothing else is required. Points and intersections do not need to be represented like they are in the examples.
Constraints
- No point will exist within the radius of another circle.
- Standard codegolf rules.
- No answers with loopholes will be accepted, but feel free to have fun with it.