Printed circuit board copper coating method based on large-scale polygon Boolean operation solution
By adopting a printed circuit board copper pouring method based on large-scale polygon Boolean operation solution in PCB auxiliary design, including preprocessing, operation sequence optimization and efficient intersection algorithm, the problem of insufficient efficiency and quality of the copper pouring algorithm in the existing technology is solved. , achieving efficient calculations on a scale of millions of line segments, meeting the needs of complex circuit board design.
Patent Information
- Application Number
- CN202411400767.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-09
- Publication Date
- 2025-01-24
AI Technical Summary
The efficiency and quality of the copper clad algorithm in PCB-assisted design is difficult to meet the needs of complex circuit board design, especially in large-scale polygonal boolean operations.
A printed circuit board copper coating method based on large-scale polygonal Boolean operation solution is adopted, including preprocessing, operation sequence optimization and efficient intersection algorithm, and the data structure is optimized through steps such as geometric element screening, polygon screening, line segment merging and arc splitting. And by identifying and prioritizing polygon operations that have a greater impact on the results, unnecessary calculations are reduced.
Significantly improves the processing speed and quality of large-scale polygonal Boolean operations in the field of PCB auxiliary design. It can complete operations in hundreds of seconds on a scale of millions of line segments, solving the problem of low efficiency in existing technologies. , which meets the needs of complex circuit board design for high-efficiency and high-quality copper pouring algorithms.
Smart Images

Figure CN119358504A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of PCB circuit board manufacturing, and in particular to a printed circuit board copper coating method based on large-scale polygonal Boolean operation solution. Background Art
[0002] In the field of PCB auxiliary design, copper-cladding algorithms play a vital role in the quality and efficiency of auxiliary design. Copper-cladding algorithms involve cutting-edge technologies from multiple disciplines, including computational geometry, graph theory, and optimization theory. As circuit board design becomes increasingly complex, how to improve the efficiency and quality of copper-cladding algorithms has become a key research direction in this field. In terms of computational geometry, copper-cladding algorithms need to frequently perform operations such as intersection and union of polygons, which is the key to the efficiency of the algorithm. Some technical solutions have proposed efficient intersection algorithms based on spatial indexes such as quadtrees and R-trees, as well as parallel computing methods accelerated by GPUs, which greatly improve the computing speed. In terms of edge-finding algorithms, determining the precise boundary shape of each copper area is also a computationally intensive process. Scholars have proposed methods based on curvature optimization and combined manufacturing processes to generate smoother copper block boundaries that meet process specifications for different application scenarios. In addition, copper-cladding algorithms involve multiple optimization objectives, such as copper layer area, heat distribution, electromagnetic interference, etc., and these factors need to be weighed and balanced. Summary of the invention
[0003] The present invention provides a printed circuit board copper cladding method based on large-scale polygonal Boolean operation solution, which is used to overcome at least one technical problem existing in the prior art.
[0004] The embodiment of the present invention provides a printed circuit board copper cladding method based on large-scale polygonal Boolean operation solution, comprising:
[0005] Step S1, preprocessing, is used to preprocess the polygonal data elements related to all copper-clad areas on the printed circuit board to obtain data elements that meet the subsequent algorithm, specifically including: (1) geometric element screening: screening the line segments or arcs in the input data, filtering out the geometric elements whose length or arc length is lower than a certain threshold; (2) polygon screening: checking the polygonal elements in the input data, filtering out the polygons whose area is lower than the preset threshold, so as to exclude noise or irrelevant small facets; (3) line segment merging: detecting and merging line segments on the same straight line and in the same direction; (4) arc splitting: splitting the arcs in the model to obtain multiple smaller arc segments; the polygonal data elements are used to represent the boundaries of the copper-clad areas on the circuit board, and are used to define different conductive areas;
[0006] Step S2, operation sequence optimization, is used to simplify solving the contour difference set in the polygon set in the pre-processed printed circuit board. In the face of many polygons in the polygon set that do not constitute an influence, they can be regarded as being outside the polygon to be calculated. The difference set calculation will be performed step by step to effectively simplify the intermediate results and optimize the polygon Boolean operation sequence, which specifically includes:
[0007] Step S21, input data definition: the input polygon data includes a main polygon A and a polygon union result B, B is composed of n polygons B1, B2, ..., B n S22, split the polygon union result: for the polygon union result B, do not regard it as a whole, but split it into n polygons B1, B2, ..., B n ; S23, gradually perform the difference operation: 1) starting from the main polygon A, each polygon B1, B2, ..., B n Perform a difference operation; the result of each difference operation will update polygon A, that is:
[0008] A1=A-B1
[0009] A2=A1-B2
[0010] …
[0011] A n =A n-1 -B n
[0012] 1) After each operation, check the geometry of the result and record the number of edges;
[0013] 2) The optimization effect is as follows: The final polygon A n It can be considered that the original polygon A and the polygon union result B have polygons B that touch each other. i The solution is obtained by performing difference operations step by step;
[0014] The intersection algorithm is used to calculate the intersection points between the edges of the polygons on the printed circuit board after preprocessing, and insert the intersection points into the polygon outline; specifically, solving the intersection points between the edges of the polygons is divided into four steps:
[0015] Step 1: Grid division, including:
[0016] Step 11: First, set the bounding box of the intersection area and define the grid as G. Then, divide the grid within the bounding box and mark each grid unit as G. i,j , where i and j represent the row and column indices of the grid respectively;
[0017] Step 12: In order to improve query efficiency, a KD tree is used to store and manage grid cells; each grid cell is used as a node of the KD tree to quickly find and locate the area where the polygon edge is located;
[0018] Step 13: For each edge of polygon BCDE and polygon FGHI, determine the grid cells it passes through, and store the index of the edge in these grid cells;
[0019] Step 2: Filter intersecting line segments, including:
[0020] Step 21: For each grid cell G i,j , read the edge index stored therein, and find the grid cell that stores multiple edge indexes at the same time;
[0021] Step 22: compare the edges in the same grid unit in pairs, read which line segments pass through the grid, quickly exclude line segments that are unlikely to intersect, and select line segments that are likely to intersect;
[0022] Step 23: For the selected line segments, calculate the intersection points between them, and sort the intersection points in ascending order of coordinates;
[0023] Step 3: Determine the intersection attributes, including:
[0024] Step 31, assume that polygon BCDE and polygon FGHI have an intersection, and the intersection is formed by the intersection of two line segments CE and FI;
[0025] Step 32: Take the counterclockwise direction as the reference direction, and the vector of the CE segment at the intersection is The vector of the FI segment is By calculating the vector cross product The value of , and the property of the intersection point are determined based on its sign:
[0026] like Then the intersection point is the exit point;
[0027] like Then the intersection point is the entry point;
[0028] Step 4, inserting the intersection points, specifically comprising: inserting the intersection points into the grid cells of the original polygonal outline according to the order of the intersection points;
[0029] For the intersection of straight line segments, the following contents are included: The intersection of straight line segments is found by geometric method, which is divided into the following three steps: a preliminary judgment is made on whether the two line segments intersect. In order to determine whether the two line segments meet the intersection conditions, two basic test methods are used: the rapid repulsion test and the straddle test;
[0030] 1) The purpose of the fast repulsion experiment is to quickly exclude non-intersection situations by detecting whether the bounding boxes of two line segments collide;
[0031] 2) If the rapid repulsion test is passed, the next step is to conduct a straddle test to further determine whether the line segments intersect;
[0032] 3) The straddling experiment determines whether there is an intersection by judging the relative positions of the endpoints of two line segments on the other line segment;
[0033] 2. Based on the preliminary judgment that the two line segments may intersect, the intersection point is then solved; the point calculation is based on the geometric method, and the exact location of the intersection point is determined by solving the definite ratio point theorem;
[0034] 1) Find the intersection point using the definite ratio point theorem:
[0035] Suppose that line segments NO and LM intersect at point P(x p ,y p ), then point P divides line segment NO into two segments and let their ratio be λ, that is,
[0036] Assume that the coordinates of N and O are (x1, y1) and (x2, y2), then the coordinates of point P (x p ,y p ) can be obtained from
[0037]
[0038]
[0039] in,
[0040] Among them, the areas of ΔMNL and ΔMOL can be obtained by vector cross product;
[0041] 2) For the overlapping line segments, it is considered that they have no intersection;
[0042] 3. Determine whether the intersection point is on the line segment. After calculating the intersection point using the fixed ratio point theorem, it is necessary to further determine whether the intersection point is within the valid range of the two line segments. Use vector cross product to make the determination.
[0043] Given a point M and a line segment KL, where K and L are the first and last endpoints of the line segment, to determine whether point M is on line segment KL, the following two conditions must be met:
[0044] Kmxkl=0
[0045] M∈K, L is a rectangle with diagonal vertices
[0046] Among them, the intersection point of step 1 satisfies the second condition;
[0047] For intersections involving curves, the following are included:
[0048] Curve intersection mainly involves two types: arc-arc intersection and arc-line segment intersection. Their solution steps are described below:
[0049] Find the intersection of arcs, including:
[0050] 1) It is known that two arcs intersect with circles of different radii r1 and r2. Assume that the centers of the circles are A(x A ,y A ) and C(x C ,y C ), the two arcs intersect at points E and F;
[0051] 2) Two centers of the circle A(x A ,y A ) and C(x C ,y C ), the distance between the two circle centers can be obtained by the distance formula:
[0052]
[0053] 3) Apply the law of cosines to find the angle. In ΔAFC, use the law of cosines to determine cosα, where α is the angle between AC and AF.
[0054] 4) Solve for the length of line segment AG. Given the known center distance r1 and angle α, calculate l AG = l r1 ·cosα;
[0055] 5) Solve for point G(x G ,y G ) through the geometric relationship of the triangle, the coordinates of point G can be determined as:
[0056]
[0057] 6) Rotate to solve the intersection points E and F. With point G as the center, rotate 90° clockwise and counterclockwise along the GA direction to obtain the coordinates of the two intersection points E and F;
[0058] Find the intersection point between a line segment and an arc, including:
[0059] 1) Given a line segment MN and a circle with center A(x A ,y A ), the arc with radius r intersects, the formula of the line is ax+by+c=0, the normal vector of the line is:
[0060] 2) Solve for the coordinates of point G, point G(xG ,y G ) is the center of the circle A(x A ,y A ) is perpendicular to the line ax+by+c=0 on which the line segment MN lies, then the coordinates of point G satisfy the following formula:
[0061]
[0062] 3) Rotate to solve the intersection points E and F. With point G as the center, rotate 90° clockwise and counterclockwise along the GA direction to obtain the coordinates of the two intersection points E and F;
[0063] 4) Use vector cross product to determine whether the intersection points E and F are on the line segment MN;
[0064] Find the edge:
[0065] The main idea of the edge-finding algorithm is to process all the areas that need copper cladding on the printed circuit board and find the maximum contour; through the edge-finding algorithm and the entry and exit point attributes of the intersection point itself, the Boolean algorithm is used to find the union and intersection of the copper-clad polygonal areas to obtain the corresponding contour;
[0066] Basic concept definition:
[0067] 1) For the two polygons ABCDE and FGHIJ that need to be Boolean-operated, the intersection points of the two polygons are calculated. The intersection points are the points where the edges of the polygons intersect.
[0068] 2) Set the entry and exit point attributes of the intersection; the counterclockwise direction is the reference direction, and the vector of line segment 1 at the intersection is The vector of line segment 2 is By calculating the vector cross product The value of , and the property of the intersection point are determined based on its sign:
[0069] like Then the intersection point is the exit point;
[0070] like Then the intersection point is the entry point;
[0071] The detailed steps of finding the union in the edge-circling algorithm are as follows:
[0072] 1) Select an exit point as the initial point. From the polygon ABCDE, select an exit point that has never been visited and mark it as the starting point S.
[0073] 2) Switch polygon: switch from the exit point of polygon ABCDE to polygon FGHIJ, take the clockwise direction as the reference direction, and continue to traverse forward along the edge of FGHIJ;
[0074] 3) Find the next entry point: Walk along the edge of polygon FGHIJ until the next entry point is found;
[0075] 4) Switch polygon: Once the entry point is found, switch back to polygon ABCDE, take the clockwise direction as the reference direction, and continue to traverse forward along the edge of polygon ABCDE;
[0076] 5) Find the next exit point: Walk along the edge of polygon ABCDE until the next exit point is found;
[0077] 6) Repeat the above steps (2)-(5) until the path returns to the initial exit point S;
[0078] 7) Mark visited points: Each time you pass an intersection, mark it as visited to avoid duplication;
[0079] 8) Determine whether there are any unvisited exit points: If there are any unvisited exit points, select the next exit point as the new starting point and repeat the above steps (1)-(7) until all exit points have been visited;
[0080] Among them, the detailed steps of finding the intersection in the edge-circling algorithm are as follows:
[0081] 1) Select an entry point as the initial point. From the polygon ABCDE, select an entry point that has never been visited and mark it as the starting point S.
[0082] 2) Switch polygon: switch from the entry point of polygon ABCDE to polygon FGHIJ, take the clockwise direction as the reference direction, and continue to traverse forward along the edge of FGHIJ;
[0083] 3) Find the next exit point: Walk along the edge of polygon FGHIJ until the next exit point is found;
[0084] 4) Switch polygon: Once the exit point is found, switch back to polygon ABCDE, take the clockwise direction as the reference direction, and continue to traverse forward along the edge of ABCDE;
[0085] 5) Find the next entry point: Walk along the edge of polygon ABCDE until the next entry point is found;
[0086] 6) Repeat the above steps (2)-(5) until the path returns to the initial entry point S;
[0087] 7) Mark visited points: Each time you pass an intersection, mark it as visited to avoid duplication;
[0088] 8) Determine whether there are any unvisited entry points: If there are any unvisited entry points, select the next entry point as the new starting point and repeat the above steps (1)-(7) until all entry points have been visited;
[0089] Final contour generation: Through the above steps, the algorithm can obtain a closed path, which is the complete contour after the polygons are merged.
[0090] One embodiment of this specification can at least achieve the following beneficial effects: This technical solution significantly improves performance and computing efficiency through the following points: Efficient solution engine for large-scale polygon Boolean operations: It supports the intersection, union and difference operations of polygons, and especially optimizes the ability to process large-scale data sets, and can complete operations in hundreds of seconds at the scale of millions of line segments. Preprocessing algorithm: It includes steps such as geometric element screening, polygon screening, line segment merging and arc splitting, which effectively reduces the computational burden, optimizes the data structure, and lays a good foundation for subsequent operations. Operation order optimization algorithm: By identifying and prioritizing polygon operations that have a greater impact on the results, unnecessary calculations are avoided, the complexity of intermediate results is reduced, and the operation process is further accelerated. Improvement of edge-finding algorithm: Through the edge-circling algorithm and entry and exit point attribute judgment, the contour after Boolean operation is accurately generated, which is applicable to both union and intersection operations, ensuring the accuracy of the results and the efficiency of the algorithm. In summary, this technical solution has significantly improved the processing speed and quality of large-scale polygonal Boolean operations in the field of PCB-assisted design through a series of innovative algorithms and technical means, solved the problem of low efficiency in existing technologies, and met the needs of complex circuit board design for high-efficiency and high-quality copper cladding algorithms. BRIEF DESCRIPTION OF THE DRAWINGS
[0091] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0092] Figure 1 A schematic diagram of a printed circuit board before copper coating in a large-scale polygon Boolean operation solution method provided in an embodiment of this specification;
[0093] Figure 2 A schematic diagram of a printed circuit board after copper coating in a large-scale polygon Boolean operation solution method provided in an embodiment of this specification;
[0094] Figure 3 A framework diagram of a copper-cladding algorithm in a large-scale polygon Boolean operation solution method provided in an embodiment of this specification;
[0095] Figure 4A schematic diagram of finding intersection in a method for solving a large-scale polygon Boolean operation provided in an embodiment of this specification;
[0096] Figure 5 for Figure 4 A partial diagram of the intersection diagram;
[0097] Figure 6 A schematic diagram of finding the intersection of non-intersecting line segments in a large-scale polygon Boolean operation solution method provided in an embodiment of this specification;
[0098] Figure 7 A schematic diagram of a point on a line segment in a method for solving a large-scale polygonal Boolean operation provided in an embodiment of this specification;
[0099] Figure 8 A schematic diagram of arc intersection in a large-scale polygon Boolean operation solution method provided in an embodiment of this specification;
[0100] Fig. 9 A schematic diagram of seeking a union in an edge-around algorithm in a large-scale polygon Boolean operation solution method provided in an embodiment of this specification;
[0101] Fig.10 A schematic diagram of finding intersection in an edge-around algorithm in a large-scale polygon Boolean operation solution method provided in an embodiment of this specification. DETAILED DESCRIPTION
[0102] In order to make the purpose, technical solutions and advantages of one or more embodiments of this specification clearer, the technical solutions of one or more embodiments of this specification will be clearly and completely described below in combination with the specific embodiments of this specification and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of one or more embodiments of this specification.
[0103] It should be understood that although the terms first, second, third, etc. may be used in this application document to describe various information, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other.
[0104] The polygon intersection algorithm is a key link in the copper plating algorithm. During the copper plating process, it is necessary to frequently calculate the geometric relationships such as the intersection and union between multiple copper block boundary polygons. These polygon operations are the core calculation bottleneck of the copper plating algorithm and directly affect the overall efficiency of the algorithm. In circuit board design, the number and complexity of copper blocks continue to increase, causing the computational complexity of polygon intersection operations to grow exponentially. Traditional polygon intersection algorithms often cannot meet the requirements of real-time and large-scale data processing.
[0105] The polygon edge algorithm is the second key link in the copper coating algorithm. The edge algorithm is an algorithm for obtaining the results of polygon Boolean operations. The current mainstream intersection algorithms are the Greiner-Hormann algorithm and the Weiler-Atherton algorithm. Of course, the Greiner-Hormann algorithm also has some limitations: it may not be able to handle polygon intersection problems in extreme cases, such as when two polygons completely overlap; for complex polygon sets, the performance of the algorithm may decline.
[0106] Although there have been a lot of research and progress in polygon intersection algorithms and edge algorithms, and on this basis, many excellent and mature commercial software have been developed. However, there are still problems that need to be solved in the existing technical solutions. The problems that may need to be solved in the copper plating algorithm in the future are: 1. Algorithm complexity problem; 2: Numerical stability problem; 3. High-dimensional space problem; 4. Parallel computing problem.
[0107] The overall idea of the technical solution of this application is first explained below. The technical solution of this invention is to solve the following problems: 1. Implement an efficient solution engine that supports large-scale polygon Boolean operations, and supports polygon intersection, union and difference operations. 2. Build a PCB copper cladding high-performance calculation library based on the polygon Boolean operation engine, and support the completion of operations within a time limit of hundreds of seconds for millions of line segments. Figure 3 As shown, Figure 3 The framework diagram of the copper coating method provided by the technical solution of the present invention consists of three parts, among which the basic modules include an algorithm based on finding the intersection of a pair of polygons and an algorithm based on finding the edges of a pair of polygons. On the basis of these two algorithms, appropriate Boolean operation decisions are taken.
[0108] The "polygon" mentioned in the technical solution of the present application refers to a closed figure in two-dimensional space composed of at least three line segments connected end to end, and every two adjacent line segments share an endpoint, called a vertex. In the context of copper-clad algorithms for PCB (printed circuit board) design, polygons usually represent the boundaries of copper-clad areas on circuit boards and are used to define different conductive areas. The polygons here can be regular or polygonal, and may also contain straight edges and curved edges (such as arcs), which are the basic geometric elements for Boolean operations. Through polygonal Boolean operations, such as intersection, union, difference, etc., the layout of the copper-clad area on the circuit board can be efficiently calculated and optimized to ensure electrical performance and manufacturing feasibility.
[0109] Among them, the commonly used software related to PCB copper pouring includes the following: 1. Altium Designer: This is a comprehensive PCB design software that provides advanced routing and layout functions including copper pouring. Its copper pouring tool supports automatic and interactive copper pouring, and can handle multi-layer board design and complex electrical rule constraints. 2. Cadence Allegro: Cadence's Allegro series is one of the industry's leading EDA tools and is widely used in high-speed and high-density PCB design. It has powerful copper pouring functions and supports advanced features such as dynamic copper filling, pushing and avoiding to ensure signal integrity and power integrity. 3. Mentor Graphics PADS: PADS provides a complete set of PCB design solutions, and its copper pouring module can help engineers complete copper pouring tasks quickly and efficiently, optimize power distribution and signal quality. 4. EAGLE (Autodesk EAGLE): Autodesk EAGLE is a lightweight but full-featured PCB design software that is suitable for a variety of needs from small projects to complex designs. It has an intuitive copper pouring tool that allows users to control copper foil areas and set copper pouring parameters. 5. KiCad: KiCad is an open source PCB design software that provides a free alternative, and its copper pour function supports multiple modes, including flood fill and custom shape fill.
[0110] The steps of the technical solution of this application mainly include the following: 1. Data preprocessing: Perform a series of preprocessing operations on the input polygon data, including geometric element screening, polygon screening, line segment merging and arc splitting, in order to optimize the data structure and reduce the complexity of subsequent calculations. 2. Optimization of the order of operations: By splitting the polygon union result, performing difference operations on the main polygon and each polygon one by one, the order of operations is optimized, the number of edges in the intermediate results is reduced, and thus the calculation complexity is reduced. 3. Polygon Boolean operations: This includes intersection operations, that is, accelerating the screening and calculation of intersections through meshing and KD trees, including the intersection between straight segments and curves, using geometric methods to determine the intersection, and considering the entry and exit attributes of the intersection. Then perform contour processing, that is, use the edge bypass algorithm and entry and exit point attributes to generate the polygon contour after Boolean operations, whether it is a union or an intersection.
[0111] Summary of the algorithm steps: First, perform data preprocessing to remove unnecessary elements and optimize the data structure. Second, use the operation order optimization strategy to gradually perform difference operations to simplify the problem. Third, implement polygonal Boolean operations, including intersection, intersection attribute judgment, contour generation, etc. Finally, output the processed geometric results and provide a visual display. These steps are aimed at building an efficient solution engine that supports large-scale polygonal Boolean operations, especially in the field of PCB copper cladding algorithms, which can significantly improve computing efficiency and processing complexity.
[0112] The following is an introduction to each module:
[0113] 1) Based on a pair of polygon intersection algorithm
[0114] The polygon intersection algorithm is the first step of the entire algorithm process. Its purpose is to calculate the intersection information of the polygons that need to be Boolean operations in advance for use in the subsequent algorithm process. The intersection information of polygons is the basis and key to polygon Boolean operations. With the intersection information, we can more accurately determine the result area of various Boolean operations, and the calculation efficiency will be greatly improved. This has important application value in many graphics applications. Polygon intersection can be abstracted as the intersection of polylines and polylines, the intersection of polylines and curves, and the intersection of curves and curves.
[0115] 2) Edge finding algorithm based on a pair of polygons
[0116] The polygon edge algorithm is another important basis for performing polygon Boolean operations. It can help us accurately determine the relationship between the inner and outer areas of a polygon, improve calculation efficiency, and support more complex geometric shapes. With edge information, we can better understand the geometric relationship between polygons, thereby simplifying the logic of Boolean operations. For example, if a polygon is completely contained inside another polygon, the "difference" operation can directly obtain the result without complex calculations. The polygon edge algorithm is widely used in graphics CAD, GIS and other fields.
[0117] 3) Boolean operation decision making based on large-scale polygonal data sets
[0118] When performing Boolean operations on large polygonal data sets, a good operation decision is the key to improving the overall algorithm efficiency. From the perspective of Boolean union, different merging orders produce different intersection situations. There are two effects: 1: It affects the number of operations to solve the straight line equation. 2: The contour line and the intersection point affect the complexity of the edge algorithm. Therefore, in the algorithm, choosing a good operation decision is crucial.
[0119] The processing process of the technical solution of the present invention is described below. The overall processing process of the technical solution of the present invention includes three steps:
[0120] First, the data is preprocessed, and then a pair of polygons are taken out for Boolean operation each time, and the operation is continued with the next polygon after the result is obtained. Finally, the operation result is output.
[0121] For the convenience of description, the following conventions are made:
[0122] 1. The algorithm mainly uses three data structures: points, lines and polygons. The point structure can represent vertices, intersections or tracked intersections; the line structure can represent line segments and curves; the polygon structure satisfies the two conditions that edges intersect only at vertices and the boundaries are closed.
[0123] 2. Lines and polygons are usually represented by coordinate points. For example, line segment AB represents a line segment formed by connecting vertices A and B; polygon ABCD represents a line segment formed by connecting vertices AB, BC, CD, and DA, with vertices in counterclockwise order. For a large number of polygons, a single polygon can be simplified to "polygon A" or "polygon B".
[0124] Preprocessing
[0125] The preprocessing algorithm is used to preprocess the polygonal data elements related to all copper-clad areas on the printed circuit board to obtain data elements that meet the subsequent algorithms. Specifically, the preprocessing algorithm is divided into four steps:
[0126] (1) Geometric element screening
[0127] Filter the line segments or arcs in the input data and filter out the geometric elements whose length or arc length is lower than a certain threshold;
[0128] (2) Polygonal screening
[0129] Check the polygon elements in the input data and filter out small polygons whose area is lower than a preset threshold to exclude noise or irrelevant small faces;
[0130] (3) Line segment merging
[0131] Detect and merge line segments on the same straight line and in the same direction to reduce redundant data and optimize data structure;
[0132] (4) Arc Splitting
[0133] Split the arcs in the model, especially at the four extreme points of the arc, and divide it into multiple smaller arc segments.
[0134] Operation order optimization
[0135] The operation order optimization algorithm is used to simplify the solution of contour difference sets in polygon sets in printed circuit boards after preprocessing. Many polygons in the polygon set that do not constitute an influence can be regarded as being outside the polygons to be calculated. The step-by-step difference calculation of them can effectively simplify the intermediate results and optimize the polygon Boolean operation order. Specifically, the operation order optimization algorithm is divided into four steps:
[0136] 1. Input data definition
[0137] The input polygon data includes a main polygon A and a polygon union result B, which consists of n polygons B1, B2, ..., B n Perform union calculation to obtain;
[0138] 2. Split polygon union results
[0139] For the polygon union result B, it is not considered as a whole, but split into n polygons B1, B2, ..., B n ;
[0140] 3. Perform difference operations step by step
[0141] 1) Starting from the main polygon A, each polygon B1, B2, ..., B n Perform a difference operation. The result of each difference operation will update polygon A, that is:
[0142] A1=A-B1
[0143] A2=A1-B2
[0144] …
[0145] A n =A n-1 -B n
[0146] Among them, for polygon B located outside polygon A (no contact with each other), i , which has limited impact on the final result and will not lead to a significant increase in the number of edges in the intermediate results, thereby effectively reducing the computational complexity.
[0147] 2) After each operation, check the geometry of the result and record the number of edges.
[0148] 3) The optimization effect is as follows: The final polygon A n It can be considered that the original polygon A and the polygon union result B have polygons B that touch each other. i The solution is obtained by performing difference operations step by step.
[0149] 4. Output of calculation results
[0150] The final output includes the number of edges of the intermediate results, the polygon shape after each difference operation, and the final difference polygon generated.
[0151] Ask for intercourse
[0152] The intersection algorithm is used to calculate the intersection points between the edges of the polygons on the printed circuit board after preprocessing, and insert the intersection points into the polygon outline. Specifically, there are four steps to solve the intersection points between the edges of the polygons:
[0153] 1. Grid division
[0154] 1) First, set the bounding box of the intersection area and define the grid as G. Grid division is performed within the bounding box, and each grid unit is marked as G i,j , where i and j represent the row and column indices of the grid respectively.
[0155] 2) In order to improve query efficiency, a KD tree (K-Dimensional Tree) is used to store and manage grid cells. Each grid cell is used as a node of the KD tree to quickly find and locate the area where the polygon edge is located.
[0156] 3) For each edge of polygon BCDE and polygon FGHI, determine the grid cells it passes through and store the index of the edge in these grid cells.
[0157] 2. Filter intersecting line segments
[0158] 1) For each grid cell Gi,j , read the edge index stored in it, and find the grid cell that stores multiple edge indexes at the same time.
[0159] 2) Compare the edges in the same grid unit in pairs, read which line segments pass through the grid, quickly exclude line segments that are unlikely to intersect, and screen out line segments that are likely to intersect.
[0160] 3) For the selected line segments, calculate the intersection points between them and sort the intersection points in ascending order of coordinates.
[0161] 3. Determine the intersection attributes
[0162] 1) Assume that polygon BCDE and polygon FGHI have an intersection, and the intersection is formed by the intersection of two line segments CE and FI.
[0163] 2) Take the counterclockwise direction as the reference direction, and the vector of the CE segment at the intersection is The vector of the FI segment is By calculating the vector cross product The value of , and the property of the intersection point are determined based on its sign:
[0164] like Then the intersection point is the exit point;
[0165] like The intersection point is the entry point.
[0166] 4. Insert intersection
[0167] Insert the intersection points into the grid cells of the original polygon outline in the order of the intersection points.
[0168] Line segment intersection
[0169] The geometric method is used to find the intersection of straight line segments, which is mainly divided into the following three steps:
[0170] 1. Make a preliminary judgment on whether two line segments intersect. In order to determine whether two line segments meet the intersection conditions, two basic test methods are used: rapid repulsion test and straddle test.
[0171] 1) The purpose of the fast exclusion experiment is to quickly exclude non-intersection situations by detecting whether the bounding boxes of two line segments collide.
[0172] 2) If the rapid repulsion test is passed, the next step is to perform a straddle test to further determine whether the line segments intersect.
[0173] 3) The straddling experiment determines whether there is an intersection by judging the relative positions of the endpoints of two line segments on the other line segment.
[0174] 2. Based on the preliminary judgment that the two line segments may intersect, the intersection point is then solved. The calculation of the intersection point is based on the geometric method, and the exact location of the intersection point is determined by solving the definite ratio intersection theorem.
[0175] 1) Find the intersection point using the definite ratio point theorem:
[0176] Suppose that line segments NO and LM intersect at point P(x p ,y p ), then point P divides line segment NO into two segments and let their ratio be λ, that is,
[0177] Assume that the coordinates of N and O are (x1, y1) and (x2, y2), then the coordinates of point P (x p ,y p ) can be obtained from
[0178]
[0179] in,
[0180] Among them, the areas of ΔMNL and ΔMOL can be obtained by vector cross product.
[0181] 2) For overlapping line segments, it is considered that they have no intersection.
[0182] 3. Determine whether the intersection point is on the line segment. After the intersection point is calculated using the definite ratio intersection theorem, it is necessary to further determine whether the intersection point is within the valid range of the two line segments, using vector cross product to make the determination.
[0183] Given a point M and a line segment KL, where K and L are the first and last endpoints of the line segment, to determine whether point M is on line segment KL, the following two conditions must be met:
[0184] KM×KL=0
[0185] M∈K, L is a rectangle with diagonal vertices
[0186] Among them, the intersection point through step 1 naturally satisfies the second condition.
[0187] Intersection involving curves:
[0188] Curve intersection mainly involves two types: arc-arc intersection and arc-line segment intersection. The following describes their solution steps respectively:
[0189] 1. Find the intersection of arcs
[0190] 1) It is known that two arcs intersect with circles of different radii r1 and r2. Assume that the centers of the circles are A(x A ,y A ) and C(x C,y C ), the two arcs intersect at points E and F;
[0191] 2) Two centers of the circle A(x A ,y A ) and C(x C ,y C ), the distance between the two circle centers can be obtained by the distance formula:
[0192]
[0193] 3) Apply the law of cosines to find the angle. In ΔAFC, use the law of cosines to determine cosα, where α is the angle between AC and AF.
[0194] 4) Solve for the length of line segment AG. Using the known center distance r1 and angle α, we can calculate l AG = l r1 ·cosα;
[0195] 5) Solve for point G(x G ,y G ). Through the geometric relationship of the triangle, the coordinates of point G can be determined as:
[0196]
[0197] 6) Rotate to find the intersection points E and F. With point G as the center, rotate 90° clockwise and counterclockwise along the GA direction to obtain the coordinates of the two intersection points E and F.
[0198] 2. Find the intersection point between a line segment and an arc
[0199] 1) Given a line segment MN and a circle with center A(x A ,y A ), the arc with radius r intersects. The formula of the straight line is ax+by+c=0, and the normal vector of the straight line is:
[0200] Find the coordinates of point G. Let point G(x G ,y G ) is the center of the circle A(x A ,y A ) is perpendicular to the line ax+by+c=0 on which the line segment MN lies, then the coordinates of point G satisfy the following formula:
[0201]
[0202] 2) Rotate to find the intersection points E and F. With point G as the center, rotate 90 degrees clockwise and counterclockwise along the GA direction to obtain the coordinates of the two intersection points E and F.
[0203] 3) Use vector cross product to determine whether the intersection points E and F are on line segment MN.
[0204] 3. Find the edge
[0205] The main idea of the edge-finding algorithm is to process all the areas on the printed circuit board that need to be copper-clad and find the maximum contour; through the edge-circuiting algorithm and the entry and exit point attributes of the intersection itself, the Boolean algorithm is used to find the union and intersection of the copper-clad polygonal areas to obtain the corresponding contour.
[0206] 1. Basic concept definition
[0207] 1) For two polygons ABCDE and FGHIJ that need to be subjected to Boolean operations, the intersection points of the edges of the two polygons are calculated, and the intersection points are the points where the edges of the polygons intersect.
[0208] 2) Set the entry and exit point attributes of the intersection. Take the counterclockwise direction as the reference direction, and the vector of line segment 1 at the intersection is The vector of line segment 2 is By calculating the vector cross product The value of , and the property of the intersection point are determined based on its sign:
[0209] like Then the intersection point is the exit point;
[0210] like The intersection point is the entry point.
[0211] 2.1 Detailed steps for finding the union in the edge-circling algorithm:
[0212] 1) Select an exit point as the initial point. From polygon ABCDE, select an exit point that has never been visited and mark it as the starting point S.
[0213] 2) Switch polygons. Switch from the exit point of polygon ABCDE to polygon FGHIJ, take the clockwise direction as the reference direction, and continue to traverse forward along the edge of FGHIJ.
[0214] 3) Find the next entry point: Walk along the edge of polygon FGHIJ until the next entry point is found.
[0215] 4) Switch polygon: Once the entry point is found, switch back to polygon ABCDE, take the clockwise direction as the reference direction, and continue to traverse forward along the edge of polygon ABCDE.
[0216] 5) Find the next exit point: Walk along the edge of polygon ABCDE until you find the next exit point.
[0217] 6) Repeat the above steps (2)-(5) until the path returns to the initial exit point S.
[0218] 7) Mark visited points: Each time you pass an intersection (entry point or exit point), mark it as visited to avoid duplication.
[0219] 8) Determine whether there are any unvisited exit points: If there are any unvisited exit points, select the next exit point as the new starting point and repeat the above steps (1)-(7) until all exit points are visited.
[0220] Detailed steps for finding the intersection in the edge-circling algorithm:
[0221] 1) Select an entry point as the initial point. From the polygon ABCDE, select an entry point that has never been visited and mark it as the starting point S.
[0222] 2) Switch polygons. Switch from the entry point of polygon ABCDE to polygon FGHIJ, take the clockwise direction as the reference direction, and continue to traverse forward along the edge of FGHIJ.
[0223] 3) Find the next exit point: Walk along the edge of polygon FGHIJ until the next exit point is found.
[0224] 4) Switch polygon: Once the exit point is found, switch back to polygon ABCDE, take the clockwise direction as the reference direction, and continue traversing forward along the edge of ABCDE.
[0225] 5) Find the next entry point: Walk along the edge of polygon ABCDE until you find the next entry point.
[0226] 6) Repeat the above steps (2)-(5) until the path returns to the initial entry point S.
[0227] 7) Mark visited points: Each time you pass an intersection (entry point or exit point), mark it as visited to avoid duplication.
[0228] 8) Determine whether there are any unvisited entry points: If there are any unvisited entry points, select the next entry point as the new starting point and repeat the above steps (1)-(7) until all entry points are visited.
[0229] Final outline generation
[0230] Through the above steps, the algorithm can obtain a closed path, which is the complete outline after the polygons are merged.
[0231] Algorithm steps
[0232] 1. Data preprocessing
[0233] (1) Geometric element screening
[0234] Filter the line segments or arcs in the input data and filter out the geometric elements whose length or arc length is lower than a certain threshold;
[0235] (2) Polygonal screening
[0236] Check the polygon elements in the input data and filter out small polygons whose area is lower than a preset threshold to exclude noise or irrelevant small faces;
[0237] (3) Line segment merging
[0238] Detect and merge line segments on the same straight line and in the same direction to reduce redundant data and optimize data structure;
[0239] (4) Arc Splitting
[0240] Split the arcs in the model, especially at the four extreme points of the arcs, and divide them into multiple smaller arc segments.
[0241] 2. Optimize the order of operations
[0242] (1) Split polygon union result
[0243] Split the polygon and treat it as a set of multiple polygons formed by the union operation instead of a whole.
[0244] (2) Perform difference operations step by step
[0245] According to the aforementioned optimization algorithm, starting from the main polygon, the difference calculation is performed on each polygon in the polygon set in turn to prevent the number of edges from growing rapidly during the calculation process, reduce redundant calculations, and reduce calculation complexity.
[0246] 3. Polygon Boolean operations
[0247] (1) Intersection processing
[0248] (1.1) Quickly filter intersection points
[0249] By meshing and storing and managing grid units in KD trees, efficient positioning of polygon boundaries and intersection calculation are achieved. Edges in the same grid unit are compared pairwise to filter out possible intersecting line segments.
[0250] (1.2) Calculation of intersection points of straight line segments
[0251] To find the intersection points of straight line segments, geometric methods are applied to determine whether the line segments intersect through a two-step method of rapid repulsion experiment and straddle experiment. After the preliminary judgment is passed, the intersection point is found through the constant ratio intersection theorem, and it is determined whether the intersection point is on the line segment.
[0252] (1.3) Calculation of curve intersection points
[0253] For the intersection of arcs and arcs, or arcs and straight lines, geometric methods are applied to calculate the position of the intersection by solving the coordinates of the perpendicular point from the center of the circle to the straight line where the intersection is located. At the same time, the intersection is ensured to be on the curve, ensuring the accuracy of the algorithm when dealing with complex shapes.
[0254] (2) Contour processing
[0255] (2.1) Intersection attribute judgment
[0256] The entry and exit point attributes of the intersection are determined by the cross product positive and negative judgment method, and the possible vertex overlap and edge overlap problems are handled by the algorithm;
[0257] (2.2) Complete contour generation
[0258] The edge-circling algorithm is used, combined with the entry and exit point strategy, to generate a complete contour line by traversing the intersection points and boundaries, which is suitable for union and intersection operations.
[0259] (3) Nested processing
[0260] Identify the intersection areas among multiple polygons, and nest smaller intersection areas within larger areas through a hierarchical nesting method to build a tree structure. Use a recursive algorithm to gradually process and merge each level from the inside out.
[0261] (4) Circular Boolean Operations
[0262] According to step 2 of the algorithm, the operation order of the polygon is optimized, and the above processing methods (1), (2), and (3) are repeated for the polygon data until all the data are processed, so as to realize the Boolean operation of the polygon data and generate the copper coating result.
[0263] 4. Data Output
[0264] (1) Formatted output
[0265] Format and output the geometric results after Boolean operation according to the predetermined protocol structure;
[0266] (2) Results visualization
[0267] Provides a visual display of output results to help identify any potential problems and facilitate user inspection and verification.
[0268] The copper cladding results specifically include: 1. Polygon Boolean operation results: After efficient intersection, union, and difference operations, the new polygon outline is obtained. This includes the union, intersection, or difference calculation results of all areas on the circuit board that need copper cladding, which is used to accurately define the actual copper cladding coverage. 2. Contour line generation: Continuous lines that can accurately describe the boundaries of the copper cladding area determined by the edge algorithm. This includes processing the complex contours generated by the intersection of polygons to ensure that the generated boundaries are both accurate and meet manufacturing requirements. 3. Operation optimization output: During the operation process, unnecessary calculations are reduced by optimizing the order of operations, making the final result not only accurate but also efficient. The output includes the edge count of the intermediate operation, the polygon shape after each step of the difference operation, and the final difference polygon, which helps to understand and verify the calculation process. 4. Data structure and formatted output: The processed data is encapsulated in an efficient data structure for easy use in subsequent manufacturing or analysis processes. At the same time, the results can be formatted and output according to a specific protocol to improve compatibility with other systems or tools. 5. Visual display: Provides intuitive visual display, allowing users to check and verify the correctness of the copper-clad area to ensure that the design meets the expected requirements. This includes a graphical representation of polygonal areas and a clear display of possible nested or multi-layer structures. In summary, the copper-clad result is a data set that combines precise geometry, efficient algorithm processing, and easy-to-verify features, directly guiding the copper foil laying process in PCB manufacturing.
[0269] The technical solution of the present application realizes efficient Boolean operations on large-scale polygonal data sets, including intersection, union and difference operations, and significantly improves the computational efficiency in the copper-cladding algorithm of printed circuit boards (PCBs). The technical solution can process data sets containing millions of line segments in a short time through a series of innovative algorithm processes, such as preprocessing, optimization of the order of operations, efficient intersection algorithms, and edge algorithms. This not only reduces the calculation time, but also maintains high accuracy of the calculation, ensuring the accurate generation of copper-clad areas. The final output is the geometric result after Boolean operation processing. These results can be directly applied to the copper-clad process in PCB design to improve the quality and efficiency of auxiliary design. In addition, the technical solution also includes formatted output and visual display of the calculation results to facilitate user inspection and verification.
[0270] This technical solution significantly improves performance and computing efficiency through the following points: The efficient solution engine for large-scale polygonal Boolean operations: It realizes support for polygon intersection, union and difference operations, and especially optimizes the ability to process large-scale data sets, and can complete operations in hundreds of seconds at the scale of millions of line segments. Preprocessing algorithm: It includes steps such as geometric element screening, polygon screening, line segment merging and arc splitting, which effectively reduces the computing burden, optimizes the data structure, and lays a good foundation for subsequent operations. Operation order optimization algorithm: By identifying and prioritizing polygon operations that have a greater impact on the results, unnecessary calculations are avoided, the complexity of intermediate results is reduced, and the operation process is further accelerated. Improvement of edge-finding algorithm: Through the edge-circling algorithm and entry and exit point attribute judgment, the contour after Boolean operation is accurately generated, which is applicable to both union and intersection operations, ensuring the accuracy of the results and algorithm efficiency. In summary, this technical solution significantly improves the processing speed and quality of large-scale polygonal Boolean operations in the field of PCB auxiliary design through a series of innovative algorithms and technical means, solves the problem of low efficiency in the existing technology, and meets the needs of complex circuit board design for high-efficiency and high-quality copper-clad algorithms.
[0271] Those skilled in the art can understand that the accompanying drawings are only schematic diagrams of an embodiment, and the modules or processes in the accompanying drawings are not necessarily required to implement the present invention.
[0272] Those skilled in the art can understand that the modules in the device in the embodiment can be distributed in the device in the embodiment according to the description of the embodiment, or can be changed accordingly and located in one or more devices different from the embodiment. The modules in the above embodiment can be combined into one module, or can be further divided into multiple sub-modules.
[0273] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A printed circuit board copper cladding method based on large-scale polygonal Boolean operation solution, characterized in that: include: Step S1, preprocessing, is used to preprocess the polygon data elements related to all copper-clad areas on the printed circuit board to obtain data elements that meet the subsequent algorithms, specifically including: S11. Geometric element screening: Screen the line segments or arcs in the input data and filter out the geometric elements whose length or arc length is lower than a certain threshold; S12, polygon screening: check the polygon elements in the input data, filter out polygons with an area lower than a preset threshold, so as to exclude noise or irrelevant small patches; S13, line segment merging: detect and merge line segments on the same straight line and in the same direction; S14, arc splitting: splitting the arc in the model to obtain multiple smaller arc segments; the polygon data element is used to represent the copper-clad area boundary on the circuit board, and is used to define different conductive areas; Step S2, operation sequence optimization, is used to simplify solving the contour difference set in the polygon set in the pre-processed printed circuit board. In the face of many polygons in the polygon set that do not constitute an influence, they can be regarded as being outside the polygon to be calculated. The difference set calculation will be performed step by step to effectively simplify the intermediate results and optimize the polygon Boolean operation sequence, which specifically includes: Step S21, input data definition, specifically including: the input polygon data includes a main polygon A and a polygon union result B, B is composed of n polygons B1, B2, ..., B n Perform union calculation to obtain; Step S22, splitting the polygon union result, specifically comprising: for the polygon union result B, not treating it as a whole, but splitting it into n polygons B1, B2, ..., B n ; Step S23, gradually perform the difference operation, specifically including: starting from the main polygon A, sequentially perform the difference operation on each polygon B1, B2, ..., B n Perform a difference operation; the result of each difference operation will update polygon A, that is: A1=A-B1 A2=A1-B2 … A n =A n-1 -B n After each operation, the geometric shape of the result is checked and the number of edges is recorded; the operation optimization effect is shown as follows: the final polygon A n It can be considered that the original polygon A and the polygon union result B have polygons B that touch each other. i The solution is obtained by performing difference operations step by step; Among them, it involves an intersection algorithm, which is used to calculate the intersection points between the edges of the polygons on the printed circuit board after preprocessing, and insert the intersection points into the polygon outline; specifically, solving the intersection points between the edges of the polygons is divided into four steps: Step 1: Grid division, including: Step 11: First, set the bounding box of the intersection area and define the grid as G. Then, divide the grid within the bounding box and mark each grid unit as G. i,j , where i and j represent the row and column indices of the grid respectively; Step 12: In order to improve query efficiency, a KD tree is used to store and manage grid cells; each grid cell is used as a node of the KD tree to quickly find and locate the area where the polygon edge is located; Step 13: For each edge of polygon BCDE and polygon FGHI, determine the grid cells it passes through, and store the index of the edge in these grid cells; Step 2: Filter intersecting line segments, including: Step 21: For each grid cell G i,j , read the edge index stored therein, and find the grid cell that stores multiple edge indexes at the same time; Step 22: compare the edges in the same grid unit in pairs, read which line segments pass through the grid, quickly exclude line segments that are unlikely to intersect, and select line segments that are likely to intersect; Step 23: For the selected line segments, calculate the intersection points between them, and sort the intersection points in ascending order of coordinates; Step 3: Determine the intersection attributes, including: Step 31, assume that polygon BCDE and polygon FGHI have an intersection, and the intersection is formed by the intersection of two line segments CE and FI; Step 32: Take the counterclockwise direction as the reference direction, and the vector of the CE segment at the intersection is The vector of the FI segment is By calculating the vector cross product The value of , and the attribute of the intersection point are determined according to its sign: like Then the intersection point is the exit point; like Then the intersection point is the entry point; Step 4, inserting the intersection points, specifically comprising: inserting the intersection points into the grid cells of the original polygonal outline according to the order of the intersection points; The intersection of straight line segments includes the following: The intersection of straight line segments is obtained by geometric method, which is divided into the following three steps: Step 41, make a preliminary judgment on whether the two line segments intersect. In order to determine whether the two line segments meet the intersection condition, two basic test methods are used: a fast repulsion test and a straddle test. The purpose of the fast repulsion test is to quickly exclude the non-intersection situation by detecting whether the bounding boxes of the two line segments collide. If the fast repulsion test is passed, the next step is to perform a straddle test to further determine whether the line segments intersect. The straddle test determines whether there is an intersection by judging the relative positions of the endpoints of the two line segments on the other line segment. Step 42: After initially determining that the two line segments may intersect, the intersection point is then determined. The point calculation is based on a geometric method, and the exact location of the intersection point is determined by solving the definite ratio intersection theorem, which specifically includes: Step 421, find the intersection point using the ratio-point theorem: Suppose that line segments NO and LM intersect at point P(x p ,y p ), then point P divides line segment NO into two segments and let their ratio be λ, that is, Assume that the coordinates of N and O are (x1, y1) and (x2, y2), then the coordinates of point P (x p ,y p ) can be obtained from in, Among them, the areas of ΔMNL and ΔMOL can be obtained by vector cross product; Step 422: For the overlapping line segments, it is considered that they have no intersection; Step 423, determine whether the intersection point is on the line segment. After calculating the intersection point by using the fixed ratio point theorem, it is necessary to further determine whether the intersection point is within the valid range of the two line segments. The determination is made by using vector cross product. Given a point M and a line segment KL, where K and L are the first and last endpoints of the line segment, to determine whether point M is on line segment KL, the following two conditions must be met: Condition (1): KM × KL = 0 Condition (2): M∈K, L is a rectangle with diagonal vertices Wherein, the intersection point passing through step 421 satisfies condition (2); The following contents are included for curve intersection: Curve intersection mainly involves arc-arc intersection and arc-line segment intersection. Their solution steps are described respectively: Among them, finding the intersection point of arcs includes: (1) Given two arcs intersecting at different radii r1 and r2, suppose the centers of the circles are A(x A ,y A ) and C(x C ,y C ), the two arcs intersect at points E and F; (2) Given two centers A(x A ,y A ) and C(x C ,y C ), the distance between the two circle centers can be obtained by the distance formula: (3) Apply the law of cosines to find the angle. In ΔAFC, use the law of cosines to determine cosα, where α is the angle between AC and AF. (4) Solve for the length of line segment AG. Given the known center distance r1 and angle α, we can calculate l AG = l r1 ·cosα; (5) Solve the point G(x G ,y G ) through the geometric relationship of the triangle, the coordinates of point G can be determined as: (6) Rotate to solve the intersection points E and F. With point G as the center, rotate 90° clockwise and counterclockwise along the GA direction to obtain the coordinates of the two intersection points E and F; Find the intersection point between a line segment and an arc, including: (1) Given that the line segment MN and the center of the circle are A(x A ,y A ), the arc with radius r intersects, the line formula is ax+by+c=0, the normal vector of the line is: (2) Solve for the coordinates of point G, point G(x G ,y G ) is the center of the circle A(x A ,y A ) is perpendicular to the line ax+by+c=0 on which the line segment MN lies, then the coordinates of point G satisfy the following formula: (3) Rotate to find the intersection points E and F. With point G as the center, rotate 90° clockwise and counterclockwise along the GA direction. Thus, the coordinates of the two intersection points E and F are obtained; (4) Use vector cross product to determine whether the intersection points E and F are on the line segment MN; Finding edges: The main idea of the edge finding algorithm is to process all the areas that need to be copper-clad on the printed circuit board and find the maximum contour; through the edge-circling algorithm and the entry and exit point attributes of the intersection point itself, the Boolean algorithm is used to find the union and intersection of the copper-clad polygonal areas to obtain the corresponding contour; Basic concept definition: (1) For the two polygons ABCDE and FGHIJ that need to be Boolean-operated, the intersection points of the two polygons are calculated. The intersection points are the points where the edges of the polygons intersect. (2) Set the entry and exit point attributes of the intersection; the counterclockwise direction is the reference direction, and the vector of line segment 1 at the intersection is The vector of line segment 2 is By calculating the vector cross product The value of , and the attribute of the intersection point are determined according to its sign: like Then the intersection point is the exit point; like Then the intersection point is the entry point; The detailed steps of finding the union in the edge-circling algorithm are as follows: (1) Select an exit point as the initial point. From polygon ABCDE, select an exit point that has never been visited and mark it as the starting point S. (2) Switch polygon: Switch from the exit point of polygon ABCDE to polygon FGHIJ, take the clockwise direction as the reference direction, and continue to traverse forward along the edge of FGHIJ; (3) Find the next entry point: Walk along the edge of polygon FGHIJ until the next entry point is found; (4) Switch polygon: Once the entry point is found, switch back to polygon ABCDE, take the clockwise direction as the reference direction, and continue to traverse forward along the edge of polygon ABCDE; (5) Find the next exit point: Walk along the edge of polygon ABCDE until the next exit point is found; (6) Repeat the above steps (2)-(5) until the path returns to the initial exit point S; (7) Mark visited points: Each time you pass an intersection, mark it as visited to avoid duplication; (8) Determine whether there are any unvisited exit points: If there are any unvisited exit points, select the next exit point as the new starting point and repeat the above steps (1)-(7) until all exit points have been visited; Among them, the detailed steps of finding the intersection in the edge-circling algorithm are as follows: (1) Select an entry point as the initial point. From the polygon ABCDE, select an entry point that has never been visited and mark it as the starting point S. (2) Switch polygon: Switch from the entry point of polygon ABCDE to polygon FGHIJ, take the clockwise direction as the reference direction, and continue to traverse forward along the edge of FGHIJ; (3) Find the next exit point: Walk along the edge of polygon FGHIJ until the next exit point is found; (4) Switch polygon: Once the exit point is found, switch back to polygon ABCDE, take the clockwise direction as the reference direction, and continue to traverse forward along the edge of ABCDE; (5) Find the next entry point: Walk along the edge of polygon ABCDE until the next entry point is found; (6) Repeat the above steps (2)-(5) until the path returns to the initial entry point S; (7) Mark visited points: Each time you pass an intersection, mark it as visited to avoid duplication; (8) Determine whether there are any unvisited entry points: If there are any unvisited entry points, select the next entry point as the new starting point and repeat the above steps (1)-(7) until all entry points have been visited; Final contour generation; Through the above steps, the algorithm can obtain a closed path, which is the complete outline after the polygons are merged.
Citation Information
Cited By
Wiring shape construction and orientation determination method and related equipment
CN119578351A
Method and device for calculating geometric union set of printed circuit board
CN119830845A
Polygon Boolean operation method based on GPU acceleration
CN122047149A