A tetrahedral mesh generation method and related device
Through the tetrahedral mesh generation method based on Delaunay triangulation and genetic algorithm optimization, the problems of poor quality and high algorithm complexity at the boundaries of tetrahedral mesh in the prior art are solved, and high-quality and efficient mesh generation are achieved .
Patent Information
- Application Number
- CN202411682282.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2044-11-22
AI Technical Summary
When generating a tetrahedral mesh in the prior art, the mesh quality at the boundary is poor, the overall quality is poor, and the algorithm is high in complexity and low optimization efficiency.
Using the tetrahedral mesh generation method based on Delaunay triangulation, Delaunay triangulation is performed through the initial point set, and the triangulation of the target triangulation model is inserted. The coordinates of the grid points are optimized by genetic algorithm to improve the grid quality. .
The global optimal tetrahedral mesh generation is achieved, which improves the mesh quality at the boundary, reduces the algorithm complexity and improves optimization efficiency.
Smart Images

Figure CN119169228B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of mesh generation, and in particular to a tetrahedral mesh generation method and related devices. Background Art
[0002] The current meshing technology uses specific methods (such as mapping method, quadtree method, Delaunay triangulation method, etc.) to generate the initial tetrahedral mesh of the triangular patch model, and then uses a local optimization algorithm to optimize the large number of grid points and complex topological relationships contained in the initial tetrahedral mesh to obtain the optimized target tetrahedral mesh.
[0003] However, the quality of the mesh at the boundary of the tetrahedral mesh generated by a specific method is poor, and the use of a local optimization algorithm makes the optimization process easily fall into the local optimum, resulting in poor overall quality of the target tetrahedral mesh. In addition, the specific method and the local optimization algorithm also have problems of high algorithm complexity and low optimization efficiency, which need to be solved urgently. Summary of the invention
[0004] In view of the above problems, the present application provides a tetrahedral mesh generation method and related devices to solve the problems of poor mesh quality at the boundary, poor overall mesh quality, high algorithm complexity and low optimization efficiency in the prior art. The specific solution is as follows:
[0005] The first aspect of the present application provides a tetrahedral mesh generation method, comprising:
[0006] Performing Delaunay triangulation based on an initial point set to obtain an initial tetrahedral mesh, wherein the initial point set is composed of all input vertices and all equidistant points of a target triangular patch model, and the equidistant points are obtained by taking points equidistantly in all directions of a three-dimensional space within a bounding box of the target triangular patch model;
[0007] Inserting each triangular face included in the target triangular face model into the initial tetrahedral mesh to obtain a first updated tetrahedral mesh, wherein a mesh surface of the first updated tetrahedral mesh includes a surface of the target triangular face model;
[0008] An initial population is obtained based on the coordinate values of all grid points included in the first updated tetrahedral grid, an average mass of tetrahedrons connected to the grid points is used as fitness, and a next generation population of the initial population is calculated using a genetic algorithm to obtain a second updated tetrahedral grid;
[0009] When the preset iteration termination condition is not reached, all mesh points of the second updated tetrahedral mesh are used as the initial point set, and the Delaunay triangulation based on the initial point set is returned to obtain the initial tetrahedral mesh, until the preset iteration termination condition is reached, the tetrahedral mesh belonging to the target triangular patch model in the second updated tetrahedral mesh is extracted to obtain the target tetrahedral mesh.
[0010] In a possible implementation, inserting each triangular face included in the target triangular face model into the initial tetrahedral mesh to obtain a first updated tetrahedral mesh includes:
[0011] Traverse each of the triangles, and for the currently traversed triangle:
[0012] Searching for a tetrahedron intersecting with the triangular face from the intermediate stage tetrahedron mesh to obtain a first tetrahedron set, wherein for the first triangular face traversed, the intermediate stage tetrahedron mesh is the initial tetrahedron mesh, and for a non-first triangular face traversed, the intermediate stage tetrahedron mesh is a tetrahedron mesh obtained by inserting the previous triangular face;
[0013] Cutting the first tetrahedron set using the plane where the triangular facet is located, and generating a second tetrahedron set corresponding to the first tetrahedron set based on the cutting plane;
[0014] Based on the points newly generated in the cutting process, the third tetrahedron set in the tetrahedron mesh of the intermediate stage is updated to obtain a fourth tetrahedron set, wherein the third tetrahedron set refers to a set consisting of other tetrahedrons in the tetrahedron set of the intermediate stage except the first tetrahedron set;
[0015] Replace the first tetrahedron set in the intermediate stage tetrahedron set with the second tetrahedron set;
[0016] Determine whether all the triangles have been traversed, if not, traverse the next triangle;
[0017] Until all the triangular facets are traversed, the first updated tetrahedral mesh is obtained.
[0018] In a possible implementation, the process of calculating the average mass of the tetrahedrons connected to the grid points includes:
[0019] Calculating the three-dimensional conformal energy of each tetrahedron connected to the grid point in the first updated tetrahedral grid;
[0020] Based on the three-dimensional conformal energy of each tetrahedron connected to the grid point, obtaining the mass of each tetrahedron connected to the grid point;
[0021] The average of the masses of the tetrahedrons connected to the grid points is calculated to obtain the average mass.
[0022] In a possible implementation, the preset iteration termination condition is: the average fitness value of the population reaches a preset fitness threshold, or the number of iterations reaches a preset total number of iterations.
[0023] In a possible implementation, extracting the tetrahedral mesh belonging to the target triangular patch model from the second updated tetrahedral mesh to obtain the target tetrahedral mesh includes:
[0024] Calculating the winding number of the center of gravity of each tetrahedron included in the second updated tetrahedral mesh relative to the surface of the target triangular patch model as the winding number corresponding to each tetrahedron;
[0025] Tetrahedrons whose corresponding winding numbers are greater than or equal to a preset winding number threshold are extracted from the second updated tetrahedral mesh, and the target tetrahedral mesh is formed by the extracted tetrahedrons.
[0026] In a possible implementation, the bounding box is a minimum axis-aligned bounding box.
[0027] A second aspect of the present application provides a tetrahedral mesh generation device, comprising:
[0028] A triangulation module, configured to perform Delaunay triangulation based on an initial point set to obtain an initial tetrahedral mesh, wherein the initial point set is composed of all input vertices and all equidistant points of a target triangular patch model, and the equidistant points are obtained by taking equidistant points in all directions of a three-dimensional space within a bounding box of the target triangular patch model;
[0029] A first optimization module is used to insert each triangular face included in the target triangular face model into the initial tetrahedral mesh to obtain a first updated tetrahedral mesh, wherein a mesh surface of the first updated tetrahedral mesh includes an outer surface of the target triangular face model;
[0030] A second optimization module is used to obtain an initial population based on the coordinate values of all grid points included in the first updated tetrahedral grid, use the average mass of tetrahedrons connected to the grid points as fitness, and use a genetic algorithm to calculate the next generation population of the initial population to obtain a second updated tetrahedral grid;
[0031] A tetrahedron extraction module is used to, when a preset iteration termination condition is not met, use all grid points of the second updated tetrahedral mesh as the initial point set, return the Delaunay triangulation based on the initial point set, and obtain the initial tetrahedral mesh, until the preset iteration termination condition is met, extract the tetrahedral mesh belonging to the target triangular face model in the second updated tetrahedral mesh to obtain the target tetrahedral mesh.
[0032] A third aspect of the present application provides a computer program product, comprising computer-readable instructions, which, when executed on an electronic device, enables the electronic device to implement the tetrahedral mesh generation method of the first aspect or any implementation of the first aspect.
[0033] A fourth aspect of the present application provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein:
[0034] The memory is used to store computer programs;
[0035] The processor is used to execute the computer program so that the electronic device can implement the tetrahedral mesh generation method of the above-mentioned first aspect or any implementation manner of the first aspect.
[0036] In a fifth aspect, the present application provides a computer storage medium, which carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement the tetrahedral mesh generation method of the above-mentioned first aspect or any implementation method of the first aspect.
[0037] By means of the above technical solution, the tetrahedral mesh generation method provided by the present application can achieve global optimization by optimizing the genetic algorithm with all the mesh points on the surface of the target triangular face model as the optimization object; the present application does not need to consider the boundary conditions when performing Delaunay triangulation, and only needs to perform tetrahedron extraction in the last step, which helps to improve the problem of poor quality mesh at the boundary caused by the difficulty encountered when Delaunay triangulation handles boundary problems. Moreover, the tetrahedral mesh generation process of the present application does not need to consider the mesh topological relationship, but only the geometric relationship, the algorithm complexity is low and the optimization speed and efficiency are improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0039] Figure 1 A schematic diagram of a system architecture provided for this application;
[0040] Figure 2 A schematic diagram of an optional hardware structure of the terminal 100 provided in this application;
[0041] Figure 3 A schematic diagram of the structure of a server 200 provided in this application;
[0042] Figure 4 A schematic diagram of a tetrahedral mesh generation method provided in this application;
[0043] Figure 5 It is a schematic diagram of the process of inserting a triangular patch in a two-dimensional plane;
[0044] Figure 6 A schematic diagram of the structure of a tetrahedral mesh generation device provided in this application;
[0045] Figure 7 A schematic diagram of the structure of an electronic device provided in this application. DETAILED DESCRIPTION
[0046] The following describes the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation method section of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.
[0047] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0048] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0049] See also Figure 1 , Figure 1 A schematic diagram of a system architecture is shown. The system may include a terminal 100 and a server 200. The server 200 may include one or more servers ( Figure 1In the example, a server is included, and the server 200 can provide the method provided in the embodiment of the present application for one or more terminals.
[0050] Among them, an application corresponding to the third-party system can be installed on the terminal 100. The above application and web page can provide an interface. The terminal 100 can receive relevant parameters entered by the user on the interface and send the above parameters to the server 200. The server 200 can obtain processing results based on the received parameters and return the processing results to the terminal 100.
[0051] It should be understood that in some optional implementations, the terminal 100 can also complete the action of obtaining the processing result based on the received parameters by itself without the cooperation of the server, and the embodiments of the present application are not limited to this.
[0052] Next describe Figure 1 The product form of the mid-terminal 100;
[0053] The terminal 100 in the embodiment of the present application can be a mobile phone, a tablet computer, a wearable device, a vehicle-mounted device, an augmented reality (AR) / virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc., and the embodiment of the present application does not impose any restrictions on this.
[0054] Figure 2 An optional hardware structure diagram of the terminal 100 is shown.
[0055] refer to Figure 2 As shown, the terminal 100 may include a radio frequency unit 110, a memory 120, an input unit 130, a display unit 140, a camera 150 (optional), an audio circuit 160 (optional), a speaker 161 (optional), a microphone 162 (optional), an earphone jack 163 (optional), a processor 170, an external interface 180, a power supply 190 and other components. Those skilled in the art will appreciate that Figure 2 These are merely examples of terminals or multi-function devices and do not constitute limitations on the terminals or multi-function devices, which may include more or fewer components than those shown in the figures, or combinations of certain components, or different components.
[0056] The input unit 130 can be used to receive input digital or character information, and generate key signal input related to the user settings and function control of the portable multifunctional device. Specifically, the input unit 130 may include a touch screen 131 (optional) and / or other input devices 132. The touch screen 131 can collect the user's touch operations on or near it (such as the user's operation on or near the touch screen using any suitable object such as fingers, joints, stylus, etc.), and drive the corresponding connection device according to a pre-set program. The touch screen can detect the user's touch action on the touch screen, convert the touch action into a touch signal and send it to the processor 170, and can receive and execute the command sent by the processor 170; the touch signal at least includes the touch point coordinate information. The touch screen 131 can provide an input interface and an output interface between the terminal 100 and the user. In addition, the touch screen can be implemented using multiple types such as resistive, capacitive, infrared and surface acoustic wave. In addition to the touch screen 131, the input unit 130 can also include other input devices. Specifically, other input devices 132 may include, but are not limited to, one or more of a physical keyboard, function keys (such as a volume control key, a switch key, etc.), a trackball, a mouse, a joystick, and the like.
[0057] Among them, the input device 132 can receive input data and the like.
[0058] The display unit 140 may be used to display information input by a user or provided to a user, various menus of the terminal 100, an interactive interface, file display, and / or playback of any multimedia file.
[0059] The memory 120 can be used to store instructions and data. The memory 120 can mainly include an instruction storage area and a data storage area. The data storage area can store various data, such as multimedia files, texts, etc.; the instruction storage area can store software units such as operating systems, applications, instructions required for at least one function, or their subsets and extensions. It can also include a non-volatile random access memory; provide the processor 170 with hardware, software and data resources including management of computing and processing equipment, and support control software and applications. It is also used for the storage of multimedia files, and the storage of running programs and applications.
[0060] The processor 170 is the control center of the terminal 100. It uses various interfaces and lines to connect various parts of the entire terminal 100. By running or executing instructions stored in the memory 120 and calling data stored in the memory 120, it executes various functions of the terminal 100 and processes data, thereby controlling the terminal device as a whole. Optionally, the processor 170 may include one or more processing units; preferably, the processor 170 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface and application program, and the modem processor mainly processes wireless communication. It is understandable that the above-mentioned modem processor may not be integrated into the processor 170. In some embodiments, the processor and the memory may be implemented on a single chip, and in some embodiments, they may also be implemented separately on separate chips. The processor 170 may also be used to generate corresponding operation control signals, send them to corresponding components of the computing and processing device, read and process data in the software, especially read and process data and programs in the memory 120, so that each functional module therein performs corresponding functions, thereby controlling the corresponding components to act according to the requirements of the instructions.
[0061] Among them, the memory 120 can be used to store software codes related to the tetrahedral mesh generation method, the processor 170 can execute the steps of the tetrahedral mesh generation method, and can also schedule other units (such as the above-mentioned input unit 130 and display unit 140) to achieve corresponding functions.
[0062] The radio frequency unit 110 (optional) can be used for receiving and sending information or receiving and sending signals during a call, for example, after receiving the downlink information of the base station, it is sent to the processor 170 for processing; in addition, the designed uplink data is sent to the base station. Generally, the RF circuit includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (Low Noise Amplifier, LNA), a duplexer, etc. In addition, the radio frequency unit 110 can also communicate with network devices and other devices through wireless communication. The wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile Communication (Global System of Mobile Communication, GSM), General Packet Radio Service (General Packet Radio Service, GPRS), Code Division Multiple Access (Code Division Multiple Access, CDMA), Wideband Code Division Multiple Access (Wideband Code Division Multiple Access, WCDMA), Long Term Evolution (Long Term Evolution, LTE), email, Short Messaging Service (SMS), etc.
[0063] In this embodiment of the present application, the RF unit 110 can send data to the server 200 and receive processing results sent by the server 200.
[0064] It should be understood that the radio frequency unit 110 is optional and can be replaced by other communication interfaces, such as a network port.
[0065] The terminal 100 also includes a power supply 190 (such as a battery) for supplying power to various components. Preferably, the power supply can be logically connected to the processor 170 through a power management system, so that the power management system can manage functions such as charging, discharging, and power consumption.
[0066] The terminal 100 further includes an external interface 180 , which may be a standard Micro USB interface or a multi-pin connector, and may be used to connect the terminal 100 to communicate with other devices, or to connect a charger to charge the terminal 100 .
[0067] Although not shown, the terminal 100 may also include a flashlight, a wireless fidelity (WiFi) module, a Bluetooth module, sensors with different functions, etc., which are not described in detail here. Some or all of the methods described below may be applied in the following embodiments. Figure 2 In the terminal 100 shown.
[0068] Next describe Figure 1 The product form of the server 200;
[0069] Figure 3 A structural diagram of a server 200 is provided, such as Figure 3 As shown, the server 200 includes a bus 201, a processor 202, a communication interface 203, and a memory 204. The processor 202, the memory 204, and the communication interface 203 communicate with each other via the bus 201.
[0070] The bus 201 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0071] The processor 202 may be any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0072] The memory 204 may include a volatile memory, such as a random access memory (RAM). The memory 204 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD), or a solid state drive (SSD).
[0073] The memory 204 may be used to store software codes related to the tetrahedral mesh generation method, and the processor 202 may execute the steps of the tetrahedral mesh generation method of the chip, and may also schedule other units to implement corresponding functions.
[0074] It should be understood that the above-mentioned terminal 100 and server 200 can be centralized or distributed devices, and the processors in the above-mentioned terminal 100 and server 200 (such as processor 170 and processor 202) can be hardware circuits (such as application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), general-purpose processors, DSPs, microprocessors or microcontrollers, etc.), or a combination of these hardware circuits. For example, the processor can be a hardware system with an instruction execution function, such as a CPU, DSP, etc., or a hardware system without an instruction execution function, such as an ASIC, FPGA, etc., or a combination of the above-mentioned hardware systems without an instruction execution function and hardware systems with an instruction execution function.
[0075] In view of the problems existing in the prior art, the inventor of this case conducted in-depth research and finally provided a tetrahedral mesh generation method. The tetrahedral mesh generation method of the embodiment of the present application is described in detail below with reference to the accompanying drawings.
[0076] Reference Figure 4 , Figure 4 A schematic flow chart of a tetrahedral mesh generation method provided in an embodiment of the present application, the tetrahedral mesh generation method may include:
[0077] Step S401: Perform Delaunay triangulation based on the initial point set to obtain an initial tetrahedral mesh.
[0078] The initial point set consists of all input vertices and all equidistant points of the target triangular patch model. The equidistant points are obtained by taking points equidistantly in all directions of the three-dimensional space within the bounding box of the target triangular patch model.
[0079] The target triangular face model refers to a geometric model represented by triangular faces to be meshed, such as an STL (STereoLithography) model, a Mesh (polygonal mesh) model, a surface model, and the like.
[0080] In this embodiment, the bounding box of the target triangular face model may be calculated first. Optionally, the bounding box may be a minimum axis-aligned bounding box (AABB).
[0081] Next, this embodiment can obtain points equidistantly along all directions of the three-dimensional space (i.e., the X, Y, and Z directions) within the bounding box. Specifically, the target side length of the mesh can be input while inputting the target triangular face model. Then, points can be equidistantly taken along the X, Y, and Z directions within the bounding box according to the target side length to obtain all equidistant points.
[0082] In this embodiment, the initial point set is composed of all input vertices and all equidistant points of the target triangular patch model. Here, the input vertices refer to the vertices of the triangular patches in the target triangular patch model.
[0083] Finally, this embodiment can perform Delaunay triangulation based on the initial point set to obtain an initial tetrahedral mesh.
[0084] Optionally, an incremental approach can be used to construct a three-dimensional Delaunay triangulation to generate an initial tetrahedral mesh. The process may specifically include: selecting an initial tetrahedron that is large enough to contain a bounding box, inserting points in the initial point set into the initial tetrahedron one by one, locating the tetrahedron containing the inserted points, and updating the tetrahedral mesh. The inserted points need to ensure that the tetrahedral mesh satisfies the empty circle property of the Delaunay triangulation. Here, when updating the tetrahedral mesh, face swapping can be applied to ensure that the updated tetrahedral mesh has no non-Delaunay edges by flipping edges or faces.
[0085] Step S402: insert each triangular face included in the target triangular face model into the initial tetrahedral mesh to obtain a first updated tetrahedral mesh.
[0086] Since the initial tetrahedral mesh is a tetrahedral mesh generated based on the bounding box, the mesh surface of the initial tetrahedral mesh may not completely contain the surface of the target triangular patch, that is, there may be a part of the surface of the target triangular patch model (hereinafter referred to as the target surface) that cannot be represented by the surface of any tetrahedron contained in the initial tetrahedral mesh. Therefore, the initial tetrahedral mesh is used as the final meshing result, resulting in a less optimized meshing result.
[0087] In order to make all surfaces of the target triangular patch model be represented by the surface of a tetrahedron, the initial tetrahedron mesh needs to be further refined. In this embodiment, all triangular patches contained in the target triangular patch model can be inserted into the initial tetrahedron mesh in sequence. By inserting triangular patches, part or all of the tetrahedrons contained in the initial tetrahedron mesh can be further divided into several smaller tetrahedrons, so that the target surface can be represented by the surfaces of the several smaller tetrahedrons, that is, the mesh surface of the first updated tetrahedron mesh obtained in this embodiment can contain all surfaces of the target triangular patch model.
[0088] Step S403, obtaining an initial population based on the coordinate values of all grid points included in the first updated tetrahedral grid, taking the average mass of tetrahedrons connected to the grid points as fitness, and using a genetic algorithm to calculate the next generation population of the initial population to obtain a second updated tetrahedral grid.
[0089] This embodiment may further optimize and adjust the positions of the grid points included in the first tetrahedral grid to obtain a more optimized tetrahedral grid.
[0090] In view of the fact that genetic algorithms (GA) have the advantages of being able to simulate operations such as selection, crossover and mutation in the biological evolution process and searching for the optimal solution or a near-optimal solution in the solution space, this embodiment uses a genetic algorithm to further optimize the first tetrahedral mesh to obtain a second updated tetrahedral mesh.
[0091] The initial population in the genetic algorithm is obtained based on the coordinate values of all grid points contained in the tetrahedral grid after the first update. Here, the coordinate values of the grid points refer to the coordinate values of the grid points in the bounding box.
[0092] Since the quality of a tetrahedron can be used to measure the quality of the tetrahedron, this embodiment uses the average quality of the tetrahedrons connected to the grid points as the fitness.
[0093] Step S404: When the preset iteration termination condition is not met, all grid points of the second updated tetrahedral mesh are used as the initial point set, and Delaunay triangulation based on the initial point set is returned to obtain the initial tetrahedral mesh, until the preset iteration termination condition is met, and the tetrahedral mesh belonging to the target triangular face model in the second updated tetrahedral mesh is extracted to obtain the target tetrahedral mesh.
[0094] In this embodiment, each time the genetic algorithm performs selection, crossover, mutation and other operations to obtain the next generation population, it will determine whether the preset iteration termination condition is reached. If so, it means that the currently optimized second updated tetrahedral mesh has reached the optimal state, and no further iteration will be performed. Instead, the internal volume of the second updated tetrahedral mesh will be extracted based on the boundary of the target triangular patch model, that is, the tetrahedral mesh in the second updated tetrahedral mesh belonging to the target triangular patch model will be extracted to obtain the target tetrahedral mesh.
[0095] On the contrary, if it is determined that the preset iteration termination condition is not met, all grid points of the tetrahedral mesh after the second update can be used as the initial point set to re-mesh, that is, return to the step of performing Delaunay triangulation based on the initial point set to obtain the initial tetrahedral mesh.
[0096] The tetrahedral mesh generation method provided by the present application uses a genetic algorithm to optimize all mesh points on the surface of the target triangular face model, and can achieve global optimization. The present application does not need to consider boundary conditions when performing Delaunay triangulation, and only needs to perform tetrahedron extraction in the last step, which helps to improve the problem of poor quality mesh at the boundary caused by difficulties in handling boundary problems in Delaunay triangulation. Moreover, the tetrahedral mesh generation process of the present application does not need to consider the mesh topological relationship, but only the geometric relationship, and the algorithm complexity is low and the optimization speed and efficiency are improved. In addition, the present application adopts a genetic algorithm and has excellent parallel capabilities.
[0097] In addition, the tetrahedral mesh generation method provided in this application does not require the use of complex mathematical models, and can improve the flexibility, robustness and generalization ability of the calculation, thereby demonstrating higher optimization efficiency and stronger global optimization ability when facing complex models.
[0098] In a possible implementation, in order to enable those skilled in the art to better understand the process of step S402 of "inserting each triangular face included in the target triangular face model into the initial tetrahedral mesh", a detailed description is given through this embodiment.
[0099] In this embodiment, each triangular facet included in the target triangular facet model can be inserted into the initial tetrahedral mesh in sequence. The sequential insertion process can be obtained through traversal, that is, this embodiment can traverse each triangular facet in each triangular facet, and then insert the currently traversed triangular facet into the initial tetrahedral mesh. After the insertion is completed, it is determined whether all triangular facets have been traversed. If not, the next triangular facet is traversed. If so, that is, all triangular facets have been traversed, and the final tetrahedral mesh is used as the first updated tetrahedral mesh.
[0100] In order to facilitate the introduction of the process of inserting triangles, the tetrahedron obtained after inserting triangles is called the intermediate stage tetrahedron mesh, that is, for the first triangle traversed, the intermediate stage tetrahedron mesh is the initial tetrahedron mesh, and for non-first triangles traversed, the intermediate stage tetrahedron mesh is the tetrahedron mesh obtained after inserting the previous triangle. Taking any traversed triangle as an example, the process of inserting the triangle into the intermediate stage tetrahedron mesh is introduced.
[0101] A tetrahedron intersecting with the triangular face is searched from the intermediate stage tetrahedron mesh to obtain a first tetrahedron set. Here, as long as any edge of a tetrahedron intersects with the triangular face, the tetrahedron is considered to intersect with the triangular face.
[0102] Next, the first tetrahedron set is cut using the plane where the triangular facet is located, and a second tetrahedron set corresponding to the first tetrahedron set is generated based on the cut surface.
[0103] Further, the third tetrahedron set in the intermediate stage tetrahedron mesh is updated based on the newly generated points in the cutting process to obtain a fourth tetrahedron set. Here, the third tetrahedron set refers to a set of tetrahedrons in the intermediate stage tetrahedron set except the first tetrahedron set.
[0104] Finally, the first tetrahedron set in the intermediate stage tetrahedron set is replaced by the second tetrahedron set.
[0105] In order to understand the above process more clearly, an insertion process in a two-dimensional plane is used as an example. Figure 5 As shown in Figure 1, it is a schematic diagram of the process of inserting a triangular patch in a two-dimensional plane. Figure 5 The arrows in the middle indicate the direction, and the four figures are named the first figure, the second figure, the third figure, and the fourth figure respectively.
[0106] like Figure 5 As shown in the first figure, there are two triangles in the two-dimensional plane, namely t1 and t2. When the triangle face is inserted, a cutting line as shown by the dotted line in the figure (corresponding to the cutting surface in this embodiment) is formed. When the cutting line intersects t2 and t1, the following appears Figure 5 At the same time, the cutting line cuts t2 (corresponding to the first tetrahedron set in this embodiment) into three triangles, t3, t4 and t5 (corresponding to the second tetrahedron set in this embodiment).
[0107] exist Figure 5Of the two points shown in the second figure, the existence of the point where t3, t4 and t5 intersect has no effect on t1, but the existence of the point where t3, t4 and t1 intersect requires further cutting of t1 (corresponding to the third tetrahedron set in this embodiment). Therefore, the point where t3, t4 and t1 intersect (i.e., the black point in the third figure) is used as the above-mentioned "newly generated point".
[0108] like Figure 5 In the fourth figure, t1 is updated according to the newly generated points, and t1 can be divided into two triangles, t6 and t7 (corresponding to the fourth tetrahedron set in this embodiment).
[0109] Then, t3, t4, t5, t6 and t7 correspond to the first updated tetrahedral mesh in this embodiment.
[0110] It can be seen that after the above-mentioned triangular patch insertion process, it can be ensured that the mesh surface of the first updated tetrahedral mesh contains the surface of the target triangular patch model. Therefore, compared with the initial tetrahedral mesh, the first updated tetrahedral mesh is more adapted to the target triangular patch model, thereby improving the meshing effect.
[0111] The following embodiment introduces the process of optimizing the first updated tetrahedral mesh based on a genetic algorithm.
[0112] Step 1: Initialization.
[0113] The initial population may be determined based on coordinate values of all grid points included in the tetrahedral grid after the first update.
[0114] Optionally, in the first iteration of the genetic algorithm, the coordinate value of each grid point contained in the tetrahedral mesh after the first update can be used as an individual of the initial population; in the non-first iteration of the genetic algorithm, the initial population can be determined based on the coordinate value of each grid point contained in the tetrahedral mesh after the first update and the population size adaptively adjusted later.
[0115] In this embodiment, the individuals in the tth generation population can be The coordinate value of .
[0116] Determine the feasible domain range of the solution, and use the bounding box mentioned above (preferably, the bounding box is AABB) as the range of the solution, that is, the genes of each individual in each generation of the population cannot exceed the solution range indicated by the bounding box.
[0117] The maximum number of individuals to determine the population size and the minimum number of individuals The value range of , total number of iterations T, crossover probability , mutation probability and fitness threshold And other parameters.
[0118] Step 2: Calculate fitness
[0119] Individuals in the population of generation t Fitness The calculation formula is as follows: Formula (1).
[0120] Formula (1)
[0121] Where m is the number of tetrahedral meshes corresponding to the individual after the first update. The number of connected tetrahedrons, After the first update, the tetrahedral mesh is The jth tetrahedron connected The mass is calculated as follows:
[0122] Formula (2)
[0123] in, Tetrahedron The three-dimensional conformal energy is calculated as shown in the following formula (3).
[0124] Formula (3)
[0125] in, To make a tetrahedron Jacobian matrix of the unique three-dimensional deformation converted to a regular tetrahedron.
[0126] Step 3: Population evolution
[0127] First, the following formula (4) and formula (5) are used to determine the crossover probability according to the fitness of each individual in the initial population: and mutation probability .
[0128] Formula (4)
[0129] Formula (5)
[0130] in, , is an experience value, optional, ; is the maximum fitness in the parent population; is the greater fitness of the parent individuals i and j that can be paired and are to be crossed, and its calculation formula is as follows: Formula (6); is the average fitness of the population, and its calculation formula is as follows: is the fitness of the individual to be mutated, and its calculation formula is the above formula (1).
[0131] Formula (6)
[0132] Formula (7)
[0133] Among them, n is the number of individuals in the parent population.
[0134] Then the selection, crossover and mutation operations are performed.
[0135] Specifically, for the selection operation, the roulette wheel selection method based on fitness is used to select individuals with good quality to directly enter the next generation, and the i-th individual The probability of being selected The calculation formula of refers to the following formula (8).
[0136] Formula (8)
[0137] Generate a random number rank1, rank1∈(0,1). If the value of rank1 is in the range shown in the following formula (9), then select the i-th individual Straight into the next generation.
[0138] Formula (9)
[0139] For the crossover operation, two individuals from the parent population are selected, and pairing calculations are performed on them to generate new offspring individuals based on the crossover probability and the crossover operator. Optionally, the crossover operator is a heuristic weighted crossover operator.
[0140] For the two selected individuals and , calculate the straight-line distance between two points according to the following formula (10): .
[0141] Formula (10)
[0142] like , then the parent individual and Can be paired, among which, is an empirical value, and b is the diagonal length of the previous bounding box.
[0143] Generate a random number rank2, rank2∈(0,1), if rank2≤ , then crossover is performed, and the coordinate values (genes) of the offspring individuals are expressed as:
[0144] Formula (11)
[0145] Formula (12)
[0146] in, represents the coordinate value of the i-th offspring individual, represents the coordinate value of the jth offspring individual, The calculation formula is as follows: Formula (13).
[0147] Formula (13)
[0148] in, , which is an empirical value; q={1,2, …}, usually q=1, when q=1 is substituted into the formula to calculate the child or When it is not within the feasible domain of the solution, take q=2, and so on.
[0149] For mutation operation, single-point mutation method can be used.
[0150] For the parent individual , generate a random number rank3, rank3∈(0,1), if rank3≤ , then mutation occurs.
[0151] The mutation process includes: generating a random number rank4, rank4∈{1,2,3}, then for the parent individual The coordinate values in the rank4th direction (rank4=1 represents the x direction, rank4=2 represents the y direction, and rank4=3 represents the z direction) are mutated, and the mutated coordinate values are randomly generated in the interval Ω.
[0152] Formula (14)
[0153] in, For individuals The coordinate value of the rank4 direction, is the minimum coordinate value of the rank4 direction, is the maximum coordinate value of the rank4 direction, and Based on the bounding box calculation above, The calculation formula is as shown in formula (15).
[0154] Formula (15)
[0155] in, is the current iteration number, T is the total number of iterations, c∈(2,3), r∈[0,1] is the empirical value.
[0156] Step 4: Determine whether the preset iteration termination condition is reached.
[0157] Optionally, the preset iteration termination condition is: the average fitness value of the population reaches the preset fitness threshold , or the number of iterations reaches the preset total number of iterations T.
[0158] If the preset iteration termination condition is met, the volume is extracted according to the process mentioned in the previous step S404 to obtain the target tetrahedral mesh; if the preset iteration termination condition is not met, the population size is adjusted according to step 5, and iterative processing is performed according to the return process mentioned in the previous step S404.
[0159] Step 5: Adaptive adjustment of population size based on fitness
[0160] During the evolution process, if the following conditions are met: the average fitness of the population for three consecutive generations has not increased significantly, or the average fitness of the population for three consecutive generations is far less than the fitness threshold , that is, satisfying the following formula (16), then the population size is increased according to formula (17).
[0161] Formula (16)
[0162] Formula (17)
[0163] During the evolution process, if the following conditions are met: Compared with five generations ago, the average fitness of the population for three consecutive generations has increased significantly, and the average fitness of the population for three consecutive generations is close to the fitness threshold , that is, the following formula (18) is satisfied, then the population size is reduced according to formula (19).
[0164] Formula (18)
[0165] Formula (19)
[0166] Among them, t represents the current population (the tth generation population), t-1 represents the previous generation population of the current population, t-2 represents the two previous generations population of the current population, t-3 represents the three previous generations population of the current population, t-4 represents the four previous generations population of the current population, and t-5 represents the five previous generations population of the current population; , is the empirical value, is the average fitness of the t-th generation population.
[0167] Optional, you can take .
[0168] In this embodiment, the use of genetic algorithms for grid optimization can effectively solve the problem that traditional optimization methods are prone to falling into local optimality; since the genetic algorithm does not consider the topological relationship of the grid during grid optimization and only considers the geometric method, the optimization speed and efficiency can be improved; in addition, the use of genetic algorithms makes this embodiment have excellent parallel capabilities.
[0169] In a possible implementation, the process of step S404 of "extracting the tetrahedral mesh belonging to the interior of the target triangular patch model from the second updated tetrahedral mesh to obtain the target tetrahedral mesh" is introduced.
[0170] Since the previous processes of generating and optimizing tetrahedral meshes are all implemented based on bounding boxes, the second updated tetrahedral mesh obtained in the present application contains tetrahedrons outside the target triangular patch model. It is necessary to extract the tetrahedral mesh belonging to the target triangular patch model based on this embodiment to obtain the final optimized target tetrahedral mesh.
[0171] Optionally, this embodiment may first calculate the winding number of the center of gravity of each tetrahedron contained in the second updated tetrahedral mesh relative to the target triangular patch model surface as the winding number corresponding to each tetrahedron, and then extract tetrahedrons whose corresponding winding numbers are greater than or equal to a preset winding number threshold in the second updated tetrahedral mesh, and the target tetrahedral mesh is composed of the extracted tetrahedrons.
[0172] Optionally, this embodiment may define internal and external functions based on a generalized winding number method for use in calculating the winding number above.
[0173] This embodiment avoids considering boundary conditions by volume extraction, and can obtain a tetrahedral mesh with better quality, thereby improving the mesh generation effect.
[0174] A tetrahedral mesh generation method provided in an embodiment of the present application is introduced above, and a device for executing the above-mentioned tetrahedral mesh generation method will be introduced below.
[0175] See also Figure 6 , Figure 6 A schematic diagram of the structure of a tetrahedral mesh generation device provided in an embodiment of the present application. Figure 6 As shown, the tetrahedral mesh generating device may include:
[0176] A triangulation module 501 is used to perform Delaunay triangulation based on an initial point set to obtain an initial tetrahedral mesh, wherein the initial point set is composed of all input vertices and all equidistant points of a target triangular patch model, and the equidistant points are obtained by taking equidistant points in all directions of a three-dimensional space within a bounding box of the target triangular patch model;
[0177] A first optimization module 502 is used to insert each triangular patch included in the target triangular patch model into the initial tetrahedral mesh to obtain a first updated tetrahedral mesh, wherein the mesh surface of the first updated tetrahedral mesh includes the outer surface of the target triangular patch model;
[0178] The second optimization module 503 is used to obtain an initial population based on the coordinate values of all grid points included in the first updated tetrahedral grid, use the average mass of the tetrahedrons connected to the grid points as fitness, and use a genetic algorithm to calculate the next generation population of the initial population to obtain a second updated tetrahedral grid;
[0179] The tetrahedron extraction module 504 is used to use all grid points of the second updated tetrahedron mesh as the initial point set when the preset iteration termination condition is not met, return to perform Delaunay triangulation based on the initial point set to obtain the initial tetrahedron mesh, and until the preset iteration termination condition is met, extract the tetrahedron mesh belonging to the inside of the target triangular face model in the second updated tetrahedron mesh to obtain the target tetrahedron mesh.
[0180] In a possible implementation, the process in which the first optimization module inserts each triangular face included in the target triangular face model into the initial tetrahedral mesh to obtain the first updated tetrahedral mesh may include:
[0181] Traverse each triangle in each triangle, for the currently traversed triangle:
[0182] Searching for tetrahedrons intersecting with the triangle from the intermediate tetrahedron mesh to obtain the first tetrahedron set, wherein for the first triangle traversed, the intermediate tetrahedron mesh is the initial tetrahedron mesh, and for the non-first triangle traversed, the intermediate tetrahedron mesh is the tetrahedron mesh obtained after inserting the previous triangle;
[0183] Cut the first tetrahedron set using the plane where the triangular facet is located, and generate a second tetrahedron set corresponding to the first tetrahedron set based on the cut surface;
[0184] Based on the newly generated points in the cutting process, the third tetrahedron set in the tetrahedron mesh of the intermediate stage is updated to obtain a fourth tetrahedron set, where the third tetrahedron set refers to a set consisting of other tetrahedrons in the tetrahedron set of the intermediate stage except the first tetrahedron set;
[0185] Replace the first tetrahedron set in the intermediate stage tetrahedron set with the second tetrahedron set;
[0186] Determine whether all triangles have been traversed. If not, traverse the next triangle.
[0187] Until all triangular faces are traversed, the first updated tetrahedral mesh is obtained.
[0188] In a possible implementation, the process of the second optimization module calculating the average quality of tetrahedrons connected to the grid points may include:
[0189] Calculating the three-dimensional conformal energy of each tetrahedron connected to the grid point in the tetrahedral grid after the first update;
[0190] Based on the three-dimensional conformal energy of each tetrahedron connected to the grid point, the mass of each tetrahedron connected to the grid point is obtained;
[0191] The average mass of each tetrahedron connected to the grid point is calculated to obtain the average mass.
[0192] In a possible implementation, the iteration termination condition preset in the second optimization module may be: the average fitness value of the population reaches a preset fitness threshold, or the number of iterations reaches a preset total number of iterations.
[0193] In a possible implementation, the tetrahedron extraction module extracts the tetrahedron mesh belonging to the target triangular patch model from the second updated tetrahedron mesh, and the process of obtaining the target tetrahedron mesh may include:
[0194] Calculate the winding number of the center of gravity of each tetrahedron included in the tetrahedron mesh after the second update relative to the surface of the target triangular patch model as the winding number corresponding to each tetrahedron;
[0195] Tetrahedrons whose corresponding winding numbers are greater than or equal to a preset winding number threshold are extracted from the second updated tetrahedral mesh, and the target tetrahedral mesh is formed by the extracted tetrahedrons.
[0196] In a possible implementation, the bounding box in the triangulation module is a minimum axis-aligned bounding box.
[0197] The tetrahedral mesh generation device proposed in this application takes the entire mesh point set as the optimization object, breaking through the limitations of the traditional optimization process. This device does not need to consider boundary conditions when performing Delaunay triangulation and only needs to perform volume extraction at the end, which can improve the difficulty encountered when Delaunay triangulation handles boundary problems. In addition, it can well solve the problem that the traditional optimization process is prone to fall into local optimality; because it does not consider the topological relationship of the mesh and only considers the geometric method, it can improve the optimization speed and efficiency, and has excellent parallel capabilities. In addition, the device does not use complex mathematical models, which can improve the flexibility, robustness and generalization of calculations, thereby showing higher optimization efficiency and stronger global optimization capabilities when facing complex models.
[0198] The present application also provides an electronic device in an embodiment. Figure 7 As shown, it shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiment of the present application. The electronic device in the embodiment of the present application may include but is not limited to fixed terminals such as mobile phones, laptops, PDAs (personal digital assistants), PADs (tablet computers), desktop computers, etc. Figure 7 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0199] like Figure 7 As shown, the electronic device may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 to a random access memory (RAM) 603. When the electronic device is powered on, various programs and data required for the operation of the electronic device are also stored in the RAM 603. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0200] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a memory card, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although Figure 7 An electronic device having various devices is shown, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0201] An embodiment of the present application also provides a computer program product, including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements any tetrahedral mesh generation method provided in the embodiment of the present application.
[0202] A computer-readable storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any tetrahedral mesh generation method provided in the embodiment of the present application.
[0203] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.
[0204] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0205] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0206] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.
Claims
1. A tetrahedral mesh generation method, characterized in that: include: Performing Delaunay triangulation based on an initial point set to obtain an initial tetrahedral mesh, wherein the initial point set is composed of all input vertices and all equidistant points of a target triangular patch model, and the equidistant points are obtained by taking points equidistantly in all directions of a three-dimensional space within a bounding box of the target triangular patch model; Inserting each triangular face included in the target triangular face model into the initial tetrahedral mesh to obtain a first updated tetrahedral mesh, wherein a mesh surface of the first updated tetrahedral mesh includes a surface of the target triangular face model; An initial population is obtained based on the coordinate values of all grid points included in the first updated tetrahedral grid, an average mass of tetrahedrons connected to the grid points is used as fitness, and a next generation population of the initial population is calculated using a genetic algorithm to obtain a second updated tetrahedral grid; In the case where the preset iteration termination condition is not met, all mesh points of the second updated tetrahedral mesh are used as the initial point set, and the Delaunay triangulation based on the initial point set is returned to obtain the initial tetrahedral mesh, until the preset iteration termination condition is met, the tetrahedral mesh belonging to the interior of the target triangular patch model in the second updated tetrahedral mesh is extracted to obtain the target tetrahedral mesh; Inserting each triangular face included in the target triangular face model into the initial tetrahedral mesh to obtain a first updated tetrahedral mesh comprises: Traverse each of the triangles, and for the currently traversed triangle: Searching for a tetrahedron intersecting with the triangular face from the intermediate stage tetrahedron mesh to obtain a first tetrahedron set, wherein for the first triangular face traversed, the intermediate stage tetrahedron mesh is the initial tetrahedron mesh, and for a non-first triangular face traversed, the intermediate stage tetrahedron mesh is a tetrahedron mesh obtained by inserting the previous triangular face; Cutting the first tetrahedron set using the plane where the triangular facet is located, and generating a second tetrahedron set corresponding to the first tetrahedron set based on the cutting plane; Based on the points newly generated in the cutting process, the third tetrahedron set in the tetrahedron mesh of the intermediate stage is updated to obtain a fourth tetrahedron set, wherein the third tetrahedron set refers to a set of tetrahedrons in the tetrahedron set of the intermediate stage except the first tetrahedron set; Replace the first tetrahedron set in the intermediate stage tetrahedron set with the second tetrahedron set; Determine whether all the triangles have been traversed, if not, traverse the next triangle; until all the triangular facets are traversed to obtain the first updated tetrahedral mesh; The process of calculating the average mass of the tetrahedrons connected to the grid points comprises: Calculating the three-dimensional conformal energy of each tetrahedron connected to the grid point in the first updated tetrahedral grid; Based on the three-dimensional conformal energy of each tetrahedron connected to the grid point, obtaining the mass of each tetrahedron connected to the grid point; The average of the masses of the tetrahedrons connected to the grid points is calculated to obtain the average mass.
2. The tetrahedral mesh generation method according to claim 1, characterized in that: The preset iteration termination condition is: the average fitness value of the population reaches a preset fitness threshold, or the number of iterations reaches a preset total number of iterations.
3. The tetrahedral mesh generation method according to claim 1, characterized in that: The step of extracting the tetrahedral mesh belonging to the target triangular patch model from the second updated tetrahedral mesh to obtain the target tetrahedral mesh comprises: Calculating the winding number of the center of gravity of each tetrahedron included in the second updated tetrahedral mesh relative to the surface of the target triangular patch model as the winding number corresponding to each tetrahedron; Tetrahedrons whose corresponding winding numbers are greater than or equal to a preset winding number threshold are extracted from the second updated tetrahedral mesh, and the target tetrahedral mesh is formed by the extracted tetrahedrons.
4. The tetrahedral mesh generation method according to any one of claims 1 to 3, characterized in that: The bounding box is a minimum axis-aligned bounding box.
5. A tetrahedral mesh generation device, characterized in that: The method for generating a tetrahedral mesh according to any one of claims 1 to 4 comprises: A triangulation module, configured to perform Delaunay triangulation based on an initial point set to obtain an initial tetrahedral mesh, wherein the initial point set is composed of all input vertices and all equidistant points of a target triangular patch model, and the equidistant points are obtained by taking equidistant points in all directions of a three-dimensional space within a bounding box of the target triangular patch model; A first optimization module is used to insert each triangular face included in the target triangular face model into the initial tetrahedral mesh to obtain a first updated tetrahedral mesh, wherein a mesh surface of the first updated tetrahedral mesh includes an outer surface of the target triangular face model; A second optimization module is used to obtain an initial population based on the coordinate values of all grid points included in the first updated tetrahedral grid, use the average mass of tetrahedrons connected to the grid points as fitness, and use a genetic algorithm to calculate the next generation population of the initial population to obtain a second updated tetrahedral grid; A tetrahedron extraction module is used to, when a preset iteration termination condition is not met, use all grid points of the second updated tetrahedral mesh as the initial point set, return the Delaunay triangulation based on the initial point set, and obtain the initial tetrahedral mesh, until the preset iteration termination condition is met, extract the tetrahedral mesh belonging to the target triangular face model in the second updated tetrahedral mesh to obtain the target tetrahedral mesh.
6. A computer program product, characterized in that The method comprises computer-readable instructions, which, when executed on an electronic device, enable the electronic device to implement the tetrahedral mesh generation method as claimed in any one of claims 1 to 4.
7. An electronic device, characterized in that: The method comprises at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program so that the electronic device can implement the tetrahedral mesh generation method as described in any one of claims 1 to 4.
8. A computer storage medium, characterized in that: The storage medium carries one or more computer programs, and when the one or more computer programs are executed by an electronic device, the electronic device can implement the tetrahedral mesh generation method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Optimization method and device of initial grid, electronic equipment and storage medium
CN115935760A
Unstructured grid encryption method and system
CN117390639A