SLSCoder
New member
- Joined
- Aug 24, 2021
- Messages
- 21
I am trying to draw a graph of a series of circles like the image below.
The circles are a result of data so the number of circles and their diameters depend on that data.
That is to say, the image below is 1 case. The number of circles, their diameters and their vertical positions can change from one graph to another. This is a software app. written in PHP.
Vertically the circles are positioned by avg relational to the scale on the left (10 to -10).
The circles are ordered by diameter from largest to smallest.
I start with the largest circle and place it in the center on the x scale.
From there I place the next to the right, the next to the left, the next to the right, etc.
I need to place each circle so that its edge almost touches the closest edge of another circle that has already been placed. For example, lift's lower left edge would almost touch forklift's upper right edge and tilt's lower left edge should almost touch lift's upper right edge.
If any circle could be moved left or right without touching any other circle it should be in the center of the x scale.
Brakes (below) should be in the center on the x scale because it cannot touch any other circle anywhere on the x scale.
Steering's lower right edge should almost touch forklifts' upper left edge.
Once they're all placed relative to each other all of them need to move left until the furthest left edge almost touches the left edge of the graph.
In the case below steering would almost touch the left edge of the white box.
I've spent hours trying to figure out how to do this. I cannot and almost gave up.
I'm not a mathematician. I aced geometry in high school and advanced algebra in college but that was about a hundred years ago and my memory fails me.
I do have access to Python if needed.
Any help in accomplishing what I'm trying to do would be greatly appreciated.

The circles are a result of data so the number of circles and their diameters depend on that data.
That is to say, the image below is 1 case. The number of circles, their diameters and their vertical positions can change from one graph to another. This is a software app. written in PHP.
Vertically the circles are positioned by avg relational to the scale on the left (10 to -10).
The circles are ordered by diameter from largest to smallest.
I start with the largest circle and place it in the center on the x scale.
From there I place the next to the right, the next to the left, the next to the right, etc.
I need to place each circle so that its edge almost touches the closest edge of another circle that has already been placed. For example, lift's lower left edge would almost touch forklift's upper right edge and tilt's lower left edge should almost touch lift's upper right edge.
If any circle could be moved left or right without touching any other circle it should be in the center of the x scale.
Brakes (below) should be in the center on the x scale because it cannot touch any other circle anywhere on the x scale.
Steering's lower right edge should almost touch forklifts' upper left edge.
Once they're all placed relative to each other all of them need to move left until the furthest left edge almost touches the left edge of the graph.
In the case below steering would almost touch the left edge of the white box.
I've spent hours trying to figure out how to do this. I cannot and almost gave up.
I'm not a mathematician. I aced geometry in high school and advanced algebra in college but that was about a hundred years ago and my memory fails me.
I do have access to Python if needed.
Any help in accomplishing what I'm trying to do would be greatly appreciated.

Last edited: