A method for color filling of layout parts and rapid determination of positional relationship between parts

By constructing a binary cube set and a scan line polygon filling algorithm, combined with a binary search algorithm, the problem of complex calculation and long time consumption in polygon layout of curved outline parts is solved, fast and stable part color filling and positional relationship judgment are achieved, and the time is reduced Nesting time and reduced image storage memory size.

CN114117566BActive Publication Date: 2024-09-13BEIJING JCZ TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111405496.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-24
Publication Date
2024-09-13
Estimated Expiration
2041-11-24

AI Technical Summary

Technical Problem

The existing technology is complex and time-consuming in polygon layout of curved outline parts. The traditional pixel method requires too much data when the accuracy is high, which leads to a very long time-consuming process, making it difficult to quickly judge the positional relationship between parts.

Method used

By constructing a binary cube set, find the smallest cube containing the part polygon as the parent cube, determine the relationship between its subcuboids and parts, use the scan line polygon filling algorithm to fill the color, and combine it with the binary search algorithm to determine the overlap of parts. Reduce time complexity.

Benefits of technology

It achieves fast and stable part color filling and positional relationship judgment, which is especially suitable for curved contour parts, reduces layout time, and effectively reduces image storage memory size without changing pixels.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114117566B
    Figure CN114117566B
Patent Text Reader

Abstract

The present invention relates to the field of two-dimensional irregular parts arrangement, specifically a method for color filling of parts and rapid determination of positional relationship between parts. First, a binary cube set with good mathematical properties is constructed, the minimum binary cube containing parts is found, the relationship between all subclass cubes of this cube and part polygons is determined, all subclass cubes inside the part are saved, the operation is repeated for the non-empty cubes intersecting with the part in the remaining subclass cubes, and the process ends when the side length is less than a given value, and all saved cubes and the last intersecting cube are filled with colors. It can also be used for image data storage, reducing the memory occupied by stored images without changing pixels. The positional relationship between parts is determined, appropriate data structures and storage rules are constructed, binary cubes that need to be filled with colors are stored, part envelope boxes are calculated, intersecting rectangles are found, and the color-filled cubes, intersecting rectangles and part data information are combined to rapidly determine part overlap.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of two-dimensional irregular parts arrangement, and in particular to a method for color filling of arrangement parts and for quickly determining positional relationships between parts. Background Art

[0002] The problem of pattern arrangement is widely present in various industries that require cutting raw materials. There are some deficiencies in the problem of pattern arrangement that need to be improved. The deficiencies are as follows:

[0003] The NFP nesting algorithm has the problem of complex and time-consuming calculation of NFP for polygonal nesting of curved contour parts. When the traditional pixel method is used with high precision, it will take a long time due to too many pixels and too much data. Based on this, we have made improvements to the pixel method and proposed a method for color filling of nested parts and quick judgment of the positional relationship between parts. Summary of the invention

[0004] The purpose of the present invention is to: address the problems raised by the existing background technology, and in order to achieve the above-mentioned purpose of the invention, the present invention provides the following technical solutions: a method for color filling of layout parts and quickly judging the position relationship between parts, so as to improve the above-mentioned problems. The present application is specifically as follows: including S1, color filling; S11, constructing a binary cube set, wherein the binary cube set only has two types: inclusion relationship and empty intersection, and binary cubes with the same length do not intersect each other. Using these binary cubes can effectively and stably reduce the calculation of whether polygons overlap, find the smallest binary cube containing the part polygon, and set it as the parent cube (here only consider the case where the part polygon is in the first quadrant, and other cases are similar); S12, judging the relationship between all child cubes of this parent cube and the part polygon; S13, all child cubes saved inside the part, and the child cubes whose intersection with the part polygon is not empty among the remaining child cubes are set as new parent cubes; S14, repeating S12 and S13 operations for all parent cubes, and ending when no new parent cube is generated or the side length of the new parent cube is less than a given value; S15, using the scan line polygon filling algorithm for all saved parent cubes and the parent cubes at the end, fill these parent cubes with colors;

[0005] S2, determine whether polygons overlap; S21, in order to reduce time complexity, build data structure and storage rules, in the color filling algorithm part, store the binary cubes that need to be filled with color; S22, calculate the envelope box of the parts to be arranged and the parts that have been arranged, and find the common rectangular part; S23, use the binary search algorithm to find all binary cubes that overlap with this rectangle, and compare them with the non-empty points and edges in the parts to be arranged that intersect with this rectangle to determine whether the parts overlap.

[0006] As the preferred technical solution of this application, in the S1 color filling, it is necessary to construct a binary cube set, and it is necessary to give a specific mathematical expression of the elements in this set. Then, according to the specific coordinate data of the given part polygon, we can quickly determine the parameters of the mathematical expression, so as to find the only minimum binary cube containing this part polygon. Here we only consider the case where the part polygon is in the first quadrant, and other cases are similar.

[0007] As the preferred technical solution of the present application, the relationship between all child cubes of the parent cube and the part polygons is judged in S12. As we know, to judge whether any two polygons overlap, it is necessary to judge whether the vertices of the two polygons are inside the other polygon and whether the edges of the two polygons intersect. This process is relatively complicated, but due to the good properties of the binary cube, the judgment conditions can be simplified a lot, and the judgment time can be shortened by more than 2 / 3.

[0008] As the preferred technical solution of the present application, in S21, we construct an appropriate one-dimensional data structure, and then establish storage rules in combination with the tree structure idea to store these two-dimensional cube data. The goal is to facilitate the subsequent query using a binary search algorithm. The time complexity of this query method is logarithmic time.

[0009] As the preferred technical solution of the present application, in S22, we first calculate the envelope boxes of the two part polygons, and then look for the common rectangular part therein. When the two envelope boxes do not have a common rectangular part, it means that the two polygons will not overlap; when there is a common rectangular part, we only need to consider the cubes stored in the S21 process that intersect with the common rectangular part and are not empty, thereby reducing a large amount of calculations.

[0010] As the preferred technical solution of the present application, in S23, we only consider the comparison of the non-empty points and edges of the polygon of the parts to be arranged and the rectangle in S22. We do not need to consider the vertices and edges that are not in this rectangle. In this way, we reduce a large number of unnecessary judgments in the judgment process. By judging whether the vertices and edges we selected intersect with the binary cube we selected, we can judge whether there is overlap.

[0011] Compared with the prior art, the present invention has the following beneficial effects:

[0012] In the scheme of this application:

[0013] 1. The present invention refers to arranging parts and filling part colors within a given raw material space layout. During the placement process, it is determined whether the parts to be arranged overlap with the arranged parts. The goal is to quickly and stably fill the part colors and determine whether the parts overlap, thereby reducing a lot of sample arrangement time, especially for parts with curved contours.

[0014] 2. The present invention can also be used for image data storage, effectively reducing the memory size occupied by the stored image without changing the pixels. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 A binary cube diagram of the method for color filling of arrangement parts and rapid determination of the positional relationship between parts provided in this application;

[0016] Figure 2 Iterative renderings of specific examples of part color filling provided in this application;

[0017] Figure 3 The envelope box and intersecting rectangular diagram of the method for color filling of layout parts and quickly judging the position relationship between parts provided in this application. DETAILED DESCRIPTION

[0018] To make the purpose, technical solution and advantages of the embodiment of the present invention clearer, the technical solution in the embodiment of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiment is a specific implementation of the present invention and is not limited to all embodiments.

[0019] Therefore, the following detailed description of the embodiments of the present invention is not intended to limit the scope of the invention claimed for protection, but merely represents some embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0020] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features and technical solutions in the embodiments may be combined with each other.

[0021] A method for color filling of arrangement parts and rapid determination of positional relationship between parts is provided to improve the above problems. The present application is specifically as follows: including S1, color filling; S11, constructing a binary cube set, in which there are only two types of binary cube sets: inclusion relationship and empty intersection, and binary cubes with the same length do not intersect each other. Using these binary cubes can effectively and stably reduce the calculation of whether polygons overlap, and find the smallest binary cube containing the part polygon, and set it as the parent cube (here only considers the case where the part polygon is in the first quadrant, and other cases are similar); S12, judging the relationship between all child cubes of this parent cube and the part polygon; S13, saving all child cubes inside the part, and setting the child cubes whose intersection with the part polygon is not empty among the remaining child cubes as new parent cubes; S14, repeating S12 and S13 operations for all parent cubes, and ending when no new parent cube is generated or the side length of the new parent cube is less than a given value; S15, using the scan line polygon filling algorithm for all saved parent cubes and the parent cubes at the end, fill these parent cubes with colors;

[0022] Preferably, S2, determines whether polygons overlap; S21, constructs data structures and storage rules to reduce time complexity, and stores binary cubes that need to be filled with colors in the color filling algorithm part; S22, calculates the envelope boxes of the parts to be arranged and the parts that have been arranged, and searches for the common rectangular parts; S23, uses a binary search algorithm to search for all binary cubes that overlap with this rectangle, and compares them with the non-empty points and edges in the parts to be arranged that intersect with this rectangle to determine whether the parts overlap.

[0023] Preferably, in the S1 color filling, it is necessary to construct a binary cube set, and to give a specific mathematical expression for the elements in this set. Then, based on the specific coordinate data of the given part polygon, we can quickly determine the parameters of the mathematical expression, thereby finding the only minimum binary cube containing the part polygon. Here we only consider the case where the part polygon is in the first quadrant, and other cases are similar.

[0024] Preferably, in S12, all child cubes of the parent cube are judged, and the relationship between the part polygons. We know that to judge whether any two polygons overlap, it is necessary to judge whether the vertices of the two polygons are inside the other polygon and whether the edges of the two polygons intersect. This process is relatively complicated, but due to the good properties of the binary cube, the judgment conditions can be simplified a lot, and the judgment time can be shortened by more than 2 / 3.

[0025] Preferably, in S21, we construct an appropriate one-dimensional data structure, and then establish storage rules in combination with the tree structure idea to store these two-dimensional cube data, with the goal of facilitating subsequent query using a binary search algorithm. The time complexity of this query method is logarithmic time.

[0026] Preferably, in S22, we first calculate the envelope boxes of the two part polygons, and then look for the common rectangular part therein. When the two envelope boxes do not have a common rectangular part, it means that the two polygons will not overlap. When a common rectangular part exists, we only need to consider the cubes stored in the S21 process that intersect with the common rectangular part and are not empty, thereby reducing a large amount of calculations.

[0027] Preferably, in S23, we only consider the comparison of the non-empty points and edges of the polygon of the part to be arranged and the rectangle in S22, and we do not need to consider the vertices and edges that are not in this rectangle. In this way, we reduce a large number of unnecessary judgments in the judgment process. By judging whether the vertices and edges we selected intersect with the binary cube we selected, we can judge whether there is overlap.

[0028] A polygon with vertices (0, 2), (2, 0), (2.5, 1), (4, 2), (2, 4), and (1, 3.5) is combined with the cube color filling algorithm and iterated twice, four times, six times, and eight times. The results are as follows: Figure 2 .according to Figure 2 In the last figure, we can see that to determine whether parts overlap, we essentially replace the pixels in the polygon with these gray binary cubes. The number of these binary cubes is obviously much less than the number of pixels. Figure 3 In the intersection rectangle of the middle envelope box, the number of binary cubes that need to be judged is further reduced, and the amount of calculation is further reduced by using the binary search algorithm. In order to facilitate distinction, the commonly used layout software on the market often uses the same color, and compared with the traditional pixel method, we can not only quickly determine whether there is overlap; in this process, since the graphics are all binary cubes, the scan line polygon filling algorithm can also quickly and stably fill the color of the desired parts.

[0029] The above embodiments are only used to illustrate the present invention and are not intended to limit the technical solutions described in the present invention. Although the present invention has been described in detail with reference to the above embodiments, the present invention is not limited to the above specific implementation methods. Therefore, any modification or equivalent replacement of the present invention; and all technical solutions and improvements thereof that do not depart from the spirit and scope of the invention are included in the scope of the claims of the present invention.

Claims

1. A method for color filling of arrangement parts and rapid determination of positional relationship between parts, characterized in that: The following steps are involved: S1, color filling; S11, construct a binary cube set, the binary cube set only has two types: inclusion relationship and empty intersection, and binary cubes with the same length do not intersect each other, find the smallest binary cube that contains the part polygon, and set it as the parent cube; S12, determine the relationship between all child cubes of this parent cube and the part polygon; S13, save all child cubes inside the part, and set the child cubes with non-empty intersections with the part polygon among the remaining child cubes as new parent cubes; S14, repeat S12 and S13 operations for all parent cubes, and end when no new parent cube is generated or the side length of the new parent cube is less than the given value; S15, use the scan line polygon filling algorithm to fill the colors of all saved parent cubes and the parent cubes at the end; S2, determine whether polygons overlap; S21, build data structure and storage rules, and store binary cubes that need to be filled with color in the color filling algorithm part; S22, calculate the envelope box of the parts to be arranged and the parts that have been arranged, and find the common rectangular part; S23, use the binary search algorithm to find all binary cubes that overlap with this rectangle, and compare them with the non-empty points and edges in the parts to be arranged that intersect with this rectangle to determine whether the parts overlap.