# Algorithm to Pack as Many Circular Segments right into a Rectangular Box

I have a circle of distance $r$, and also I have a bounding box with 4 sides, $a$, $b$, $c$ and also $d$ as highlighted in the listed below layout :

Here are a couple of restraints

$$r \geq a$$ $$r \geq b$$ $$c >> a$$ $$d >> a$$ $$c >> b$$ $$d >> b$$

$a$ and also $b$ have to be vertical to $d$ sector.

An additional problem is that the the round fields have to touch among the lengthy line sector (the leading line sector in this instance), base upon an additional lengthy sector (all-time low line sector in this instance) and also have to not head out from it.

What is the algorithm/equation that permits me to create all the round fields that

- Touch among the line sectors
- Won't head out from it
- Fill the bounding box (as specified by $a$, $b$, $c$ and also $d$) as compactly as feasible?

There is a fair bit of details on circle packaging on packomania, consisting of packagings in rectangular shapes. So several of it might serve to you.

Below is another page on the very same motif.

Related questions