Shape generation method and device

By determining the effective grid where the initial shape intersects with the preset grid diagram and calculating its closest distance, the target shape of the shape is generated, and the problem of high complexity of the shape generation algorithm in the prior art is solved, and efficiency and accuracy are improved.

CN120014200APending Publication Date: 2025-05-16SHANGHAI BILIBILI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510128245.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-27
Publication Date
2025-05-16

AI Technical Summary

Technical Problem

The prior art algorithms are more complex when generating shapes, and the calculation process is not efficient enough, especially in the process of extracting the mesh surface from implicitly expressed shapes.

Method used

By obtaining the initial shape and preset grid maps, valid grids intersect the initial shape and calculate the closest distance between the vertices of these grids to the initial shape, thereby determining the grid intersection and generating the target shape.

Benefits of technology

It reduces the complexity of the algorithm, improves the efficiency and accuracy of shape generation, avoids the calculation of invalid grilles, and concentrates on processing areas closely related to shape boundaries.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120014200A_ABST
    Figure CN120014200A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a shape generation method and device, and belongs to the technical field of computers. The shape generation method comprises the following steps: acquiring an initial shape and a preset grid chart, wherein the preset grid chart comprises a plurality of grids; according to the initial shape and the preset grid chart, a plurality of effective grids are determined, and at least two grid edges of each effective grid intersect with the initial shape; determining the nearest distance from each vertex of the plurality of effective grids to the initial shape; according to the multiple nearest distances, grid intersection points where the initial shape intersects with the grid edges of all the effective grids are determined; and generating a target shape corresponding to the initial shape according to the plurality of grid intersection points. According to the technical scheme provided by the embodiment of the invention, the calculation of invalid grids which are not intersected with the initial shape can be avoided, so that the algorithm complexity of shape generation is reduced, and the efficiency and accuracy of shape generation are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer technology, and in particular, to a shape generation method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art

[0002] In fields such as geometry processing and modeling, the process of extracting mesh surfaces from implicitly expressed shapes is often involved. Implicit reconstruction methods combined with deep learning, such as neural implicit representations, have gradually become a research hotspot. They can learn more complex shape representations and produce high-quality reconstruction results.

[0003] However, these methods have high algorithmic complexity when generating shapes, and the calculation process is not efficient enough.

[0004] It should be noted that the above content is not necessarily prior art, nor is it intended to limit the scope of patent protection of this application. Summary of the invention

[0005] Embodiments of the present application provide a shape generation method, apparatus, computer device, computer-readable storage medium, and computer program product to solve or alleviate one or more of the technical problems raised above.

[0006] One aspect of an embodiment of the present application provides a shape generation method, the method comprising: Acquire an initial shape and a preset grid map, wherein the preset grid map includes a plurality of grids; Determine a plurality of effective grids according to the initial shape and the preset grid diagram, wherein at least two grid edges of the effective grids intersect with the initial shape; Determine the shortest distance between each vertex of the plurality of effective grids and the initial shape; Determining grid intersection points where the initial shape intersects with grid edges of each of the effective grids based on the multiple closest distances; and A target shape corresponding to the initial shape is generated according to the plurality of grid intersection points.

[0007] Optionally, a vertical axis and a horizontal axis are provided on the boundary of the preset grid diagram; Determining a plurality of effective grids according to the initial shape and the preset grid map includes: Emitting a plurality of first rays along the horizontal axis from each vertex of the grid on the vertical axis; emitting a plurality of second rays along the longitudinal direction from the vertices of each of the grids on the transverse axis; determining a plurality of axial intersection points according to the intersection of the first ray or the second ray with the initial shape; Determining a plurality of grid edges intersecting with the initial shape according to the plurality of axial intersection points; A plurality of effective grids are determined according to a plurality of grid edges intersecting with the initial shape.

[0008] Optionally, determining the shortest distances between each vertex of the plurality of valid grids and the initial shape comprises: Taking a target vertex as a starting point, emitting a plurality of third rays; wherein the target vertex is any one of the vertices of the plurality of effective grids, and the directions of the third rays are different; Determine the intersection points of each of the third rays with the rays of the initial shape; Determining a plurality of ray distances according to the target vertex and a plurality of ray intersection points; The shortest ray distance among the plurality of ray distances is determined as the shortest distance from the target vertex to the initial shape.

[0009] Optionally, determining, based on the multiple closest distances, a grid intersection point where the initial shape intersects with a grid edge of each of the effective grids comprises: Determine two endpoints corresponding to a target grid edge, wherein the target grid edge is any one of a plurality of grid edges intersecting with the initial shape; According to the shortest distances from the two endpoints to the initial shape, a target grid intersection point between the initial shape and the target grid edge is determined, and the target grid intersection point is one of the multiple grid intersection points.

[0010] Optionally, the method further comprises: Extracting a plurality of first feature points according to the initial shape; Taking the first characteristic points as the center of the circle and the first preset length as the radius, performing multiple shape reconstructions to obtain multiple first reconstructed shapes, wherein the first preset length corresponding to each shape reconstruction is different, and the first preset lengths used in the multiple shape reconstructions are gradually lengthened according to a gradient; in each shape reconstruction: taking the first characteristic points as the center of the circle and the corresponding first preset length as the radius, generating multiple unit circles corresponding to the first characteristic points respectively; connecting the first characteristic points corresponding to the intersecting unit circles to obtain the corresponding first reconstructed shape; Topological features that exist in more than a first preset number of the first reconstructed shapes are determined as key topological features.

[0011] Optionally, the method further comprises: Extracting a plurality of second feature points according to the target shape; Taking the plurality of second feature points as the center of the circle and the second preset length as the radius, performing multiple shape reconstructions to obtain multiple second reconstructed shapes, wherein the second preset length corresponding to each shape reconstruction is different, and the second preset lengths used in the multiple shape reconstructions are gradually lengthened according to a gradient; in each shape reconstruction: taking the plurality of second feature points as the center of the circle and the corresponding second preset length as the radius, generating multiple unit circles corresponding to the plurality of second feature points respectively; connecting the second feature points corresponding to the intersecting unit circles to obtain the corresponding second reconstructed shape; According to the key topological feature, positions of at least part of the grid intersections are adjusted so that the key topological feature exists in more than a second preset number of the second reconstructed shapes.

[0012] Another aspect of an embodiment of the present application provides a shape generating device, the device comprising: An acquisition module, used to acquire an initial shape and a preset grid map, wherein the preset grid map includes a plurality of grids; A first determination module, configured to determine a plurality of valid grids according to the initial shape and the preset grid map, wherein at least two sides of the valid grids intersect with the initial shape; A second determination module, used to determine the shortest distance between each vertex of the plurality of valid grids and the initial shape; A third determination module, configured to determine a plurality of grid intersections between the initial shape and the preset grid diagram according to the plurality of closest distances; A generating module is used to generate a target shape corresponding to the initial shape according to a plurality of grid intersection points.

[0013] Another aspect of an embodiment of the present application provides a computer device, including: at least one processor; and a memory communicatively coupled to the at least one processor; Wherein: the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method as described above.

[0014] Another aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method described above is implemented.

[0015] Another aspect of an embodiment of the present application provides a computer program product, including a computer program, which implements the method described above when executed by a processor.

[0016] The above technical solution adopted in the embodiment of the present application may have the following advantages: Valid grids intersecting with the initial shape are extracted from the grid map, thereby avoiding the calculation of invalid grids not intersecting with the initial shape, thereby reducing the algorithm complexity of shape generation and improving the efficiency and accuracy of shape generation. BRIEF DESCRIPTION OF THE DRAWINGS The accompanying drawings exemplarily illustrate the embodiments and constitute a part of the specification, and together with the text description of the specification, are used to explain the exemplary implementation of the embodiments. The embodiments shown are for illustrative purposes only and do not limit the scope of the claims. In all drawings, the same reference numerals refer to similar but not necessarily identical elements.

[0017] Figure 1 The operating environment diagram of the shape generation method according to the first embodiment of the present application is schematically shown; Figure 2 A flowchart of a shape generation method according to Embodiment 1 of the present application is schematically shown; Figure 3 The schematic diagram schematically shows the implementation effect of the initial shape and the preset grid diagram according to the first embodiment of the present application; Figure 4 Schematically shows Figure 2 Flow chart of sub-steps of step S202; Figure 5 The schematic diagram schematically shows the effect of determining the effective grid according to the first embodiment of the present application; Figure 6 Schematically shows Figure 2 Flow chart of sub-steps of step S204; Figure 7 The schematic diagram schematically shows the effect of calculating the shortest distance using rays according to the first embodiment of the present application; Figure 8 Schematically shows Figure 2 Flow chart of sub-steps of step S206; Fig. 9 A schematic diagram schematically shows the effect of generating a target shape according to grid intersections according to the first embodiment of the present application; Fig.10 The newly added flow chart of the shape generation method according to the first embodiment of the present application is schematically shown; Fig.11 The schematic diagram of the shape reconstruction process according to the first embodiment of the present application is shown schematically; Fig.12 Another newly added flow chart of the shape generation method according to the first embodiment of the present application is schematically shown; Fig.13 A diagram schematically shows an application example of the shape generation method according to an embodiment of the present application; Fig.14 A block diagram schematically shows a shape generating device according to the second embodiment of the present application; and Fig.15 The hardware architecture diagram of the computer device according to the third embodiment of the present application is schematically shown. DETAILED DESCRIPTION

[0018] In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.

[0019] It should be noted that the descriptions involving "first", "second", etc. in the embodiments of the present application are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.

[0020] In the description of the present application, it should be understood that the numerical labels before the steps do not indicate the order in which the steps are executed, but are only used to facilitate the description of the present application and to distinguish each step, and therefore should not be understood as a limitation on the present application.

[0021] First, the following terms are explained: Implicit expression: It is a method of mathematically describing a three-dimensional shape or surface by defining a multivariable function F(x,y,z)=0 to implicitly represent the surface of the shape instead of directly listing all the points or edges that make up the shape.

[0022] Display expression: It is a method of directly describing the geometric information of a 3D shape or model. It defines the model by listing all the geometric elements that make up the shape (such as vertex coordinates, edge connection information, and facet data).

[0023] Signed Distance Field (SDF): is a scalar field method that represents the distance between a point and the nearest geometric surface in three-dimensional space, where the value of each point represents the distance from the point to the nearest surface that defines the shape, a positive value indicates that the point is outside the shape, a negative value indicates that the point is inside the shape, and a zero value indicates that the point is on the surface of the shape.

[0024] Marching Cubes: is an algorithm for extracting isosurfaces (usually zero isosurfaces) from 3D volume data by dividing the 3D space into small cubes (voxels) and analyzing the scalar values ​​of the vertices within each cube to determine the intersection of the isosurface with the cube. Then, a predefined lookup table is used to determine how to connect these intersections into triangles, thereby generating a polygonal mesh that approximates the isosurface.

[0025] Topological features: It is a mathematical tool to describe and quantify the properties of spatial objects that remain unchanged under continuous transformations, reflecting the basic structure and shape characteristics of the object.

[0026] Persistent homology theory: It is a method in topological data analysis that reveals the topological characteristics of a data set by studying the persistence of the homology group of the data set as it changes with scale. The theory analyzes the appearance and disappearance of topological structures such as connected branches, holes, and gaps in the data, and generates persistent barcodes or persistence graphs. These visualization tools show the stability of topological features as they change with scale, thereby helping to identify significant and robust topological patterns in the data.

[0027] Omni-directional ray: A ray that is emitted from a starting point in all directions in three-dimensional space.

[0028] Linear interpolation: is an interpolation method used to estimate the value of an unknown data point between two known data points based on the coordinates of the known points and the relative distance between them.

[0029] Secondly, in order to facilitate those skilled in the art to understand the technical solutions provided in the embodiments of the present application, the relevant technologies are described below: Most mesh reconstruction methods target implicit expression methods such as signed distance fields. However, signed distance fields themselves have the defect of being unable to express non-closed or nested shapes, making mesh reconstruction algorithms such as Marching Cubes unsuitable for reconstructing open shapes and multi-layer shapes. During the mesh reconstruction process, there will be a large number of grids that do not intersect with the shape or have a weak intersection relationship. These grids are not helpful in determining the boundaries of the shape, but will waste a lot of computing resources. In addition, most of these algorithms focus on optimizing the geometric properties of the reconstruction results, and lack attention to the topological properties of the shape reconstruction results, making the reconstruction results lack robustness in real modeling work scenarios.

[0030] To this end, the embodiment of the present application provides a shape generation technology solution. In this technology solution, (1) the positional relationship between the target vertex and the initial shape is determined by using omnidirectional rays, so that the shortest distance from the point to the shape can be calculated without distinguishing whether the target vertex is inside or outside the shape; (2) the effective grid that intersects with the initial shape with at least two grid edges is first extracted, so that computing resources can be concentrated on processing the area closely related to the shape boundary; (3) the target shape is adjusted according to the key topological features of the extracted initial shape, so that the target shape and the initial shape maintain similar topological properties. See below for details.

[0031] Finally, for ease of understanding, an exemplary operating environment is provided below.

[0032] like Figure 1 As shown, the environment diagram includes a server 2, a network 4, and a client 6, wherein: Server 2 may be comprised of a single or multiple computing devices. The multiple computing devices may include virtualized computing instances. Virtualized computing instances may include virtual machines, such as simulations of computer systems, operating systems, servers, and the like. A computing device may load a virtual machine based on a virtual image and / or other data defining specific software (e.g., an operating system, a dedicated application, a server) for simulation. As the demand for different types of processing services changes, different virtual machines may be loaded and / or terminated on one or more computing devices. A hypervisor may be implemented to manage the use of different virtual machines on the same computing device.

[0033] The server 2 may be configured to communicate with the client 6, etc., via a network 4. The network 4 includes various network devices, such as routers, switches, multiplexers, hubs, modems, bridges, repeaters, firewalls, proxy devices, and / or the like. The network 4 may include physical links, such as coaxial cable links, twisted pair cable links, optical fiber links, combinations thereof, etc., or wireless links, such as cellular links, satellite links, Wi-Fi links, etc.

[0034] Server 2 can provide storage, reading, writing, querying, deleting and other services, such as providing shape expression data uploading service for clients.

[0035] The client 6 may be an electronic device running an operating system such as Windows, Android™ or iOS, such as a smart phone, a tablet device, a laptop computer, a virtual reality device, a game device, a set-top box, a vehicle terminal, or a smart TV. Based on the above operating system, various applications may be run, such as an application for uploading shape expression data, an application for receiving shape data and displaying a surface mesh shape.

[0036] The client 6 can provide / configure a user access page for manipulating the server 2 or uploading an object, etc.

[0037] It should be noted that the above devices are exemplary, and the number and type of devices are adjustable in different scenarios or according to different needs.

[0038] The following describes the technical solution of the present application through multiple embodiments, taking the client 6 or the server 2 as the execution subject. It should be noted that these embodiments can be implemented in a variety of different forms and should not be interpreted as being limited to the embodiments described here.

[0039] Embodiment 1 Figure 2 The flowchart of the shape generation method according to the first embodiment of the present application is schematically shown.

[0040] like Figure 2 As shown, the shape generation method may include steps S200 to S208, wherein: Step S200, obtaining an initial shape and a preset grid map, wherein the preset grid map includes a plurality of grids.

[0041] Step S202: determining a plurality of effective grids according to the initial shape and the preset grid diagram, wherein at least two grid edges of the effective grids intersect with the initial shape.

[0042] Step S204: determining the shortest distance between each vertex of the plurality of effective grids and the initial shape.

[0043] Step S206: determining grid intersection points where the initial shape intersects with grid edges of each of the effective grids according to the multiple closest distances.

[0044] Step S208: generating a target shape corresponding to the initial shape according to the plurality of grid intersections.

[0045] The shape generation method provided in this embodiment extracts valid grids intersecting with the initial shape from the grid map, thereby avoiding calculation of invalid grids that do not intersect with the initial shape, thereby reducing the algorithm complexity of shape generation and improving the efficiency and accuracy of shape generation.

[0046] The following combination Figure 2 , each step in steps S200~S208 and other optional steps are explained in detail.

[0047] Step S200 , obtaining an initial shape and a preset grid map, wherein the preset grid map includes a plurality of grids.

[0048] The initial shape can be a closed shape pattern such as a rectangle, square, circle, etc., or a non-closed shape pattern such as a straight line, parabola, ring, etc. The initial shape can be expressed by display expressions such as grid coordinates, point clouds, polygonal surfaces, etc., or by display expressions such as isosurfaces, neural implicit representations, and function equations.

[0049] The resolution of the preset grid map (i.e., the density of the grid) can be adjusted as needed. For example, you can choose a suitable resolution based on the computing power of the target platform, the desired visual effects, rendering performance requirements, and post-processing steps (such as lighting and shadow calculations). The resolution of the preset grid map can be uniform, or you can choose to increase the resolution of the preset grid map in some areas with complex shapes according to actual conditions. The implementation effect of the initial shape and the preset grid map is as follows Figure 3 shown.

[0050] Step S202 , determining a plurality of effective grids according to the initial shape and the preset grid diagram, wherein at least two grid edges of the effective grids intersect with the initial shape.

[0051] There are a large number of invalid grids in the preset grid map that do not intersect with the initial shape or are at the end of the shape. These invalid grids are not very helpful in determining the boundary of the initial shape. Instead, a lot of computing time and computing resources will be wasted because of calculating the position of these invalid grids. In view of this, before calculating the position of the initial shape, the valid grids that intersect with the initial shape at least two grid edges are extracted. In this way, computing resources can be concentrated to process the areas closely related to the shape boundary, thereby optimizing the shape generation process and improving the efficiency and accuracy of shape generation.

[0052] There are many ways to determine the effective grid, and an exemplary method is provided below.

[0053] In an optional embodiment, a vertical axis and a horizontal axis are set on the boundary of the preset grid map, such as Figure 4 As shown, step S202 includes: S400, emitting a plurality of first rays along a horizontal axis direction from each vertex of the grid on the vertical axis.

[0054] S402: emitting a plurality of second rays from each vertex of the grid on the horizontal axis along the vertical axis.

[0055] S404: Determine a plurality of axial intersection points according to the intersection of the first ray or the second ray with the initial shape.

[0056] S406: Determine a plurality of grid edges intersecting with the initial shape according to the plurality of axial intersection points.

[0057] S408: Determine a plurality of valid grids according to a plurality of grid edges intersecting with the initial shape.

[0058] For example, if the equation of one ray A is X = 3 (Y ≤ 0), and the axial intersection point of ray A with the initial shape is between M (3, -1) and N (3, -2), then MN can be determined as a grid edge intersecting with the initial shape; if the equation of another ray B is Y = -2 (X ≥ 0), and the axial intersection point of ray B with the initial shape is between O (2, -2) and N (3, -2), then ON can be determined as a grid edge intersecting with the initial shape, and thus, the grid P including both grid edges MN and ON is a valid grid.

[0059] According to actual conditions, the starting points of the first ray and the second ray may not be the grid vertices on the horizontal axis or the vertical axis. The schematic diagram of the effect of determining the effective grid by intersecting the first ray and the second ray with the shape is as follows: Figure 5 shown.

[0060] The grid edges intersecting the initial shape are determined using axial rays starting from the coordinate axis. Thus, the position of the shape in the grid map can be determined without determining whether the shape is inside or outside, thereby improving the versatility of the shape generation method. For example, the method of this embodiment can be applied to non-closed or nested shapes.

[0061] Step S204 , determining the shortest distances from each vertex of the plurality of effective grids to the initial shape.

[0062] The accuracy of the closest distance calculation can be adaptively adjusted according to the complexity of the initial shape and the expected generation quality to balance the computational cost and result quality. At the same time, an error control mechanism can also be introduced, such as setting a maximum allowable error threshold, to ensure that the accuracy of the distance calculation meets the specific application requirements.

[0063] Calculating the shortest distance from each vertex to the initial shape helps to subsequently determine the exact intersection of the initial shape and the mesh graph and the quality of the final generated target shape, thereby improving the computational efficiency of the shape generation method and the accuracy of the generated shape.

[0064] There are many methods for calculating the closest distance. An exemplary method for calculating the closest distance is provided below.

[0065] In an optional embodiment, if Figure 6 As shown, step S204 includes: S600, emitting a plurality of third rays with a target vertex as a starting point; wherein the target vertex is any one of the vertices of the plurality of valid grids, and the directions of the third rays are different.

[0066] S602: Determine intersection points of each of the third rays with the rays of the initial shape.

[0067] S604: Determine multiple ray distances according to the target vertex and the multiple ray intersection points.

[0068] S606: Determine the shortest ray distance among the multiple ray distances as the shortest distance from the target vertex to the initial shape.

[0069] Before emitting rays, the direction of the initial shape relative to the target vertex can be preliminarily determined, thereby limiting the direction range of the rays and reducing the number of calculations.

[0070] Specifically, during the calculation process, the closest distance from each vertex to the initial shape can be calculated starting from the target vertex using a breadth-first algorithm. At the same time, depending on whether the grid edge intersects with the initial shape, the closest distances from the vertices at both ends of the grid edge intersecting with the initial shape to the initial shape can be set to positive or negative values, respectively, to distinguish between the two sides of the initial shape boundary.

[0071] In this embodiment, omnidirectional rays are used to determine the positional relationship between the target vertex and the initial shape. As a result, the point on the initial shape closest to the target vertex can be accurately found without distinguishing whether the target vertex is inside or outside the shape, thereby accurately calculating the closest distance from the point to the shape, thereby improving the flexibility and calculation efficiency of the shape generation method, as well as the accuracy of distance calculation. The schematic diagram of the implementation effect of using rays to calculate the closest distance is shown in FIG. Figure 7 shown.

[0072] Step S206 , determining grid intersection points where the initial shape intersects with grid edges of each of the effective grids based on the multiple closest distances.

[0073] When determining the effective grid, it has been preliminarily determined which grid edges the initial shape and the grid diagram intersect on. However, since the rays are long at this time, the error of the result is large and the exact position of the intersection of the shape and the grid cannot be determined.

[0074] In view of this, in this embodiment, the closest distance between each vertex in each effective grid and the shape is used to determine the exact intersection of the shape and the grid, thereby improving the accuracy of the grid intersection result, reducing the calculation error, and improving the accuracy of the generated target shape.

[0075] There are many methods for calculating grid intersections. An exemplary method for calculating grid intersections is provided below.

[0076] In an optional embodiment, if Figure 8 As shown, step S206 includes: S800, determining two endpoints corresponding to a target grid edge, where the target grid edge is any one of a plurality of grid edges intersecting with the initial shape.

[0077] S802: Determine a target grid intersection point between the initial shape and the target grid edge according to the shortest distances between the two endpoints and the initial shape, wherein the target grid intersection point is one of the plurality of grid intersection points.

[0078] In some embodiments, the position of the grid intersection can be calculated by using the shortest distance between the two endpoints and the initial shape through a linear interpolation formula. Depending on the actual situation, other methods such as Newton iteration method can also be used to determine the grid intersection.

[0079] For example, MN is a grid edge that intersects with the initial shape, the closest distance from M (3, -1) to the initial shape is 1, and the closest distance from N (3, -2) to the initial shape is 1.5. Then, using the linear interpolation formula, we can get the coordinates of the intersection of MN and the initial shape as J (3, -1.4), that is, J is a grid intersection point.

[0080] In this embodiment, the positions of the grid intersections are calculated using the endpoints of the grid edges intersecting with the initial shape. This can reduce the number of calculations and improve the efficiency of shape generation. At the same time, the grid intersections can be determined more accurately, so that the generated target shape has a higher degree of similarity with the initial shape, and the geometric features of the initial shape can be more accurately reflected, thereby improving the quality of the target shape.

[0081] Step S208 , generating a target shape corresponding to the initial shape according to the plurality of grid intersections.

[0082] In specific implementation, multiple grid intersections can be directly connected in sequence to obtain the target shape, or after connecting the grid intersections, the connection results can be simplified, smoothed, or repaired to obtain a target shape that better meets the requirements. The schematic diagram of the effect of generating the target shape according to the grid intersections is shown in FIG. Fig. 9 shown.

[0083] In the process of generating a target shape from an initial shape, in order to keep the target shape and the initial shape with similar topological properties, it is necessary to first extract key topological features of the initial shape that better represent its topological properties. An exemplary method for extracting key topological features of an initial shape is provided below.

[0084] In an optional embodiment, if Fig.10 As shown, the method also includes: S1000: extracting a plurality of first feature points according to the initial shape.

[0085] S1002, with the plurality of first feature points as the center of the circle and the first preset length as the radius, perform multiple shape reconstructions to obtain multiple first reconstructed shapes, the first preset length corresponding to each shape reconstruction is different, and the first preset lengths used in the multiple shape reconstructions are gradually lengthened according to a gradient; in each shape reconstruction: with the plurality of first feature points as the center of the circle and the corresponding first preset length as the radius, generate multiple unit circles corresponding to the plurality of first feature points respectively; connect the first feature points corresponding to the intersecting unit circles to obtain the corresponding first reconstructed shapes.

[0086] S1004: Determine topological features that exist in more than a first preset number of the first reconstructed shapes as key topological features.

[0087] In the theory of persistent homology, the change of topological properties of a shape can be reflected by the process of reconstructing a discrete point cloud into a mesh. The topological characteristics of a shape can include topological variables in the first three dimensions, such as connected components, rings, and cavities.

[0088] Combine the following Fig.11 , explain the above shape reconstruction process with a specific example: A. Extract multiple discrete first feature points from an initial shape Q; B. Draw multiple unit circles with each first feature point as the center and the first preset length (1.5 unit length) as the radius. At this time, no unit circles intersect, and the first reconstructed shape is a plurality of discrete points. It can be obtained that the topological feature of the first reconstructed shape is a plurality of connected components. C. Draw multiple unit circles with each first feature point as the center and the first preset length (2 unit lengths) as the radius. At this time, some unit circles intersect, and the new first reconstructed shape is a ring. The topological feature of the new first reconstructed shape can be obtained as a ring. D. Draw multiple unit circles with each first feature point as the center and the first preset length (2.5 unit lengths) after the second lengthening as the radius. At this time, some unit circles intersect, and the new first reconstructed shape is a ring. It can be obtained that the topological feature of the new first reconstructed shape is a ring. E. Draw multiple unit circles with each first feature point as the center and the first preset length (3 unit lengths) after the third lengthening as the radius. At this time, some unit circles intersect, and the new first reconstructed shape is a ring. It can be obtained that the topological feature of the new first reconstructed shape is a ring. F. According to the above reconstruction process, it can be obtained that the topological features of the three first reconstructed shapes are all rings, which exceeds the first preset number (2), that is, it can be determined that the key topological feature of the initial shape Q is a ring.

[0089] In this embodiment, the topological features that appear more frequently during the reconstruction process are determined as key topological features. Thus, the topological properties of the initial shape can be more accurately grasped, which facilitates adaptive adjustment of the target shape in the subsequent generation process of the target shape, so as to improve the accuracy and reliability of shape generation.

[0090] It should be noted that in the process of determining key topological features, in addition to considering the number of occurrences of topological features, the timing of the occurrence of topological features can also be taken into consideration. For example, topological features that appear earlier and last longer in the shape reconstruction process are determined as key topological features.

[0091] In addition to extracting key topological features, in order to further strengthen the grasp of the topological properties of the initial shape, general topological features that appear less frequently or appear later can also be extracted, and these general topological features can be denoised in the target shape.

[0092] In order to keep the target shape and the initial shape with similar topological properties, the target shape can be adjusted according to the key topological features extracted in the above process. A method for adjusting the target shape according to the key topological features is provided below.

[0093] In an optional embodiment, if Fig.12 As shown, the method also includes: S1200: Extract multiple second feature points according to the target shape.

[0094] S1202, with multiple second feature points as the center of the circle and the second preset length as the radius, perform multiple shape reconstructions to obtain multiple second reconstructed shapes, the second preset length corresponding to each shape reconstruction is different, and the second preset lengths used in multiple shape reconstructions are gradually lengthened according to a gradient; in each shape reconstruction: with multiple second feature points as the center of the circle and the corresponding second preset length as the radius, generate multiple unit circles corresponding to each of the multiple second feature points; connect the second feature points corresponding to the intersecting unit circles to obtain the corresponding second reconstructed shape.

[0095] S1204: According to the key topological feature, adjust the positions of at least part of the grid intersections, so that the key topological feature exists in more than a second preset number of the second reconstructed shapes.

[0096] In specific implementation, a threshold for adjusting the grid intersection position may be set to avoid errors in the adjusted target shape due to over-adjustment.

[0097] For example, if the key topological feature of the initial shape Q is a ring, some grid intersections of the corresponding target shape R may be adjusted so that the topological feature of the target shape R in the second reconstructed shapes exceeding the second preset number (2) is a ring.

[0098] In this embodiment, by adjusting the positions of the grid intersections, the key topological features of the target shape and the initial shape are made consistent, so that the target shape and the initial shape have similar topological properties, thereby improving the accuracy and quality of shape generation.

[0099] In order to make this application easier to understand, the following Fig.13 An exemplary application is provided. S11, obtaining an implicit expression of an initial shape E and a preset grid map T with a resolution of 6*7; S12, emitting 5 first rays parallel to the vertical axis from the horizontal axis of the preset grid graph T, and emitting 6 second rays parallel to the horizontal axis from the vertical axis, to obtain 12 grid edges intersecting with the initial shape E; S13, determining 11 valid grids including at least two grid edges intersecting with the initial shape E according to the 12 grid edges intersecting with the initial shape E; S14, calculating the shortest distance to the initial shape E using omnidirectional rays emitted from the endpoints of each grid edge in the effective grid that intersects with the initial shape E; S15, calculating 12 grid intersection points between the initial shape E and the preset grid graph T according to the obtained shortest distances between each endpoint and the initial shape E; S16, connecting 12 grid intersections in sequence to obtain the target shape F; S17, reconstructing the initial shape E, wherein more than three (i.e., a first preset number) of the first reconstructed shapes contain rings, determining that the key topological feature of the initial shape E is a ring; S18, adjusting the position of one of the grid intersections so that in the adjusted target shape F, more than three (ie, a second preset number) second reconstructed shapes have rings.

[0100] Embodiment 2 Fig.14 The block diagram of the shape generation device according to the second embodiment of the present application is schematically shown. The device can be divided into one or more program modules, one or more program modules are stored in a storage medium and executed by one or more processors to complete the embodiment of the present application. The program module referred to in the embodiment of the present application refers to a series of computer program instruction segments that can complete specific functions. The following description will specifically introduce the functions of each program module in this embodiment. Fig.14As shown, the apparatus 1000 may include: an acquisition module 1100, a first determination module 1200, a second determination module 1300, a third determination module 1400, and a generation module 1500, wherein: An acquisition module 1100 is used to acquire an initial shape and a preset grid map, wherein the preset grid map includes a plurality of grids; A first determining module 1200 is used to determine a plurality of valid grids according to the initial shape and the preset grid map, wherein at least two sides of the valid grids intersect with the initial shape; A second determination module 1300 is used to determine the shortest distance between each vertex of the plurality of valid grids and the initial shape; A third determination module 1400 is used to determine a plurality of grid intersections between the initial shape and the preset grid map according to the plurality of the closest distances; The generating module 1500 is used to generate a target shape corresponding to the initial shape according to the plurality of grid intersection points.

[0101] As an optional embodiment, a vertical axis and a horizontal axis are set on the boundary of the preset grid map, and the first determining module 1200 is further used to: Emitting a plurality of first rays along the horizontal axis from each vertex of the grid on the vertical axis; emitting a plurality of second rays along the longitudinal direction from the vertices of each of the grids on the transverse axis; determining a plurality of axial intersection points according to the intersection of the first ray or the second ray with the initial shape; Determining a plurality of grid edges intersecting with the initial shape according to the plurality of axial intersection points; A plurality of effective grids are determined according to a plurality of grid edges intersecting with the initial shape.

[0102] As an optional embodiment, the second determining module 1300 is further configured to: Taking a target vertex as a starting point, emitting a plurality of third rays; wherein the target vertex is any one of the vertices of the plurality of effective grids, and the directions of the third rays are different; Determine the intersection points of each of the third rays with the rays of the initial shape; Determining a plurality of ray distances according to the target vertex and a plurality of ray intersection points; The shortest ray distance among the plurality of ray distances is determined as the shortest distance from the target vertex to the initial shape.

[0103] As an optional embodiment, the third determining module 1400 is further configured to: Determine two endpoints corresponding to a target grid edge, wherein the target grid edge is any one of a plurality of grid edges intersecting with the initial shape; According to the shortest distances from the two endpoints to the initial shape, a target grid intersection point between the initial shape and the target grid edge is determined, and the target grid intersection point is one of the multiple grid intersection points.

[0104] As an optional embodiment, the apparatus 1000 further includes a topological feature extraction module, which is used to: Extracting a plurality of first feature points according to the initial shape; Taking the first characteristic points as the center of the circle and the first preset length as the radius, performing multiple shape reconstructions to obtain multiple first reconstructed shapes, wherein the first preset length corresponding to each shape reconstruction is different, and the first preset lengths used in the multiple shape reconstructions are gradually lengthened according to a gradient; in each shape reconstruction: taking the first characteristic points as the center of the circle and the corresponding first preset length as the radius, generating multiple unit circles corresponding to the first characteristic points respectively; connecting the first characteristic points corresponding to the intersecting unit circles to obtain the corresponding first reconstructed shape; Topological features that exist in more than a first preset number of the first reconstructed shapes are determined as key topological features.

[0105] As an optional embodiment, the topological feature extraction module is further used for: Extracting a plurality of second feature points according to the target shape; Taking the plurality of second feature points as the center of the circle and the second preset length as the radius, performing multiple shape reconstructions to obtain multiple second reconstructed shapes, wherein the second preset length corresponding to each shape reconstruction is different, and the second preset lengths used in the multiple shape reconstructions are gradually lengthened according to a gradient; in each shape reconstruction: taking the plurality of second feature points as the center of the circle and the corresponding second preset length as the radius, generating multiple unit circles corresponding to the plurality of second feature points respectively; connecting the second feature points corresponding to the intersecting unit circles to obtain the corresponding second reconstructed shape; According to the key topological feature, positions of at least part of the grid intersections are adjusted so that the key topological feature exists in more than a second preset number of the second reconstructed shapes.

[0106] Embodiment 3 Fig.15The schematic diagram of the hardware architecture of a computer device 10000 suitable for implementing the shape generation method according to the third embodiment of the present application is schematically shown. In some embodiments, the computer device 10000 may be a terminal device such as a smart phone, a wearable device, a tablet computer, a personal computer, a vehicle terminal, a game console, a virtual device, a workbench, a digital assistant, a set-top box, a robot, etc. In other embodiments, the computer device 10000 may be a rack server, a blade server, a tower server, or a cabinet server (including an independent server, or a server cluster composed of multiple servers), etc. Fig.15 As shown, the computer device 10000 includes but is not limited to: a memory 10010, a processor 10020, and a network interface 10030 that can communicate with each other through a system bus. Among them: The memory 10010 includes at least one type of computer-readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (such as SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 10010 can be an internal storage module of the computer device 10000, such as a hard disk or memory of the computer device 10000. In other embodiments, the memory 10010 can also be an external storage device of the computer device 10000, such as a plug-in hard disk equipped on the computer device 10000, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the memory 10010 can also include both the internal storage module of the computer device 10000 and its external storage device. In this embodiment, the memory 10010 is generally used to store the operating system and various application software installed in the computer device 10000, such as the program code of the shape generation method, etc. In addition, the memory 10010 can also be used to temporarily store various data that have been output or will be output.

[0107] In some embodiments, the processor 10020 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other chips. The processor 10020 is generally used to control the overall operation of the computer device 10000, such as performing control and processing related to data interaction or communication with the computer device 10000. In this embodiment, the processor 10020 is used to run the program code stored in the memory 10010 or process data.

[0108] The network interface 10030 may include a wireless network interface or a wired network interface, and the network interface 10030 is generally used to establish a communication link between the computer device 10000 and other computer devices. For example, the network interface 10030 is used to connect the computer device 10000 to an external terminal through a network, and to establish a data transmission channel and a communication link between the computer device 10000 and the external terminal. The network may be a wireless or wired network such as an intranet, the Internet, the Global System of Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, Bluetooth, Wi-Fi, etc.

[0109] It should be pointed out that Fig.15 Only a computer device having components 10010 - 10030 is shown, but it should be understood that implementation of all of the components shown is not a requirement, and more or fewer components may alternatively be implemented.

[0110] In this embodiment, the shape generation method stored in the memory 10010 can also be divided into one or more program modules and executed by one or more processors (such as processor 10020) to complete the embodiment of the present application.

[0111] Embodiment 4 An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, wherein when the computer program is executed by a processor, the steps of the shape generation method in the embodiment are implemented.

[0112] In this embodiment, the computer-readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the computer-readable storage medium can be an internal storage unit of a computer device, such as a hard disk or memory of the computer device. In other embodiments, the computer-readable storage medium can also be an external storage device of a computer device, such as a plug-in hard disk equipped on the computer device, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the computer-readable storage medium can also include both the internal storage unit of the computer device and its external storage device. In this embodiment, the computer-readable storage medium is generally used to store an operating system and various application software installed on the computer device, such as the program code of the shape generation method in the embodiment. In addition, the computer-readable storage medium can also be used to temporarily store various types of data that have been output or are to be output.

[0113] Embodiment 5 An embodiment of the present application also provides a computer program product, including a computer program, which implements the method in the above embodiment when executed by a processor.

[0114] Obviously, those skilled in the art should understand that the modules or steps of the above-mentioned embodiments of the present application can be implemented by general-purpose computer devices, they can be concentrated on a single computer device, or distributed on a network composed of multiple computer devices, optionally, they can be implemented by executable program codes of computer devices, so that they can be stored in a storage device and executed by the computer device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the embodiments of the present application are not limited to any specific combination of hardware and software.

[0115] It should be noted that the above are only preferred embodiments of the present application, and the patent protection scope of the present application is not limited thereto. Any equivalent structure or equivalent process transformation made using the contents of the specification and drawings of the present application, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A shape generation method, characterized in that: The method comprises: Acquire an initial shape and a preset grid map, wherein the preset grid map includes a plurality of grids; Determine a plurality of effective grids according to the initial shape and the preset grid diagram, wherein at least two grid edges of the effective grids intersect with the initial shape; Determine the shortest distance between each vertex of the plurality of effective grids and the initial shape; Determining grid intersection points where the initial shape intersects with grid edges of each of the effective grids based on the multiple closest distances; and A target shape corresponding to the initial shape is generated according to the plurality of grid intersection points.

2. The method according to claim 1, characterized in that A vertical axis and a horizontal axis are provided on the boundary of the preset grid diagram; Determining a plurality of effective grids according to the initial shape and the preset grid map includes: Emitting a plurality of first rays along the horizontal axis from each vertex of the grid on the vertical axis; emitting a plurality of second rays along the longitudinal direction from the vertices of each of the grids on the transverse axis; determining a plurality of axial intersection points according to the intersection of the first ray or the second ray with the initial shape; Determining a plurality of grid edges intersecting with the initial shape according to the plurality of axial intersection points; A plurality of effective grids are determined according to a plurality of grid edges intersecting with the initial shape.

3. The method according to claim 1, characterized in that Determining the shortest distances between each vertex of the plurality of valid grids and the initial shape comprises: Taking a target vertex as a starting point, emitting a plurality of third rays; wherein the target vertex is any one of the vertices of the plurality of effective grids, and the directions of the third rays are different; Determine the intersection points of each of the third rays with the rays of the initial shape; Determining a plurality of ray distances according to the target vertex and a plurality of ray intersection points; The shortest ray distance among the plurality of ray distances is determined as the shortest distance from the target vertex to the initial shape.

4. The method according to claim 1, characterized in that: Determining grid intersection points where the initial shape intersects with grid edges of each of the effective grids according to the multiple closest distances includes: Determine two endpoints corresponding to a target grid edge, wherein the target grid edge is any one of a plurality of grid edges intersecting with the initial shape; According to the shortest distances from the two endpoints to the initial shape, a target grid intersection point between the initial shape and the target grid edge is determined, and the target grid intersection point is one of the multiple grid intersection points.

5. The method according to claim 1, characterized in that The method further comprises: Extracting a plurality of first feature points according to the initial shape; Taking the first characteristic points as the center of the circle and the first preset length as the radius, performing multiple shape reconstructions to obtain multiple first reconstructed shapes, wherein the first preset length corresponding to each shape reconstruction is different, and the first preset lengths used in the multiple shape reconstructions are gradually lengthened according to a gradient; in each shape reconstruction: taking the first characteristic points as the center of the circle and the corresponding first preset length as the radius, generating multiple unit circles corresponding to the first characteristic points respectively; connecting the first characteristic points corresponding to the intersecting unit circles to obtain the corresponding first reconstructed shape; Topological features that exist in more than a first preset number of the first reconstructed shapes are determined as key topological features.

6. The method according to claim 5, characterized in that The method further comprises: Extracting a plurality of second feature points according to the target shape; Taking the plurality of second feature points as the center of the circle and the second preset length as the radius, performing multiple shape reconstructions to obtain multiple second reconstructed shapes, wherein the second preset length corresponding to each shape reconstruction is different, and the second preset lengths used in the multiple shape reconstructions are gradually lengthened according to a gradient; in each shape reconstruction: taking the plurality of second feature points as the center of the circle and the corresponding second preset length as the radius, generating multiple unit circles corresponding to the plurality of second feature points respectively; connecting the second feature points corresponding to the intersecting unit circles to obtain the corresponding second reconstructed shape; According to the key topological feature, positions of at least part of the grid intersections are adjusted so that the key topological feature exists in more than a second preset number of the second reconstructed shapes.

7. A shape generating device, characterized in that: The device comprises: An acquisition module, used to acquire an initial shape and a preset grid map, wherein the preset grid map includes a plurality of grids; A first determination module, configured to determine a plurality of valid grids according to the initial shape and the preset grid diagram, wherein at least two sides of the valid grids intersect with the initial shape; A second determination module, used to determine the shortest distance between each vertex of the plurality of valid grids and the initial shape; A third determination module, configured to determine a plurality of grid intersections between the initial shape and the preset grid diagram according to the plurality of closest distances; A generating module is used to generate a target shape corresponding to the initial shape according to a plurality of grid intersection points.

8. A computer device, characterized in that: include: at least one processor; and a memory communicatively connected to the at least one processor; wherein: The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method according to any one of claims 1 to 6 is implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.