A method and system for encoding a quadrangular polygon distribution pattern
By establishing a polygon and pattern database through a polygon-based encoding method, the problems of low encoding accuracy and storage redundancy in existing technologies are solved. This achieves efficient and accurate graphic encoding and simplified graphic symmetry processing, which is applicable to fields such as high-end manufacturing, game development, and geographic information.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHUHAI RUIJING JUYUAN TECH CO LTD
- Filing Date
- 2022-12-12
- Publication Date
- 2026-06-26
Smart Images

Figure CN116152364B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of computer graphics processing technology, and in particular relates to a method and system for encoding orthogonal polygon distribution patterns. Background Technology
[0002] In pattern encoding, a pattern refers to an orthogonal polygon that may contain holes, a pattern refers to a two-dimensional distribution composed of specific patterns, and encoding is a descriptive form of this distribution. To make subsequent operations more efficient and accurate, this encoding should contain the necessary geometric information of the pattern using as little storage capacity as possible. In situations with a very large number of patterns, such as in the automated processing of integrated circuit layout information, efficient pattern encoding methods will be one of the most important foundations of the algorithm system.
[0003] The applicant found that existing graphic pattern encoding methods mainly include the following:
[0004] (1) Pattern encoding based on density matrix: This method is intuitive and easy to understand. It uses the area ratio of the pattern on each pixel block of the same size as the graphic encoding of the pattern. However, the problem with this method is that the size of the pixel block needs to be manually adjusted and the encoding accuracy is not high, which often makes it difficult to meet the actual needs.
[0005] (2) Pattern encoding based on graphic grid partitioning: This method projects the edges of each polygon (including holes) contour onto the boundary, and each line formed cuts the rectangular area of the entire pattern, thus forming a 0-1 distributed two-dimensional matrix. This method is widely used because it is easy to operate. However, the grid partitioning method will generate a lot of redundant information, and the 0-1 distribution can only obtain insufficient topological features of the pattern. The length information in the horizontal or vertical direction must be stored separately. Therefore, this method is only suitable for the coarse screening stage of graphic classification or pattern matching.
[0006] (3) Pattern encoding based on skeleton graph: The core idea of this method is to store the topological information of polygons and use it as the polygon skeleton for analysis and processing; however, if this method is to store complete geometric information, it also requires more storage space, and the conversion between the two is difficult to meet the efficiency requirements, and it is also difficult to handle the situation where there is overlap between polygons.
[0007] (4) Pattern coding based on circular sampling: take the center of the pattern as the center of the circle, draw a set of concentric circles, and analyze the information of the graphic distribution based on the sampling results of the concentric circles; however, this method is also subject to constraints such as sampling density, and cannot fully reflect the geometric information of the graphic. Summary of the Invention
[0008] To address the aforementioned problems in existing technologies, this invention provides a method and system for encoding orthogonal polygon distribution patterns. This encoding method is used to encode patterns formed by a specific distribution composed of a large number of perforated orthogonal polygons, and can be applied to the analysis, processing, and synthesis of large amounts of two-dimensional distributed graphics, such as computer graphics pattern matching. It can be applied in various fields such as high-end manufacturing, game development, and geographic information systems.
[0009] To solve the above-mentioned technical problems, the present invention adopts the following technical solution:
[0010] In a first aspect, the present invention provides a method for encoding orthogonal polygon distribution patterns, comprising:
[0011] S1. Establish a polygon database and a pattern database. The polygon database is used to store the number, shape code and transformation code of various polygons encountered in the pattern encoding process. The pattern database is used to store the feature code and transformation code of the pattern.
[0012] S2. For each polygon in the given distribution, establish a pattern object: search for each polygon in the polygon database established in S1 according to its shape code. If the search is successful, return the number and transformation type of the polygon. If the search fails, determine its symmetry type according to the shape code of the polygon, and calculate all its transformation codes according to its shape code and symmetry type, store them in the polygon database, assign a polygon number to it, and then return the newly assigned polygon type number and transformation type.
[0013] S3. Encode the pattern according to the number and transformation type of each polygon and its position relative to the center point of the pattern;
[0014] S4. Create various transformation codes for the pattern: Based on the pattern established in S2 and the polygons in the pattern, encode the different geometric transformation operations of the pattern to obtain the transformation codes of the pattern, and retain and store them in the pattern database.
[0015] This invention offers several advantages. First, it is based on polygons, enabling user-friendly encoding with polygons as the graphic unit, eliminating the need for image or mesh conversion. It also facilitates convenient and simple processing and conversion of symmetrical graphics or patterns. Second, it can handle polygon overlap and polygons with holes, providing a clear and intuitive representation of the geometric features of the graphics, and the conversion between graphics and encoding is very convenient. Third, it requires only a small amount of data to complete some common subsequent algorithmic steps such as pattern matching or pattern similarity analysis. Fourth, it can be easily converted to other encoding methods.
[0016] Furthermore, S4 uses the pattern established in S2 and the polygons in the pattern as a basis to encode different geometric transformation operations of the pattern. Specifically, the rotation and mirroring operations of the polygon pattern are based on the polygons, and the relative position of the polygons is represented by the coordinates of the center point of the polygon border relative to the center point of the pattern. Then, the center point of each polygon is operated according to the rotation and mirroring rules of point coordinates, and then the polygons are sorted according to the order required by the pattern.
[0017] Furthermore, the transformation type is a geometric transformation type, including prototype, prototype horizontal mirror, prototype rotated 90° counterclockwise, prototype rotated 90° counterclockwise and then horizontal mirror, prototype rotated 180° counterclockwise, prototype rotated 180° counterclockwise and then horizontal mirror, prototype rotated 270° counterclockwise, and prototype rotated 270° counterclockwise and then horizontal mirror.
[0018] Furthermore, S3 specifically involves: calculating the encoding of various transformation types of the calculation mode, calculating the new polygon transformation type after the mode transformation based on the original polygon type and mode transformation type, and representing it in a lookup table.
[0019] Secondly, the present invention provides an encoding system for orthogonal polygon distribution patterns, characterized in that it includes:
[0020] Polygon processing module: It is used to search for each polygon contained in the graphic to be encoded in the established polygon database according to its shape code. If the search is successful, it returns the corresponding number and transformation type of the polygon; if the search fails, it determines the symmetry type of the polygon based on its shape code, calculates all its transformation codes based on its shape code and symmetry type, stores them in the polygon database, assigns a polygon number to it, and then returns the newly assigned polygon type number and transformation type.
[0021] Pattern processing module: used to encode the pattern according to the number and transformation type of each obtained polygon and its position relative to the center point of the pattern, and to encode different geometric transformation operations of the pattern based on the established pattern and the polygons in the pattern, to obtain the transformation code of the pattern, and to retain and store it in the pattern database.
[0022] In addition, the database module is used to store the numbering, shape encoding, and transformation information of various polygons encountered during the pattern encoding process, as well as the feature encoding and transformation information of the pattern.
[0023] Furthermore, the polygon processing module includes a polygon parsing submodule and a polygon transformation submodule; wherein,
[0024] The polygon parsing submodule is used to parse the various types of orthogonal polygons contained in the input graphic to be encoded, obtain a vertex list containing only shape information, and use it as the shape code of the polygon. Then, it searches in the established polygon database according to the shape code, and when the search is successful, it returns the number and transformation type of the polygon.
[0025] The polygon transformation submodule is used to determine the symmetry type of the polygon based on its shape code when the search in the established polygon database fails based on the shape code, and to calculate all its transformation codes based on its shape code and symmetry type, store them in the polygon database, assign a polygon number to it, and then return the newly assigned polygon type number and transformation type.
[0026] Furthermore, the database module includes:
[0027] Polygon database: used to store the number, shape code, and transformation code of different polygons;
[0028] In addition, a pattern database: used to store the feature codes and transformation codes of patterns.
[0029] For the various aspects of the second aspect mentioned above and the technical effects that each aspect may achieve, please refer to the above description of the technical effects that can be achieved for the first aspect or the various possible solutions in the first aspect, which will not be repeated here. Attached Figure Description
[0030] Figure 1 This is a flowchart illustrating the encoding method for orthogonal polygon distribution patterns described in this invention;
[0031] Figure 2 These are examples of various symmetry types of polygons in the encoding method for orthogonal polygon distribution patterns described in this invention;
[0032] Figure 3 This is a transformation type table corresponding to different symmetry types of polygons in the encoding method for orthogonal polygon distribution patterns described in this invention;
[0033] Figure 4 This is a flowchart of the polygon symmetry type determination process in the encoding method for orthogonal polygon distribution patterns described in this invention;
[0034] Figure 5 This is the transformation type table of polygon symmetry type after different geometric operations in the encoding method for orthogonal polygon distribution patterns described in this invention;
[0035] Figure 6 This is an example diagram of the pattern in Embodiment 1 of the encoding method for orthogonal polygon distribution patterns described in this invention;
[0036] Figure 7 The encoding method for orthogonal polygon distribution patterns described in Embodiment 1 of this invention includes polygon classification in the pattern.
[0037] Figure 8 This refers to the transformation of different polygons in Embodiment 1 of the encoding method for orthogonal polygon distribution patterns described in this invention;
[0038] Figure 9 These are different transformation types of the pattern in Embodiment 1 of the encoding method for orthogonal polygon distribution patterns described in this invention;
[0039] Figure 10 This is an example diagram of the pattern in Embodiment 2 of the encoding method for orthogonal polygon distribution patterns described in this invention;
[0040] Figure 11 In Embodiment 2 of the encoding method for orthogonal polygon distribution patterns described in this invention, the pattern includes polygon classification.
[0041] Figure 12 This refers to the transformation of different polygons in Embodiment 2 of the encoding method for orthogonal polygon distribution patterns described in this invention;
[0042] Figure 13 These are different transformation types of the pattern in Embodiment 2 of the encoding method for orthogonal polygon distribution patterns described in this invention;
[0043] Figure 14 This describes the grid formation process during the traversal of the encoding method of this invention, which is then converted into grid encoding.
[0044] Figure 15 This invention's encoding method is converted into a grid 0-1 matrix obtained after grid division during the grid encoding process;
[0045] Figure 16 This is a schematic diagram of the structure of the encoding system for orthogonal polygon distribution patterns described in this invention. Detailed Implementation
[0046] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0047] like Figure 1 As shown in the figure, the encoding method for orthogonal polygon distribution patterns according to the present invention specifically includes the following steps:
[0048] Step S1. Establish a polygon database and a pattern database. The polygon database stores the numbers, shape codes, and transformation codes of various polygons encountered during the pattern encoding process. The pattern database stores the feature codes and transformation codes of patterns. The polygon code is an entry stored in the polygon database, and its code contains three elements:
[0049] 1. Shape encoding of polygons: Described by a list of vertices of the polygon. The list of vertices consists of the coordinates of each vertex of the polygon relative to the center position of the polygon (the center position is the center of the bounding rectangle of the polygon). The vertices are arranged in a counterclockwise direction.
[0050] 2. Polygon numbering: Each time a new polygon is obtained, the polygon processing module assigns a number to the current polygon to identify the polygon of that shape.
[0051] 3. Polygon Transformation Encoding: This element stores a list of polygon vertices obtained after various geometric transformations.
[0052] Specifically, for a given polygon, first, based on the shape encoding of the polygon... Figure 2 and Figure 4 The method determines the symmetry type of a polygon, and then, based on the symmetry type, ... Figure 3 The algorithm identifies which transformation types of the polygon need to be stored and obtains the transformed vertex list based on the corresponding geometric transformations. This is done by performing the corresponding geometric operation on each vertex and then sorting them counterclockwise to obtain the corresponding transformation.
[0053] For each polygon, we need to obtain its border and vertex list. Since the vertex list contains the position information of the polygon's vertices, in order to make it contain only shape information, we translate the vertex coordinates by subtracting the x-coordinate of the polygon's border center from the x-coordinate of the vertex, and subtracting the y-coordinate of the polygon's border center from the y-coordinate of the vertex.
[0054] It's worth noting that the outer boundary vertices of polygons are stored in counter-clockwise order. For polygons containing holes, the hole shapes are also stored using the same translation method, but in clockwise order to distinguish them from the outer boundary. For both outer and inner boundaries, vertices are recorded starting from the bottom-left vertex. For polygons containing multiple holes, the recording also starts from the bottom-left polygon, with the holes arranged in a clockwise order.
[0055] Using the method described above, a unique shape description for each type of polygon can be obtained. Mathematically, it can be proven that this representation is compact and free of redundancy.
[0056] The following transformations involve rotation and mirroring. For a given polygon symmetry type, the symmetry type is determined by the polygon's symmetry and includes eight geometric transformation types: the original and its horizontal mirror, the original rotated 90° counterclockwise and its horizontal mirror, the original rotated 180° counterclockwise and its horizontal mirror, and the original rotated 270° counterclockwise and its horizontal mirror. This transformation is similar to rotation around the center of rotation and symmetry operations around the perpendicular axis of symmetry in mathematics. It's important to note that after each operation, for cases with multiple holes, the arrangement of the holes needs to be readjusted according to the transformed direction.
[0057] To save storage space, this paper also analyzes polygons with special symmetry types. When processing polygons, it is necessary to determine the symmetry type of the polygon. Specific polygon symmetry types are as follows: Figure 2 Examples include bi-fold central symmetry, quadri-fold central symmetry, vertical symmetry, horizontal symmetry, +π / 4 axial symmetry, -π / 4 axial symmetry, bi-fold central axis symmetry, and quadri-fold central axis symmetry. For polygons with symmetry, only a few specific transformations need to be stored during storage, because different transformations may produce the same shape. Here, the above eight transformation types are denoted as O1, O2, O3, O4, O5, O6, O7, and O8, respectively. The specific storage representation is as follows: Figure 3 The process for determining the symmetry type of a polygon is as follows: Figure 4 As shown.
[0058] After completing the above steps, the shape information of the polygons can be stored in the polygon database in the form of a list (the shape information of the polygons is obtained through polygon parsing, including a vertex list, a transformation list (referring to the transformation type of a specific polygon), and a symmetry type), and each polygon type can be assigned a number, denoted as index.
[0059] The establishment of the polygon database involves analyzing and encoding the polygon graphics encountered during the pattern encoding process, storing the shape information of the polygons in the database, and assigning a number to each polygon for later use.
[0060] Step S2. For each polygon in the given distribution, establish a pattern object: Search for each polygon in the graphic to be encoded in the polygon database established in S1 according to its shape code. If the search is successful, return the corresponding number and transformation type of the polygon; if the search fails, determine its symmetry type based on the polygon's shape code, and calculate all its transformation codes based on its shape code and symmetry type, store them in the polygon database, assign it a polygon number, and then return the newly assigned polygon type number "index" and transformation type (i.e., ...). Figure 3(The "T1" transformation type in the text).
[0061] The position of the center point of each polygon in the pattern relative to the center point of the pattern is used as the position coordinate of the polygon in the pattern. Starting from the bottom left polygon, the polygons in the pattern are assigned a sequence number id in counterclockwise order (different orders can be used depending on the actual needs). Each polygon is assigned an object, which only needs to store the polygon's index and transformation type. Each polygon in the pattern is stored as an element in the given order in the form of a list. For larger patterns, an rtree suitable for spatial indexing can also be used for storage.
[0062] Step S3. Encode the pattern according to the number and transformation type of each polygon and its position relative to the center point of the pattern.
[0063] Pattern encoding, similar to polygon encoding, serves as an entry in the pattern database. The acquisition process is as follows: For an acquired pattern, it has a rectangular border and its own center point (i.e., the center point of the rectangular border), with polygons distributed in different positions. The pattern encoding format is as follows:
[0064] [Pattern width, pattern height, polygon distribution list]
[0065] Both the pattern width and height can be determined by the pattern's rectangular border. Its polygon distribution list includes information about the polygons in the pattern, with each polygon described as follows:
[0066] [x,y,polygon_id,transform_id]
[0067] Where x and y are the coordinates of the polygon's center point relative to the pattern's center point, and polygon_id and transform_id are the polygon ID and transformation type returned when searching for a polygon. Arranging these polygons in counter-clockwise order by their center points yields a list of polygon distributions.
[0068] Step S4. Create various transformation codes for the polygon pattern: Based on the pattern established in S2 and the polygons in the pattern, encode the different geometric transformation operations of the pattern to obtain the transformation codes of the pattern, and save and store them in the pattern database.
[0069] The specific operation is as follows: calculate the encoding of various transformation types of the pattern, calculate the new polygon transformation type after the pattern transformation based on the original polygon type and pattern transformation type, and represent it in a lookup table. Figure 5The purpose of this calculation is to determine the code corresponding to a pattern after transformation, so that subsequent encounters with the same code can be correctly searched and categorized. The calculation process is as follows: for each polygon in the pattern, the coordinates of its center point will change after transformation, its shape will not change (that is, its polygon number will not change), its symmetry type may change, and the changes in its symmetry type have been listed in the lookup table above; the changes in its center point are reflected in the table below (simple geometric transformations):
[0070]
[0071] The rotation and mirroring operations of the polygon pattern are based on polygons. The relative position of the polygons is represented by the coordinates of the center point of the polygon's border relative to the center point of the pattern. Then, the center point of each polygon is rotated and mirrored according to the point coordinate rules. Finally, the polygons are sorted according to the order required by the pattern. This sorting process does not need to be done from scratch because the polygons in the pattern prototype are already arranged in a counter-clockwise order. Therefore, when arranging, for transformations involving only rotation, since rotation does not change the clockwise or counter-clockwise order, it is only necessary to find the bottom-left corner graphic and arrange them in the original pattern's order. For transformations involving mirroring, since mirroring changes clockwise to counter-clockwise and counter-clockwise to clockwise, after finding the bottom-left corner graphic, it is also necessary to reverse the polygon arrangement.
[0072] Pattern analysis also requires establishing different transformations for the pattern. Similar to polygon analysis, there are eight transformation types. However, due to the complexity of the graphic distribution within the pattern and the demands of practical applications, symmetry analysis is not always necessary. Therefore, the eight transformation types for each pattern are encoded and stored here.
[0073] For each transformation of the pattern, its encoding is saved and stored in the pattern database.
[0074] In this invention, geometric information related to the pattern can be stored in the pattern database for use in subsequent operations.
[0075] The encoding method for orthogonal polygon distribution patterns described in this invention has the following advantages compared with existing encoding methods:
[0076] 1. Since the encoding method of the present invention is based on polygons, it is very user-friendly when polygons are used as graphic units, and there is no need to convert images or grids.
[0077] 2. The encoding method of the present invention can conveniently and easily process and transform symmetrical graphics or patterns, while the analysis of symmetry in existing methods is often very complicated;
[0078] 3. The encoding method of the present invention can be used to handle cases of polygon overlap and polygons with holes, and the description of the geometric features of the graphics is very clear and intuitive, and the conversion between graphics and encoding is also very convenient.
[0079] 4. The encoding method of the present invention can complete the computation with a relatively small amount of data when performing some common subsequent algorithm steps such as pattern matching or pattern similarity analysis;
[0080] 5. The encoding method of the present invention can be easily converted into other encoding methods.
[0081] It is evident that the encoding method for orthogonal polygon distribution patterns described in this invention is efficient and accurate.
[0082] The encoding method for orthogonal polygon distribution patterns described in this invention is further illustrated by the following embodiments.
[0083] Example 1
[0084] Reference Figure 6 Taking the pattern of this graphic distribution as an example, assuming it is a graphic to be encoded, its encoding is given through the following steps.
[0085] Step 101: [The text appears to be incomplete and contains several grammatical errors. A more accurate translation would require Figure 6 The polygons contained in the graphic to be encoded have indices of 0-3 (e.g., ...). Figure 7 The system encodes and stores the data, and determines the symmetry of the graphics. Specifically, the encoding results for each polygon index (0-3) are as follows:
[0086] index: 0
[0087] vertex_list: (-1.5, -1.5) (-0.5, -1.5) (-0.5, 0.5) (1.5, 0.5) (1.5, 1.5) (-1.5, 1.5)
[0088] hole: None
[0089] symmetry_type: -πt / 4 axis symmetry
[0090] index: 1
[0091] vertex_list: (-0.5, -1.5) (0.5, -1.5) (0.5, 1.5) (-0.5, 1.5)
[0092] hole: None
[0093] symmetry_type: center of two folds
[0094] Axisymmetry
[0095] index: 2
[0096] vertex_list: (-2.5, -1.5) (2.5, -1.5) (2.5, -0.5) (0.5, -0.5) (0.5, 1.5) (-0.5, 1.5) (-0.5, -0.5) (-2.5, -0.5)
[0097] hole: None
[0098] symmetry_type: vertical axis symmetry
[0099] index: 3
[0100] vertex_list: (-0.5, -0.5) (0.5, -0.5) (0.5, 0.5)-0.5, 0.5)
[0101] hole: None
[0102] symmetry_type: four-fold
[0103] Axial symmetry
[0104] Furthermore, the transformation types of each polygon with indices 0-3 are as follows: Figure 8 .
[0105] Step 102: Express the graphic distribution of this pattern in the following form according to the agreed rules:
[0106] {5, 7, [(0, 0, 2, 1), (-1, -3, 1, 2), (2, -3, 3, 1), (2, 2, 1, 1), (-1, 2, 0, 1)]}
[0107] The encoding consists of three elements. The first two elements, 5 and 7, represent the width and height of the pattern, respectively. The last element represents the polygon information in the pattern. There are a total of 5 polygons. Each polygon's information is represented by four numbers: the first two numbers represent the polygon's relative position coordinates with respect to the pattern (represented by the polygon's center position relative to the pattern's center position), the third number represents the polygon's index number in the polygon database, and the fourth number represents the polygon's transformation type.
[0108] Step 103: Establish different transformations for the pattern and store the transformed codes along with the original codes in the pattern database. The various transformations of the pattern are as follows: Figure 9 As shown.
[0109] Example 2
[0110] Reference Figure 10 Taking the pattern of this graphic distribution as an example, assuming it is the graphic to be encoded, its encoding is given through the following steps. This example includes two cases: polygons with holes and polygons overlapping. Its encoding is given through the following steps:
[0111] Step 201: [The text appears to be incomplete and contains several grammatical errors. A more accurate translation would require Figure 10 The polygon index contained in it: 4-5 (e.g., Figure 11 The process involves encoding, storing, and determining the symmetry of the graphics. Specifically, the encoding results for each polygon index (4-5) are as follows:
[0112] index: 4
[0113] vertex_list: (-1.5,-1.5)(1.5,-1.5)(1.5,1.5)(-1.5,1.5)
[0114] hole: (-o.5, -o.5) (-0.5, 0.5) (0.5, 0.5) (0.5, -0.5)
[0115] symmetry_type: Four-fold center
[0116] Axisymmetry
[0117] index: 5
[0118] vertex_list: (-0.5, -2.5) (0.5, -2.5) (0.5, 2.5) (-0.5, 2.5)
[0119] hole: None
[0120] symmetry_type: Four-fold center
[0121] Axisymmetry
[0122] Furthermore, the transformation type of each polygon with index 4-5 is as follows: Figure 12 .
[0123] Step 202: Express the graphic distribution of this pattern in the following form according to the agreed rules:
[0124] {5,5,[(0,-2,5,2),(2,0,5,1),(-1,1,4,1)]}
[0125] The encoding consists of three elements. The first two elements, 5 and 5, represent the width and height of the pattern, respectively. The last element represents the polygon information in the pattern, which contains three polygons, two of which overlap (in...). Figure 10 (Represented in orange in the image), each polygon's information is represented by four numbers: the first two numbers represent the polygon's relative position coordinates with respect to the pattern (represented by the polygon's center position relative to the pattern's center position), the third number represents the polygon's index number in the polygon database, and the fourth number represents the polygon's transformation type.
[0126] Step 203: Establish different transformations for the pattern and store the transformed codes along with the original codes in the pattern database. The various transformations of the pattern are as follows: Figure 13 As shown.
[0127] Pattern similarity measurement is an important application of graph coding. Since the polygons used in this method are described through a list of polygon vertices, it is not direct enough for performing two-pattern similarity comparisons. However, a simpler method can be used to convert the coding scheme. Here, we take converting it to grid coding as an example to illustrate the rapid conversion between this coding scheme and other coding schemes. This embodiment still uses Example 2 as an example. Figure 10 Let's take the pattern as an example for explanation. Because... Figure 10 The patterns in the code include cases of holes and overlaps, and can therefore serve as a typical example, which is encoded through the following steps.
[0128] Step 301: Create two arrays. Array 1 represents the horizontal division of the grid, and array 2 represents the vertical division of the grid.
[0129] Step 302: Iterate through each polygon in the pattern, specifically the vertices of its outer border. Since the outer borders are organized counter-clockwise, the first edge must be horizontal to the right. Add the ordinate of the first vertex to array two, and the x-coordinate of the second vertex to array one. Repeat this process for each polygon. For polygons containing holes, this operation is also applied to the vertex list of the holes, but the order in which the coordinates are added to array one and array two is reversed. The specific process is as follows: Figure 14 As shown.
[0130] Step 303: Sort and remove duplicates from array 1 and array 2 to obtain the projected mesh in two directions. Figure 12 The array obtained after partitioning the pattern shown is as follows:
[0131] Horizontal array: [-2.5, -1.5, -0.5, 0.5, 1.5, 2.5]
[0132] Vertical array: [-2.5, -1.5, -0.5, 0.5, 1.5, 2.5]
[0133] Then, based on whether each grid cell is filled with a grid value, a two-dimensional 0-1 matrix can be formed, and the final grid matrix is as follows: Figure 15 As shown.
[0134] Step 304: After obtaining the grid matrix, the XOR operation of the two-dimensional matrix can be easily performed to measure the similarity between the two patterns.
[0135] Secondly, see Figure 16 The present invention also provides an encoding system for orthogonal polygon distribution patterns, including a polygon processing module 100, a pattern processing module 200, and a database module 300.
[0136] The polygon processing module 100 is used to analyze and process polygons encountered during pattern encoding, process orthogonal polygons containing holes, and perform symmetry analysis on polygons. The polygon processing module 100 may include a polygon parsing submodule and a polygon transformation submodule. The polygon parsing submodule parses various types of orthogonal polygons in the input graphic to be encoded, obtaining a vertex list containing only shape information, assigning a shape code to each vertex, and then searching in the established polygon database based on the shape code. If the search is successful, it returns the corresponding polygon number and transformation type. The polygon transformation submodule, when the search in the established polygon database fails based on the shape code, determines the symmetry type of the polygon based on its shape code, calculates all its transformation codes based on its shape code and symmetry type, stores them in the polygon database, assigns a polygon number to each polygon, and then returns the newly assigned polygon type number and transformation type. In simple terms, the polygon parsing submodule parses the input orthogonal polygons of various types to obtain a vertex list containing only shape information and assigns it a number; the polygon transformation submodule performs rotation and / or mirroring operations on the newly created polygons to obtain different forms of transformation, and determines the symmetry type of the polygon through the equivalent transformation relationship of different transformations, and stores the necessary and sufficient transformation codes.
[0137] The pattern processing module 200 is used to analyze a given distribution of polygon sets to form a pattern, and to perform orientation transformation analysis on the pattern.
[0138] The database module 300 is used to store the shape information and assigned numbers of various polygons encountered during the pattern encoding process, as well as the transformation type of the pattern. The database module may include a polygon sub-database and a pattern sub-database; the polygon sub-database is used to store the numbers, shape codes, and transformation information of different polygons (i.e., the numbers, shape codes, and transformation information for each different polygon) according to the previously defined encoding method, where the transformation information is already obtained during polygon analysis; the pattern sub-database is used to store the feature codes and transformation information of the pattern according to the previously defined encoding method.
[0139] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A method for encoding orthogonal polygon distribution patterns, characterized in that, include: S1. Establish a polygon database and a pattern database. The polygon database is used to store the number, shape code and transformation code of various polygons encountered in the pattern encoding process. The pattern database is used to store the feature code and transformation code of the pattern. S2. For each polygon in the given distribution, establish a pattern object: search for each polygon in the polygon database established in S1 according to its shape code. If the search is successful, return the number and transformation type of the polygon. If the search fails, determine its symmetry type according to the shape code of the polygon, and calculate all its transformation codes according to its shape code and symmetry type, store them in the polygon database, assign a polygon number to it, and then return the newly assigned polygon type number and transformation type. S3. Encode the pattern according to the number and transformation type of each polygon and its position relative to the center point of the pattern; S4. Create various transformation codes for the pattern: Based on the pattern established in S2 and the polygons in the pattern, encode the different geometric transformation operations of the pattern to obtain the transformation codes of the pattern, and save and store them in the pattern database. S4 is based on the pattern established in S2 and the polygons in the pattern. Different geometric transformation operations of the pattern are encoded. Specifically, the rotation and mirroring operations of the polygon pattern are based on the polygon. The relative position of the polygon is represented by the coordinates of the center point of the polygon border relative to the center point of the pattern. Then, the center point of each polygon is operated according to the rotation and mirroring rules of point coordinates. Finally, the polygons are sorted according to the order required by the pattern.
2. The method according to claim 1, characterized in that, The transformation type is a geometric transformation type, including prototype, prototype horizontal mirror, prototype rotated 90° counterclockwise, prototype rotated 90° counterclockwise and then horizontal mirror, prototype rotated 180° counterclockwise, prototype rotated 180° counterclockwise and then horizontal mirror, prototype rotated 270° counterclockwise, and prototype rotated 270° counterclockwise and then horizontal mirror.
3. The method according to claim 1, characterized in that, S3 specifically involves: calculating the encoding of various transformation types of the calculation mode, calculating the new polygon transformation type after the mode transformation based on the original polygon type and mode transformation type, and representing it in a lookup table.
4. A coding system for orthogonal polygon distribution patterns, used to execute the coding method according to any one of claims 1-3, characterized in that, include: Polygon processing module: It is used to search for each polygon contained in the graphic to be encoded according to its shape in the established polygon database. If the search is successful, it returns the number and transformation type of the polygon. If the search fails, determine the symmetry type of the polygon based on its shape code, calculate all its transformation codes based on its shape code and symmetry type, store them in the polygon database, assign a polygon number to it, and then return the newly assigned polygon type number and transformation type. Pattern processing module: used to encode the pattern according to the number and transformation type of each obtained polygon and its position relative to the center point of the pattern, and to encode different geometric transformation operations of the pattern based on the established pattern and the polygons in the pattern, to obtain the transformation code of the pattern, and to retain and store it in the pattern database. In addition, the database module is used to store the numbering, shape encoding, and transformation information of various polygons encountered during the pattern encoding process, as well as the feature encoding and transformation information of the pattern.
5. The encoding system for orthogonal polygon distribution patterns according to claim 4, characterized in that, The polygon processing module includes a polygon parsing submodule and a polygon transformation submodule; wherein... The polygon parsing submodule is used to parse various types of orthogonal polygons contained in the input graphic to be encoded, obtain a vertex list containing only shape information, and use it as the shape code of the polygon. Then, it searches in the established polygon database according to the shape code, and if the search is successful, it returns the corresponding number and transformation type of the polygon. The polygon transformation submodule is used to determine the symmetry type of the polygon according to the shape code when the search in the established polygon database according to the shape code fails, and calculate all its transformation codes according to its shape code and symmetry type, store them in the polygon database, assign a polygon number to it, and then return the newly assigned polygon type number and transformation type.
6. The encoding system for orthogonal polygon distribution patterns according to claim 4, characterized in that, The database module includes: Polygon database: used to store the number, shape code, and transformation code of different polygons; In addition, a pattern database: used to store the feature codes and transformation codes of patterns.