Method for selfing detection and decomposition of polygon with arc in computer-aided manufacturing
By using computer-aided manufacturing methods, the self-intersecting regions of complex polygons can be automatically detected and decomposed, solving the problem of limited self-intersecting capabilities of complex polygons in traditional methods. This achieves efficient and accurate polygon decomposition, which is suitable for PCB manufacturing.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-25
- Publication Date
- 2026-03-27
AI Technical Summary
In the PCB manufacturing process, traditional methods are difficult to effectively handle the self-intersection problem of complex polygons containing arcs, resulting in invalid geometry.
An efficient computer-aided manufacturing method is adopted, which automatically identifies and decomposes the self-intersecting regions of complex polygons through steps such as object transformation and preprocessing, self-intersection detection and intersection calculation, self-intersection processing and path reconstruction, and object endpoint updating, while maintaining the original geometric properties of lines and arcs.
It achieves efficient self-intersection detection and decomposition of complex polygons, ensuring that the processed data meets CAM manufacturing requirements, maintaining geometric accuracy and memory efficiency, and is suitable for various polygon data in PCB manufacturing.
Smart Images

Figure CN121745007A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of PCB manufacturing industry, and particularly relates to a method for self-intersection detection and decomposition of polygons with arcs in computer-aided manufacturing. BACKGROUND
[0002] In the process of PCB manufacturing, when performing geometric operations (such as equidistant scaling and offsetting) on polygons, the polygons may be self-intersected due to the movement of vertices, resulting in invalid geometric shapes. Traditional self-intersection processing methods are usually only applicable to simple polygons, and have limited processing capability for complex polygons containing arcs. SUMMARY
[0003] To solve the above technical problems, one technical solution adopted by the present application is: an efficient and accurate method for self-intersection detection and decomposition of polygons with arcs in computer-aided manufacturing, comprising the following steps:
[0004] 1. Object conversion and preprocessing:
[0005] 1.1. Convert the set of polygon object elements read into a unified edge object representation;
[0006] 1.2. Establish a bidirectional mapping relationship between the edge object and the original object;
[0007] 1.3. Detect the vertex order direction of the original polygon, and adjust all edge objects to a unified clockwise direction. For the arc objects with opposite directions, record their reverse state;
[0008] 2. Self-intersection detection and intersection point calculation:
[0009] 2.1. Traverse all edge objects to calculate whether the vertex of each edge object is a concave point, and identify all concave arcs (counterclockwise arcs). Mark the adjacent edges and concave arcs of the identified concave points as potential self-intersecting edges;
[0010] 2.2. Calculate the exact intersection point between each pair of potential self-intersecting edges;
[0011] 2.3. Sort the calculated intersection points according to their distance from the starting point of the edge;
[0012] 3. Self-intersection processing and path reconstruction:
[0013] 3.1. Re-combine all edge objects and their intersection points according to the polygon vertex order to construct a complete polygon point set containing all original vertices and intersection points;
[0014] 3.2. Input the complete polygon point set, call the self-intersection simplification function of the geometry library for processing, set the negative filling rule, the processing automatically identifies the self-intersection region, and decomposes the original polygon into multiple closed paths without self-intersection, and the processing result ensures that all output paths are in the clockwise direction;
[0015] 4. Object endpoint update: according to the decomposed closed path, find the original object corresponding to each path segment through the mapping relationship of the edge object to the object, and update the geometric properties of the object according to the start point and end point of the new path;
[0016] 5. Processing result output: compare the original object set with the object set still used after processing, identify the objects that no longer belong to any valid path due to self-intersection decomposition, update the original object according to the processing result, and delete the invalid objects removed due to self-intersection.
[0017] In a preferred embodiment of the present application, the object elements include straight line objects and circular arc objects, corresponding edge objects are created according to the type of the object elements, and the start point, end point, type identifier, and geometric bounding box information are set for each edge object.
[0018] In a preferred embodiment of the present application, in step 1.2, establishing a bidirectional mapping relationship between the edge object and the original object includes the following steps:
[0019] 1.2.1 Create a mapping table of edge objects to object objects;
[0020] 1.2.2 Record the direction reversal information of the circular arc object;
[0021] 1.2.3 Maintain the state information of the object.
[0022] In a preferred embodiment of the present application, in step 2.1, detecting concave points and concave circular arcs includes the following steps:
[0023] 2.1.1 Calculate the cross product of the adjacent edges to judge the concave-convex;
[0024] 2.1.2 Identify whether the direction of the circular arc object is concave;
[0025] 2.1.3 Use the bounding box to accelerate the detection process.
[0026] In a preferred embodiment of the present application, in step 2.2, before calculating the exact intersection point between each pair of potential self-intersecting edges, it further includes the step of quickly excluding the edge pairs that are not likely to intersect through bounding box overlap detection.
[0027] In a preferred embodiment of the present application, in step 2.2, calculating the exact intersection point between each pair of potential self-intersecting edges includes the following steps:
[0028] 2.2.1 Exclude the intersection point calculation of adjacent edge pairs;
[0029] 2.2.2 Calculate the intersection point for line-line, line-arc, arc-arc respectively;
[0030] 2.2.3 Sort the intersection points on the edge object according to the distance from the starting point.
[0031] In a preferred embodiment of the present application, the self-intersection processing further comprises the steps of constructing a complete path containing all vertices and intersection points and processing self-intersection using the SimplifyPolygon function of the Clipper library.
[0032] In a preferred embodiment of the present application, it further comprises the steps of updating the end points of the line object and the arc object according to the new path, and deleting the objects that are determined to be invalid due to self-intersection.
[0033] In another embodiment, a computer readable storage medium is provided, which stores program instructions, the program instructions being executed by a processor to implement the self-intersection detection and decomposition method of the arc polygon.
[0034] In another embodiment, a CAM system is provided, which comprises a processor and a memory, the memory storing program instructions, and the processor being configured to execute the program instructions to implement the self-intersection detection and decomposition method of the arc polygon.
[0035] The beneficial effects of the present application are: the self-intersection detection and decomposition method of the arc polygon in computer-aided manufacturing provided by the present application can automatically identify the self-intersection area, intelligently decompose it into multiple effective closed paths, and maintain the geometric properties of the original objects (lines and arcs), ensuring that the processed data meets the requirements of CAM manufacturing. BRIEF DESCRIPTION OF DRAWINGS
[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application:
[0037] Figure 1 is a flowchart of the self-intersection detection and decomposition method of the arc polygon in computer-aided manufacturing of the present application;
[0038] Figure 2 is a schematic diagram of the polygon in the object conversion and preprocessing step in the present application after being shrunk by a certain value;
[0039] Figure 3 is a schematic diagram of the intersection point calculation result in the self-intersection detection and intersection point calculation step in the present application;
[0040] Figure 4is the schematic diagram in the path reconstruction and object endpoint updating steps in the present application;
[0041] Figure 5 is the schematic diagram of the area reserved after processing by the Clipper library in the present application;
[0042] Figure 6 is the schematic diagram of updating the original object endpoint and deleting invalid objects in the present application. DETAILED DESCRIPTION
[0043] The technical solutions in the embodiments of the present application will be described clearly and completely below. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the protection scope of the present application.
[0044] Please refer to Figure 1 The embodiments of the present application disclose a self-intersection detection and decomposition method for arc polygon in computer-aided manufacturing, comprising the following steps:
[0045] 1. Object conversion and preprocessing (such as Figure 2 as shown, the green polygon is shrunk by a certain value to become a red polygon):
[0046] 1.1. Object uniformization processing: converting the set of read polygon object elements into uniform edge object representation, wherein the object elements include straight line objects and circular arc objects, creating corresponding edge objects according to the object element types, and setting the start point, end point, type identifier and geometric bounding box information for each edge object;
[0047] 1.2. Establishing a mapping relationship: in the conversion process, a bidirectional mapping relationship between the edge objects and the original objects is established, the mapping table is used for fast lookup of the original objects corresponding to the edge objects in subsequent processing, and it is ensured that the geometric processing result can be correctly written back to the original data structure;
[0048] 1.3. Direction standardization processing: detecting the vertex sequence direction (clockwise or counterclockwise) of the original polygon, and adjusting all edge objects to a uniform clockwise direction, and for the circular arc objects with opposite directions, recording their reverse state so as to be correctly restored in subsequent processing.
[0049] 2. Self-intersection detection and intersection point calculation (such as Figure 3 as shown, the intersection point is calculated):
[0050] 2.1. Concave point and concave arc recognition: traverse all edge objects, calculate whether each edge object's vertex is a concave point through vector cross product, and identify all concave arcs (counterclockwise arcs) at the same time, mark the adjacent edges and concave arcs of the identified concave points as potential self-intersecting edges, as the basis for subsequent intersection point calculation;
[0051] 2.2. Calculate the exact intersection points between each pair of potential self-intersecting edges. Before calculating the exact intersection points between each pair of potential self-intersecting edges, quickly exclude the pairs of edges that are not likely to intersect through bounding box overlap detection, greatly improving the calculation efficiency;
[0052] 2.3. Sort the calculated intersection points according to their distance from the start point of the edge, exclude the intersection point calculation of adjacent edge pairs, and calculate the intersection point coordinates according to the edge type combination (straight line-straight line, straight line-arc, arc-arc) respectively using the corresponding geometric algorithm;
[0053] 2.4. Sort the intersection points on the edge object according to their distance from the start point. For straight line edges, sort by Euclidean distance; for arc edges, sort by the central angle, and consider the clockwise / counterclockwise direction and whether the angle boundary is crossed.
[0054] 3. Self-intersection processing and path reconstruction (as shown in Figures 4-6 , the remaining objects after deleting invalid objects are the Figure 6 red line outline parts):
[0055] 3.1. Re-combine all edge objects and their intersection points according to the original vertex order of the polygon, construct a complete polygon point set containing all original vertices and intersection points, to ensure the correct order of the point set and provide input data for subsequent self-intersection processing;
[0056] 3.2. Input the complete polygon point set, use the self-intersection simplification function of the geometric library, set the negative fill rule, this processing automatically identifies the self-intersecting area and decomposes the original polygon into multiple closed paths without self-intersection, the processing result ensures that all output paths are in the clockwise direction.
[0057] 4. Object endpoint update: according to the decomposed closed path, find the original object corresponding to each path segment through the mapping relationship between edge objects and objects, and update the geometric properties of the object according to the start and end points of the new path. For arc objects, special processing is also needed to consider the direction reversal. Update the endpoints of straight line objects and arc objects according to the new path.
[0058] 5. Processing result output: compare the original object set with the object set still used after processing, identify the objects that no longer belong to any valid path due to self-intersection decomposition, remove these invalid objects from the object set and release the related resources, return the updated object set containing all valid objects after self-intersection processing, and output data in the original data format, which can be directly used for subsequent manufacturing processes or further geometric operations.
[0059] Specifically, establishing a bidirectional mapping relationship between the edge object and the original object includes the following steps:
[0060] S1, create a mapping table of edge objects to object objects;
[0061] S2, record the direction reversal information of the circular arc object;
[0062] S3, maintain the state information of the object.
[0063] Specifically, detecting concave points and concave circular arcs includes the following steps:
[0064] S1, calculate the vector cross product of adjacent edges to determine concave and convex;
[0065] S2, identify whether the direction of the circular arc object is concave;
[0066] S3, use the bounding box to accelerate the detection process.
[0067] In another embodiment, a computer-readable storage medium is provided, which stores program instructions, the program instructions being executed by a processor to implement the self-intersection detection and decomposition method of the arc polygon.
[0068] In another embodiment, a CAM system is provided, including a processor and a memory, the memory storing program instructions, and the processor being configured to execute the program instructions to implement the self-intersection detection and decomposition method of the arc polygon.
[0069] In summary, the self-intersection detection and decomposition method of the arc polygon in computer-aided manufacturing has the following advantages:
[0070] (1) Efficient self-intersection processing: automatically detects and decomposes the self-intersection area of complex polygons containing straight lines and circular arcs;
[0071] (2) Geometric property preservation: preserves the original geometric properties of straight lines and circular arcs, supporting accurate manufacturing;
[0072] (3) High-precision calculation: uses bounding box pre-screening and precise geometric calculation to ensure accurate intersection point calculation;
[0073] (4) High memory efficiency: uses mapping table and set to manage object relationships, reducing memory usage;
[0074] (5) Strong adaptability: applicable to various polygon data in PCB layout, and supporting complex geometric operations.
[0075] The above only describes the embodiments of the present application, and does not limit the patent scope of the present application, and any equivalent structure or equivalent process transformation using the content of the present application specification, or direct or indirect application in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A method for detecting and decomposing self-intersections of curved polygons in computer-aided manufacturing, characterized by comprising the following steps:
1. Object conversion and preprocessing: 1.
1. Convert the collection of read polygonal object elements into a unified edge object representation; 1.
2. Establish a two-way mapping relationship between the edge object and the original object; 1.
3. Detect the vertex order direction of the original polygon and adjust all edge objects to a uniform clockwise direction. For arc objects with opposite directions, record their reverse state.
2. Self-intersection detection and intersection calculation: 2.
1. Traverse all edge objects, calculate and determine whether the vertex of each edge object is a concave point, and identify all concave arcs. Mark the adjacent edges and concave arcs of the identified concave points as potential self-intersecting edges. 2.
2. Calculate the exact intersection point between each pair of potential self-intersecting edges; 2.
3. Sort the calculated intersection points according to their distance from the starting point of the edge; 3. Self-intersection processing and path reconstruction: 3.
1. Reassemble all edge objects and their intersections according to the order of polygon vertices to construct a complete polygon point set containing all original vertices and intersections; 3.
2. Input a complete polygon point set, process it using the self-intersection simplification function of the geometry library, set a negative fill rule, this process automatically identifies self-intersecting regions and decomposes the original polygon into multiple non-self-intersecting closed paths, the processing result ensures that all output paths are in a clockwise direction; 4. Object endpoint update: Based on the decomposed closed path, find the original object corresponding to each path segment through the mapping relationship between edge objects and objects, and update the geometric properties of the object according to the start and end points of the new path.
5. Processing result output: Compare the original set of objects with the set of objects that are still used after processing, identify objects that no longer belong to any valid path due to self-intersection, update the original objects according to the processing result, and delete invalid objects that were removed due to self-intersection.
2. The method for detecting and decomposing self-intersections of arc-shaped polygons in computer-aided manufacturing according to claim 1, characterized in that, In step 1, the object elements include straight objects and arc objects. Corresponding edge objects are created according to the object element type, and start point, end point, type identifier, and geometric bounding box information are set for each edge object.
3. The method for detecting and decomposing self-intersections of arc-shaped polygons in computer-aided manufacturing according to claim 1, characterized in that, Establish a two-way mapping relationship between edge objects and original objects. Includes the following steps: 1.2.1 Create a mapping table from edge objects to object objects; 1.2.2 Record the direction reversal information of the arc-shaped object; 1.2.3 Maintain the status information of objects.
4. The method for detecting and decomposing self-intersections of arc-shaped polygons in computer-aided manufacturing according to claim 1, characterized in that, In step 2, detect the concave points and concave arcs. Includes the following steps: 2.1.1 Calculate the cross product of adjacent edges to determine concavity / convexity; 2.1.2 Identify whether the direction of the arc-shaped object is concave; 2.1.3 Use bounding boxes to accelerate the detection process.
5. The method for detecting and decomposing self-intersections of arc-shaped polygons in computer-aided manufacturing according to claim 1, characterized in that, In step 2.2, before calculating the exact intersection point between each pair of potential self-intersecting edges, a step is also included to quickly eliminate edge pairs that cannot intersect by bounding box overlap detection.
6. The method for detecting and decomposing self-intersections of arc-shaped polygons in computer-aided manufacturing according to claim 5, characterized in that, Calculate the exact intersection point between each pair of potential self-intersecting edges. Includes the following steps: 2.2.1 Exclude the calculation of intersection points of adjacent edge pairs; 2.2.2 Calculate the intersection points for line-line, line-arc, and arc-arc combinations respectively; 2.2.3 Sort the intersection points on the edge objects according to their distance from the starting point.
7. The method for detecting and decomposing self-intersections of arc-shaped polygons in computer-aided manufacturing according to claim 1, characterized in that, Step 3, the self-intersection processing also includes: constructing a complete path containing all vertices and intersections, and processing the self-intersection using the SimplifyPolygon function of the Clipper library.
8. The method for detecting and decomposing self-intersections of arc-shaped polygons in computer-aided manufacturing according to claim 1, characterized in that, Step 4 also includes updating the endpoints of straight and arc objects based on the new path and deleting objects that were deemed invalid due to self-intersection.
9. A computer-readable storage medium having stored thereon program instructions that, when executed by a processor, implement the method for detecting and decomposing self-intersections of arc-shaped polygons as described in any one of claims 1 to 8.
10. A CAM system, comprising a processor and a memory, the memory storing program instructions, the processor executing the program instructions to implement the method for detecting and decomposing self-intersections of arc-shaped polygons as described in any one of claims 1 to 8.