This is the number of sphere-polyhedra resulted in the packing. This value cannot be greater than "Maximal number of sphere-polyhedra". The changes to this value will be committed after pressing the "Apply" button. If this value is increased, the algorithm will add objects to the existing packing. If this value is decreased, the algorithm will remove objects based on their origination in the packing process.
The packing process can be stopped by lowering the value to equal or less then the current number of sphere-polyhedra and then pressing the "Apply" button.
In a case of the pack in bunker, this number includes 5 special starting sphere-polyhedra representing the bunker bottom and walls.
We offer 3 types of packing algorithm: best (the most compact), normal and touching.
If this option is selected the objects are packed into a rectangular box "from above" where z coordinate decreases. The bunker has only the bottom and 4 side walls that are defined by corresponding pre-generated sphere-polyhedra.
This option can be cleared at any time, but can only be set when the pack is empty. You can empty the pack by setting the desired number of sphere-polyhedrons to 0 and pressing the "Apply" button.
For all packing kinds except "Best" the algorithm checks L positions at surface of the "lump" of already packed objects, find the nearest to the center and pack new sphere-polyhedron near the found position. Increasing this parameter improves the compactness of packing, but slows the algorithm.
If the flag "Random rotating" is set, the algorithm randomly rotates the sphere-polyhedron for every checked position at the surface (except the 1st position). It can improve the compactness, but the orientations of sphere-polyhedra will become non-random.
When this parameter is 100%, the algorithm builds compact packing. Decreasing this parameter improves the performance of algorithm, but decreases the compactness of packing.
Normal and touching packing alrorithms begin from building a ray, starting from the coordinate origin (0,0,0) in a case of the central pack, or from the bunker bottom (and directed to the top) in a case of the bunker pack. Then the aglorithm "moves" the new object from the infinity along this ray until it will touch the "lump" of already packed objects. In a case of bunker back and normal or touching algrorithm, this group of parameters allows to control the choosing start point of the ray.
All sizes (see R and r in "Sphere-polyhedra kinds") of packed sphere-polyhedra are random numbers. 3 methods are available for making random values:
There are several kinds of sphere-polyhedrons available to choose from. The string "sphere-polyhedra kinds" describes selected kinds. Every kind is described by a group of characters. Groups must be separated by spaces or commas. In this application, you can use the following kinds of sphere-polyhedrons with two characteristics and sizes R and r:
| S | sphere with radius R | C | cube with an edge 2R | ||
| s | sphere with radius r | c | cube with an edge 2r | ||
| 1 | sphere-cylinder with length of the generatrix segment 2R and radius of the generatrix sphere r | b | parallelepiped ("small bar") 2R x 2r x 2r | ||
| 2 | sphere-square with side 2R and radius of the generatrix sphere r | B | parallelepiped ("big Bar") 2R x 2R x 2r | ||
| 3 | sphere-cube with edge 2R and radius of the generatrix sphere r |
P | hexagonal prism with a height 2R and a base side R | ||
| p | hexagonal prism with a height 2R and a base side r | ||||
Frequency of every kind is proportional to number of instances of the character in the string. For example, the string "S, S, S, C, C, 1" creates a pack where 50% are spheres with radius R, 33.3% are cubes with an edge 2R and 16.7% are sphere-cylinders. This behaviour can be changed by the "Fractions of kinds" parameter.
Sizes R/r are random values with the mean MeanR/meanr and the deviation DR/dr (see Method for making random sizes). The values for DR/dr can be expressions that use the variables MeanR and meanr (for example, 0.1*MeanR).
The parameters MeanR/meanr and DR/dr can contain sets of numbers separated by commas. Then, the first number is applied to the first sphere-polyhedron kind, the second number is applied to the second kind, etc.; the last number is applied to all remaining kinds. For example, if MeanR parameter contains "1, 5", DR contains "0.1, 0.5" and sphere-polyhedra kinds are "S, S", then the pack will consist of two groups of spheres, the first group with radii 1±0.1 and the second with radii 5±0.5.
After specifying the kind characteristic user can specify the color with a color characteristic. Available colors are in "Used colors" table. For example, the string "SW, SY, SC, 1, Cr, Cg" creates a pack where 16.7% of all objects are white spheres, 16.7% are yellow spheres, 16.7% are cyan spheres, 16.7% are sphere-cylinders with color randomly chosen from the string "Used colors", 16.7% are maroon cubes and 16.7% are dark-green cubes.
There are also special requirements that can be specified in the string. For example, user can require the new object to touch 1, 2 or 3 already packed objects with the given colors. The syntax is the following:
These restrictions apply only if the current number of objects is greater than the minimal number specified in the "Packing restrictions" section.
More precisely, let "Fractions of kinds" contain the numbers p1, p1, ..., pL. Two cases are possible.
The objects can be packed with so called virtual radius increment (RI). Namely, if it is not zero, every object is dilated by RI before packing (increased when RI > 0, reduced when RI < 0); after packing, the original required size is restored. As a result, the new object will be separated from already packed objects with the distance RI (RI > 0) or will intersect the packed objects with the depth RI (RI < 0).
An important exception: if RI < 0 and the "packed object" is a bunker wall, RI is ignored. In other words, the objects never intersect the bunker walls.
Characteristic size RI is a random value with the mean MeanRI and the deviation DRI (see Method for making random sizes). The value for DRI can be some expression using the variable MeanRI.
Dilation command with added radius r = RI/2 produces alike results, but it doesn't provide different intersection depths for different objects, and also allows intersections of the objects and the bunker walls.
The parameters MeanRI and DRI can contain sets of numbers separated by commas. Then, the first number is applied to the first sphere-polyhedron kind, the second number is applied to the second kind, etc.; the last number is applied to all remaining kinds.
If you do not specify the color of sphere-polyhedron kind, the colors for all sphere-polyhedra of this kind are chosen accidentally from the string "Used colors". Colors are described by following characters:
| R(red) | M(magenta) | B(blue) | C(cyan) | G(green) | Y(yellow) |
| 1 | 2 | 3 | 4 | 5 | 6 |
| A | D | E | F | H | K |
| a | d | e | f | h | k |
| r(maroon) | m(purple) | b(blue) | c(teal) | g(green) | y(olive) |
| 0(black) | w(gray) | - (hyphen, bunker walls usually) | W(white) | ||
Frequency of using each color is proportional to number of copies of the character in the string. For example, the string "WWrg" means that 50% of all packed objects of kinds with not-specified color will be white, 25% will be dark red and 25% will be dark green.
The objects, which colors are specified in the "Invisible colors" parameter, are fully transparent. This parameter can be changed at any time and the result will be visible immediately. This can be used in combination with the "New object: can touch maximum 3/2/1 invisible objects" parameter.
These colors are used for the bunker (when it is used): the bottom and 4 side walls. Format of the string "Bunker colors" is the same that format of "Used colors". First charater corresponds to the bottom color, following 4 charaters corresponds to the walls. If there are < 5 charaters, the last one is automatically repeated.
Usually, orientation of the packed sphere-polyhedra is chosen randomly. This group of parameters allows to change this behaviour.
The first input area for preferred directions contains coordinates of up to 4 different vectors that describe 4 directions in 3D space. The algorithm will try to pack sphere-polyhedra in such a way that their edges would be parallel to these directions. The zero vector (0.0, 0.0, 0.0) has a special sense: in a case of non-bunker pack, normal or touching packing kinds, it means the radial direction from the origin to the new position if the object's center.
The second input area contains up to 4 corresponding angles Δφ that describe the maximal allowed deviation (in degrees) from the listed directions.
The third input area, "Used directions", is a number of preferred directions that should be used by the algorithm. Zero value means the default behaviour.
If "Used directions" is 2 or greater, then some packed sphere-polyhedra will have another form than described in "used sphere-polyhedron kinds" parameter. For example, 3 preferred direction means that "cubes" ("C" and "c" object codes) will not be true cubes, but will be parallelepipeds which edges are parallel to the chosen direction (or almost parallel, in ranges allowed by Δφ). Analogously, 4 preferred directions lead to the situation when "prisms" ("P" and "p" object codes) cease to be prism but become complex polyhedra with 4 generatrix directions.
When this flag is set, the algorithm builds the same packing every time when you press "Execute" without changing parameters. When this flag is cleared, new packing is generated always.
When it is impossible to pack new object (i.e. to place new sphere-polyhedron so that it touchs 3 sphere-polyhedra from existing structure), the algorithm warns about it in the status line. This situation is possible, for example, when random size of the new object is very small.
The algorithm can repaint the packing and/or recalculate result parameters every 2 sec while building the packing. It slows the algorithm.
You can require that every new packed object must touch the object with the given index NNN. Here NNN should be an integer number 1, 2, ...; if it is negative, zero, or not specified (an empty text box), this restriction is not used.
Especially useful in a case of packing in the bunker, when you can specify here the bunker bottom (NNN=1) or side wall (NNN=2..5).
This restriction doesn't act if the pack doesn't contain NNN objects yet.
You can require that every new packed object must touch 1, 2 or 3 already packed objects with the same color. (2 and 3 are impossible for "Touching" packing kind.)
You can require that every new packed object can touch maximum 2, 1 already packed invisible objects or cannot touch any invisible objects. (The "3", "2" and "1" cases are equivalent for packing kind "Touching".)
These packing restrictions are actual only when current number of objects is greater than NNN.
If this value maxd > 0, then packing a new object is allowed only in a case when the whole packed object is placed:
Maximal number of sphere-polyhedra you can pack. This parameter (together
"grid dimension N") determines the
size of memory used by this algorithm: the algorithm requires about
(Maximal number of sphere-polyhedra)*(39+6*(Maximal average count of generatrix
segments))+4*(N*N*N)
bytes of memory.
Changing this parameter takes effect only when you will press the button "Execute" for full rebuilding the packing.
Average count of generatrix segments per 1 sphere-polyhedron cannot be greater than this value. The value 4 is enough for all situations possible in this executable page. You can decrease this value to save memory; in this case, you must know that every prism needs 4 generatrix segments, every cube or sphere-cube needs 3 generatrix segments, every sphere-square needs 2 generatrix segments, every sphere-cylinder needs 1 generatrix segments, and spheres don't need any generatrix segments.
For improving performance, the algorithm uses 3-dimensional grid: NxNxN cells, one cell is a cube DxDxD. The grid step D must be about 2.5*(MeanR+meanr). For best performance, the grid must cover all packed objects. These parameters are recalculated automatically when you change mean sizes R, r and maximal number of sphere-polyhedra.
Changing the parameter N takes effect only when you will press the button "Execute" for full rebuilding the packing.
For improving performance, the algorithm usually does not check too complex possible positions for packing new object onto 3 already packed ones. Such positions do not appear when the packing consists of only spheres or only usual polyhedra (not true sphere-polyhedra and not a mix of spheres and usual polyhedra). If you set this flag, the algorithm checks all positions. It can slow the execution, but increases the density of the packing, especially when you pack sphere-cylinders.
After packing each object, the algorithm waits ("sleeps") for a short time. This parameter defines the estimated percent of the "sleeping" time as compared with the calculation time. For maximal performance, you can set this parameter to 0%; however, the Web-browser and other applications can work very slowly during calculations in this case.
If the algorithm cannot pack the next object during the specified number of seconds, it stops automatically. Zero value disables automatic stopping. Please keep in mind that pack of one complex sphere-polyhedron can require a lot of time, up to several tens of seconds.