A method and system for filling multiple independent vector elements based on layers

By constructing fill layers and compound paths, the problem of flexible editing and unified fill calculation of multiple independent vector elements in laser engraving machines is solved, achieving efficient laser processing and improved product quality.

CN122244203APending Publication Date: 2026-06-19SHENZHEN ENFU ELECTRONICS TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHENZHEN ENFU ELECTRONICS TECH CO LTD
Filing Date
2026-03-20
Publication Date
2026-06-19

Smart Images

  • Figure CN122244203A_ABST
    Figure CN122244203A_ABST
Patent Text Reader

Abstract

This invention discloses a layer-based method and system for filling multiple independent vector elements, relating to the fields of laser processing and graphics processing technology. The method includes: constructing a fill layer containing multiple independent, editable vector line elements; loading this layer as a temporary composite path and converting it into path command form during processing calculations; setting predetermined fill rules; constructing scan lines and gradually translating them to obtain multiple sets of intersection points between the scan lines and the composite path; sorting the intersection points at each scan line position according to the scan line direction; determining the filled line segments and empty travel segments on the scan line based on the intersection point index position; processing special intersection points, correcting the intersection point counting results, generating fill processing path data for laser processing, and releasing resources related to the composite path and scan lines. This invention enables independent editing of vector elements and unified overall filling, improving editing flexibility and filling accuracy, reducing operational complexity, and adapting to the processing needs of laser engraving and cutting equipment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of laser processing and graphics processing technology, and more specifically to a method and system for filling multiple independent vector elements based on layers. Background Technology

[0002] In the laser engraving process, closed graphic areas often require filling engraving to achieve overall coloring of the pattern or material removal. Existing laser processing software typically calculates filling based on a single closed graphic, or requires the user to merge multiple graphics beforehand during the editing stage.

[0003] In practical applications, users often need to create multiple independent vector elements within the same fill area and perform operations such as moving, rotating, and scaling on each element to achieve flexible adjustments to complex patterns. However, in existing technologies, most fill algorithms struggle to perform uniform fill calculations while maintaining the independent editability of each vector element.

[0004] Specifically, existing technologies have at least the following shortcomings: (1) Insufficient editing flexibility: Multiple vector elements usually need to be merged into a single graphic before filling, making it difficult to adjust each element independently later.

[0005] (2) Limited application of filling rules: When dealing with multiple independent elements, the existing scheme is difficult to accurately calculate the whole area according to a unified filling rule (such as the even-odd filling rule).

[0006] (3) High coupling between processing and editing stages: The graphic organization method in the editing stage is closely coupled with the filling calculation in the processing stage, which increases the complexity of operation and the risk of error.

[0007] Therefore, there is an urgent need for a filling algorithm that can both support flexible editing of multiple independent vector elements and perform filling calculations on them as a whole during the processing stage. Summary of the Invention

[0008] In view of this, the present invention provides a method and system for filling multiple independent vector elements based on layers, which can support multiple independently editable vector elements in a graphics editing environment, and perform filling calculations on the vector elements as a whole according to predetermined filling rules during the processing stage. It is applicable to filling processing of CNC processing equipment such as laser engraving machines and laser cutting machines.

[0009] To achieve the above objectives, the present invention provides the following technical solution: A method for filling multiple independent vector elements based on a layer includes the following steps: S1. Construct a fill layer, and create or import multiple vector line elements into the fill layer; S2. During the filling process calculation, multiple vector line elements are loaded into a temporarily constructed composite path, so that each vector line element is a sub-path of the composite path. S3. Convert the composite path into a data representation based on path instructions, and set a predefined filling rule for the composite path; S4. Construct scan lines for the composite path, and gradually translate the scan lines along the direction perpendicular to the scan lines to obtain multiple sets of intersection points between the scan lines and the composite path; S5. Sort the intersections at each scan line position according to the scan line direction, and determine the fill line segment and the empty travel line segment on the scan line according to the intersection index position. S6. Process the special intersections between the scan line and the vertex or path connection position of the composite path, and correct the intersection count results; S7. Based on the fill line segment and the empty travel line segment, generate the laser processing fill path data, and release the composite path and scan line related resources after the fill calculation is completed.

[0010] Optionally, in S1, each vector line element exists independently of the others, can be selected individually, and can be subjected to geometric transformation operations including moving, scaling, rotating, and flipping.

[0011] Optionally, in S2, the composite path is used to represent the overall contour region during the fill processing calculation phase and is released after the fill processing calculation is completed.

[0012] Optionally, in S3, when converting a composite path into a data representation based on path instructions, each sub-path is described by a path instruction, and the data of multiple sub-paths are organized and merged into the same path description. The path description can represent multiple discontinuous closed or non-closed paths.

[0013] Optionally, in S4, the scan line is a horizontally extending line segment whose length is not less than the maximum dimension of the composite path in the corresponding direction.

[0014] Optionally, in S5, the specific method for determining filled line segments and empty line segments is as follows: a line segment formed by an intersection point with an odd index and its subsequent adjacent intersection point is determined to be a filled line segment; a line segment formed by an intersection point with an even index and its subsequent adjacent intersection point is determined to be an empty line segment.

[0015] A layer-based system for filling multiple independent vector elements, comprising performing any of the above-described layer-based methods for filling multiple independent vector elements, including: The layer building module is used to build fill layers and create or import multiple vector line elements within the fill layers; The composite path construction module is used to load multiple vector line elements into a temporarily constructed composite path during filling processing calculations, so that each vector line element serves as a sub-path of the composite path. The path data processing module is used to convert the composite path into a data representation based on path instructions and to set predefined filling rules for the composite path. The scan line and intersection point generation module is used to construct scan lines for composite paths, and gradually translate the scan lines along a direction perpendicular to the scan lines to obtain multiple sets of intersection points between the scan lines and the composite paths; The fill line segment determination module is used to sort the intersections at each scan line position according to the scan line direction, and determine the fill line segments and empty travel line segments on the scan line according to the intersection point index position. The special intersection processing module is used to process special intersections between the scan line and the vertex or path connection position of the composite path, and correct the intersection counting results; The processing path generation and resource release module is used to generate laser processing path data based on fill line segments and empty travel line segments, and release composite path and scan line related resources after the filling calculation is completed.

[0016] As can be seen from the above technical solution, compared with the prior art, the present invention discloses a method and system for filling multiple independent vector elements based on layers, which has the following beneficial effects: (1) Significantly improve editing flexibility: By supporting multiple independent vector elements in the same fill layer, users can edit each element independently without having to perform graphic merging and splitting operations frequently; (2) High consistency and accuracy of filling calculation: During the processing stage, multiple independent vector elements are treated as a whole and a unified filling rule is applied to ensure the consistency and accuracy of the filling results; (3) Reduce operational complexity: The editing stage and the processing stage are decoupled, and users do not need to care about the underlying implementation of the filling algorithm to complete the design of complex filling effects; (4) Facilitates rapid adjustment of complex patterns: Each vector element maintains an independent structure, so that local modifications will not affect the overall filling logic, greatly improving the efficiency of modifying complex patterns; (5) Applicable to laser processing scenarios: By effectively distinguishing between filled line segments and empty travel line segments, ineffective movement is reduced, and laser processing efficiency and finished product quality are improved. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0018] Figure 1 A flowchart of a layer-based method for filling multiple independent vector elements provided by the present invention; Figure 2 This is a schematic diagram of the editing state provided by the present invention; Figure 3 This is a schematic diagram of the processing state provided by the present invention. Detailed Implementation

[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. 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 are within the scope of protection of the present invention.

[0020] This invention discloses a method for filling multiple independent vector elements based on layers, aiming to solve at least one of the following technical problems existing in the prior art: (1) How to support the creation, movement, rotation and scaling of multiple independent vector elements in the graphics editor without affecting the overall integrity of the filling process; (2) How to treat multiple independent vector elements as a whole area for filling calculation during the processing stage; (3) How to uniformly apply even-odd and other filling rules without destroying the independence of the original vector elements; (4) How to accurately determine the intersection relationship between the filling line and the outline of the graphic, so as to distinguish between the line segment that needs to be filled and the empty line segment; (5) How to reduce the complexity of graphic organization and path calculation during the filling calculation process.

[0021] like Figure 1 As shown, the filling method for multiple independent vector elements based on layers proposed in this embodiment specifically includes the following steps: S1. Construct a fill layer, and create or import multiple vector line elements into the fill layer; S2. During the filling process calculation, multiple vector line elements are loaded into a temporarily constructed composite path, so that each vector line element is a sub-path of the composite path. S3. Convert the composite path into a data representation based on path instructions, and set a predefined filling rule for the composite path; S4. Construct scan lines for the composite path, and gradually translate the scan lines along the direction perpendicular to the scan lines to obtain multiple sets of intersection points between the scan lines and the composite path; S5. Sort the intersections at each scan line position according to the scan line direction, and determine the fill line segment and the empty travel line segment on the scan line according to the intersection index position. S6. Process the special intersections between the scan line and the vertex or path connection position of the composite path, and correct the intersection count results; S7. Based on the fill line segment and the empty travel line segment, generate the laser processing fill path data, and release the composite path and scan line related resources after the fill calculation is completed.

[0022] Furthermore, the "construction of the fill layer and management of vector elements" described in S1 specifically involves: creating a fill layer for fill processing in the graphics editor, where users can create or import multiple vector line elements. Each vector line element exists independently, can be selected individually, and can undergo geometric transformations including moving, scaling, rotating, and flipping, maintaining the independence and flexibility of each vector element during the editing phase. See also... Figure 2 In edit mode, the four circles can be edited independently.

[0023] Furthermore, the "composite path construction in the fill processing calculation stage" described in S2 specifically involves: during fill processing calculations, multiple independent vector elements in the fill layer are uniformly loaded into a temporarily constructed composite path, so that each vector element exists as a sub-path under the composite path. The composite path represents the overall outline area during the fill processing calculation stage and is released after the fill processing calculation is completed to avoid affecting the original vector elements in the graphics editing canvas.

[0024] Furthermore, the "path data organization of composite paths" described in S3 specifically involves: converting composite paths into a data representation based on path instructions, and setting predetermined filling rules for the composite paths so that they participate in the filling determination as a whole during the filling calculation process. Specifically, when converting composite paths into a data representation based on path instructions, each sub-path is described using path instructions, and the data of multiple sub-paths are organized and merged into the same path description. The path description can represent multiple discontinuous closed or non-closed paths. See also... Figure 3 In the processing state, the four circles can be treated as a whole and the filling rule can be applied.

[0025] Furthermore, the "fill line generation based on scan line" described in S4 specifically involves: constructing a scan line for filling calculation for a composite path, wherein the scan line is a line segment extending along a predetermined direction; and gradually translating the scan line along a direction perpendicular to the scan line to make the scan line intersect with the composite path at multiple positions, thereby forming a set of multiple intersection points for filling calculation.

[0026] In a preferred embodiment, the scan line is a horizontally extending line segment whose length is not less than the maximum dimension of the composite path in the corresponding direction.

[0027] Furthermore, the "intersection analysis and filling segment determination" described in S5 specifically involves: at each scan line position, analyzing the intersection results of the scan line and the composite path, obtaining all intersection points of the scan line and the composite path, and sorting the intersection points in order along the scan line direction; and determining the filling segment and the empty travel segment on the scan line based on the index position of the intersection point after sorting.

[0028] Specifically, the method for determining filled line segments and empty travel line segments is as follows: a line segment formed by an intersection point with an odd index and its subsequent adjacent intersection point is determined to be a filled line segment; a line segment formed by an intersection point with an even index and its subsequent adjacent intersection point is determined to be an empty travel line segment. Filled line segments and empty travel line segments are generated alternately on the same scan line in this manner.

[0029] Furthermore, the "special intersection case handling" described in S6 specifically means that when the intersection of the scan line and the composite path is located at the vertex position or the path connection position, the intersection is specially handled to avoid errors in intersection counting or duplicate counting, thereby ensuring the accuracy and stability of the filling line segment determination result.

[0030] Furthermore, the "fill processing path generation, resource release, and path cleanup" described in S7 specifically involves: generating processing path data for laser processing equipment to perform fill engraving based on the obtained fill line segments and empty travel line segments, thereby achieving unified fill processing of multiple independent vector elements based on layers. After completing the calculation of fill line segments and empty travel line segments and generating the corresponding processing path, the scan lines and composite paths used for fill calculation are deleted, and related resources are released to prevent them from affecting other elements in the graphics editing canvas or subsequent operations.

[0031] and Figure 1 Corresponding to the method described above, this embodiment of the invention also provides a layer-based system for filling multiple independent vector elements, used for... Figure 1 The specific implementation of the method, a layer-based multiple independent vector element filling system provided in this embodiment of the invention, can be applied to computer terminals or various mobile devices, specifically including: The layer building module is used to build fill layers and create or import multiple vector line elements within the fill layers; The composite path construction module is used to load multiple vector line elements into a temporarily constructed composite path during filling processing calculations, so that each vector line element serves as a sub-path of the composite path. The path data processing module is used to convert the composite path into a data representation based on path instructions and to set predefined filling rules for the composite path. The scan line and intersection point generation module is used to construct scan lines for composite paths, and gradually translate the scan lines along a direction perpendicular to the scan lines to obtain multiple sets of intersection points between the scan lines and the composite paths; The fill line segment determination module is used to sort the intersections at each scan line position according to the scan line direction, and determine the fill line segments and empty travel line segments on the scan line according to the intersection point index position. The special intersection processing module is used to process special intersections between the scan line and the vertex or path connection position of the composite path, and correct the intersection counting results; The processing path generation and resource release module is used to generate laser processing path data based on fill line segments and empty travel line segments, and release composite path and scan line related resources after the filling calculation is completed.

[0032] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the systems disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple; relevant parts can be referred to the method section.

[0033] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for filling multiple independent vector elements based on layers, characterized in that, Includes the following steps: S1. Construct a fill layer, and create or import multiple vector line elements into the fill layer; S2. During the filling process calculation, multiple vector line elements are loaded into a temporarily constructed composite path, so that each vector line element is a sub-path of the composite path. S3. Convert the composite path into a data representation based on path instructions, and set a predefined filling rule for the composite path; S4. Construct scan lines for the composite path, and gradually translate the scan lines along the direction perpendicular to the scan lines to obtain multiple sets of intersection points between the scan lines and the composite path; S5. Sort the intersections at each scan line position according to the scan line direction, and determine the fill line segment and the empty travel line segment on the scan line according to the intersection index position. S6. Process the special intersections between the scan line and the vertex or path connection position of the composite path, and correct the intersection count results; S7. Based on the fill line segment and the empty travel line segment, generate the laser processing fill path data, and release the composite path and scan line related resources after the fill calculation is completed.

2. The method for filling multiple independent vector elements based on layers according to claim 1, characterized in that, In S1, each vector line element exists independently and can be selected individually to perform geometric transformation operations, including moving, scaling, rotating, and flipping.

3. The method for filling multiple independent vector elements based on layers according to claim 1, characterized in that, In S2, the composite path is used to represent the overall contour region during the filling process calculation stage and is released after the filling process calculation is completed.

4. The method for filling multiple independent vector elements based on layers according to claim 1, characterized in that, In S3, when converting a composite path into a data representation based on path instructions, each sub-path is described by path instructions. The data of multiple sub-paths are organized and merged into the same path description, which can represent multiple discontinuous closed or non-closed paths.

5. The method for filling multiple independent vector elements based on layers according to claim 1, characterized in that, In S4, the scan line is a horizontally extending line segment, and its length is not less than the maximum dimension of the composite path in the corresponding direction.

6. The method for filling multiple independent vector elements based on layers according to claim 1, characterized in that, In S5, the specific method for determining filled line segments and empty line segments is as follows: a line segment formed by an intersection point with an odd index and its next adjacent intersection point is determined to be a filled line segment; a line segment formed by an intersection point with an even index and its next adjacent intersection point is determined to be an empty line segment.

7. A layer-based system for filling multiple independent vector elements, characterized in that, Performing a layer-based method for filling multiple independent vector elements as described in any one of claims 1-6, comprising: The layer building module is used to build fill layers and create or import multiple vector line elements within the fill layers; The composite path construction module is used to load multiple vector line elements into a temporarily constructed composite path during filling processing calculations, so that each vector line element serves as a sub-path of the composite path. The path data processing module is used to convert the composite path into a data representation based on path instructions and to set predefined filling rules for the composite path. The scan line and intersection point generation module is used to construct scan lines for composite paths, and gradually translate the scan lines along a direction perpendicular to the scan lines to obtain multiple sets of intersection points between the scan lines and the composite paths; The fill line segment determination module is used to sort the intersection points at each scan line position according to the scan line direction, and determine the fill line segment and the empty travel line segment on the scan line according to the intersection point index position. The special intersection processing module is used to process special intersections between the scan line and the vertex or path connection position of the composite path, and correct the intersection counting results; The processing path generation and resource release module is used to generate laser processing path data based on fill line segments and empty travel line segments, and release composite path and scan line related resources after the filling calculation is completed.