Each pack is started with an initial placement of two or three balls. These generate the first pockets, which are positions where a ball can be placed so that it makes three or more contacts with other balls and/or the container.
If there is more than one pocket available for the next ball position then the pocket which is chosen is determined by the packing method (from the -M option) -
When the new ball is added it will often create new pockets. This process of adding balls then finding any new pockets continues until there are no more available pockets, and the pack is complete.
![]() |
![]() |
![]() |
| packer.py -M up 1 7 178 points |
packer.py -M in 1 7 177 points |
packer.py -M out 1 7 139 points |
usage: packer.py [options] ball_radius container_radius
options
-h this help message
-M mthd packing method: up - bottom up (default), in - outside to
centre, out - centre to outside, inup - outside in bottom
first, outup - centre to outside bottom first.
-o file write output to file, if this option is not used
the program writes to standard output.
ball_radius defaults to 0.3333 and container_radius defaults to 1.0