Method, device and storage medium for determining graphic inclusion relationship in laser processing

By determining whether a graphic is closed, calculating the intersection set, and traversing points near the intersection, the problem of quickly and accurately determining the inclusion relationship of graphics in laser processing is solved, thereby improving the efficiency and accuracy of laser processing.

CN114612377BActive Publication Date: 2025-09-09HANS LASER TECH IND GRP CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210059563.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-19
Publication Date
2025-09-09
Estimated Expiration
2042-01-19

AI Technical Summary

Technical Problem

It is difficult to quickly and accurately determine the inclusion relationship of graphics in existing technologies during laser processing, especially when determining whether graphics are included, tangent, or inscribed.

Method used

A method is provided to determine whether a figure is closed, calculate the intersection set, traverse the points near the intersection, and use the minimum enclosing rectangle and rectangle judgment to determine the inclusion relationship of the figure, and combine the parity of the ray intersection to determine whether the figure contains a certain point.

Benefits of technology

It can quickly and accurately judge the inclusion, tangency and incision relationships of graphics, and improve the efficiency and accuracy of laser processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114612377B_ABST
    Figure CN114612377B_ABST
Patent Text Reader

Abstract

The present application discloses a method, device, and storage medium for determining the inclusion relationship of graphics in laser processing. The method for determining the inclusion relationship of graphics in laser processing includes the following steps: A1. If it is necessary to determine whether graphic a contains graphic b, first determine whether graphic a is closed; A2. If graphic a is closed, find the intersection of a and b, and let the intersection set be S; A3. If set S is empty, determine whether a contains any point on b. If it does, it means that a contains b, and graphics a and graphics b are not tangent; A4. If set S is not empty, traverse each point P in set S and find points b1 and b2 on graphic b that are near P. If b1 is not on graphic a and b1 is not inside graphic a, or b2 is not on graphic a and b1 is not inside graphic a, it means that graphic a does not contain graphic b. Otherwise, it means that graphic a contains graphic b and is tangent. The present application can quickly and accurately determine the inclusion relationship of graphics.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of graphics processing technology, and in particular to a method, device and storage medium for determining the inclusion relationship of graphics in laser processing. Background Art

[0002] Before processing products, laser processing equipment needs to design processing graphics first and process the products according to the processing graphics. For example, a pattern consistent with the graphics can be printed on the product, or the product can be cut into a shape consistent with the graphics. In other words, the movement of the laser head is controlled according to the designed graphics.

[0003] During the processing of graphics used for laser processing, it is often necessary to determine the inclusion relationship of graphics, such as whether graphic a contains graphic b. Inclusion includes inner inclusion and incision. After determining the inclusion relationship, it is convenient to fill the space between the outer contour and the inner contour with color, and it is also convenient for cutting operations.

[0004] Therefore, it is urgent to provide a method, device and storage medium for determining the inclusion relationship of graphics to solve the above problems. Summary of the Invention

[0005] The purpose of this application is to provide a method, device and storage medium that can quickly and accurately determine the inclusion relationship of graphics during laser processing.

[0006] To achieve the above objectives, the following technical solutions are provided:

[0007] A1. To determine whether shape a contains shape b, first determine whether shape a is closed.

[0008] A2. If figure a is closed, find the intersection of figure a and figure b. Let the set of intersection points be S.

[0009] A3. If the set S is empty, determine whether figure a contains any point on figure b. If so, it means that figure a contains figure b, and figures a and b are not tangent.

[0010] A4. If the set S is not empty, iterate over each point P in the set S and find the points b1 and b2 on the shape b that are near P. If b1 is not on the shape a and b1 is not inside the shape a, or if b2 is not on the shape a and b1 is not inside the shape a, then shape a does not contain shape b. Otherwise, shape a contains shape b and is tangent to it.

[0011] As an optional solution for the method of determining the inclusion relationship of graphics in the above-mentioned laser processing, step A4 also includes: finding points a1 and a2 on graphic a located near P. If a1 is not on graphic b and a1 is not outside graphic b, or a2 is not on graphic b and a2 is not outside graphic b, then it means that graphic a does not contain graphic b; otherwise, it means that graphic a contains graphic b and is tangent to it.

[0012] As an optional solution to the method for determining the inclusion relationship of graphics in the above laser processing, the step A2 may further include the following steps:

[0013] S1. Determine whether the minimum bounding rectangle of figure a contains the minimum bounding rectangle of figure b;

[0014] S2. If it is included, further determine whether figure a is a rectangle. If figure a is a rectangle, figure a contains figure b.

[0015] S3. If the minimum bounding rectangle of figure a in step S1 does not contain the minimum bounding rectangle of figure b, or if figure a is not a rectangle in step S2, proceed to step A2.

[0016] As an optional solution to the method for determining the inclusion relationship of graphics in the above laser processing, step S1 specifically includes:

[0017] S11. Let the minimum circumscribed rectangle of figure a be a′, and the minimum circumscribed rectangle of figure b be b′. Find the minimum point a1 and maximum point a2 of a′, and find the minimum point b1 and maximum point b2 of b′.

[0018] S12. If b1.x ≥ a1.x and b1.y ≥ a1.y, b1.x represents the X coordinate of point b1, b1.y represents the Y coordinate of point b1, and b1.x ≤ a2.x and b1.y ≤ a2.y, and b2.x ≥ a1.x and b2.y ≥ a1.y and b2.x ≤ a2.x and b2.y ≤ a2.y, then the minimum enclosing rectangle a′ of figure a contains the minimum enclosing rectangle b′ of figure b.

[0019] As an optional solution to the method for determining the inclusion relationship of graphics in the above laser processing, the S2 further includes:

[0020] S21. Traverse all line segments of figure a; if there are arcs, figure a is not a rectangle; if the number of line segments is less than 4, figure a is not a rectangle either;

[0021] S22. If there is no arc in the segment of figure a and the number of line segments is 4, loop through the line segment nodes and compare the two adjacent nodes in turn. If the X of the first node is the same as the second node, the Y of the second node is the same as the third node, the X of the third node is the same as the fourth node, and the Y of the fourth node is the same as the first node, or the Y of the first node is the same as the second node, the X of the second node is the same as the third node, the Y of the third node is the same as the fourth node, and the X of the fourth node is the same as the first node, then figure a is a rectangle.

[0022] As an optional solution for the method of determining the inclusion relationship of graphics in the above-mentioned laser processing, in the above-mentioned steps A3 and A4, the method for determining whether the graphic a contains a certain point N, that is, determining whether a certain point N is inside the graphic a, is as follows:

[0023] Draw a ray from point N to figure a. If the intersection of the ray and figure a is an odd number, it means that figure a contains point N. If the intersection of the ray and figure a is an even number, it means that figure a does not contain point N.

[0024] As an optional solution to the method of determining the inclusion relationship of graphics in the above laser processing, the method of determining whether the graphic a contains the point N includes:

[0025] A41. Draw a ray L from point N to figure a, parallel to the X-axis and along the negative direction of the X-axis.

[0026] A42. Explode the shape a into a set T of straight lines and circular arcs. The number of intersections between the ray L and the shape a is W. Initialize W to 0.

[0027] A43. Select a suitable line in set T and find the intersection with ray L: Traverse the lines in set T. If it is a straight line, set the starting point of the line to Q1 and the end point to Q2. If Q1.y = Q2.y, then the line is invalid. Continue traversal and set a parameter D. If Q1.y < Q2.y of the line, then D = 1; if Q1.y > Q2.y of the line, then D = -1. If Q1.ye ≤ Ny < Q2.ye, and the X coordinate of the intersection of ray L and the line is < Nx, then W′ = W + D, where W′ is the final intersection of ray L and the line, and e is the preset accuracy.

[0028] If it is an arc, split the arc to ensure the monotonicity of the arc, traverse the set of arcs obtained by segmentation, let the starting point of the arc be Q1 and the end point be Q2, if Q1.y=Q2.y, then judge that this arc is invalid, continue traversal, if Q1.y of the arc is less than Q2.y, then D=1, if Q1.y of the arc is greater than Q2.y, then D=-1; if Q1.ye≤Ny<Q2.ye, and the X coordinate of the intersection of ray L and the arc is less than Nx, then W′=W+D.

[0029] As an optional solution for the method of determining the inclusion relationship of graphics in the above-mentioned laser processing, in step A3, when determining whether graphic a contains any point on graphic b, the starting point of graphic b is taken for determination.

[0030] A device for determining the inclusion relationship of graphics in laser processing, the device comprising:

[0031] one or more processors;

[0032] a memory for storing one or more programs;

[0033] When the one or more programs are executed by the one or more processors, the one or more processors implement the method for determining graphic inclusion relationships in laser processing as described above.

[0034] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the method for determining graphic inclusion relationships in laser processing as described above.

[0035] The method for determining the inclusion relationship of graphics in the laser processing of the embodiment of the present application is as follows: A1. If it is necessary to determine whether graphic a contains graphic b, first determine whether graphic a is closed; A2. If graphic a is closed, find the intersection of graphic a and graphic b, and let the intersection set be S; A3. If set S is empty, determine whether graphic a contains any point on graphic b. If it does, it means that graphic a contains graphic b, and graphic a and graphic b are not tangent; A4. If set S is not empty, traverse each point P in set S and find points b1 and b2 on graphic b that are near P. If b1 is not on graphic a and b1 is not inside graphic a, or b2 is not on graphic a and b1 is not inside graphic a, it means that graphic a does not contain graphic b. Otherwise, it means that graphic a contains graphic b and is tangent. The method for determining the inclusion relationship of graphics in the laser processing of the embodiment of the present application can quickly and accurately determine the inclusion relationship of graphics, and can determine whether the graphics are tangent. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 This is a flowchart of a method for determining graphic inclusion relationships in laser processing in one embodiment of the present application;

[0037] Figure 2 This is a schematic diagram of the principle of step S140 in this application;

[0038] Figure 3 A schematic diagram of the principle of determining whether the minimum enclosing rectangle of figure a contains the minimum enclosing rectangle of figure b in this application;

[0039] Figure 4 This is a schematic diagram of the principle of determining whether a graphic contains a certain point in this application. DETAILED DESCRIPTION

[0040] The following detailed description of the embodiments of the present application is not intended to limit the scope of the present application for protection, but merely represents selected embodiments of the present application. All other embodiments obtained by persons of ordinary skill in the art based on the embodiments of the present application without creative work are within the scope of protection of the present application.

[0041] Example 1

[0042] This embodiment discloses a method for determining the inclusion relationship of graphics in laser processing. Figure 1 FIG. 1 is a flowchart of a method for determining the inclusion relationship of graphics in laser processing in one embodiment of the present application. Figure 1 As shown, the method for determining the inclusion relationship of graphics in laser processing may include the following steps:

[0043] S110: If it is necessary to determine whether figure a contains figure b, first determine whether figure a is closed.

[0044] Specifically, when asking whether figure a contains figure b, first determine whether figure a is closed. If figure a is not closed, then figure a cannot contain figure b.

[0045] S120. If figure a is closed, find the intersection of figure a and figure b. Let the set of intersections be S.

[0046] S130. If the set S is empty, determine whether figure a contains any point on figure b. If so, it means that figure a contains figure b, and figures a and b are not tangent.

[0047] Specifically, if the intersection point set S of figure a and figure b is empty, it means that figure a and figure b have no intersection, and figure b is either inside figure a or outside figure a. Therefore, in this case, it is only necessary to determine whether any point on figure b is inside figure a, which can indicate that figure b is contained inside figure a. And because the intersection point set S of figure a and figure b is empty, figure a and figure b have no intersection, and it can also be determined that figure a and figure b are not tangent. In a preferred embodiment, when determining whether figure a contains any point on figure b, the starting point of figure b is used for judgment. It is relatively simple to directly use the starting point of figure b to make the judgment, without having to set complex rules to select points on figure b.

[0048] S140. If the set S is not empty, traverse each point P in the set S and find the points b1 and b2 on the figure b that are near P. If b1 is not on the figure a and b1 is not inside the figure a, or b2 is not on the figure a and b1 is not inside the figure a, then it means that the figure a does not contain the figure b. Otherwise, it means that the figure a contains the figure b and is tangent to it.

[0049] The step S140 further includes: finding points a1 and a2 on figure a near P. If a1 is not on figure b and is not outside figure b, or a2 is not on figure b and is not outside figure b, it means that figure a does not contain figure b.

[0050] Specifically, refer to Figure 2 , Figure 2 The large circle is figure a, the small circle is figure b, assuming that the intersection of figure a and figure b is P, take the points near P to make the judgment. Figure 2 , take points b1 and b2 on graph b near P. Preferably, b1 and b2 are on opposite sides of P. The distances from b1 and b2 to P can be the same or different, but are preferably the same. If b1 is not on graph a and not inside graph a, or if b2 is not on graph a and not inside graph a, then graph a does not contain graph b. Otherwise, graph a contains graph b and is tangent to it.

[0051] Similarly, if Figure 2 As shown, take points a1 and a2 near P on figure a. If a1 is not on figure b and a1 is not outside figure b, or a2 is not on figure b and a2 is not outside figure b, then figure a does not contain figure b. Otherwise, figure a contains figure b and is tangent to it.

[0052] Preferably, the distances from points a1, a2, b1 and b2 to P are the same, which makes it easier to pick points. When picking points, you only need to pick four points near P on the graph according to the set distance. The set distance here can be a pre-set accuracy.

[0053] If it is determined in step S140 that shape a contains shape b, then shapes a and b are still in an inscribed relationship, because set S is not empty, shapes a and b have an intersection, and shape a contains shape b. Therefore, shape a contains shape b and is inscribed.

[0054] In one embodiment, the step S120 further includes the following steps:

[0055] S10, determining whether the minimum bounding rectangle of figure a contains the minimum bounding rectangle of figure b;

[0056] S20, if it is included, further determine whether figure a is a rectangle; if figure a is a rectangle, figure a contains figure b;

[0057] S30. If the minimum bounding rectangle of figure a does not include the minimum bounding rectangle of figure b in step S10, or if figure a is not a rectangle in step S20, then go to step S120.

[0058] Specifically, the inclusion relationship between Figures a and b can be simply determined by determining the bounding rectangles before step S120. First, determine whether the minimum bounding rectangle of Figure a contains the minimum bounding rectangle of Figure b. If so, further determine whether Figure a is a rectangle. If so, it indicates that the minimum bounding rectangle of Figure a is Figure a itself. Furthermore, since it was previously determined that the minimum bounding rectangle of Figure a contains the minimum bounding rectangle of Figure b, that is, Figure a contains the minimum bounding rectangle of Figure b, then Figure a must contain Figure b.

[0059] If the minimum bounding rectangle of figure a does not include the minimum bounding rectangle of figure b, or figure a is not a rectangle, the process goes to step S120.

[0060] In one embodiment, step S10 specifically includes the following steps of determining whether the minimum bounding rectangle of figure a includes the minimum bounding rectangle of figure b:

[0061] S101. Let the minimum circumscribed rectangle of figure a be a′, and the minimum circumscribed rectangle of figure b be b′. Find the minimum point a1 and maximum point a2 of a′, and find the minimum point b1 and maximum point b2 of b′.

[0062] Specifically, the minimum point and maximum point here refer to the minimum coordinate point and the maximum coordinate point. Figure 3 , Figure 3 The larger rectangle is the minimum circumscribed rectangle a′ of figure a, and the smaller rectangle is the minimum circumscribed rectangle b′ of figure b. Assume that the minimum point of rectangle a′ is a1 (a1.x, a1.y), where a1.x and a1.y are the horizontal and vertical coordinates of point a1, respectively. Assume that the maximum point of rectangle a′ is a2 (a2.x, a2.y), the minimum point of rectangle b′ is b1 (b1.x, b1.y), and the maximum point of rectangle b′ is b2 (b2.x, b2.y).

[0063] S102. If b1.x ≥ a1.x, and b1.y ≥ a1.y, and b1.x ≤ a2.x and b1.y ≤ a2.y, and b2.x ≥ a1.x and b2.y ≥ a1.y and b2.x ≤ a2.x and b2.y ≤ a2.y, then the minimum circumscribed rectangle a′ of figure a contains the minimum circumscribed rectangle b′ of figure b.

[0064] In one embodiment, step S20 specifically includes the following steps of determining whether the shape a is a rectangle:

[0065] S201. Traverse all line segments of figure a; if there are arcs, figure a is not a rectangle; if the number of line segments is less than 4, figure a is not a rectangle either.

[0066] Specifically, since the line segments of a rectangle cannot be arcs, and the number of line segments of a rectangle cannot be less than 4, if all the line segments of figure a are traversed and there are arcs in the line segments, or the number of line segments is less than 4, it can be determined that figure a is not a rectangle.

[0067] S202: If there is no arc in the segment of figure a and the number of line segments is 4, loop through the line segment nodes and compare the two adjacent nodes in sequence. If the X of the first node is the same as the second node, the Y of the second node is the same as the third node, the X of the third node is the same as the fourth node, and the Y of the fourth node is the same as the first node, or if the Y of the first node is the same as the second node, the X of the second node is the same as the third node, the Y of the third node is the same as the fourth node, and the X of the fourth node is the same as the first node, then figure a is a rectangle.

[0068] Specifically, if there are no arcs in the segments of figure a and the number of line segments is equal to 4, figure a may be a rectangle, and further judgment is required. If figure a is a rectangle, then the coordinates of the four nodes of figure a satisfy the following relationship in the coordinate system: if the X of the first node and the second node are the same, then the second node and the third node must have the same Y, the third node and the fourth node must have the same X, and the fourth node and the first node must have the same Y; or, if the Y of the first node and the second node are the same, then the second node and the third node must have the same X, the third node and the fourth node must have the same Y, and the fourth node and the first node must have the same X. This relationship can be used to determine whether figure a is a rectangle.

[0069] In both step S130 and step S140, it is necessary to determine whether the graph a contains a certain point N, that is, to determine whether the certain point N is inside the graph a. In one embodiment, the determination method is:

[0070] Draw a ray from point N to figure a. If the intersection of the ray and figure a is an odd number, it means that figure a contains point N. If the intersection of the ray and figure a is an even number, it means that figure a does not contain point N.

[0071] Specifically, if figure a contains point N, then the number of intersections between the ray drawn from point N and figure a must be an odd number; if figure a contains point N, then the number of intersections between the ray drawn from point N and figure a must be an even number.

[0072] Furthermore, the method for determining whether the graph a contains the point N specifically includes:

[0073] A141. Draw a ray L from point N to figure a, parallel to the X-axis and along the negative direction of the X-axis.

[0074] A142. Explode the shape a into a set T of lines and arcs. The number of intersections between the ray L and the shape a is W. Initialize W to 0.

[0075] A143. Select a suitable line in set T and find the intersection with ray L: traverse the lines in set T. If it is a straight line, set the starting point of the line to Q1 and the end point to Q2. If Q1.y = Q2.y, then the line is invalid. Continue traversal and set a parameter D. If Q1.y < Q2.y of the line, then D = 1; if Q1.y > Q2.y of the line, then D = -1; if Q1.ye ≤ Ny < Q2.ye, and the X coordinate of the intersection of ray L and the line is < Nx, then W′ = W + D, where W′ is the final intersection of ray L and the line, and e is the preset accuracy.

[0076] If it is an arc, split the arc to ensure the monotonicity of the arc, traverse the set of arcs obtained by segmentation, let the starting point of the arc be Q1 and the end point be Q2, if Q1.y=Q2.y, then judge that this arc is invalid, continue traversal, if Q1.y of the arc is less than Q2.y, then D=1, if Q1.y of the arc is greater than Q2.y, then D=-1; if Q1.ye≤Ny<Q2.ye, and the X coordinate of the intersection of ray L and the arc is less than Nx, then W′=W+D.

[0077] Specifically, refer to Figure 4 , assuming that the figure a contains six segments 1, 2, 3, 4, 5 and 6, that is, the image a after explosion contains Figure 4 The set T of six lines 1, 2, 3, 4, 5 and 6. Figure 3 As shown, a ray L is drawn from point N toward figure a. Ray L is parallel to the X-axis and lies in the negative direction of the X-axis. In practice, any ray drawn from point N in any direction can be used to find the intersection with figure a. However, the direction of ray L is defined here for ease of calculation; otherwise, there would be an infinite number of rays. A parameter W is defined to represent the number of intersections between ray L and figure a. Initially, before counting the number of intersections, W is defined as 0, i.e., W = 0.

[0078] Traverse the lines in the set T. If it is a straight line, set the starting point of the line to Q1 and the end point to Q2. If Q1.y = Q2.y, then the line is considered invalid and the traversal continues. For example Figure 4 As shown, both Line 2 and Line 5 are parallel to the X-axis, and the Y coordinates of their starting and ending points are equal, that is, Q1.y = Q2.y. Since Ray L is also parallel to the X-axis, and a line parallel to the X-axis does not intersect Ray L, the line is considered invalid. Figure 4 The Y coordinate of the starting point B of line 1 is not equal to the Y coordinate of the end point F, which means that line 1 is not parallel to the X-axis. Therefore, line 1 is a valid line.

[0079] Set a parameter D. If Q1.y < Q2.y of the straight line, then D = 1. If Q1.y > Q2.y of the straight line, then D = -1. Here, D can be understood as the definition of the direction of the straight line. Figure 4 In the equation, the starting point Y coordinate of line 1 is smaller than the ending point Y coordinate, that is, By<Fy, and line 1 falls to the right as a whole. In this case, D=1. Figure 4 The Y coordinate of the starting point of the middle straight line 3 is greater than the Y coordinate of the end point, that is, Wy>Zy, and the straight line 3 as a whole falls to the left. At this time, D is defined as -1.

[0080] If Q1.ye≤Ny<Q2.ye, and the X coordinate of the intersection of ray L and the line is less than Nx, then W′=W+D, W′ is the final intersection of ray L and the line, and e is the preset accuracy, which can be understood as an error range. In one embodiment, e can be 10-6. Specifically, this is still the definition of a valid line. Only when the Y coordinate of point N is greater than or equal to the Y coordinate of the starting point of the line and less than the Y coordinate of the end point of the line, that is, Q1.ye≤Ny<Q2.ye, the line is valid and can be used to calculate the intersection with ray L. For example Figure 4 In the equation, if point N is located at position N', then N'.y = By, that is, the Y coordinate of point N is equal to the starting coordinate of line 1, which is in the critical condition. In this way, line 1 still meets the conditions and is a valid line. It can be used to calculate the intersection point with the ray drawn from point N'; if point N is located at position N", N".y = Fy. In this case, line 1 does not meet the conditions and is an invalid line. It cannot be used to calculate the intersection point with the ray drawn from point N". When the previous conditions are met and the X coordinate of the intersection point of ray L with the line is less than Nx, it corresponds to Figure 4 In the figure, the intersection point of ray L and line 1 is R, Rx<Nx, then the number of intersection points of ray L and figure a is W′=W+D=0+1=1. If the number of intersection points is an odd number, then figure a is judged to contain point N.

[0081] For the X coordinate Rx of point R, it is not difficult to calculate Rx=B.x+((Fx-Bx) / (Fy-By)*(Ny-By)) based on geometric relationships.

[0082] When traversing the lines in set T, if the line is an arc, split the arc to ensure the monotonicity of the arc. Otherwise, even if figure a contains point N, an even number of intersection points may be found. When splitting the arc, the arc can be split into 90-degree and 270-degree segments. Other judgment conditions are similar to those for straight lines. Let the starting point of the arc be Q1 and the end point be Q2. If Q1.y = Q2.y, then the arc is invalid and the traversal continues. If Q1.y < Q2.y of the arc, then D = 1; if Q1.y > Q2.y of the arc, then D = -1; if Q1.ye ≤ Ny < Q2.ye, and the X coordinate of the intersection of ray L and the arc < Nx, then W′ = W + D. The parity of W′ is used to determine whether figure a contains point N.

[0083] It is understandable that the method for determining graphic inclusion relationships in laser processing in this application can be applied to laser processing fields such as laser cutting, and can also be applied to other fields, without limitation here.

[0084] Example 2

[0085] The second embodiment of the present application further provides a device for determining the inclusion relationship of graphics during laser processing. The device for determining the inclusion relationship of graphics during laser processing may include but is not limited to: one or more processors and memories.

[0086] Memory, as a computer-readable storage medium, can be used to store software programs, computer-executable programs, and modules, such as the program instructions corresponding to the method for determining graphic inclusion relationships during laser processing described in the embodiments of this application. The processor executes the software programs, instructions, and modules stored in the memory to execute the various functional applications and data processing of the device for determining graphic inclusion relationships during laser processing, thereby implementing the aforementioned method for determining graphic inclusion relationships during laser processing.

[0087] Example 3

[0088] The third embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When the program is executed by a processor, a method for determining the inclusion relationship of graphics in laser processing is implemented. The method for determining the inclusion relationship of graphics in laser processing includes the following steps:

[0089] A1. If you need to determine whether figure a contains figure b, first determine whether figure a is closed;

[0090] A2. If figure a is closed, find the intersection of figure a and figure b. Let the set of intersection points be S.

[0091] A3. If the set S is empty, determine whether figure a contains any point on figure b. If so, it means that figure a contains figure b, and figures a and b are not tangent.

[0092] A4. If the set S is not empty, iterate over each point P in the set S and find the points b1 and b2 on the shape b that are near P. If b1 is not on the shape a and b1 is not inside the shape a, or if b2 is not on the shape a and b1 is not inside the shape a, then shape a does not contain shape b. Otherwise, shape a contains shape b and is tangent to it.

[0093] Of course, the computer-readable storage medium provided in an embodiment of the present application, whose computer-executable instructions are not limited to the method operations described above, can also execute related operations in the method for determining graphic inclusion relationships in laser processing provided in any embodiment of the present application.

[0094] Through the above description of the implementation methods, those skilled in the art can clearly understand that the present application can be implemented with the help of software and necessary general-purpose hardware, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as a computer's floppy disk, read-only memory (ROM), random access memory (RAM), flash memory (FLASH), hard disk or optical disk, etc., including a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0095] Note that the above are only preferred embodiments of the present application and the technical principles employed. Those skilled in the art will understand that the present application is not limited to the specific embodiments described herein, and that various obvious changes, readjustments, and substitutions can be made by those skilled in the art without departing from the scope of protection of the present application. Therefore, although the present application has been described in more detail through the above embodiments, the present application is not limited to the above embodiments and may include many other equivalent embodiments without departing from the scope of the present application. The scope of the present application is determined by the scope of the appended claims.

Claims

1. A method for determining the inclusion relationship of graphics in laser processing, characterized in that: The steps include: A1. To determine whether shape a contains shape b, first determine whether shape a is closed. A2. If figure a is closed, find the intersection of figure a and figure b. Let the set of intersection points be S. A3. If the set S is empty, determine whether figure a contains any point on figure b. If so, it means that figure a contains figure b, and figures a and b are not tangent. A4. If the set S is not empty, iterate over each point P in the set S and find the points b1 and b2 on the shape b that are near P. If b1 is not on the shape a and b1 is not inside the shape a, or if b2 is not on the shape a and b1 is not inside the shape a, then shape a does not contain shape b. Otherwise, shape a contains shape b and is tangent to it. A5. If shape a contains shape b, fill the space between shape a and shape b with color to facilitate cutting. A6. Move the laser head along the outlines of Figures a and b to perform laser cutting on the product.

2. The method for determining the inclusion relationship of graphics in laser processing according to claim 1, characterized in that: The step A4 further includes: finding points a1 and a2 on figure a near P. If a1 is not on figure b and is not outside figure b, or if a2 is not on figure b and is not outside figure b, then figure a does not contain figure b; otherwise, figure a contains figure b and is tangent to it.

3. The method for determining the inclusion relationship of graphics in laser processing according to claim 1, wherein: The step A2 also includes the following steps: S1. Determine whether the minimum bounding rectangle of figure a contains the minimum bounding rectangle of figure b. S2. If it is included, further determine whether figure a is a rectangle. If figure a is a rectangle, figure a contains figure b; S3. If the minimum bounding rectangle of figure a in step S1 does not contain the minimum bounding rectangle of figure b, or if figure a is not a rectangle in step S2, proceed to step A2.

4. The method for determining the inclusion relationship of graphics in laser processing according to claim 3, wherein: The step S1 specifically includes: S11. Let the minimum circumscribed rectangle of figure a be a′, and the minimum circumscribed rectangle of figure b be b′. Find the minimum point a1 and maximum point a2 of a′, and find the minimum point b1 and maximum point b2 of b′. S12. If b1.x ≥ a1.x and b1.y ≥ a1.y, b1.x represents the X coordinate of point b1, b1.y represents the Y coordinate of point b1, and b1.x ≤ a2.x and b1.y ≤ a2.y, and b2.x ≥ a1.x and b2.y ≥ a1.y and b2.x ≤ a2.x and b2.y ≤ a2.y, then the minimum enclosing rectangle a′ of figure a contains the minimum enclosing rectangle b′ of figure b.

5. The method for determining the inclusion relationship of graphics in laser processing according to claim 3, wherein: Said S2 further comprises: S21. Traverse all line segments of figure a; if there are arcs, figure a is not a rectangle; if the number of line segments is less than 4, figure a is not a rectangle either; S22. If there is no arc in the segment of figure a and the number of line segments is 4, loop through the line segment nodes and compare the two adjacent nodes in turn. If the X of the first node is the same as the second node, the Y of the second node is the same as the third node, the X of the third node is the same as the fourth node, and the Y of the fourth node is the same as the first node, or the Y of the first node is the same as the second node, the X of the second node is the same as the third node, the Y of the third node is the same as the fourth node, and the X of the fourth node is the same as the first node, then figure a is a rectangle.

6. The method for determining the inclusion relationship of graphics in laser processing according to claim 1, wherein: In step A3 and step A4, the method for determining whether the graph a contains a certain point N, that is, determining whether a certain point N is inside the graph a, is as follows: Draw a ray from point N to figure a. If the intersection of the ray and figure a is an odd number, it means that figure a contains point N. If the intersection of the ray and figure a is an even number, it means that figure a does not contain point N.

7. The method for determining the inclusion relationship of graphics in laser processing according to claim 6, characterized in that: Methods for determining whether figure a contains point N include: A41. Draw a ray L from point N to figure a, parallel to the X-axis and along the negative direction of the X-axis. A42. Explode the shape a into a set T of straight lines and circular arcs. The number of intersections between the ray L and the shape a is W. Initialize W to 0. A43. Select a suitable line in set T and find the intersection with ray L: Traverse the lines in set T. If it is a straight line, set the starting point of the line to Q1 and the end point to Q2. If Q1.y = Q2.y, then the line is invalid. Continue traversal and set a parameter D. If Q1.y < Q2.y of the line, then D = 1; if Q1.y > Q2.y of the line, then D = -1. If Q1.ye ≤ Ny < Q2.ye, and the X coordinate of the intersection of ray L and the line is < Nx, then W′ = W + D, where W′ is the final intersection of ray L and the line, and e is the preset accuracy. If it is an arc, split the arc to ensure the monotonicity of the arc, traverse the set of arcs obtained by segmentation, let the starting point of the arc be Q1 and the end point be Q2, if Q1.y=Q2.y, then judge that this arc is invalid, continue traversal, if Q1.y of the arc is less than Q2.y, then D=1, if Q1.y of the arc is greater than Q2.y, then D=-1; if Q1.ye≤Ny<Q2.ye, and the X coordinate of the intersection of ray L and the arc is less than Nx, then W′=W+D.

8. The method for determining graphic inclusion relationships in laser processing according to claim 1, wherein: In step A3, when determining whether figure a includes any point on figure b, the starting point of figure b is used for determination.

9. A device for determining the inclusion relationship of graphics in laser processing, characterized in that: The device comprises: one or more processors; a memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method for determining graphic inclusion relationships in laser processing according to any one of claims 1 to 8.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method for determining graphic inclusion relationships in laser processing according to any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Method for extracting minimum closed graphs

    CN103116900A

  • Building outline automatic identification method based on building general plane positioning map

    CN113901542A