Application of Algorithms for Placement of Orthogonal Polyhedrons for Solving the Problems of Packing Objects of Complex Geometric Shape

The article is devoted to the development and research of algorithms for placing objects of complex geometric shapes. To solve the placement problem is proposed an approach which consists in transforming the shape of all objects and further application of the developed algorithm for placing orthogonal polyhedrons of arbitrary dimension to the resulting transformed objects. In the process of transforming the shape of the objects being placed, they are initially voxelized, after which the developed decomposition algorithm is applied to the resulting voxelized objects, which provides the formation of orthogonal polyhedrons consisting of the largest possible orthogonal objects. The proposed model of potential containers is used to describe the free space of containers as a set of orthogonal areas. The developed algorithm for the placement of orthogonal polyhedrons provides a fast solution to NP-hard problems of placing objects of complex geometric shapes without resorting to the use of time-consuming nonlinear programming methods. Examples of the practical application of the developed algorithms for modeling the dense layout of parts of complex geometric shapes on the platform of a 3D printer are given.


Introduction
The problem of packing objects of complex geometric shape has a large number of practical applications in various areas. Solving the problems of cutting industrial materials, rational usage of free spaces (for example, ships or aircraft), geometric surface coverage with specified shapes, modelling the microstructure of composite materials as well as a number of other optimization problems is reduced to packing problem [1][2][3][4][5][6].
All packing problems are NP-hard optimization problems for which there are no algorithms of polynomial complexity to solve them, which makes it urgent to develop algorithms that provide suboptimal solutions in an acceptable time. Modern methods for solving problems of packing objects of complex geometric shape are based on the use of the hodograph vector function of dense placement, which requires the subsequent application of nonlinear programming methods characterized by high computational complexity [7][8][9][10][11][12].
To reduce the complexity of the problem, we propose an approach that consists in packing of voxelized objects [13][14][15] by applying the developed algorithm of placement of orthogonal polyhedrons.
We will consider the problem of placement orthogonal polyhedrons in the general D -dimensional case. A container is specified in the form of Ddimensional parallelepiped with the dimensions containing the coordinates of orthogonal objects in the local coordinate system associated with each orthogonal polyhedron i O [16]. In the particular case, when all orthogonal polyhedrons consist of only one orthogonal object , the considered problem will be reduced to the classic D -dimensional orthogonal packing problem [1,2].

Description of free container spaces
To describe a packing is used the developed model of potential containers [17][18][19]. Under a potential container (PC) placed in a container at some its point is understood an imaginary orthogonal object with the largest possible dimensions that can be placed at this point without overlapping with any packed into the container object and edges of the container. Each potential container h is described with a vector { } containing coordinates of its point which is nearest to the origin of the container containing it.
All existing free orthogonal spaces located in a container are described by a set of potential containers. When a new orthogonal object is put into a container it is necessary to verify the correctness of the placement. The model of potential containers guarantees the correct placement of an orthogonal object if it overlaps no borders of the potential container in which it is located. In this case when an object is put at some point of a container instead of checking on the intersection with all placed into the container objects is required to check only one condition of placement of this object entirely within the potential container, located at this point. This ensures a higher speed of formation the orthogonal packing.
When an orthogonal object i with the dimensions   Figure 1 presents all new potential containers which are formed in a three-dimensional potential container after placing an orthogonal object inside it. To update a set of potential containers after placing an orthogonal polyhedron 2 of a D -dimensional container, the free spaces of which are described by a set of potential containers 0 Ω , the following algorithm is performed.
Step 1. Create a set 0 0 Step 2. Place an orthogonal polyhedron i O in the 2 of a new identical empty container, as a result of which a set of potential containers Ω will be formed in it. Placement of the orthogonal polyhedron is performed by sequentially placing of all its orthogonal objects Step 3. Apply the intersection operation ( Figure 2) to sets of potential containers 0 Ω′ and Ω to get a set of potential containers Ω ∩ Ω′ = Ω ′ ′ 0 0 that describes all free spaces of the original container in the area of the placed orthogonal polyhedron i O . During the intersection operation, each set of potential containers is considered as an orthogonal polyhedron, consisting of orthogonal objects whose parameters coincide with the parameters of the corresponding potential containers.
Step 4. Replace in the set 0 Ω all potential containers that are also in the set 0 Ω′ with potential containers from the set 0 Ω ′ ′ . This algorithm is shown in Figure 3.

Preparing objects for placement
As a result of converting objects to a voxel representation, orthogonal polyhedrons consisting of a large number of cubes are obtained. To reduce the number of orthogonal objects forming an orthogonal polyhedron, a decomposition algorithm has been developed. The algorithm provides the decomposition of a D -dimensional orthogonal polyhedron V into a set of large orthogonal objects includes steps 1-6. Step where d S is the length of the packing measured along the axis d .
Step 2. Place the orthogonal polyhedron V into container 1.
As a result in the container 1, a set of potential containers will be formed. The set of potential containers 1 Ω describes the space of container 1, which does not belong to the placed orthogonal polyhedron V .
Step 3. Create an empty D -dimensional orthogonal container 2 with the overall dimensions that match the overall dimensions of the container 1 ( Step 4. Place in the container 2 a set of Ddimensional orthogonal objects with parameters matching the parameters of potential containers from the container 1 (when placing objects, their mutual overlap is allowing): , will be formed. The set 2 Ω describes the space of container 2, which belongs to the orthogonal polyhedron V .
Step 5. Create a D -dimensional orthogonal polyhedron V ′ , consisting of orthogonal objects with parameters matching the parameters of potential containers from the container 2: , so the orthogonal polyhedron V ′ will contain the set of all orthogonal objects into which it can be decomposed.
Step 6. Apply the addition operation to all orthogonal objects that are part of the orthogonal polyhedron V ′ . As a result, an orthogonal polyhedron O will be obtained, consisting of the largest orthogonal objects that do not overlap each other.
The operation of addition orthogonal objects (Figure 4) includes the following steps.

Place all objects from the set A into the set +
A .

Sort the set +
A in descending order of volumes (areas) of objects. 1 in the set C .  Unlike decomposition algorithms developed by other authors [20][21][22], the proposed algorithm is described and programmatically implemented invariantly with respect to the dimension of the problem to be solved.

For each current object
The decomposition significantly increases the speed of placing objects. Figures 5 as an example shows original voxelized ball as well as the obtained decomposed orthogonal polyhedron. In this figure also shown time which was spent to place the orthogonal polyhedrons (here and later in this paper, the results of computational experiments performed on a personal computer with CPU Intel Core i5-8400, 2,8 GHz and 8 GB RAM are presented). An example of the decomposition of a complex geometric shape is shown in the Figure 6.    This algorithm is based on the creation of orthogonal polyhedrons that determine the possible placement areas for each object of complex shape. To reduce the complexity of the block diagram, in Figure 7 is presented a part of the algorithm which provides placing of an orthogonal polyhedron inside only one current container. Algorithm for packing orthogonal polyhedrons in a set of containers in presented in the paper [23].
The steps for sequentially determining the region of admissible placement of an orthogonal polyhedron in a given potential container are shown in Figure 7. The final orthogonal polyhedron is obtained after application the intersection operation to all orthogonal polyhedrons describing areas of admissible placement. Figure 9 presents an example of placement orthogonal polyhedrons into a container.  Fig. 9. Placement of voxelized balls into a parallelepiped.
As an example of the practical application of the developed algorithms for the formation and placement of orthogonal polyhedrons, the problem of parts (details) layout on the platform of a 3D printer is considered.
Solving the problem of optimizing the layout of objects is of great importance in additive technologies, since it can significantly reduce the consumption of material, reduce the time spent on preparing the layout of objects inside the platform (container) of a 3D printer, as well as the time spent on their direct manufacture. The use of denser layouts additionally leads to a reduction in energy costs in the process of manufacturing objects, and also reduces the equipment depreciation used.
At present, the richest functionality for solving the problems of additive manufacturing is provided by the software Materialise Magics (Materialise NV, Lovaine, Belgium), which is used by the world's leading manufacturers of equipment for 3D printing [24]. The widespread recognition of this tool in the global market for additive technologies explains its choice for a comparative analysis of the obtained results.
We consider a three-dimensional container with the following parameters: length: 340 mm, width: 340 mm, height: 620 mm, the gap from the bottom of the container is 9 mm, the gap from the side faces of the container is 10 mm, minimum distance between placed objects is 6 mm. Parameters of details are given in Figure 10 (200 items of three types). All details can be rotated by multiples of 90° when placed.    Reducing the detalization on voxelization results in a significant increase in the placement speed with a slight loss of placement density. The resulting layout of details with reduced detalization is shown in Figure 13

Conclusion
The article proposes a method for solving the problem of placing objects of complex geometric shapes, which consists in transforming it to the problem of placing orthogonal polyhedrons.
All considered algorithms are developed and implemented independently from the dimension of the problem being solved, which makes them applicable for solving arbitrary types of cutting and packing problems.
The proposed algorithm for placing an orthogonal polyhedron of arbitrary dimension solves the problem of obtaining the area closest to the origin of the container which can be used for the placement of all orthogonal objects that are part of the considered orthogonal polyhedron. As a result of analyzing the set of all existing free orthogonal areas of the container, the most suitable area of the container is determined for each orthogonal polyhedron when forming a dense placement of objects.
The efficiency of application of the developed and software-implemented algorithms for the formation and placement of orthogonal polyhedrons is investigated by the example of solving the problem of modeling the layout of objects of complex geometric shape on the platform of a 3D printer. It is shown that the algorithms presented in the work provide an average of 10% denser layouts in a several times shorter than the layouts generated by Materialize Magics software which is the market leader in software solutions for additive technologies.