A method for solving the Boolean outer contour of plane geometric figures based on image lattice
Through the image lattice-based method, the Boolean calculation process of plane geometric figures is simplified, the problems of low efficiency and poor robustness in the prior art are solved, and efficient and accurate Boolean and outer contour solutions are achieved.
Patent Information
- Application Number
- CN202111648989.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-29
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2041-12-29
AI Technical Summary
When the prior art deals with Boolean operations of a large number of complex planar geometric patterns, it is inefficient and poorly robust, making it difficult to efficiently and accurately solve the outer contour of the Boolean and computed.
Using an image lattice-based method, by reading the basic information of the plane geometry, selecting the appropriate image lattice, drawing and filling the figure outline, and using the contour extraction algorithm to obtain a discrete ordered point set sequence of the plane geometry Boolean and outer contour.
It simplifies the complexity of mathematical calculations, improves the efficiency of solving the relationship between plane geometric figures, enhances robustness, and can efficiently and accurately solve the outer contours of Booleans and calculations.
Smart Images

Figure CN114463366B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of Boolean operations of plane graphics, and relates to a method for solving the Boolean outer contour of a plane geometric figure based on an image dot matrix. Background Art
[0002] Boolean operations on plane geometric figures are one of the basic problems in geometry and solid modeling. Currently, there are many methods to calculate Boolean operations on polygons, but most algorithms cannot avoid the calculation of plane geometry mathematics. These algorithms generally include two major steps: 1) Calculate the intersection points between plane geometric figures; 2) According to the vertices and intersection points of the plane geometric figures, according to a certain solution rule, finally obtain the outline of the Boolean operation figure. It is undeniable that step 2) needs to take into account various cumbersome special cases in Boolean operations, so the robustness is poor and the efficiency is relatively low in some scenarios.
[0003] When the number of plane geometric figures to be solved is very large and the shapes are complex and changeable, these traditional algorithms are difficult to efficiently and accurately solve the outer contour of the Boolean operation. Therefore, a relatively novel method based on image lattice can effectively avoid considering various cumbersome special cases in Boolean operations, thereby having higher efficiency and stronger robustness.
[0004] In practical applications, especially in the field of computer graphics, Boolean operations on arbitrary planar geometric figures are very important. Graphic samples of intelligent CAD design methods such as example-based design and prototype-based design are generally composed of complex basic graphic samples. In most cases, users need to be able to see the effects of sample images in different forms. For example, most of the integrated circuit boards produced need to be copper-clad. The shapes of the copper-clad area and non-copper-clad area of the integrated circuit board after copper cladding need to be clearly presented to the designer during the design. It is difficult to avoid the need to perform Boolean operations on a large number of complex geometric figures to obtain their outer contours after Boolean operations.
[0005] And with the rapid development of integrated circuits, the density, scale and complexity of IO are constantly increasing. In order to ensure the correctness and accuracy of IO board design, its graphic recognition and verification, geometric design rule checking, etc. are becoming more and more important. Boolean operations of plane geometric figures are the basis of these tasks. Therefore, a method with strong robustness and the ability to efficiently solve the Boolean outer contour of plane geometric figures is particularly important. Summary of the invention
[0006] To solve the above problems, the present invention can simplify the traditional calculation of solving the relationship between plane geometric figures through mathematical equations, and improve the efficiency of solving the relationship between plane geometric figures.
[0007] The technical solution is a method for solving the Boolean outer contour of a plane geometric figure based on an image dot matrix, comprising the following steps:
[0008] S1, read the basic information of all plane geometric elements to be solved;
[0009] S2, select an image dot matrix that meets the size and accuracy requirements for solving the Boolean outer contour of a plane geometric figure, and initialize a pixel value;
[0010] S3, according to the drawing order of the plane geometric figure to be solved, draw the outline of the plane geometric figure element on the image dot matrix, and fill it to obtain a filled image;
[0011] S4, using the contour extraction algorithm to extract the contour of the filled image to obtain a discrete ordered point set sequence of the Boolean outer contour of the plane geometric figure.
[0012] Preferably, the basic information of the plane geometric figure elements in S1 includes information of edges and points constituting the closed plane geometric figure.
[0013] Preferably, S2 specifically includes calculating the basic information of all the plane geometric graphic elements to be solved to obtain the size and density of the image lattice.
[0014] Preferably, the image dot matrix size and density refer to the number of pixels contained in the width and height of the image dot matrix respectively.
[0015] Preferably, meeting the accuracy requirement in S2 refers to the size of a plane geometric element that can be represented by the size of a pixel point in the determined image dot matrix.
[0016] Preferably, the drawing order of the plane geometric figures in S3 refers to the order in which the plane geometric figures to be solved are read.
[0017] Preferably, the filling image in S3 refers to drawing the edge contour of a plane geometric figure and then filling the inside thereof with a pixel value that is different from the image dot matrix background, that is, the initialized pixel value.
[0018] Preferably, the contour extraction algorithm in S4 refers to obtaining an ordered point set of the image contour by tracing the boundary of the entire filled image in a certain manner.
[0019] The present invention has at least the following beneficial effects: it breaks the traditional idea of solving graphic Boolean operations through mathematical equations, can simplify the complexity of mathematical calculations, and obtains the outer contour point set of the plane geometric figure by drawing its filled image and extracting the contour of the filled image. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 A flowchart of the steps of a method for solving the Boolean outer contour of a plane geometric figure based on an image dot matrix according to an embodiment of the present invention;
[0021] Figure 2 A filled image diagram of a method for solving the Boolean outer contour of a plane geometric figure based on an image dot matrix according to an embodiment of the present invention;
[0022] Figure 3 An example diagram of the Boolean union of plane geometric figures of the method for solving the Boolean union of the outer contours of plane geometric figures based on the image dot matrix according to an embodiment of the present invention;
[0023] Figure 4 A comparison diagram of geometric figures and filled images of a method for solving the Boolean outer contour of a plane geometric figure based on an image dot matrix according to an embodiment of the present invention;
[0024] Figure 5 It is a direction array of contour tracing of the method for solving the Boolean outer contour of a plane geometric figure based on an image dot matrix according to an embodiment of the present invention;
[0025] Figure 6 This is a result diagram of the contour tracing algorithm of the method for solving the Boolean outer contour of a planar geometric figure based on an image dot matrix according to an embodiment of the present invention. DETAILED DESCRIPTION
[0026] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0027] On the contrary, the present invention covers any substitution, modification, equivalent method and scheme made on the essence and scope of the present invention as defined by the claims. Further, in order to make the public have a better understanding of the present invention, some specific details are described in detail in the detailed description of the present invention below. Those skilled in the art can fully understand the present invention without the description of these details.
[0028] See also Figure 1 , is a flow chart of the method of the present invention, comprising the following steps:
[0029] S1, read the basic information of all plane geometric elements to be solved;
[0030] S2, select an image dot matrix that meets the size and accuracy requirements for solving the Boolean outer contour of a plane geometric figure, and initialize a pixel value;
[0031] S3, according to the drawing order of the plane geometric figure to be solved, draw the outline of the plane geometric figure element on the image dot matrix, and fill it to obtain a filled image;
[0032] S4, using the contour extraction algorithm to extract the contour of the filled image to obtain a discrete ordered point set sequence of the Boolean outer contour of the plane geometric figure.
[0033] The basic information of the plane geometric figure elements in S1 includes information of edges and points constituting the closed plane geometric figure.
[0034] S2 specifically includes calculating the basic information of all the plane geometric elements to be solved and then obtaining the size and density of the image dot matrix. The size and density of the image dot matrix refer to how many pixels are contained in the width and height of the image dot matrix respectively; the drawing needs to meet the accuracy requirements of the solution. In addition, the pixel values filled in the plane geometric figure can be arbitrary. Meeting the accuracy requirements refers to the size of the plane geometric element that can be represented by the size of a pixel in the determined image dot matrix.
[0035] The drawing order of the plane geometric figures described in S3 refers to the order in which the plane geometric figures to be solved are read; filling the image means that after drawing the edge outline of the plane geometric figure, the inside is filled with a pixel value that is different from the image dot matrix background, that is, the initialized pixel value, and the filled image after filling should be a binary image with a relatively obvious difference.
[0036] The contour extraction algorithm described in S4 refers to obtaining an ordered point set of the image contour by tracking the boundary of the entire filled image in a certain manner.
[0037] In a specific embodiment, the following steps are included:
[0038] S1 reads the basic information of all plane geometric elements to be solved;
[0039] S2 selects an image dot matrix that meets the size and accuracy requirements for solving the Boolean outer contour of a plane geometric figure, and initializes a pixel value to 0;
[0040] S3 draws the outline of the plane geometric figure elements on the image dot matrix according to the drawing order of the plane geometric figure to be solved, and fills it with a pixel value of 255 to obtain a filled image. Figure 2 ; Figure 3 is the Boolean and example diagram of the corresponding plane geometry. Figure 4 Comparison diagram of the corresponding geometric figures and filled images;
[0041] S4 uses the contour extraction algorithm to extract the contour of the filled image to obtain a discrete ordered point set sequence of the Boolean outer contour of the plane geometric figure;
[0042] S41 determines the starting point of tracking. Raster scan the segmented binary image from bottom to top and from left to right, distinguish the inner and outer contours by the change of the grayscale value of the pixel points in the window, and determine the tracking starting point and starting direction. If the grayscale value in the window changes from 0 to 255, the pixel point with a grayscale value of 255 is determined as the starting point of the outer contour, the starting tracking direction is the 0 direction, and the order of the contour point set is counterclockwise; if it changes from 255 to 0, the pixel point with a grayscale value of 255 is determined as the starting point of the inner contour, the starting tracking direction is the 4 direction, and the order of the contour point set is clockwise.
[0043] S42 determines the tracking end point. Figure 5 , traverse the 8 neighborhoods of the starting point in reverse order according to the direction array to find a pixel point with a grayscale value of 255. If it exists, it is the end point of the contour. If it does not exist, the current contour has only one isolated point, and the contour tracking ends.
[0044] S43: Start contour tracking. Starting from the contour starting point, traverse the 8 neighborhoods of the contour point in the order of the direction array and determine whether the current pixel point is a contour point (whether the grayscale value is 255). If so, insert the tail into the contour linked list. In addition, the pixel value of the contour point needs to be modified during the tracking process. The outer contour is modified to 3 and the inner contour is modified to 4 to avoid subsequent repeated tracking of the same contour. After the modification, the contour tracking continues from the current pixel point, and so on.
[0045] S44: End contour tracking. Tracking ends when the image boundary is tracked or the contour end point is tracked, or when there are no more contour points in the 8-neighborhood of the current contour point. In addition, to be applicable to contour tracking of open contours, when tracking ends in the order of the direction array from the starting point, it is necessary to track again in reverse order from the starting point in the direction array. At this time, the contour nod is inserted into the contour linked list. When reverse tracking reaches the image boundary or there are no more contour points in the 8-neighborhood of the current contour point, reverse tracking ends and this contour tracking ends. See the results. Figure 6 .
[0046] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for solving the Boolean outer contour of a plane geometric figure based on an image dot matrix, characterized in that: The following steps are involved: S1, read the basic information of all plane geometric elements to be solved; S2, select an image dot matrix that meets the size and accuracy requirements for solving the Boolean outer contour of a plane geometric figure, and initialize a pixel value; S3, according to the drawing order of the plane geometric figure to be solved, draw the outline of the plane geometric figure element on the image dot matrix, and fill it to obtain a filled image; S4, using the contour extraction algorithm to extract the contour of the filled image to obtain a discrete ordered point set sequence of the Boolean outer contour of the plane geometric figure; The filling in S3 refers to drawing the edge outline of the plane geometric element and then filling the inside with pixel values different from the initialized pixel values.
2. The method for solving the Boolean outer contour of a plane geometric figure based on an image dot matrix according to claim 1, characterized in that: The basic information of the plane geometric figure elements in S1 includes information of edges and points constituting the closed plane geometric figure.
3. The method for solving the Boolean outer contour of a plane geometric figure based on an image dot matrix according to claim 1, characterized in that: The S2 specifically includes calculating the basic information of all the plane geometric graphic elements to be solved to obtain the size and density of the image lattice.
4. The method for solving the Boolean outer contour of a plane geometric figure based on an image dot matrix according to claim 3, characterized in that: The size and density of the image dot matrix refer to how many pixels are included in the width and height of the image dot matrix respectively.
5. The method for solving the Boolean outer contour of a plane geometric figure based on an image dot matrix according to claim 1, characterized in that: The accuracy requirement in S2 refers to the size of a plane geometric element that can be represented by the size of a pixel point in the determined image dot matrix.
6. The method for solving the Boolean outer contour of a plane geometric figure based on an image dot matrix according to claim 1, characterized in that: The drawing order of the plane geometric figures in S3 refers to the order in which the plane geometric figures to be solved are read.
7. The method for solving the Boolean outer contour of a plane geometric figure based on an image dot matrix according to claim 1, characterized in that: The contour extraction algorithm in S4 refers to obtaining an ordered point set of the image contour by tracking the boundary of the entire filled image in a certain manner.