Method and device for detecting spatial relationship of components based on polygon boolean operation

By standardizing polygon orientation and constructing jump arrays, the adaptability and efficiency issues of polygon Boolean operations in component spatial relationship detection are solved, realizing efficient and accurate Boolean operation tasks, which are suitable for computer-aided design and manufacturing systems.

CN122492789APending Publication Date: 2026-07-31XI AN JIAOTONG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
XI AN JIAOTONG UNIV
Filing Date
2026-05-22
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Existing polygon Boolean operation methods suffer from insufficient adaptability, low efficiency in intersection attribute judgment, high path tracing overhead, and poor robustness in degradation processing when detecting spatial relationships of components, resulting in low detection efficiency and inaccurate results.

Method used

By standardizing the projected polygon outline of the components to a counterclockwise direction, detecting intersections and marking their types, and constructing jump arrays nextA, nextB, prevA, and prevB, different tracking strategies are selected based on the intersection type to perform intersection, union, difference, and XOR operations, thus simplifying the path tracking process.

Benefits of technology

It improves the efficiency and accuracy of component spatial relationship detection, reduces the search overhead of path tracing, ensures the geometric integrity of the results, and is suitable for detection tasks of different scales and complexities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122492789A_ABST
    Figure CN122492789A_ABST
Patent Text Reader

Abstract

This invention, in the field of computer graphics, discloses a method and apparatus for detecting spatial relationships of components based on polygon Boolean operations. The method includes acquiring the projected outline polygons of two components and standardizing them to a counter-clockwise direction to obtain a first polygon and a second polygon; detecting the intersection points of the first and second polygons and marking the type of each intersection point; sorting the intersection points of each edge in ascending order of distance from the starting point of that edge, and constructing jump arrays nextA, nextB, prevA, and prevB based on the sorting results to record the next intersection point along the forward direction of the first polygon, the forward direction of the second polygon, the reverse direction of the first polygon, and the reverse direction of the second polygon; and performing intersection, union, difference, and / or XOR operations according to the type of each intersection point to obtain the detection results of the intersection region, union region, difference region, and / or XOR region of the two components. This method can effectively improve the efficiency of detecting spatial relationships of components.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer graphics and relates to a method and apparatus for detecting spatial relationships of components based on polygon Boolean operations. Background Technology

[0002] In computer-aided design and manufacturing (CAD / CAM) systems, component spatial relationship detection is a fundamental step in core design tasks such as assembly feasibility verification, machining allowance allocation, assembly clearance analysis, and support structure design. Component spatial relationship detection refers to using computational geometry methods to determine the interference, merging, difference, or symmetrical difference regions in space between the projected contours of two parts, thus providing a geometric basis for design decisions. Typical component spatial relationship detection scenarios include: determining assembly interference between gear contours and bearing hole projections; calculating the effective load-bearing cross-section between flange contours and bolt hole arrays; extracting material removal areas between turbine blade cross-sections and blank contours; and identifying suspended areas between adjacent layer cross-sections in 3D printing. These detection tasks have two significant characteristics: first, the number of polygon vertices of the components to be detected varies greatly, ranging from tens to thousands; second, the detection operation is frequently invoked during design iterations, parametric modifications, and slicing processes, constituting a significant component of the overall response time of the CAD / CAM system.

[0003] Currently, the underlying polygon Boolean operation methods used to detect spatial relationships between components mainly include classic schemes such as the Weiler-Atherton algorithm, the Vatti algorithm, and the Greiner-Hormann algorithm, as well as their subsequent improvements. However, these methods reveal the following shortcomings when facing the specific needs of part design: First, the intersection detection strategy lacks adaptability. Brute-force enumeration methods become drastically less efficient when the number of vertices in the part is large, causing significant interaction delays in the design of complex parts such as gears and turbine blades; while the scanline method incurs unnecessary performance overhead due to sorting and event queue maintenance when handling simple parts such as bolt holes and mounting holes. Common detection scenarios in part design, such as complex parts and simple holes or blades and rectangular blanks, require algorithms to flexibly switch strategies according to the actual scale of the objects being processed. However, existing methods generally adopt a single fixed strategy, which cannot balance efficiency under different scales. Second, the process of determining the entry / exit attributes of intersections is complex. Traditional methods typically require online maintenance of scan line status during the tracing phase or repeated inclusion tests of points within polygons. These cumulative operations significantly increase computational overhead when designing parts with numerous intersections, impacting the real-time response of design verification. Third, path tracing in the result generation phase incurs runtime search overhead. Traditional methods dynamically search for the next jump intersection during tracing. In scenarios like 3D printing slicing, where layer-by-layer difference operations are required, this search operation's cumulative time cost directly extends the overall processing cycle from component model to manufacturing path generation. Fourth, the robustness of degradation handling strategies is insufficient. Engineering features in component design, such as axis-aligned edges, standard apertures, and equidistant arrays, frequently result in collinearity and concurrency between polygon boundaries, leading to degenerate geometric states. Improper handling can cause topological errors in spatial relationship detection results, subsequently causing overcutting in downstream CAM toolpaths or misjudgment of assembly interference, affecting manufacturing quality.

[0004] In summary, in the field of component spatial relationship detection, existing methods still have shortcomings in terms of algorithm adaptability, efficiency of intersection attribute judgment, efficiency of path tracing execution, and robustness in handling degradation. There is an urgent need for an improved method that can comprehensively solve the above problems in order to meet the requirements of increasingly complex component designs for real-time performance, accuracy, and robustness in spatial relationship detection. Summary of the Invention

[0005] The purpose of this invention is to overcome the shortcomings of the prior art and provide a method and apparatus for detecting spatial relationships of components based on polygon Boolean operations.

[0006] To achieve the above objectives, the present invention employs the following technical solution: In a first aspect, this invention provides a method for detecting spatial relationships between components based on polygon Boolean operations, comprising: acquiring the projected outline polygons of two components and standardizing them to a counterclockwise direction to obtain a first polygon and a second polygon; detecting the intersection points of the first polygon and the second polygon and marking the type of each intersection point; sorting the intersection points of each side in ascending order by distance from the starting point of the side, and constructing jump arrays nextA, nextB, prevA, and prevB based on the sorting result to record the next intersection point along the forward direction of the first polygon, the forward direction of the second polygon, the reverse direction of the first polygon, and the reverse direction of the second polygon, respectively; and performing intersection, union, difference, and / or XOR operations according to the type of each intersection point to obtain the intersection region detection result and the union region of the two components. The detection results include the difference region detection results and / or the XOR region detection results. The intersection operation involves tracing from unvisited intersections of type "entry point" using alternating `nextB` and `nextA`. The union operation involves tracing from unvisited intersections of type "exit point" using alternating `nextB` and `nextA`. The difference operation involves tracing from unvisited intersections of type "exit point" using alternating `nextA` and `prevB`. The XOR operation involves tracing from all intersections of type "exit point" using alternating `nextA` and `prevB`, and from all intersections of type "entry point" using alternating `nextB` and `prevA`, and then merging them. Furthermore, during the tracing process, the vertices of the first or second polygon between adjacent intersections are added to the tracing results sequentially.

[0007] Optionally, obtaining the projected outline polygons of the two components and standardizing them to a counter-clockwise direction includes: obtaining the projected outline polygons of the two components; and obtaining the polygon area of ​​the projected outline polygons using the following formula. :

[0008] in, For the projected outline polygon vertices coordinate; For the projected outline polygon vertices coordinate; For the projected outline polygon vertices coordinate; For the projected outline polygon vertices coordinate.

[0009] when When, preserve the vertex sequence of the projected contour polygon; when At this time, the vertex sequence of the projected contour polygon is reversed.

[0010] Optionally, detecting the intersection of the first polygon and the second polygon includes: obtaining the total number of vertices of the first polygon and the second polygon; when the total number of vertices is less than a preset threshold, using a pairwise detection method based on axis-aligned bounding box pruning to detect candidate intersecting edge pairs of the first polygon and the second polygon; otherwise, using a scanline algorithm to detect candidate intersecting edge pairs of the first polygon and the second polygon; and performing line segment intersection tests based on the candidate intersecting edge pairs to obtain the intersection point and the intersection point coordinates.

[0011] Optionally, the line segment intersection test based on candidate intersecting edge pairs includes: setting the candidate intersecting edge pairs as edge a and edge b; when and and At that time, there is an intersection point between edge a and edge b, and the coordinates of the intersection point are: ;in, Let be the cross product of edge a and edge b; The position parameter of the intersection point on edge a; The position parameter of the intersection point on edge b; This is the floating-point precision threshold. Let be the coordinates of the starting point of edge a; Let be the coordinates of the endpoint of edge a; Let be the coordinates of the starting point of edge b; Let be the coordinates of the endpoint of edge b; This is the cross product operation.

[0012] Optionally, the type of marking each intersection point includes: obtaining the cross product result of each intersection point using the following formula. :

[0013] in, Let be the edge vector of the edge containing the intersection point in the first polygon; Let be the edge vector of the edge to which the intersection point belongs in the second polygon; For cross product operation; when The type of the intersection point is marked as an entry point; when The type of the intersection point is marked as an exit point.

[0014] Optionally, sorting the intersection points of each edge in ascending order by distance from the starting point of the edge includes: obtaining the distance between the intersection point and the starting point of the edge using the following formula. :

[0015] in, The coordinates of the intersection point; The coordinates of the starting point of the edge containing the intersection point; The coordinates of the endpoint of the edge containing the intersection point; This represents the vector dot product operation; This indicates the length of the side containing the intersection point.

[0016] Optionally, before detecting the intersection of the first polygon and the second polygon, the method further includes: when a vertex of one polygon in the first polygon or the second polygon is located on the edge of the other polygon, shifting all vertices of that polygon. ;in, As a preset disturbance, The coefficients are non-integer coefficients.

[0017] In a second aspect, the present invention provides a component spatial relationship detection system based on polygon Boolean operations, comprising: an intersection point processing module, configured to acquire the projected contour polygons of two components and standardize them to a counterclockwise direction to obtain a first polygon and a second polygon, and to detect the intersection points of the first polygon and the second polygon and mark the type of each intersection point; a jump array module, configured to sort the intersection points of each side in ascending order by distance from the starting point of the side, and construct jump arrays nextA, nextB, prevA, and prevB based on the sorting result to record the next intersection point along the forward direction of the first polygon, the forward direction of the second polygon, the reverse direction of the first polygon, and the reverse direction of the second polygon; and a relationship detection module, configured to perform intersection, union, difference, and / or XOR operations according to the type of each intersection point to obtain the spatial relationship between the two components. The results include intersection region detection, union region detection, difference region detection, and / or XOR region detection. The intersection operation involves tracing from unvisited intersections of type "entry point" using alternating `nextB` and `nextA`. The union operation involves tracing from unvisited intersections of type "exit point" using alternating `nextB` and `nextA`. The difference operation involves tracing from unvisited intersections of type "exit point" using alternating `nextA` and `prevB`. The XOR operation involves tracing from all intersections of type "exit point" using alternating `nextA` and `prevB`, and from all intersections of type "entry point" using alternating `nextB` and `prevA`, and then merging them. Furthermore, during the tracing process, the vertices of the first or second polygon between adjacent intersections are added to the tracing results sequentially.

[0018] In a third aspect, the present invention provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the component spatial relationship detection method based on polygon Boolean operations.

[0019] In a fourth aspect, the present invention provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of the component spatial relationship detection method based on polygon Boolean operations.

[0020] Compared with the prior art, the present invention has the following beneficial effects: This invention presents a component spatial relationship detection method based on polygon Boolean operations. By standardizing the projected polygon outlines of two components to a counter-clockwise direction, it ensures a consistent foundation for subsequent intersection point type determination and path tracing direction. Based on this, it detects intersection points and marks their types. Using the distances between intersection points and their respective edge starting points, it constructs forward and reverse jump arrays nextA, nextB, prevA, and prevB, ensuring that the next jump target for each intersection point in any direction is pre-recorded as an array element. This transforms the operation of finding the next intersection point in subsequent tracing from a runtime search in traditional methods to a constant-time direct access to the jump arrays, eliminating... In addition to the search overhead in the path tracing stage, the corresponding tracing strategy is selected based on the Boolean operation type and intersection type: intersection starts from the entry point, union and difference start from the exit point, and XOR starts from the two types of intersections respectively. Different jump arrays are used alternately to complete the tracing, so that multiple spatial relationship detection tasks are unified on the same set of preprocessed data, without having to repeatedly perform intersection detection and sorting for different operations. At the same time, during the tracing process, the original vertices of the crossed polygons are included in the result path in sequence to ensure that the generated result area has a complete geometric shape and closed boundaries. Thus, the four component spatial relationship detection tasks of intersection, union, difference and XOR are completed efficiently and accurately within a single method framework. Attached Figure Description

[0021] Figure 1 This is a flowchart of the component spatial relationship detection method based on polygon Boolean operations according to an embodiment of the present invention.

[0022] Figure 2 This is a block diagram of the component spatial relationship detection system based on polygon Boolean operations according to an embodiment of the present invention. Detailed Implementation

[0023] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0024] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0025] The present invention will now be described in further detail with reference to the accompanying drawings: See Figure 1 In one embodiment of the present invention, a method for detecting spatial relationships of components based on polygon Boolean operations is provided, which can effectively improve the efficiency of component spatial relationship detection. Specifically, the method for detecting spatial relationships of components based on polygon Boolean operations of the present invention includes the following steps: S1: Obtain the projected outline polygons of the two components and standardize them to a counterclockwise direction to obtain the first polygon and the second polygon, and detect the intersection points of the first polygon and the second polygon and mark the type of each intersection point.

[0026] S2: Sort the intersection points of each side in ascending order of distance from the starting point of the side, and construct jump arrays nextA, nextB, prevA and prevB based on the sorting result to record the next intersection point of the current intersection point along the forward direction of the first polygon, the forward direction of the second polygon, the reverse direction of the first polygon and the reverse direction of the second polygon.

[0027] S3: Based on the type of each intersection point, perform intersection, union, difference and / or XOR operations to obtain the detection results of the intersection region, union region, difference region and / or XOR region of the two components.

[0028] Specifically, the intersection operation involves tracing from unvisited intersections of type "entry point" using alternating steps of nextB and nextA; the union operation involves tracing from unvisited intersections of type "exit point" using alternating steps of nextB and nextA; the difference operation involves tracing from unvisited intersections of type "exit point" using alternating steps of nextA and prevB; the XOR operation involves tracing from all intersections of type "exit point" using alternating steps of nextA and prevB, and from all intersections of type "entry point" using alternating steps of nextB and prevA, and then merging them; furthermore, during the tracing process, the vertices of the first or second polygon between adjacent intersections are added to the tracing result in sequence.

[0029] This invention presents a component spatial relationship detection method based on polygon Boolean operations. By standardizing the projected polygon outlines of two components to a counter-clockwise direction, it ensures a consistent foundation for subsequent intersection point type determination and path tracing direction. Based on this, it detects intersection points and marks their types. Using the distances between intersection points and their respective edge starting points, it constructs forward and reverse jump arrays nextA, nextB, prevA, and prevB, ensuring that the next jump target for each intersection point in any direction is pre-recorded as an array element. This transforms the operation of finding the next intersection point in subsequent tracing from a runtime search in traditional methods to a constant-time direct access to the jump arrays, eliminating... In addition to the search overhead in the path tracing stage, the corresponding tracing strategy is selected based on the Boolean operation type and intersection type: intersection starts from the entry point, union and difference start from the exit point, and XOR starts from the two types of intersections respectively. Different jump arrays are used alternately to complete the tracing, so that multiple spatial relationship detection tasks are unified on the same set of preprocessed data, without having to repeatedly perform intersection detection and sorting for different operations. At the same time, during the tracing process, the original vertices of the crossed polygons are included in the result path in sequence to ensure that the generated result area has a complete geometric shape and closed boundaries. Thus, the four component spatial relationship detection tasks of intersection, union, difference and XOR are completed efficiently and accurately within a single method framework.

[0030] In one possible implementation, obtaining the projected outline polygons of the two components and standardizing them both to a counter-clockwise direction includes: obtaining the projected outline polygons of the two components; and obtaining the polygon area of ​​the projected outline polygons using the following formula. :

[0031] in, For the projected outline polygon vertices coordinate; For the projected outline polygon vertices Coordinate; is the coordinate of the th vertex of the projected contour polygon; is the coordinate of the th vertex of the projected contour polygon.

[0032] When , retain the vertex sequence of the projected contour polygon; when , reverse the vertex sequence of the projected contour polygon.

[0033] Explanatory, standardize the projected contour polygons A and B of the two input components to the counterclockwise direction. Let the first polygon A be composed of the vertex sequence {a0, a1,..., a -1}, and the second polygon B be composed of the vertex sequence {b0, b1,..., b -1}. Determine its direction by calculating the sign of the polygon area. If Area > 0, the polygon is in the counterclockwise direction; if Area < 0, reverse the vertex sequence.

[0034] In a possible implementation manner, the detecting of the intersection points of the first polygon and the second polygon includes: obtaining the total number of vertices of the first polygon and the second polygon; when the total number of vertices is less than a preset vertex total threshold, detecting candidate intersecting edge pairs of the first polygon and the second polygon by using a pairwise detection method based on axis-aligned bounding box pruning; otherwise, detecting candidate intersecting edge pairs of the first polygon and the second polygon by using a scan line algorithm; performing a line segment intersection test based on the candidate intersecting edge pairs to obtain intersection points and intersection coordinates.

[0035] Explanatory, in this implementation manner, an adaptive intersection point detection method is designed, that is, select an intersection point detection algorithm according to the total number of vertices n + m of the first polygon and the second polygon.

[0036] Case 1: When n + m < T (T is a preset vertex total threshold), use pairwise detection based on axis-aligned bounding box pruning (that is, brute-force detection method with AABB bounding box pruning). For the i-th edge e Ai = (a i , a i+1 ) of the first polygon A and the j-th edge e Bj = (b j , b j+1First, the axis-aligned bounding box (AABB) of each edge is calculated. An exact line segment intersection test is only performed when two bounding boxes intersect. This method avoids sorting overhead and is suitable for small-scale problems. Case 2: When n+m≥T, the X-axis scan line algorithm is used. After sorting all edges according to their minimum x-coordinate, the algorithm scans from left to right, only detecting edge pairs that overlap within the x-axis interval. This method reduces unnecessary edge pair comparisons and is suitable for large-scale problems.

[0037] For example, the basis for setting T is as follows: Specifically, the time complexity of the pairwise detection method based on axis-aligned bounding box pruning is O(n×m), and its processing of each edge pair does not require sorting or state maintenance, resulting in a relatively small unit operation constant c1; the time complexity of the X-axis scan line algorithm is O((n+m)log(n+m)+k) (where k is the number of intersections), which requires edge set sorting, event queue maintenance, and active edge table updates, resulting in a significantly larger unit operation constant c2 than c1. The break-even point is when the running time of the two algorithms is equal, derived from c1·n·m≈c2·(n+m)log(n+m); in the symmetric case where n≈m, this break-even point is on the order of tens to hundreds of n+m. Within this theoretical order of magnitude, this embodiment conducts comparative measurements on typical CAD / CAM workpieces (gears, flanges, L-shaped brackets, PCB panels, and turbine blades, etc.). It is found that when T=200, the method of this invention achieves stable and superior performance on both small-scale workpieces (such as L-shaped brackets and mounting hole calculations, n+m=38) and large-scale workpieces (such as m0.5z60 gears and bearing hole calculations, n+m=2060). In practical engineering, T can be empirically adjusted within the range of [100, 500] according to the specific hardware platform, geometric complexity distribution, and accuracy requirements to adapt to different CAD / CAM workpiece libraries.

[0038] Based on an adaptive intersection detection strategy, this method automatically selects either a brute-force method or a scan-line method according to the polygon size, balancing low overhead for small-scale problems and low complexity for large-scale problems. For example, in CAD / CAM machining scenarios, this method achieves a speedup of more than 3 times compared to the mainstream polygon Boolean operation library Clipper2 in both small-scale workpiece calculations (such as subtraction between an L-shaped bracket and a mounting hole, n+m=38) and large-scale workpiece calculations (such as interference detection between an m0.5z60 gear and a bearing hole, n+m=2060), thus significantly improving the execution efficiency of core tasks such as part interference detection and machining allowance calculation.

[0039] In one possible implementation, the line segment intersection test based on candidate intersecting edge pairs includes: setting candidate intersecting edge pairs as edge a and edge b; when and and At that time, there is an intersection point between edge a and edge b, and the coordinates of the intersection point are: ;in, Let be the cross product of edge a and edge b; The position parameter of the intersection point on edge a; The position parameter of the intersection point on edge b; This is the floating-point precision threshold. Let be the coordinates of the starting point of edge a; Let be the coordinates of the endpoint of edge a; Let be the coordinates of the starting point of edge b; Let be the coordinates of the endpoint of edge b; This is the cross product operation.

[0040] Explanatoryly, this method can determine the three valid intersection points—whether the two sides are not parallel, whether the intersection point is inside edge a, and whether the intersection point is inside edge b—in one go, avoiding the redundant steps of traditional methods that first calculate the intersection point and then verify whether it is inside the line segment. After the three conditions are met, the intersection point coordinates are directly obtained by adding the direction vector to the starting point of edge a and multiplying by the position parameter t. The entire judgment and intersection calculation process only requires a few cross product and division operations, without the need for time-consuming operations such as square root or trigonometric functions, making the calculation simple and efficient. At the same time, the introduction of ε effectively filters out false intersection points near the endpoints caused by floating-point rounding errors, ensuring that only true intersections that are strictly located inside the two sides are recorded. This prevents topological ambiguity caused by overlapping endpoints in subsequent intersection point sorting and path tracing, thus guaranteeing the geometric correctness and numerical stability of the component spatial relationship detection results from the bottom layer.

[0041] In one possible implementation, the type of marking each intersection point includes: obtaining the cross product result of each intersection point by the following formula. :

[0042] in, Let be the edge vector of the edge containing the intersection point in the first polygon; Let be the edge vector of the edge to which the intersection point belongs in the second polygon; This is the cross product operation.

[0043] when The type of the intersection point is marked as an entry point; when The type of the intersection point is marked as an exit point.

[0044] Interpretively, for each detected intersection point P, its type is determined in constant time using the cross product method. Let intersection point P lie on the edge vector of the first polygon A. =a i+1 -a i The side vectors of the second polygon B =b j+1 -b jAbove, calculate the cross product: If cross > 0, then the intersection point P is marked as the entry point, indicating that tracing along polygon B from this point will lead to the interior of polygon A; if cross ≤ 0, then it is marked as the exit point. This method does not require maintaining the scan line state and only needs one cross product calculation to complete the judgment.

[0045] In this embodiment, by using the cross product method to determine the entry / exit type of the intersection point in O(1) time, there is no need to maintain complex scan line states or perform additional point judgments within the polygon, simplifying implementation and reducing computational overhead. For example, in typical gear meshing interference detection in CAD / CAM (two 1320 vertex gears undergo rotational pairing operations), the method of this invention achieves a speedup of more than 2 times compared to Clipper2, significantly improving the real-time performance of assembly verification and machining preparation.

[0046] In one possible implementation, sorting the intersection points of each edge in ascending order by distance from the starting point of the edge includes: obtaining the distance between the intersection point and the starting point of the edge using the following formula. :

[0047] in, The coordinates of the intersection point; The coordinates of the starting point of the edge containing the intersection point; The coordinates of the endpoint of the edge containing the intersection point; This represents the vector dot product operation; This indicates the length of the side containing the intersection point.

[0048] Explanatory, for each edge of the first polygon A and the second polygon B, collect all intersection points located on that edge, sorted by the distance of each intersection point from the origin of the edge. Sort the data in ascending order and construct a linked list of edges and intersections of the first polygon A and the second polygon B. This step mainly provides the data foundation for the subsequent jump array.

[0049] In one possible implementation, before detecting the intersection of the first polygon and the second polygon, the method further includes: when a vertex of one polygon in the first polygon or the second polygon is located on the edge of the other polygon, offsetting all vertices of that polygon. ;in, As a preset disturbance, The coefficients are non-integer coefficients.

[0050] Interpretive, when a polygon vertex is detected to be located exactly on the edge of another polygon, a small perturbation is applied to one of the polygons. Offset the coordinates of all vertices of the polygon Eliminate degradation.

[0051] In one possible implementation, a feasible method is provided to construct four jump arrays based on the edge-intersection linked lists of the first polygon A and the second polygon B. Based on the edge-intersection linked lists of the first polygon A and the second polygon B, a global intersection order ordA along the first polygon A and a global intersection order ordB along the second polygon B are generated, and then the jump relationships between the intersections are established. This pre-computation ensures that each jump during path tracing requires only O(1) time. Specifically, the construction of the jump arrays includes the following steps: Step 1: Intersection Bucket Allocation. Assume a total of k intersections are detected. For each intersection P, record the indices of its edges, edgeA(i) and edgeB(i), and the parameter values ​​tA(i) and tB(i) on the two edges. Create two bucket arrays onA[nA] and onB[nB] (nA and nB are the number of edges of the first and second polygons, respectively), and add the index of each intersection to onA[edgeA(i)] and onB[edgeB(i)] respectively.

[0052] Step 2: In-bucket sorting. For all intersection points on each edge of the first polygon A, sort them in ascending order according to parameter t; for each edge of the second polygon B, sort them in ascending order according to t. This sorting ensures that multiple intersection points on the same edge are strictly ordered along the edge direction.

[0053] Step 3: Global Unfolding and Jump Assignment. Unfold all buckets onA[0..nA-1] sequentially according to the edge index order of the first polygon A to obtain the global intersection point sequence array ordA[k] along the direction of the first polygon A; similarly, obtain ordB[k]. Then, iterate through ordA and ordB, assigning jump array values ​​to each adjacent intersection point pair (circular closure). Since the closed polygon is connected end-to-end, the next element after the (k-1)th element is the 0th element; therefore, modulo k operation is used to implement the circular jump between the first and last elements.

[0054] The total time complexity of the above construction process is O(k log k) (dominated by the sorting within the bucket, where k is the number of intersections), but it is only executed once in the preprocessing stage; after the construction is completed, the time complexity of each jump operation in the path tracing stage is O(1), which is only a random access to the jump array.

[0055] Furthermore, based on the jump array, different starting points and tracking strategies are selected according to the Boolean operation type: Intersection operation: Starting from an unvisited entry point, when currently on the second polygon B, use nextB to jump to the next intersection point, then switch to the first polygon A and use nextA to jump, alternating in this way until returning to the starting point to form a closed polygon. Union operation: Starting from an unvisited exit point, the tracking strategy is the same as intersection, alternating between nextB and nextA for jumps. Difference operation: Starting from an unvisited exit point, use nextA to trace forward on polygon A, and use prevB to trace backward on polygon B, alternating in this way. XOR operation: Tracking is performed in two rounds. The first round starts from all exit points and uses nextA and prevB for tracking; the second round starts from all entry points and uses nextB and prevA for tracking, finally merging the results of the two rounds of tracking.

[0056] Explained, by employing a pre-computed jump array, each jump during path tracing requires only O(1) time array access, avoiding runtime search operations. For example, in downstream stages of CAD / CAM machining, such as CNC slicing and 3D printing support structure extraction (layer difference operation), the method of this invention achieves a speedup of more than 3 times compared to Clipper2. Since this operation needs to be called once on each printing layer, for parts composed of thousands of slices, the cumulative savings in runtime search overhead directly shorten the processing latency of the slicing software, improving the overall cycle of machining scheduling and sample preparation.

[0057] In one possible implementation, an example is used to illustrate the method of the present invention. Specifically, for two overlapping squares Q and W, the method of the present invention is used to detect spatial relationships.

[0058] The vertices of polygon Q are: {(0,0), (100,0), (100,100), (0,100)}; the vertices of polygon W are: {(50,50), (150,0), (150,150), (50,150)}.

[0059] Step 1: Input preprocessing.

[0060] Calculate the area of ​​polygon Q The direction is counterclockwise. Similarly, polygon W is also counterclockwise. n=m=4, and the total number of vertices is 8.

[0061] Step 2: Adaptive intersection detection. Since n + m = 8 < T (let T = 200), a brute-force detection method with QQWW pruning is adopted. Traverse all edge pairs, and 2 intersections are detected: Intersection P0 = (100, 50), located on the edge (100, 0) → (100, 100) of Q and the edge (50, 50) → (150, 50) of W; Intersection P1 = (50, 100), located on the edge (100, 100) → (0, 100) of Q and the edge (50, 150) → (50, 50) of W.

[0062] Step 3: O(1) entry / exit marking. For P0: vQ = (-100, 0), vW = (100, 0), , marked as an exit point. For P1: vQ = (-100, 0), vW = (0, -100), , marked as an entry point.

[0063] Step 4: Construct the edge-intersection linked list and jump array.

[0064] The intersection order along Q: P0 (edge 1, t = 0.5) → P1 (edge 2, t = 0.5), so ordQ = [0, 1]; The intersection order along W: P0 (edge 0, t = 0.5) → P1 (edge 3, t = 0.5), so ordW = [0, 1]; Jump array: nextQ = [1, 0], nextW = [1, 0], prevQ = [1, 0], prevW = [1, 0].

[0065] Step 5: Path tracing. Taking the intersection operation as an example, starting from the entry point P1: ① The starting point P1 (50, 100), on W, use nextW[1] = 0 to jump to P0, passing through the vertex (50, 50) of W; ② The current P0 (100, 50), switch to Q, use nextQ[0] = 1 to jump to P1, passing through the vertex (100, 100) of Q; ③ Return to the starting point P1, and the tracing ends. The intersection result polygon: {(50, 100), (50, 50), (100, 50), (100, 100)}, with an area of 2500 square units.

[0066] Using the method of the present invention can achieve two-dimensional polygon intersection, union, difference, and exclusive-or Boolean operations. Through technologies such as adaptive algorithm selection, constant-time entry / exit marking, and precomputed jump arrays, the implementation complexity is simplified, the algorithm efficiency is improved, and further the detection efficiency of the spatial relationship of components based on polygon Boolean operations is enhanced, which can be applied to fields such as CQD systems, GIS applications, and game engines.

[0067] In one possible implementation, the component spatial relationship detection method based on polygon Boolean operations of the present invention is illustrated by its application in part interference detection in a CAD / CAM machining scenario. Specifically, to perform an assembly feasibility analysis on a gear part, it is necessary to calculate the intersection operation between the m0.5z60 involute gear (generated according to ISO 6336 standard, discretized into a polygon E with 1980 vertices) and its bearing hole (a circular hole projected as a polygon R with 80 vertices) to determine whether there is assembly interference between the gear and the bearing hole.

[0068] Step 1: Preprocess both polygons E and R to be in a counterclockwise direction.

[0069] Step 2: Since n+m=2060>T (T=200), the X-axis scan line algorithm is automatically selected for intersection detection; the gear tooth profile and bearing hole only intersect at the tooth tip contact strip, so the scan line algorithm only traverses the truly overlapping edge pairs in the y interval, avoiding testing other non-contact tooth profile edges.

[0070] Step 3: For each detected intersection, use the cross product method to determine the entry / exit type in O(1) time.

[0071] Step 4: Construct an edge-intersection linked list and four jump arrays nextA, prevA, nextB, and prevB, so that subsequent path tracing only requires O(1) array accesses for each jump.

[0072] Step 6: Starting from the unvisited entry point, use the intersection operation strategy alternately to trace using nextB and nextA, and finally generate a polygon representing the actual overlapping area of ​​the gear and bearing hole. This polygon serves as the basis for assembly interference judgment in the CAD / CAM system and can further guide the subsequent machining allowance and toolpath generation.

[0073] In this example, the invention completes a single interference detection on a standard hardware platform in about 46.35 microseconds, achieving a speedup of 3.77 times compared to the mainstream polygon Boolean operation library Clipper2 (which takes about 174.54 microseconds). Furthermore, the resulting polygon area error is less than 0.006%, which is far below the engineering tolerance of CAD / CAM processing scenarios.

[0074] This example is also applicable to other typical CAD / CAM workpieces, such as: a difference operation performed with the L-shaped bracket outline as the first polygon and the mounting hole outline as the second polygon to calculate the actual machining area of ​​the bracket after removing the mounting holes; an intersection operation performed with the turbine blade outline as the first polygon and the rectangular blank as the second polygon to calculate the machining area of ​​the blade in the rectangular blank; a difference operation performed with the PCB panel outline as the first polygon and the sheared area as the second polygon to calculate the actual board surface after the PCB board edge is trimmed; and a difference operation performed with the flange outline as the first polygon and the bolt hole array as the second polygon to calculate the effective structural area of ​​the flange after removing the bolt holes.

[0075] Similarly, in GIS applications, using administrative region polygons as the first polygon and query window polygons as the second polygon, the intersection operation result is used for viewport clipping and buffer analysis of administrative regions; the union operation result is used for merging analysis of multiple plots; and the difference operation result is used for the remaining analysis area after deducting specific areas. This invention can be used to complete region clipping and buffer analysis. In game engines, using the character's two-dimensional bounding polygon as the first polygon and scene obstacle polygons as the second polygon, the intersection operation result is used for real-time collision detection and hit determination. This invention can be used to complete real-time collision detection; the union operation result is used for merging areas bound by multiple objects; and the difference operation result is used for culling visible areas and rendering only the unoccluded parts. In IC layout design, using layout polygons from two different layers as the first and second polygons, the intersection operation result is used for coupling area detection in multi-layer layouts; the union operation result is used for merging and simplifying polygons in the same layer; the difference operation result is used for layout analysis after deducting prohibited areas; and the XOR operation result is used for layout difference comparison and design rule verification. This invention can be used to complete layer spatial relationship detection.

[0076] The following are embodiments of the apparatus of the present invention, which can be used to execute embodiments of the method of the present invention. For details not disclosed in the apparatus embodiments, please refer to the embodiments of the method of the present invention.

[0077] See Figure 2 In another embodiment of the present invention, a component spatial relationship detection system based on polygon Boolean operations is provided, which can be used to implement the above-mentioned component spatial relationship detection method based on polygon Boolean operations. Specifically, the component spatial relationship detection system based on polygon Boolean operations includes an intersection processing module, a jump array module, and a relationship detection module.

[0078] The intersection processing module is used to obtain the projected outline polygons of the two components and standardize them to a counterclockwise direction to obtain the first polygon and the second polygon, and to detect the intersection points of the first polygon and the second polygon and mark the type of each intersection point; the jump array module is used to sort the intersection points of each side in ascending order of distance from the starting point of the side, and to construct jump arrays nextA, nextB, prevA and prevB based on the sorting result to record the next intersection point along the positive direction of the first polygon, the positive direction of the second polygon, the negative direction of the first polygon and the negative direction of the second polygon respectively; the relationship detection module is used to perform intersection operation, union operation, difference operation and / or XOR operation according to the type of each intersection point to obtain the intersection region detection result, union region detection result, difference region detection result and / or XOR region detection result of the two components.

[0079] Specifically, the intersection operation involves tracing from unvisited intersections of type "entry point" using alternating steps of nextB and nextA; the union operation involves tracing from unvisited intersections of type "exit point" using alternating steps of nextB and nextA; the difference operation involves tracing from unvisited intersections of type "exit point" using alternating steps of nextA and prevB; the XOR operation involves tracing from all intersections of type "exit point" using alternating steps of nextA and prevB, and from all intersections of type "entry point" using alternating steps of nextB and prevA, and then merging them; furthermore, during the tracing process, the vertices of the first or second polygon between adjacent intersections are added to the tracing result in sequence.

[0080] In one possible implementation, obtaining the projected outline polygons of the two components and standardizing them both to a counter-clockwise direction includes: obtaining the projected outline polygons of the two components; and obtaining the polygon area of ​​the projected outline polygons using the following formula. :

[0081] in, For the projected outline polygon vertices coordinate; For the projected outline polygon vertices coordinate; For the projected outline polygon vertices coordinate; For the projected outline polygon vertices Coordinates; when When, preserve the vertex sequence of the projected contour polygon; when At this time, the vertex sequence of the projected contour polygon is reversed.

[0082] In one possible implementation, detecting the intersection of the first polygon and the second polygon includes: obtaining the total number of vertices of the first polygon and the second polygon; when the total number of vertices is less than a preset threshold, using a pairwise detection method based on axis-aligned bounding box pruning to detect candidate intersecting edge pairs of the first polygon and the second polygon; otherwise, using a scanline algorithm to detect candidate intersecting edge pairs of the first polygon and the second polygon; and performing line segment intersection tests based on the candidate intersecting edge pairs to obtain the intersection point and the intersection point coordinates.

[0083] In one possible implementation, the line segment intersection test based on candidate intersecting edge pairs includes: setting candidate intersecting edge pairs as edge a and edge b; when and and At that time, there is an intersection point between edge a and edge b, and the coordinates of the intersection point are: ;in, Let be the cross product of edge a and edge b; The position parameter of the intersection point on edge a; The position parameter of the intersection point on edge b; This is the floating-point precision threshold. Let be the coordinates of the starting point of edge a; Let be the coordinates of the endpoint of edge a; Let be the coordinates of the starting point of edge b; Let be the coordinates of the endpoint of edge b; This is the cross product operation.

[0084] In one possible implementation, the type of marking each intersection point includes: obtaining the cross product result of each intersection point by the following formula. :

[0085] in, Let be the edge vector of the edge containing the intersection point in the first polygon; Let be the edge vector of the edge to which the intersection point belongs in the second polygon; For cross product operation; when The type of the intersection point is marked as an entry point; when The type of the intersection point is marked as an exit point.

[0086] In one possible implementation, sorting the intersection points of each edge in ascending order by distance from the starting point of the edge includes: obtaining the distance between the intersection point and the starting point of the edge using the following formula. :

[0087] in, The coordinates of the intersection point; The coordinates of the starting point of the edge containing the intersection point; The coordinates of the endpoint of the edge containing the intersection point; This represents the vector dot product operation; This indicates the length of the side containing the intersection point.

[0088] In one possible implementation, before detecting the intersection of the first polygon and the second polygon, the method further includes: when a vertex of one polygon in the first polygon or the second polygon is located on the edge of the other polygon, offsetting all vertices of that polygon. ;in, As a preset disturbance, The coefficients are non-integer coefficients.

[0089] All relevant content of each step involved in the aforementioned embodiment of the component spatial relationship detection method based on polygon Boolean operation can be referenced to the functional description of the corresponding functional module of the component spatial relationship detection system based on polygon Boolean operation in the embodiment of the present invention, and will not be repeated here.

[0090] The module division in this embodiment of the invention is illustrative and represents only one logical functional division. In actual implementation, other division methods may be used. Furthermore, the functional modules in the various embodiments of the invention can be integrated into a single processor, exist as separate physical entities, or be integrated into a single module. The integrated modules described above can be implemented in hardware or as software functional modules.

[0091] In another embodiment of the present invention, a computer device is provided, comprising a processor and a memory. The memory stores a computer program, which includes program instructions. The processor executes the program instructions stored in the computer storage medium. The processor may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. It is the computing and control core of the terminal, suitable for implementing one or more instructions, specifically suitable for loading and executing one or more instructions from the computer storage medium to achieve a corresponding method flow or corresponding function. The processor described in this embodiment of the present invention can be used for the operation of a component spatial relationship detection method based on polygon Boolean operations.

[0092] In another embodiment of the present invention, a storage medium is provided, specifically a computer-readable storage medium (Memory), which is a memory device in a computer device used to store programs and data. It is understood that the computer-readable storage medium here can include both the built-in storage medium in the computer device and extended storage media supported by the computer device. The computer-readable storage medium provides storage space that stores the terminal's operating system. Furthermore, the storage space also stores one or more instructions suitable for loading and execution by a processor. These instructions can be one or more computer programs (including program code). It should be noted that the computer-readable storage medium here can be high-speed RAM or non-volatile memory, such as at least one disk storage device. The processor can load and execute one or more instructions stored in the computer-readable storage medium to implement the corresponding steps of the component spatial relationship detection method based on polygon Boolean operations in the above embodiments.

[0093] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0094] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0095] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0096] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0097] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the specific implementation of the present invention. Any modifications or equivalent substitutions that do not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.

Claims

1. A method for detecting spatial relationships of components based on polygon Boolean operations, characterized in that, include: The projected outline polygons of the two components are obtained and standardized to a counterclockwise direction to obtain the first polygon and the second polygon. The intersection points of the first polygon and the second polygon are detected and the type of each intersection point is marked. The intersection points of each edge are sorted in ascending order by distance from the starting point of the edge. Based on the sorting result, jump arrays nextA, nextB, prevA, and prevB are constructed to record the next intersection point along the first polygon forward direction, the second polygon forward direction, the first polygon backward direction, and the second polygon backward direction, respectively. Based on the type of each intersection point, intersection, union, difference, and / or XOR operations are performed to obtain the intersection region detection result, union region detection result, difference region detection result, and / or XOR region detection result of the two components. Specifically, the intersection operation involves tracing from an unvisited intersection point of type "entry point" using alternating `nextB` and `nextA`; the union operation involves tracing from an unvisited intersection point of type "exit point" using alternating `nextB` and `nextA`; the difference operation involves tracing from an unvisited intersection point of type "exit point" using alternating `nextA` and `prevB`; and the XOR operation involves tracing from all intersection points of type "exit point" using alternating `nextA` and `prevB`, and from all intersection points of type "entry point" using alternating `nextB` and `prevA`, and then merging the results. Furthermore, during the tracing process, the vertices of the first or second polygon between adjacent intersection points are added to the tracing result sequentially.

2. The component spatial relationship detection method based on polygon Boolean operations according to claim 1, characterized in that, The step of obtaining the projected outline polygons of the two components and standardizing them to a counterclockwise direction includes: Obtain the projected polygonal outlines of the two components; The area of ​​the projected outline polygon is obtained by the following formula. : in, For the projected outline polygon vertices coordinate; For the projected outline polygon vertices coordinate; For the projected outline polygon vertices coordinate; For the projected outline polygon vertices coordinate; when At the same time, preserve the vertex sequence of the projected contour polygon; when At this time, the vertex sequence of the projected contour polygon is reversed.

3. The component spatial relationship detection method based on polygon Boolean operations according to claim 1, characterized in that, The detection of the intersection of the first polygon and the second polygon includes: Get the total number of vertices of the first polygon and the second polygon; When the total number of vertices is less than a preset threshold, a pairwise detection method based on axis-aligned bounding box pruning is used to detect candidate intersection pairs of the first and second polygons; otherwise, a scanline algorithm is used to detect candidate intersection pairs of the first and second polygons. Line segment intersection tests are performed based on candidate intersecting edge pairs to obtain the intersection point and its coordinates.

4. The component spatial relationship detection method based on polygon Boolean operations according to claim 3, characterized in that, The line segment intersection test based on candidate intersecting edge pairs includes: Let candidate intersecting edge pairs be edge a and edge b; when and and At that time, there is an intersection point between edge a and edge b, and the coordinates of the intersection point are: ; in, Let be the cross product of edge a and edge b; The position parameter of the intersection point on edge a; The position parameter of the intersection point on edge b; This is the floating-point precision threshold. Let be the coordinates of the starting point of edge a; Let be the coordinates of the endpoint of edge a; Let be the coordinates of the starting point of edge b; Let be the coordinates of the endpoint of edge b; This is the cross product operation.

5. The component spatial relationship detection method based on polygon Boolean operations according to claim 1, characterized in that, The types of the marked intersection points include: The cross product of each intersection point is obtained using the following formula. : in, Let be the edge vector of the edge containing the intersection point in the first polygon; Let be the edge vector of the edge to which the intersection point belongs in the second polygon; This is the cross product operation; when The type of the intersection point is marked as an entry point; when The type of the intersection point is marked as an exit point.

6. The component spatial relationship detection method based on polygon Boolean operations according to claim 1, characterized in that, The method of sorting the intersection points of each edge in ascending order by distance from the starting point of the edge includes: obtaining the distance between the intersection point and the starting point of the edge using the following formula. : in, The coordinates of the intersection point; The coordinates of the starting point of the edge containing the intersection point; The coordinates of the endpoint of the edge containing the intersection point; This represents the vector dot product operation; This indicates the length of the side containing the intersection point.

7. The component spatial relationship detection method based on polygon Boolean operations according to claim 1, characterized in that, Before detecting the intersection of the first polygon and the second polygon, the method further includes: When a vertex of one polygon in the first polygon or the second polygon lies on the edge of the other polygon, offset all vertices of that polygon. ;in, As a preset disturbance, The coefficients are non-integer coefficients.

8. A component spatial relationship detection system based on polygon Boolean operations, characterized in that, include: The intersection processing module is used to obtain the projected outline polygons of two components and standardize them to a counterclockwise direction to obtain a first polygon and a second polygon, and to detect the intersection points of the first polygon and the second polygon and mark the type of each intersection point; The jump array module is used to sort the intersection points of each edge in ascending order by distance from the starting point of the edge, and construct jump arrays nextA, nextB, prevA, and prevB based on the sorting result to record the next intersection point along the first polygon forward direction, the second polygon forward direction, the first polygon backward direction, and the second polygon backward direction, respectively. The relationship detection module is used to perform intersection, union, difference and / or XOR operations based on the type of each intersection point to obtain the intersection region detection result, union region detection result, difference region detection result and / or XOR region detection result of the two components; Specifically, the intersection operation involves tracing from unvisited intersections of type "entry point" using alternating steps of nextB and nextA; the union operation involves tracing from unvisited intersections of type "exit point" using alternating steps of nextB and nextA; the difference operation involves tracing from unvisited intersections of type "exit point" using alternating steps of nextA and prevB; the XOR operation involves tracing from all intersections of type "exit point" using alternating steps of nextA and prevB, and from all intersections of type "entry point" using alternating steps of nextB and prevA, and then merging them; furthermore, during the tracing process, the vertices of the first or second polygon between adjacent intersections are added to the tracing result in sequence.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the component spatial relationship detection method based on polygon Boolean operations as described in any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the component spatial relationship detection method based on polygon Boolean operations as described in any one of claims 1 to 7.