Polygon offsetting method, apparatus, medium, and device in circuit layout

CN122886522APending Publication Date: 2026-10-09ORIGIN QUANTUM INSTR CO
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510375991.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-27
Publication Date
2026-10-09

AI Technical Summary

Technical Problem

[0003]本发明的目的是提供一种电路版图中多边形的偏移方法、装置、存储介质及电子设备,以解决现有技术中需要手动逐一移动多边形的每条边线完成偏移的问题,能够快速对多边形完成偏移,提高版图布线效率

Benefits of technology

[0039]区别于现有技术的情况,本发明提供的电路版图中多边形的偏移方法在获取目标多边形的偏移方位后,先按照偏移方位将每一边线法向移动预设距离得到平行线段,再依次确定相邻两条边线中后一边线的尾端点相对于前一边线的相对方位,然后在相对方位与偏移方位相反时,将对应两条平行线段所在直线的第一交点作为两者的公共端点,最后构建到目标多边形的欧几里得区域,将每一平行线段位于欧几里得区域外的部分作为偏移线段,如果所有偏移线段围合成多边形,那么将所围合而成的多边形作为目标多边形的偏移结果。通过上述方式,本发明能够快速对多边形完成偏移,因此可以提高版图布线效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122886522A_ABST
    Figure CN122886522A_ABST
Patent Text Reader

Abstract

The application discloses a polygon offsetting method and device in a circuit layout, a medium and equipment. The method comprises the following steps: obtaining an offset direction of a target polygon in a circuit layout, the target polygon being sequentially connected by a plurality of edges; moving each edge normal by a preset distance according to the offset direction to obtain parallel line segments; determining the relative position of the tail end point of a latter edge relative to a former edge among two adjacent edges; when the relative position is opposite to the offset direction, taking the first intersection point of the straight line where the corresponding two parallel line segments are located as the common end point of the two parallel line segments, and updating the corresponding two parallel line segments; constructing a detection area where the shortest distance from the boundary to the target polygon is less than the preset distance and is a fixed value, and taking the part of each parallel line segment located outside the detection area as an offset line segment; when all the offset line segments enclose a polygon, taking the polygon as the offset result of the target polygon. The application can quickly offset the polygon, and improve the layout efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of circuit layout design, and in particular to a method, apparatus, medium, and device for offsetting polygons in a circuit layout. Background Technology

[0002] In circuit layout design, different polygons are typically drawn to represent circuit entities such as components, pads, and buses. Sometimes, it's necessary to adjust the size of the drawn polygons without changing their shape. In this case, it's sufficient to offset the drawn polygons, either expanding or shrinking them, without redrawing new polygons. However, current layout software does not support polygon offsetting. Therefore, designers must manually move each edge of the polygon one by one, which is tedious, error-prone, and leads to low layout routing efficiency. Summary of the Invention

[0003] The purpose of this invention is to provide a method, apparatus, storage medium, and electronic device for offsetting polygons in a circuit layout, so as to solve the problem in the prior art that each edge of the polygon needs to be moved manually one by one to complete the offset, and to quickly offset the polygon, thereby improving the efficiency of layout routing.

[0004] To solve the above-mentioned technical problems, the present invention provides a method for offsetting polygons in a circuit layout, comprising:

[0005] Obtain the offset orientation of the target polygon formed by sequentially connecting multiple edge lines in the circuit layout;

[0006] Each edge is moved a preset distance along its normal direction according to the offset orientation to obtain parallel line segments;

[0007] Determine the relative position of the tail end point of the latter sideline with respect to the former sideline in sequence among two adjacent sidelines;

[0008] When the relative orientation and the offset orientation are opposite, the first intersection point of the lines containing the two parallel line segments is taken as the common endpoint of the two, and the two parallel line segments are updated.

[0009] Construct a detection region where the shortest distance from the boundary to the target polygon is less than the preset distance and is a fixed value, and take the portion of each parallel line segment outside the detection region as an offset line segment;

[0010] When all offset line segments form a polygon, the resulting polygon is taken as the offset result of the target polygon.

[0011] Preferably, before the detection region where the shortest distance from the constructed boundary to the target polygon is less than the preset distance and is a fixed value, the offset method further includes:

[0012] When the relative orientation and the offset orientation are the same, detect whether the two corresponding parallel line segments intersect directly;

[0013] If they intersect directly, the second intersection point formed by the direct intersection is taken as the common endpoint of the two parallel line segments, and the two parallel line segments are updated accordingly.

[0014] If they do not intersect directly, keep the corresponding two parallel line segments unchanged.

[0015] Preferably, the offset method further includes:

[0016] If none of the offset segments form a polygon, a message indicating that the offset has failed is generated.

[0017] Preferably, before obtaining the offset orientation of the target polygon formed by multiple sequentially connected edges in the circuit layout, the offset method further includes:

[0018] Merge two adjacent sidelines that are on the same straight line into one.

[0019] Preferably, obtaining the offset orientation of the target polygon formed by sequentially connecting multiple edge lines in the circuit layout includes:

[0020] Obtain the offset point set on the circuit layout;

[0021] Find the edge line on the target polygon that is closest to the offset point;

[0022] The relative orientation of the offset point with respect to the nearest edge is taken as the offset orientation of the target polygon.

[0023] Preferably, the detection region where the shortest distance from the constructed boundary to the target polygon is less than the preset distance and is a fixed value includes:

[0024] Construct a circle with a radius smaller than the preset distance and a fixed value, using each vertex of the target polygon as the center;

[0025] Construct a closed line that connects two adjacent circles and is tangent to both adjacent circles;

[0026] Obtain the outer contour located outside the target polygon and at least one inner contour located inside the target polygon, among all the contours composed of circles and closed lines, whose shortest distance to the target polygon is the fixed value;

[0027] A Boolean subtraction operation is performed on the outer contour and the inner contour to form a detection area.

[0028] Preferably, the step of using the enclosed polygon as the offset result of the target polygon further includes:

[0029] Delete the offset segments that do not form a polygon, as well as the portions of the offset segments that do form a polygon that are outside the polygon.

[0030] To solve the above-mentioned technical problems, the present invention also provides a polygon offset device in a circuit layout, comprising:

[0031] The acquisition module is used to acquire the offset orientation of a target polygon formed by sequentially connecting multiple edge lines in a circuit layout.

[0032] The offset module is used to move each sideline normal by a preset distance according to the offset orientation to obtain parallel line segments;

[0033] The determination module is used to determine the relative orientation of the tail end point of the latter sideline with respect to the former sideline in sequence between two adjacent sidelines.

[0034] The adjustment module is used to take the first intersection point of the straight lines containing the two parallel line segments as the common endpoint of the two when the relative orientation and the offset orientation are opposite, and update the two parallel line segments.

[0035] The construction module is used to construct a detection region where the shortest distance from the boundary to the target polygon is less than the preset distance and is a fixed value, and to take the part of each parallel line segment outside the detection region as an offset line segment;

[0036] The output module is used to take the polygon formed by all offset line segments as the offset result of the target polygon.

[0037] To address the aforementioned technical problems, the present invention also provides a storage medium storing a computer program configured to execute, during runtime, the polygon offset method in the circuit layout described in any of the preceding claims.

[0038] To address the aforementioned technical problems, the present invention also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the polygon offset method in the circuit layout described in any of the preceding claims.

[0039] Unlike existing technologies, the polygon offset method in the circuit layout provided by this invention, after obtaining the offset orientation of the target polygon, first moves the normal of each edge by a preset distance according to the offset orientation to obtain parallel line segments. Then, it sequentially determines the relative orientation of the tail endpoint of the latter edge relative to the former edge in two adjacent edges. When the relative orientation is opposite to the offset orientation, the first intersection point of the lines containing the corresponding two parallel line segments is taken as their common endpoint. Finally, it constructs the Euclidean region of the target polygon, taking the portion of each parallel line segment outside the Euclidean region as the offset line segment. If all offset line segments form a polygon, then the enclosed polygon is taken as the offset result of the target polygon. Through this method, this invention can quickly offset polygons, thus improving layout routing efficiency.

[0040] The polygon offset device, storage medium, and electronic device in the circuit layout provided by this invention belong to the same inventive concept as the polygon offset method in the circuit layout, and therefore have the same beneficial effects, which will not be repeated here. Attached Figure Description

[0041] Figure 1 This is a flowchart illustrating a method for offsetting polygons in a circuit layout provided in an embodiment of the present invention.

[0042] Figure 2 A schematic diagram of each side of the target polygon and the parallel line segments formed by its outward offset.

[0043] Figure 3 for Figure 2 The diagram shows the updated parallel line segments.

[0044] Figure 4 This is a schematic diagram of parallel line segments and the detection area.

[0045] Figure 5 This is a partial flowchart illustrating a method for offsetting polygons in a circuit layout according to another embodiment of the present invention.

[0046] Figure 6 A schematic diagram of each side of the target polygon and the parallel line segments formed by its inward offset.

[0047] Figure 7 for Figure 6 The diagram shows the updated parallel line segments.

[0048] Figure 8 for Figure 2 A schematic diagram of each side of the target polygon and the parallel line segments formed by its excessive inward offset.

[0049] Figure 9This is a schematic diagram of a target polygon containing two adjacent edges that lie on the same straight line.

[0050] Figure 10 This is a schematic diagram of the circles and closing lines constructed from a target polygon.

[0051] Figure 11 According to Figure 10 A schematic diagram of the detection area formed by the outline shown.

[0052] Figure 12 This is a schematic diagram of a target polygon containing 5 sides.

[0053] Figure 13 To Figure 12 The diagram shows the updated parallel line segments formed by the offset of the edge lines.

[0054] Figure 14 To Figure 12 A schematic diagram of the detection region constructed from the target polygon.

[0055] Figure 15 For the reason Figure 14 A schematic diagram of the parallel line segments and the offset line segments obtained from the detection area.

[0056] Figure 16 for Figure 12 A schematic diagram of the offset results of the target polygon in the diagram.

[0057] Figure 17 This is a schematic diagram of a target polygon containing four sides.

[0058] Figure 18 To Figure 17 The diagram shows the updated parallel line segments formed by the offset of the edge lines.

[0059] Figure 19 To Figure 17 A schematic diagram of the detection region constructed from the target polygon.

[0060] Figure 20 For the reason Figure 19 A schematic diagram of the parallel line segments and the offset line segments obtained from the detection area.

[0061] Figure 21 for Figure 17 A schematic diagram of the offset results of the target polygon in the diagram.

[0062] Figure 22 A schematic block diagram of a polygon offset device in a circuit layout provided for another embodiment of the present invention. Detailed Implementation

[0063] The specific embodiments of the present invention will now be described in more detail with reference to the accompanying drawings. The advantages and features of the present invention will become clearer from the following description and claims. It should be noted that the drawings are all in a very simplified form and use non-precise proportions, and are only used to facilitate and clarify the illustration of the embodiments of the present invention.

[0064] In the description of this invention, it should be understood that the terms "center", "upper", "lower", "left", "right", etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this invention.

[0065] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.

[0066] Please refer to Figure 1 This invention provides a method for offsetting polygons in a circuit layout, the method comprising the following steps:

[0067] S1: Obtain the offset orientation of the target polygon formed by connecting multiple edge lines sequentially in the circuit layout.

[0068] In circuit wiring design, circuit entities are usually represented by polygons formed by their outlines. The target polygon is formed by connecting multiple edges in sequence. These edges have a connection order, which can be a specified order or the order of drawing time. Regardless of the order of the edges of the target polygon, they are connected in sequence according to the current order. That is, the first endpoint of the next edge is the last endpoint of the previous edge, and the last endpoint of the last edge is the first endpoint of the first edge.

[0069] Offset orientation is a relative direction, either left or right. In other words, the offset orientation of the target polygon is either left or right.

[0070] The target polygon can be determined based on external input, such as when a user selects a polygon on a circuit layout using the mouse, thus selecting it as the target polygon.

[0071] S2: Move the normal of each sideline by a preset distance according to the offset orientation to obtain parallel line segments.

[0072] When offsetting a sideline, the offset direction is relative to the sideline itself. The direction of the sideline is the direction from its first endpoint to its last endpoint, which is a vector direction. Therefore, the offset direction is either to the left or to the right of this vector direction. Taking the leftward direction as an example, if the sideline's direction is clockwise, then the sideline will offset to the left relative to itself, that is, outward, forming a parallel line segment. If the sideline's direction is counterclockwise, then the sideline will offset to the left relative to itself, that is, inward, forming a parallel line segment.

[0073] The preset distance can be set according to actual needs, and there are no restrictions on the value of this distance.

[0074] like Figure 2 The diagram shows each side of the target polygon and the parallel line segments formed by its outward offset. Assuming the offset direction is to the left, the target polygon T1 contains three sides H1, H2, and H3. The arrows on the three sides H1, H2, and H3 indicate the direction from the first endpoint to the last endpoint. Offset the three sides H1, H2, and H3 to the left to obtain three parallel line segments P1, P2, and P3.

[0075] S3: Determine the relative position of the tail end point of the latter sideline with respect to the former sideline in sequence among two adjacent sidelines.

[0076] Since the edges have a specific order, adjacent edges can be determined sequentially. The tail endpoint of the preceding edge becomes the head endpoint of the following edge. Therefore, the endpoint of the following edge furthest from the head endpoint is its tail endpoint. The relative orientation of the tail endpoint of the following edge with respect to the preceding edge is the orientation of its vector direction relative to the preceding edge; it is either to the left or to the right. Thus, the relative orientation and the offset orientation are either the same or opposite.

[0077] like Figure 2 As shown, edge lines H1 and H2 are adjacent. The tail end of edge line H2 is positioned to the right relative to edge line H1, while the offset position of the target polygon T1 is to the left. Therefore, the relative position and the offset position are opposite.

[0078] S4: When the relative orientation and the offset orientation are opposite, take the first intersection point of the lines containing the corresponding two parallel line segments as the common endpoint of the two, and update the corresponding two parallel line segments.

[0079] In this scenario, for any two parallel line segments of two adjacent sidelines that are not parallel, their lines must intersect at a point, which is denoted as the first intersection point. If the relative orientation and the offset orientation are opposite, extend the first sideline towards the first intersection point, making the first intersection point the tail endpoint of the first sideline. Similarly, extend the second sideline towards the first intersection point, making the first intersection point the head endpoint of the second sideline. This is equivalent to increasing the length of the two parallel line segments of the two adjacent sidelines.

[0080] Please refer to the reference. Figure 2 and Figure 3 , Figure 3 yes Figure 2 The diagram shows the updated parallel line segments. Parallel line segments P1 and P2 correspond to edge lines H1 and H2, and parallel line segments P2 and P3 correspond to edge lines H2 and H3. Any two adjacent edge lines satisfy the condition that their relative orientation and offset orientation are opposite. Therefore, the first intersection point J12 of the lines containing parallel line segments P1 and P2 is taken as the tail endpoint of parallel line segment P1 and the head endpoint of parallel line segment P2. The first intersection point J23 of the lines containing parallel line segments P2 and P3 is taken as the tail endpoint of parallel line segment P2 and the head endpoint of parallel line segment P3.

[0081] S5: Construct a detection region where the shortest distance from the boundary to the target polygon is less than a preset distance and is a fixed value, and take the part of each parallel line segment outside the detection region as an offset line segment.

[0082] For a given line segment, there exists a contour enclosing the line segment. The shortest distance from any point on this contour to the line segment is a fixed value, also known as the Euclidean distance. The area covered by this contour is also called the Euclidean region. The boundary of the detection area is the contour that satisfies the Euclidean distance. In this embodiment, the fixed value can be set according to actual needs, for example, slightly less than a preset distance.

[0083] If any parallel line segment has a portion within the detection area, that portion is deleted, while the remaining portion—that is, the part of the parallel line segment outside the detection area—is retained. It should be noted that the portion of the parallel line segment that overlaps with the boundary of the detection area can be determined as either the deleted or retained portion based on actual needs.

[0084] Please refer to the reference. Figure 4 , Figure 4This is a schematic diagram of parallel line segments and the detection area. In the diagram, the detection area is the region between two boundaries K (shown by dashed lines). The shortest distance from any point on any boundary to the target polygon T1 is a fixed value, which is less than a preset distance. Parallel line segments P1, P2, and P3 are not located within the detection area, so they are all retained. Therefore, the parallel line segments P1, P2, and P3 in the diagram are used as offset line segments.

[0085] S6: When all offset line segments form a polygon, the polygon formed is used as the offset result of the target polygon.

[0086] When all or part of the offset line segments intersect each other, they will form a polygon. These polygons are used as the offset result of the target polygon, thus realizing the offset of the target polygon.

[0087] like Figure 4 As shown, the offset line segments P1, P2, and P3 form a polygon T2, which becomes the offset result of the target polygon T1.

[0088] In the above-described manner, the polygon offset method in the circuit layout provided by this invention moves the normal of each side of the target polygon a preset distance according to the offset orientation to obtain parallel line segments. Then, it determines the relative orientation of the tail endpoint of the latter side relative to the former side in two adjacent side lines. When the relative orientation is opposite to the offset orientation, the first intersection point of the lines containing the corresponding two parallel line segments is taken as their common endpoint. Next, a detection area of ​​the target polygon is constructed, and the portion of each parallel line segment outside the detection area is taken as the offset line segment. Finally, when all the offset line segments enclose a polygon, the resulting polygon is taken as the offset result of the target polygon. Through this method, the present invention can quickly offset polygons, thus improving layout routing efficiency.

[0089] Please refer to Figure 5 This is a partial flowchart illustrating a polygon offset method in a circuit layout according to another embodiment of the present invention. Based on the steps of the foregoing embodiments, before constructing a detection region where the shortest distance from the boundary to the target polygon is less than a preset distance and is a fixed value, i.e., before step S5, the offset method further includes:

[0090] S71: When the relative orientation and offset orientation are the same, detect whether the corresponding two parallel line segments intersect directly.

[0091] Among them, when the relative orientation and the offset orientation are the same, the corresponding two parallel line segments of two adjacent initial line segments may intersect directly or they may not intersect.

[0092] S72: If they intersect directly, take the second intersection point formed by the direct intersection as the common endpoint of the two parallel line segments, and update the two parallel line segments.

[0093] If the lines intersect directly, the intersection point is designated as the second intersection point. The portion of the preceding parallel line segment that extends beyond the second intersection point is shortened to the second intersection point, making the second intersection point the tail endpoint of the preceding parallel line segment. Similarly, the portion of the following parallel line segment that extends beyond the second intersection point is shortened to the second intersection point, making the second intersection point the head endpoint of the following parallel line segment. This is equivalent to shortening the lengths of the corresponding parallel line segments of the two adjacent initial line segments.

[0094] Please refer to the reference. Figure 6 and Figure 7 , Figure 6 It is a schematic diagram of each side of the target polygon and the parallel line segments formed by its inward offset. Figure 7 yes Figure 6 The diagram shows the updated parallel line segments. Assuming the offset is to the right, the target polygon contains three edges H1, H2, and H3. The arrows on edges H1, H2, and H3 indicate the direction from the first endpoint to the last endpoint. All three edges H1, H2, and H3 are offset to the right, resulting in three parallel line segments P1, P2, and P3. Parallel line segments P1 and P2 intersect directly at the second intersection point B12, parallel line segments P2 and P3 intersect directly at the second intersection point B23, and parallel line segments P3 and P1 intersect directly at the second intersection point B31. Therefore, parallel line segments P1, P2, and P3 are all shortened, forming... Figure 7 The parallel line segments shown.

[0095] S73: If there is no direct intersection, keep the corresponding two parallel line segments unchanged.

[0096] If there is no direct intersection, it means that the preset distance is set too large, resulting in no parallel line segments intersecting.

[0097] Please refer to Figure 8 , Figure 8 yes Figure 2 The diagram illustrates each side of the target polygon and the parallel line segments formed by its excessive inward offset. Assuming the offset is to the right, the target polygon contains three sides H1, H2, and H3. The arrows on the three sides H1, H2, and H3 indicate the direction from the first endpoint to the last endpoint. All three sides H1, H2, and H3 are offset to the right, resulting in three parallel line segments P1, P2, and P3. Parallel line segments P1 and P2 do not intersect directly, parallel line segments P2 and P3 do not intersect directly, and parallel line segments P3 and P1 do not intersect directly. Therefore, these parallel line segments P1, P2, and P3 neither extend nor shorten, but remain unchanged.

[0098] In some embodiments of this application, please refer to [the relevant documentation]. Figure 1 The offset method also includes:

[0099] S8: Generate a message indicating offset failure when all offset segments fail to form any polygon.

[0100] Please continue to refer to this. Figure 8 , Figure 8 Parallel line segments P1, P2, and P3 located outside the detection area of ​​the target polygon are considered as offset line segments. It can be seen that no offset line segments form a polygon. Therefore, a prompt indicating offset failure will be generated to prompt the user to modify the preset distance and offset orientation and perform offset again.

[0101] In some embodiments of this application, before obtaining the offset orientation of the target polygon in the circuit layout that is sequentially connected by multiple edge lines, i.e. before step S1, the offset method further includes: merging two adjacent edge lines located on the same straight line into one.

[0102] In layout drawing, sometimes two connected edges are drawn on a straight line. Such edges appear to be one, but the layout data records two. Therefore, when offsetting these edges, it is equivalent to offsetting only the merged line segment of the two. Thus, merging such edges into one can reduce the complexity of offsetting.

[0103] Please refer to Figure 9 This is a schematic diagram of a target polygon containing two adjacent edges lying on the same straight line. In the diagram, the target polygon contains edges H1, H2, H3, and H4. Edges H1 and H2 lie on a straight line; therefore, edges H1 and H2 are merged into a new edge. It should be noted that the order of the merged edges needs to be redefined.

[0104] In some embodiments of this application, the offset orientation can be obtained by setting a point on a circuit layout. Specifically, the step of obtaining the offset orientation of a target polygon formed by sequentially connecting multiple edge lines in the circuit layout, i.e., step S1, includes:

[0105] S11: Get the offset point set on the circuit layout.

[0106] An offset point is a coordinate point in a circuit layout. Offset points can be obtained in various ways, such as by clicking with a mouse, where the mouse cursor position is the offset point, or by the user selecting the offset point by inputting coordinates.

[0107] S12: Find the edge of the target polygon that is closest to the offset point.

[0108] The distance between the offset point and different edges of the target polygon is different, but there must be one edge that is closest to the offset point. The closest edge can be found by comparing the distances.

[0109] S13: Use the relative orientation of the offset point with respect to the nearest edge as the offset orientation of the target polygon.

[0110] Among them, the direction from the first endpoint to the last endpoint of the nearest edge is a vector direction, and the position of the offset point relative to this vector direction is the offset position of the target polygon. All edges of the target polygon need to be based on this offset position when offsetting.

[0111] To quickly construct the detection region, in this embodiment, the step of constructing a detection region whose shortest distance from the boundary to the target polygon is less than a preset distance and is a fixed value includes:

[0112] S51: Construct a circle with a radius smaller than a preset distance and a fixed value, centered on each vertex of the target polygon.

[0113] S52: Construct a closed line that connects two adjacent circles and is tangent to both adjacent circles.

[0114] In this system, two adjacent circles are circles whose centers are two adjacent vertices. The closing line of the two adjacent circles is tangent to both circles and parallel to the line connecting their centers.

[0115] Please refer to Figure 10 This is a schematic diagram of the circles and closed lines constructed from a target polygon. If the target polygon has three edges, then 8 circles R and 16 closed lines F will be constructed (only some of the closed lines are marked in the diagram).

[0116] S53: Obtain the outer contour located outside the target polygon and at least one inner contour located inside the target polygon, which are among the contours composed of all circles and closed lines and whose shortest distance to the target polygon is a fixed value.

[0117] Since the target polygon is a closed shape, the contours formed by all circles and closed lines include both the part outside the target polygon (i.e., the outer contour located outside the target polygon) and the part inside the target polygon (i.e., the inner contour located inside the target polygon). Both parts contain contours whose shortest distance to the target polygon is a fixed value, and there may be more than one inner contour that satisfies the condition that the shortest distance to the target polygon is a fixed value. Therefore, there is at least one inner contour.

[0118] S54: Perform a Boolean subtraction operation on the outer contour and the inner contour to form the detection area.

[0119] The area between the outer contour and the inner contour is the detection area, which can be obtained by performing a Boolean subtraction operation between the outer contour and the inner contour.

[0120] Please refer to Figure 11 It is based on Figure 10 This is a schematic diagram of the detection area formed by the shown contour. The detection area includes an outer contour and two inner contours.

[0121] In some embodiments of this application, all offset line segments may form multiple polygons, or some offset line segments may not form polygons. The following will further explain this application in conjunction with different target polygons.

[0122] Please refer to Figures 12 to 16 , Figure 12 In the diagram, the target polygon includes 5 edges H1, H2, H3, H4, and H5, offset to the left, meaning each edge is offset to the left. After steps S2 to S4 and steps S71 and S72, the desired result is obtained. Figure 13 The parallel line segments P1, P2, P3, P4, and P5 are shown. After step S5, we obtain... Figure 14 The detection area shown includes an outer contour and an inner contour. The portion of each parallel line segment within the detection area is deleted, resulting in... Figure 15 The offset line segments are shown. These offset line segments form two polygons, and the final two polygons are used as the offset result of the target polygon, resulting in... Figure 16 The offset results are shown.

[0123] Please refer to Figures 17 to 21 , Figure 17 In the diagram, the target polygon includes four edges H1, H2, H3, and H4, and is a self-intersecting polygon. The offset direction is to the left, meaning each edge is offset to the left. After steps S2 to S4 and steps S71 and S72, the following is obtained: Figure 18 The parallel line segments P1, P2, P3, and P4 are shown. After step S5, we obtain... Figure 19 The detection area shown includes an outer contour and two inner contours. The portion of each parallel line segment within the detection area is deleted, resulting in... Figure 20 The offset line segments are shown. Three of these offset line segments form a triangle, while the other three do not form a polygon. The final triangle is used as the offset result of the target polygon, resulting in... Figure 21 The offset results are shown.

[0124] In this embodiment of the application, the step of using the enclosed polygon as the offset result of the target polygon further includes: deleting the offset line segments that do not enclose a polygon and the portions of the offset line segments that enclose a polygon located outside the polygon.

[0125] Among the offset segments that form a polygon, some segments intersect, resulting in a portion of the offset segments outside the polygon; this portion needs to be deleted. Offset segments that do not form a polygon are considered failed offsets and also need to be deleted.

[0126] like Figure 20 As shown, the three offset line segments at the top need to be deleted. Two of the three offset line segments forming a triangle intersect, and the parts of these two intersecting offset line segments outside the triangle also need to be deleted.

[0127] Please refer to Figure 22 Another embodiment of the present invention also provides a polygon offset device in a circuit layout, the device comprising:

[0128] The acquisition module 11 is used to acquire the offset orientation of the target polygon formed by connecting multiple edge lines in sequence in the circuit layout.

[0129] In circuit wiring design, circuit entities are typically represented by polygons formed by their outlines. A target polygon is composed of multiple edges connected sequentially. These edges have a connection order, which can be a specified order or a chronological order of drawing. Regardless of the edge order of the target polygon, they are connected sequentially according to the current order; that is, the first endpoint of the next edge is the last endpoint of the previous edge, and the last endpoint of the last edge is the first endpoint of the first edge. Offset orientation is a relative left or right direction; that is, the offset orientation is either left-hand or right-hand. In other words, the offset orientation of the target polygon is either left-hand or right-hand. The target polygon can be determined based on external input, such as when a user selects a polygon on the circuit layout using the mouse, thus designating it as the target polygon.

[0130] The offset module 12 is used to move the normal of each sideline by a preset distance according to the offset orientation to obtain parallel line segments.

[0131] When offsetting a sideline, the offset direction is relative to the sideline itself. The direction of the sideline is the direction from its first endpoint to its last endpoint, which is a vector direction. Therefore, the offset direction is either to the left or right of this vector direction. Taking the leftward direction as an example, if the sideline direction is clockwise, then the sideline will offset to the left relative to itself, i.e., outward, forming a parallel line segment. If the sideline direction is counterclockwise, then the sideline will offset to the left relative to itself, i.e., inward, forming a parallel line segment. The preset distance can be set according to actual needs, and there are no restrictions on the value of this distance.

[0132] The determination module 13 is used to determine the relative position of the tail end point of the latter sideline relative to the former sideline in sequence among two adjacent sidelines.

[0133] Since the edges have a specific order, adjacent edges can be determined sequentially. The tail endpoint of the preceding edge becomes the head endpoint of the following edge. Therefore, the endpoint of the following edge furthest from the head endpoint is its tail endpoint. The relative orientation of the tail endpoint of the following edge with respect to the preceding edge is the orientation of its vector direction relative to the preceding edge; it is either to the left or to the right. Thus, the relative orientation and the offset orientation are either the same or opposite.

[0134] The adjustment module 14 is used to take the first intersection point of the straight lines containing the two parallel line segments as the common endpoint of the two when the relative orientation and the offset orientation are opposite, and to update the two parallel line segments.

[0135] In this scenario, for any two parallel line segments of two adjacent sidelines that are not parallel, their lines must intersect at a point, which is denoted as the first intersection point. If the relative orientation and the offset orientation are opposite, extend the first sideline towards the first intersection point, making the first intersection point the tail endpoint of the first sideline. Similarly, extend the second sideline towards the first intersection point, making the first intersection point the head endpoint of the second sideline. This is equivalent to increasing the length of the two parallel line segments of the two adjacent sidelines.

[0136] The construction module 15 is used to construct a detection area where the shortest distance from the boundary to the target polygon is less than a preset distance and is a fixed value, and to take the part of each parallel line segment outside the detection area as an offset line segment.

[0137] In this system, for a line segment, there exists a contour enclosing the line segment. The shortest distance from any point on this contour to the line segment is a fixed value, also known as the Euclidean distance. The area covered by this contour is also called the Euclidean region. The boundary of the detection region is the contour that satisfies the Euclidean distance. In this embodiment, the fixed value can be set according to actual needs, for example, slightly less than a preset distance. If any parallel line segment has a portion within the detection region, that portion is deleted, while the remaining portion, i.e., the portion of the parallel line segment outside the detection region, is retained. It should be noted that the portion of the parallel line segment that overlaps with the boundary of the detection region can be determined as either the portion to be deleted or the portion to be retained, depending on actual needs.

[0138] The output module 16 is used to take the polygon formed by all offset line segments as the offset result of the target polygon when all offset line segments form a polygon.

[0139] When all or part of the offset line segments intersect each other, they will form a polygon. These polygons are used as the offset result of the target polygon, thus realizing the offset of the target polygon.

[0140] The polygon offset device in the circuit layout of this embodiment may also include other technical features of the polygon offset method in the circuit layout of the foregoing embodiment, implement all the steps of the polygon offset method in the circuit layout of the foregoing embodiment, and have the same technical effect as the polygon offset method in the circuit layout of the foregoing embodiment, which will not be repeated here.

[0141] The present invention also provides a storage medium storing a computer program configured to execute, at runtime, the polygon offset method in the circuit layout of the foregoing embodiments.

[0142] Specifically, in this embodiment, the storage medium may include, but is not limited to, USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks, and other media capable of storing computer programs.

[0143] The present invention also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the polygon offset method in the circuit layout of the foregoing embodiments.

[0144] Specifically, the memory and processor can be connected via a data bus. Furthermore, the aforementioned electronic device may also include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0145] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," or "specific example," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments. In addition, those skilled in the art can combine and integrate the different embodiments or examples described in this specification.

[0146] The above are merely preferred embodiments of the present invention and do not constitute any limitation on the present invention. Any equivalent substitutions or modifications made by those skilled in the art to the technical solutions and content disclosed in the present invention without departing from the scope of the present invention shall be deemed to have remained within the protection scope of the present invention.

Claims

1. A method for offsetting polygons in a circuit layout, characterized in that, include: Obtain the offset orientation of the target polygon formed by sequentially connecting multiple edge lines in the circuit layout; Each edge is moved a preset distance along its normal direction according to the offset orientation to obtain parallel line segments; Determine the relative position of the tail end point of the latter sideline with respect to the former sideline in sequence among two adjacent sidelines; When the relative orientation and the offset orientation are opposite, the first intersection point of the lines containing the two parallel line segments is taken as the common endpoint of the two, and the two parallel line segments are updated. Construct a detection region where the shortest distance from the boundary to the target polygon is less than the preset distance and is a fixed value, and take the portion of each parallel line segment outside the detection region as an offset line segment; When all offset line segments form a polygon, the resulting polygon is taken as the offset result of the target polygon.

2. The offset method according to claim 1, characterized in that, Before the detection region where the shortest distance from the constructed boundary to the target polygon is less than the preset distance and is a fixed value, the offset method further includes: When the relative orientation and the offset orientation are the same, detect whether the two corresponding parallel line segments intersect directly; If they intersect directly, the second intersection point formed by the direct intersection is taken as the common endpoint of the two parallel line segments, and the two parallel line segments are updated accordingly. If they do not intersect directly, keep the corresponding two parallel line segments unchanged.

3. The offset method according to claim 1 or 2, characterized in that, The offset method further includes: If none of the offset segments form a polygon, a message indicating that the offset has failed is generated.

4. The offset method according to claim 1, characterized in that, Before obtaining the offset orientation of the target polygon in the circuit layout, which is composed of multiple edges connected sequentially, the offset method further includes: Merge two adjacent sidelines that are on the same straight line into one.

5. The offset method according to claim 1, characterized in that, The acquisition of the offset orientation of the target polygon formed by sequentially connecting multiple edge lines in the circuit layout includes: Obtain the offset point set on the circuit layout; Find the edge line on the target polygon that is closest to the offset point; The relative orientation of the offset point with respect to the nearest edge is taken as the offset orientation of the target polygon.

6. The offset method according to claim 1, characterized in that, The detection region where the shortest distance from the constructed boundary to the target polygon is less than the preset distance and is a fixed value includes: Construct a circle with a radius smaller than the preset distance and a fixed value, using each vertex of the target polygon as the center; Construct a closed line that connects two adjacent circles and is tangent to both adjacent circles; Obtain the outer contour located outside the target polygon and at least one inner contour located inside the target polygon, among all the contours composed of circles and closed lines, whose shortest distance to the target polygon is the fixed value; A Boolean subtraction operation is performed on the outer contour and the inner contour to form a detection area.

7. The offset method according to claim 1, characterized in that, The step of using the enclosed polygon as the offset result of the target polygon further includes: Delete the offset segments that do not form a polygon, as well as the portions of the offset segments that do form a polygon that are outside the polygon.

8. A polygon offsetting device in a circuit layout, characterized in that, include: The acquisition module is used to acquire the offset orientation of a target polygon formed by sequentially connecting multiple edge lines in a circuit layout. The offset module is used to move each sideline normal by a preset distance according to the offset orientation to obtain parallel line segments; The determination module is used to determine the relative orientation of the tail end point of the latter sideline with respect to the former sideline in sequence between two adjacent sidelines. The adjustment module is used to take the first intersection point of the straight lines containing the two parallel line segments as the common endpoint of the two when the relative orientation and the offset orientation are opposite, and update the two parallel line segments. The construction module is used to construct a detection region where the shortest distance from the boundary to the target polygon is less than the preset distance and is a fixed value, and to take the part of each parallel line segment outside the detection region as an offset line segment; The output module is used to take the polygon formed by all offset line segments as the offset result of the target polygon.

9. A storage medium, characterized in that, The storage medium stores a computer program configured to execute, when running, the polygon offset method in the circuit layout according to any one of claims 1 to 7.

10. An electronic device, characterized in that, It includes a memory and a processor, the memory storing a computer program, and the processor being configured to run the computer program to perform the polygon offset method in a circuit layout according to any one of claims 1 to 7.