Edge reduction method, device and equipment for arbitrary convex polygon and storage medium
By constructing triangles from adjacent vertices of a convex polygon and calculating the deformation for edge reduction, the problem of low computational efficiency in existing technologies is solved, achieving efficient convex polygon edge reduction and real-time 3D model rendering.
Patent Information
- Application Number
- CN202511347453.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-19
- Publication Date
- 2026-01-06
AI Technical Summary
Existing technologies for reducing the sides of convex polygons have low computational efficiency and cannot meet the real-time requirements of 3D model rendering.
By constructing multiple triangles from adjacent vertices of a convex polygon, the deformation of each triangle is calculated, and the number of sides is reduced based on the minimum deformation until the target number of sides is reached.
It improves the computational efficiency of fitting convex polygons, reduces computational complexity, meets the real-time requirements of 3D model rendering, and ensures that the graphic remains a convex polygon after the reduction of sides.
Smart Images

Figure CN121280680A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of image processing technology, and particularly relates to a method, apparatus, device and storage medium for reducing the sides of an arbitrary convex polygon. Background Technology
[0002] When rendering 3D models, reducing the number of convex polygons helps improve rendering efficiency and avoids visual distortion. Existing convex polygon reduction methods usually involve directly fitting a new target convex polygon. However, this method has low computational efficiency, requiring the calculation of the area change before and after the convex polygon is transformed. This makes the area calculation process of the convex polygon complex and computationally intensive, and it is difficult to meet the real-time requirements of 3D model rendering. Summary of the Invention
[0003] In view of this, the present invention aims to provide a method for reducing the sides of an arbitrary convex polygon. By constructing multiple triangles of the convex polygon based on the information of adjacent vertices, calculating the deformation of each triangle, and then performing the side reduction operation on the convex polygon based on the deformation, the computational efficiency of fitting the convex polygon is improved and the computational complexity is reduced, while meeting the real-time requirements of 3D model rendering.
[0004] To achieve the above objectives, the technical solution created by this invention is implemented as follows: In a first aspect, embodiments of the present invention provide a method for reducing the sides of an arbitrary convex polygon, comprising: Step S10: Obtain the first vertex set of the convex polygon, wherein the first vertex set contains all vertex information of the convex polygon; Step S20: Confirm the current number of sides of the convex polygon based on the vertex information. If the current number of sides is less than or equal to the preset target number of sides, do not execute the subsequent steps and directly output the first vertex set as the output result of the side reduction method. If the current number of sides is greater than the target number of sides, continue to perform the subsequent steps. Step S30: Construct multiple triangles based on the adjacent vertex information, and calculate the deformation of each triangle; Step S40: Based on the triangle with the smallest deformation among the multiple deformation variables, perform a side reduction operation on the convex polygon. If the current number of sides of the convex polygon after the side reduction operation is still greater than the preset target number of sides, return to step S20. Confirm the current number of sides of the convex polygon after the side reduction operation based on the vertex information after the side reduction operation, and continue to perform the side reduction operation on the convex polygon. When the current number of sides of the convex polygon after the side reduction operation is less than or equal to the preset target number of sides, proceed to the subsequent steps. Step S50: Output the second vertex set of the convex polygon after the edge reduction operation is completed.
[0005] In some embodiments of the present invention, constructing multiple triangles based on the adjacent vertex information and the current number of sides includes: Step S301: Identify a vertex of the convex polygon, namely the second vertex, and the first and third vertices adjacent to the second vertex, wherein the line connecting the first vertex and the second vertex forms the first side of the convex polygon, and the line connecting the second vertex and the third vertex forms the second side of the convex polygon. Step S302: Connect the first vertex and the third vertex so that the line connecting the first vertex and the third vertex forms a third side; construct the triangle based on the first side, the second side, and the third side; connect the second vertex and the third side so that a first straight line is formed between the second vertex and the third side, wherein the first side and the second side form an included angle of the triangle, and the first straight line is perpendicular to the third side; Step S303: Repeat steps S301 to S302, constructing the triangle by taking each vertex of the convex polygon as the second vertex in sequence, and calculating the area of the triangle, until all vertices of the convex polygon have completed the construction of the triangle, and the area of each triangle is calculated. Step S304: Determine the included angle of the triangle formed by the first side and the second side in each of the plurality of triangles; Step S305: Introduce a preset first weight value, a second weight value, and a third weight value, and calculate the deformation of each triangle based on the first weight value, the second weight value, the third weight value, the third side, the area, and the included angle of the triangle.
[0006] In some embodiments of the present invention, calculating the deformation of each of the triangles includes: Step S3051: Calculate the first product of the first weight value and the third side; Step S3052: Calculate the second product of the second weight value and the area of the triangle; Step S3053: Calculate the third product of the third weight value and the included angle of the triangle; Step S3054: Summate the first product, the second product, and the third product to obtain the deformation.
[0007] In some embodiments of the present invention, the third side and the area are both directly proportional to the deformation, and the angle is inversely proportional to the deformation.
[0008] In a second aspect, embodiments of the present invention provide an edge reduction device for an arbitrary convex polygon, comprising at least one control processor and a memory for communicatively connecting to the at least one control processor; the memory stores instructions executable by the at least one control processor, the instructions being executed by the at least one control processor to enable the at least one control processor to perform the edge reduction method for an arbitrary convex polygon as described in the first aspect above.
[0009] Thirdly, embodiments of the present invention provide an electronic device including a side reduction device for an arbitrary convex polygon as described in the second aspect above.
[0010] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing computer-executable instructions for performing the side reduction method for an arbitrary convex polygon as described in the first aspect above.
[0011] Compared with the prior art, the present invention can achieve the following beneficial effects: This invention constructs multiple triangles based on three adjacent vertices of an arbitrary convex polygon, calculates the deformation of each triangle, and performs a side reduction operation on the arbitrary convex polygon based on the triangle with the smallest deformation. This allows the calculation of deformation of the convex polygon to only require calculating the deformation of the triangles, thereby effectively improving the computational efficiency of convex polygon fitting, reducing computational complexity, simplifying the operation, and meeting the real-time requirements of 3D model rendering.
[0012] Furthermore, since the graphic obtained by the present invention after the side reduction operation on the convex polygon is still a convex polygon, there is no need to perform a concavity / convexity test on the graphic after the side reduction operation. Attached Figure Description
[0013] The accompanying drawings, which form part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments and descriptions of the invention are used to explain the invention and do not constitute an undue limitation of the invention. In the drawings: Figure 1 This is a flowchart of the method for reducing the sides of an arbitrary convex polygon according to the present invention; Figure 2 This is a flowchart of constructing multiple triangles provided in an embodiment of the present invention; Figure 3 This is a flowchart for calculating the deformation of a triangle provided in an embodiment of the present invention; Figure 4 This is a schematic diagram of constructing a triangle provided in an embodiment of the present invention; Figure 5 This is a structural diagram of an arbitrary convex polygon reduction device provided in another embodiment of the present invention. Detailed Implementation
[0014] 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 specific embodiments. It should be understood that the specific embodiments described herein are only for explaining the invention and do not constitute a limitation thereof. Similar elements in different embodiments are referred to by associated similar element reference numerals. In the following embodiments, many details are described to facilitate a better understanding of the invention. However, those skilled in the art will readily recognize that some features may be omitted in different situations, or may be replaced by other elements, materials, or methods. In some cases, some operations related to the invention are not shown or described in the specification. This is to avoid obscuring the core parts of the invention with excessive description. For those skilled in the art, detailed description of these related operations is not necessary; they can fully understand the related operations based on the description in the specification and general technical knowledge in the art.
[0015] It should be noted that, unless otherwise specified, the embodiments and features described in this invention can be combined to form various implementations. Furthermore, the order of the steps or actions in the method description can be changed or adjusted in a manner readily apparent to those skilled in the art. Therefore, the various orders in the specification and drawings are merely for the clear description of a particular embodiment and do not imply a mandatory order, unless otherwise stated that a particular order must be followed.
[0016] In the description of this invention, it should be understood that the terms "center," "longitudinal," "lateral," "length," "width," "thickness," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," "outer," "clockwise," and "counterclockwise," etc., indicating orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation on this invention. Furthermore, the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, features defined with "first," "second," etc., may explicitly or implicitly include one or more of that feature. In the description of this invention, unless otherwise stated, "a plurality of" means two or more.
[0017] In the description of this invention, it should be noted that, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art will understand the specific meaning of the above terms in this invention based on the specific circumstances.
[0018] The invention will now be described in detail with reference to the accompanying drawings and embodiments.
[0019] Reference Figure 1 This invention provides a method for reducing the number of sides of an arbitrary convex polygon, comprising: obtaining a first vertex set of the convex polygon, wherein the first vertex set contains all vertex information of the convex polygon; determining the current number of sides of the convex polygon based on the vertex information; if the current number of sides is less than or equal to a preset target number of sides, directly outputting the first vertex set; if the current number of sides is greater than the preset target number of sides, continuing with subsequent steps; constructing multiple triangles based on adjacent vertex information and the current number of sides, and calculating the deformation of each triangle; performing a side reduction operation on the convex polygon based on the triangle with the smallest deformation among the multiple deformations; if the current number of sides of the convex polygon after the side reduction operation is still greater than the preset target number of sides, returning to the previous step of determining the current number of sides of the convex polygon based on the vertex information, determining the current number of sides of the convex polygon after the side reduction operation based on the vertex information after the side reduction operation, and continuing to perform the side reduction operation on the convex polygon until the current number of sides of the convex polygon is equal to the target number of sides; and outputting a second vertex set of the convex polygon after the side reduction operation.
[0020] In this embodiment, multiple triangles are constructed based on three adjacent vertices of an arbitrary convex polygon, and the deformation of each triangle is calculated. The triangle with the smallest deformation is used to reduce the number of sides of the arbitrary convex polygon. This allows the convex polygon to only need to calculate the deformation of the triangles when measuring deformation, thereby effectively improving the computational efficiency and reducing the computational complexity of fitting the convex polygon, and meeting the real-time requirements of 3D model rendering.
[0021] Furthermore, in this embodiment, since the side reduction operation is performed on the newly constructed triangle, the convex polygon after the side reduction operation must also be a convex polygon, thus avoiding the need to check the concavity and convexity of the polygon.
[0022] The method for reducing the sides of arbitrary convex polygons according to embodiments of the present invention will be further described below with reference to the accompanying drawings.
[0023] Reference Figure 1 and Figure 4 , Figure 1 The flowchart illustrates a method for reducing the sides of an arbitrary convex polygon according to an embodiment of the present invention. This method includes, but is not limited to, the following steps: Step S10: Obtain the first vertex set of the convex polygon, wherein the first vertex set contains all vertex information of the convex polygon; It should be noted that, in this embodiment, based on the vertex information in the first vertex set, each vertex of the convex polygon is labeled as A, B, C, D, E, F, G, H, I, and J; Step S20: Determine the current number of sides of the convex polygon based on the vertex information. If the current number of sides is less than or equal to the preset target number of sides, do not execute the subsequent steps and directly output the first vertex set as the output result of the side reduction method. If the current number of sides is greater than the preset target number of sides, continue to perform the subsequent steps. It should be noted that an n-sided convex polygon necessarily contains n vertices, and adjacent vertices are connected by edges. The first and last vertices are also adjacent. Therefore, once the vertex information is confirmed, the number of sides of the convex polygon is also confirmed. In this embodiment, the sides of the convex polygon are AB, BC, CD, DE, EF, FG, GH, HI, IJ, and JA, respectively. It should be noted that when the current number of edges is less than or equal to the preset target number of edges, the subsequent steps will not be executed. Instead, the first vertex set of the convex polygon will be directly output as the output result of the edge reduction method for any convex polygon. This is to avoid performing subsequent vertex traversal, edge reduction, and other operations when the current number of edges of the convex polygon already meets the requirements, thereby reducing the computational load of the edge reduction method, lowering the running difficulty, and improving real-time performance.
[0024] Step S30: Construct multiple triangles based on the information of adjacent vertices, and calculate the deformation of each triangle; It should be noted that in this embodiment, the order of traversing three adjacent vertices is ABC, BCD, CDE, DEF, EFG, FGH, GHI, HIJ, IJA, and JAB. That is, the vertices of the triangle constructed from these vertices are labeled ABC, BCD, CDE, DEF, EFG, FGH, GHI, HIJ, IJA, and JAB. Connecting two vertices separated by one point forms a new edge, namely AC, BD, CE, DF, EG, FH, GI, HJ, IA, and JB. Calculate the deformation of the triangle containing the new side in turn to ensure that the side to be removed minimizes the deformation of the convex polygon after the side reduction operation. Step S40: Based on the triangle with the smallest deformation among multiple deformation variables, perform a side reduction operation on the convex polygon. If the current number of sides of the convex polygon after the side reduction operation is still greater than the preset target number of sides, return to step S20. Confirm the current number of sides of the convex polygon after the side reduction operation based on the vertex information after the side reduction operation, and continue to perform the side reduction operation on the convex polygon. When the current number of sides of the convex polygon after the side reduction operation is less than or equal to the preset target number of sides, proceed to the subsequent steps. It should be noted that, because this embodiment selects the triangle with the smallest deformation during the edge reduction process, it effectively avoids the appearance of concave points after edge reduction. Since the local geometric features corresponding to triangles with small deformation changes little, the overall convexity of the original convex polygon is not destroyed, thus ensuring that the final shape formed by the set of the second vertices is still a convex polygon.
[0025] Furthermore, in this embodiment, the current number of sides of the convex polygon is equal to the target number of sides through the side reduction operation. Since the deformation of the convex polygon accumulated during the entire side reduction operation is small, the key shape features such as the outline and proportion of the original convex polygon can be preserved to the greatest extent, so that the properties of the convex polygon after side reduction are not changed. It should be noted that in this embodiment, the edge reduction operation only subtracts one edge of the convex polygon at a time. Subtracting one edge is equivalent to subtracting one vertex from the convex polygon. For example, refer to... Figure 4 The side reduction operation involves connecting points A and C to form a new edge of the convex polygon, meaning that vertex B is subtracted.
[0026] Step S50: Output the set of the second vertices of the convex polygon after the edge reduction operation is completed.
[0027] It should be noted that the output is the second vertex set of the convex polygon after the edge reduction operation. This second vertex set contains all vertex information of the convex polygon after the edge reduction operation, allowing direct access to the vertex information of the convex polygon after the edge reduction operation, so that further edge reduction operations can be performed on the convex polygon if needed later.
[0028] Additionally, in one embodiment, reference is made to Figure 2 and Figure 4 ,exist Figure 1 Step S30 of the illustrated embodiment also includes, but is not limited to, the following steps: Step S301: Identify a vertex of the convex polygon, namely the second vertex, as well as the first and third vertices adjacent to the second vertex, wherein the line connecting the first and second vertices forms the first side of the convex polygon, and the line connecting the second and third vertices forms the second side of the convex polygon. Step S302: Connect the first vertex and the third vertex to form a third side between the first vertex and the third vertex. Construct a triangle based on the first side, the second side, and the third side. Connect the second vertex and the third side to form a first straight line between the second vertex and the third side. The first side and the second side form the included angle of the triangle, and the first straight line is perpendicular to the third side. Step S303: Repeat steps S301 to S302, constructing triangles for each vertex of the convex polygon as the second vertex, and calculating the area of the triangles, until all vertices of the convex polygon have completed the construction of triangles and the area of each triangle has been calculated. Step S304: Determine the included angle of the triangle formed by the first side and the second side of each of the multiple triangles; Step S305: Introduce the preset first weight value, second weight value and third weight value, and calculate the deformation of each triangle based on the first weight value, second weight value, third weight value, third side, triangle area and the included angle of the triangle.
[0029] It should be noted that, referring to Figure 4 In this embodiment, we take the three vertices of a convex polygon ABC as an example. AB and BC are two sides of the original convex polygon. A straight line L1 is drawn through points A and C so that the two sides of the original convex polygon and the straight line L1 form a triangle. That is, AB is the first side of the triangle, BC is the second side of the triangle, and AC is the third side of the triangle. Then, a straight line L2 is drawn through point B perpendicular to AC, with the perpendicular point being Z. That is, BZ is perpendicular to AC. Therefore, the area of triangle ABC can be obtained based on BZ and AC. Following the triangle construction process described above, triangles BCD, CDE, DEF, EFG, FGH, GHI, HIJ, IJA, and JAB are constructed in sequence, and the area of each triangle is calculated.
[0030] It should be noted that, to obtain the length of line segment BZ and the length of the third side AC, since line segment BZ is perpendicular to AC, the area of triangle ABC can be calculated using the following formula: ; in, For the area of the triangle, The length of the third side of the triangle. The third side of triangle ABC The corresponding height length.
[0031] The angle ABC of the triangle is calculated, and the change in the area of triangle ABC (i.e., the deformation of the triangle) is measured based on the length of the third side AC, the area of triangle ABC, and the angle ABC. Specifically, the length of the third side AC reflects the geometric deviation when the convex polygon undergoes a side reduction operation, the area of triangle ABC reflects the impact of the side reduction operation on the convex polygon, and the included angle ABC reflects the local convexity of the convex polygon.
[0032] Furthermore, in this embodiment, the deformation of the triangle is measured by introducing a first weight value, a second weight value, and a third weight value that are preset by humans, combined with the length of the third side AC, the area of triangle ABC, and the angle of the included angle ABC of the triangle, and finally the deformation of each triangle is calculated.
[0033] Additionally, in one embodiment, reference is made to Figure 3 ,exist Figure 2 Step S305 of the illustrated embodiment further includes, but is not limited to, the following steps: Step S3051: Calculate the first product of the first weight value and the length of the third side; Step S3052: Calculate the second product of the second weight value and the area of the triangle; Step S3053: Calculate the third product of the third weight value and the angle between the triangles; Step S3054: Summate the first product, the second product, and the third product to obtain the deformation.
[0034] It should be noted that the first, second, and third weight values are manually preset coefficients, which are used to adjust the contribution ratio of the length of the third side AC, the area of triangle ABC, and the included angle ABC of triangle ABC to the deformation of the triangle. Ultimately, the multidimensional geometric feature differences of the convex polygon are transformed into a single quantifiable and comparable indicator, namely the first product, the second product, and the third product. Then, by summing the first product, the second product, and the third product, the deformation of the triangle is finally obtained.
[0035] It should be noted that when calculating the first, second, and third weight values, only the specific values of the length of the third side, the area of the triangle, and the included angle of the triangle are introduced into the calculation of the first, second, and third weight values, respectively, and are not related to the unit dimensions of the length of the third side, the area of the triangle, and the included angle of the triangle.
[0036] It should be noted that when introducing the specific values of the length of the third side, the area of the triangle, and the included angle of the triangle, the unit of the length of the third side is millimeters, the unit of the area of the triangle is square centimeters, and the unit of the included angle of the triangle is degrees.
[0037] The deformation of a triangle can be calculated using the following formula: ; in, For the deformation of the triangle, The length of the third side. Let the area be the triangle. 1 represents the included angle of the triangle, W1 is the first weight value, W2 is the second weight value, and W3 is the third weight value.
[0038] In another embodiment, the length of the third side and the area of the triangle are both directly proportional to the deformation, while the included angle of the triangle is inversely proportional to the deformation.
[0039] It should be noted that the deformation of a triangle can take the following forms: When the deformation of a triangle changes, the third side and the area of the triangle increase as the deformation increases, while the included angle of the triangle decreases as the deformation increases. The third side and area of a triangle decrease as the deformation decreases, while the included angle of a triangle increases as the deformation decreases.
[0040] It should be noted that the direct proportional relationship ensures that the length of the third side and the area of the triangle change linearly with the deformation, so as to avoid non-linear changes in multiple sides of the convex polygon, which may cause local distortion or global distortion of the convex polygon; the inverse proportional relationship can effectively limit the range of angle changes, so as to avoid the convex polygon having too sharp or flat included angles during the side reduction operation, thereby maintaining the structural rationality of the convex polygon.
[0041] It should be noted that during the edge reduction operation of a convex polygon, there may be situations where the current number of sides of the convex polygon differs significantly from the target number of sides (e.g., reducing from 20 sides to 8 sides), making it impossible to achieve the target in a single edge reduction operation. Therefore, this embodiment establishes a logic of edge reduction, judgment, and further edge reduction until the current number of sides is less than or equal to the preset target number of sides. This ensures that the number of sides of the convex polygon after edge reduction strictly matches the expected number of sides, thereby avoiding deviations in the convex polygon after edge reduction due to the limitations of a single edge reduction operation.
[0042] In addition, the preset target number of sides can be dynamically adjusted according to the scene (e.g., first reduced to 50 sides and then to 20 sides), and then the data after the sides are reduced is re-evaluated. This logic breaks down the complex convex polygon side reduction operation into multiple side reduction operations, further reducing the computational difficulty and improving real-time performance.
[0043] like Figure 5 As shown, Figure 5This is a structural diagram of an arbitrary convex polygon reduction device according to an embodiment of the present invention. The present invention also provides an arbitrary convex polygon reduction device, comprising: The processor 501 can be implemented using a general-purpose central processing unit (CPU), microprocessor, application specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the side reduction method for arbitrary convex polygons provided in the above embodiments of the present invention. The memory 502 can be implemented as a read-only memory (ROM), static storage device, dynamic storage device, or random access memory (RAM). The memory 502 can store the operating system and other applications. When the method for reducing the edge of an arbitrary convex polygon provided in the above embodiments of the present invention is implemented through software or firmware, the relevant program code is stored in the memory 502 and is called and executed by the processor 501. The input / output interface 503 is used to implement information input and output; The communication interface 504 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.). Bus 505 transmits information between various components of the device (e.g., processor 501, memory 502, input / output interface 503, and communication interface 504); The processor 501, memory 502, input / output interface 503, and communication interface 504 are connected to each other within the device via bus 505.
[0044] Memory 502, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory 502 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory 502 may optionally include remotely located memories 502 relative to the processor, which can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof. The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated to be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0045] This invention also provides an electronic device, including the side reduction device for any convex polygon as described above.
[0046] This invention also provides a storage medium, which is a computer-readable storage medium, storing a computer program that, when executed by a processor, implements the above-described method for reducing the sides of an arbitrary convex polygon.
[0047] Those skilled in the art will understand that all or some of the steps and systems in the methods disclosed above can be implemented as software, firmware, hardware, and suitable combinations thereof. Some or all of the physical components can be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software can be distributed on a computer-readable medium, which can include computer storage media (or non-transitory media) and communication media (or transient media). As is known to those skilled in the art, the term computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, as is known to those skilled in the art, communication media typically include computer-readable instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.
[0048] The systems, apparatuses, modules, or units described in one or more of the above embodiments may be implemented by a computer chip or entity, or by a product having a certain function. A typical implementation device is a computer. Specifically, a computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or any combination of these devices.
[0049] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0050] The various embodiments in this specification are described in a progressive manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments.
[0051] In summary, the above description is merely a preferred embodiment of this specification and is not intended to limit the scope of protection of this specification. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this specification should be included within the scope of protection of this specification.
Claims
1. A method of edge reduction of an arbitrary convex polygon, characterized by, The method comprises the following steps: Step S10, obtaining a first vertex set of a convex polygon, wherein the first vertex set contains all vertex information of the convex polygon; Step S20, determining a current edge number of the convex polygon according to the vertex information, when the current edge number is less than or equal to a preset target edge number, no subsequent step is executed, and the first vertex set is directly output as an output result of a side reduction method, when the current edge number is greater than the target edge number, subsequent steps are continued; Step S30, constructing a plurality of triangles according to adjacent vertex information, and calculating a deformation variable of each triangle; Step S40, performing a side reduction operation on the convex polygon according to a triangle with the smallest deformation variable in a plurality of deformation variables, when the current edge number of the convex polygon after the side reduction operation is still greater than a preset target edge number, returning to the step S20 to determine the current edge number of the convex polygon after the side reduction operation according to the vertex information after the side reduction operation, and continuing to perform the side reduction operation on the convex polygon, when the current edge number of the convex polygon after the side reduction operation is less than or equal to the preset target edge number, entering a subsequent step; Step S50, outputting a second vertex set of the convex polygon after the side reduction operation.
2. The method of claim 1, wherein, The step of constructing a plurality of triangles according to adjacent vertex information and a current edge number comprises the following steps: Step S301, determining a second vertex of the convex polygon, and first and third vertices adjacent to the second vertex, wherein a line connecting the first and second vertices forms a first edge of the convex polygon, and a line connecting the second and third vertices forms a second edge of the convex polygon; Step S302, connecting the first and third vertices to form a third edge, constructing the triangle according to the first, second and third edges, and connecting the second vertex and the third edge to form a first straight line, wherein an included angle of the triangle is formed between the first and second edges, and the first straight line is perpendicular to the third edge; Step S303, re-executing the steps S301 to S302, and constructing the triangle according to each vertex of the convex polygon as the second vertex in turn, and calculating an area of each triangle until all vertices of the convex polygon are constructed into the triangle, and the area of each triangle is calculated; Step S304, determining an angle of the included angle of the triangle formed by the first and second edges in each triangle in a plurality of triangles; Step S305, introducing preset first, second and third weight values, and calculating a deformation variable of each triangle according to the first, second and third weight values, the third edge, the area and the angle of the included angle of the triangle.
3. The method of claim 2, wherein, The step of calculating a deformation variable of each triangle comprises the following steps: Step S3051, calculating a first product of the first weight value and the third side; Step S3052, calculating a second product of the second weight value and the area of the triangle; Step S3053, calculating a third product of the third weight value and the angle of the included angle of the triangle; Step S3054, summing the first product, the second product and the third product to obtain the deformation variable.
4. The method of claim 2, wherein, The third side and the area are in direct proportion to the deformation variable, and the angle is in inverse proportion to the deformation variable.
5. An edge-reduction device for any convex polygon, characterized in that, The at least one control processor and the memory connected in communication with the at least one control processor; the memory stores instructions executable by the at least one control processor, and the instructions are executed by the at least one control processor to enable the at least one control processor to perform the edge-reducing method of any convex polygon according to any one of claims 1 to 4.
6. An electronic device, comprising: The edge-reducing device of any convex polygon according to claim 5.
7. A computer readable storage medium characterized by The computer readable storage medium stores computer executable instructions for causing a computer to perform the edge-reducing method of any convex polygon according to any one of claims 1 to 4.