Three-dimensional model optimization method and device, electronic equipment and computer storage medium
By identifying and processing the edge contour of the three-dimensional model, the original three-dimensional model is optimized based on the vertex coordinates of the edge contour, solving the problems of terrain cracks and holes in three-dimensional modeling, and improving the accuracy and rendering effect of the model.
Patent Information
- Application Number
- CN202411504074.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-25
- Publication Date
- 2025-02-11
AI Technical Summary
In the three-dimensional modeling process, especially when dealing with complex terrain or large scenes, terrain cracks and holes are often encountered, which not only destroys the integrity of the model, but also seriously affects the final rendering effect and user experience.
By extracting the edge contours in the original three-dimensional model data, forming an edge data array, traversing the edges in the edge data array, forming an array of boundaries to be connected, and connecting the boundaries segments in the boundaries to be connected that can be connected through common points, forming a structure Closed or non-closed boundary, stored in the array of boundaries to be expanded. Optimize the original three-dimensional model based on the boundary vertex coordinates in the boundary array to be expanded.
This reduces the occurrence of cracks, holes and other problems in the three-dimensional model, improves the accuracy and completeness of the three-dimensional model, and thus optimizes the rendering effect of the three-dimensional model.
Smart Images

Figure CN119418001A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of three-dimensional modeling, and more specifically, to a three-dimensional model optimization method, device, electronic device and computer storage medium. Background Art
[0002] In the field of computer graphics and 3D vision, 3D modeling is a crucial process, which is widely used in many industries such as game development, movie special effects, architectural design, terrain simulation, and virtual reality. 3D models digitally construct the shape, structure, material and surface properties of objects, providing a basis for subsequent rendering, animation and interaction. However, in the actual 3D modeling process, especially when dealing with complex terrain or large scenes, a series of technical challenges are often encountered, among which terrain cracks and holes are particularly prominent. These problems not only destroy the integrity of the model, but also seriously affect the final rendering effect and user experience. Summary of the invention
[0003] In view of this, the purpose of the embodiments of the present application is to provide a three-dimensional model optimization method, device, electronic device and computer storage medium to reduce the occurrence of cracks, holes and other problems in the three-dimensional model.
[0004] In a first aspect, an embodiment of the present application provides a three-dimensional model optimization method, comprising: extracting edge contours in original three-dimensional model data to form an edge data array; traversing the edges in the edge data array to form an array of boundaries to be connected; connecting the boundary segments that can be connected in the first position in the array of boundaries to be connected through common points to form a closed boundary or a non-closed boundary, and storing the closed boundary or the non-closed boundary in an array of boundaries to be expanded; optimizing the original three-dimensional model according to the coordinates of the boundary vertices in the array of boundaries to be expanded.
[0005] In the above implementation process, by identifying and processing the edge contour of the three-dimensional model and optimizing the original three-dimensional model based on the vertex coordinates of the edge contour, the occurrence of problems such as cracks and holes in the three-dimensional model can be reduced, the accuracy and completeness of the three-dimensional model can be improved, and the rendering effect of the three-dimensional model can be optimized.
[0006] In one embodiment, the step of connecting the first-connected boundary segments in the boundary array to be connected through a common point to form a closed boundary or a non-closed boundary, and storing the closed boundary or the non-closed boundary in the boundary array to be extended includes: selecting a first boundary segment in the boundary array to be connected, and storing the first boundary segment in the boundary array to be extended; traversing the other boundary segments in the boundary array to be connected except the first boundary segment, and if it is determined that the boundary array to be extended and the other boundary segments have the same starting vertex or ending vertex, connecting the first boundary segment and the other boundary segments through a common vertex, and updating the boundary array to be extended; updating the boundary array to be extended through the updated boundary array to be extended, and repeatedly traversing the other boundary segments in the boundary array to be connected except the first boundary segment, until a stop condition is reached.
[0007] In the above implementation process, the edges in the array of boundaries to be connected are connected in order by traversal, thereby forming one or more closed boundaries or non-closed boundaries to divide the original three-dimensional model into regions, which is conducive to the subsequent optimization of the original three-dimensional model according to the regional relationship between each region.
[0008] In one embodiment, the optimizing the original three-dimensional model according to the boundary vertex coordinates in the boundary array to be expanded includes: obtaining the boundary vertex coordinates in the boundary array to be expanded to generate an original vertex coordinate array; performing coordinate mapping on the boundary vertex coordinates to generate a new vertex coordinate array; determining whether the first vertex in the original vertex coordinate array, and the second vertex and the third vertex in the new vertex coordinate array are collinear; wherein the first vertex and the second vertex are vertices before and after the coordinate mapping of the same boundary vertex coordinates, and the third vertex is an adjacent vertex of the second vertex; when the first vertex, the second vertex and the third vertex are not collinear, reconstructing the mesh sheet structure of the three-dimensional model by using the first vertex, the second vertex and the third vertex as three vertices of a polygon; and optimizing the original three-dimensional model based on the reconstructed mesh sheet structure.
[0009] In the above implementation process, by expanding the closed boundary or the non-closed boundary in the original three-dimensional model, two adjacent areas overlap at the junction, thereby filling the crack area, reducing the cracks in the three-dimensional model, and improving the accuracy of the three-dimensional model.
[0010] In one embodiment, optimizing the original three-dimensional model according to the coordinates of the boundary vertices in the array of boundaries to be extended includes: obtaining an element in the array of boundaries to be extended; selecting any salient point among all vertices of the element, and obtaining an edge adjacent to the salient point in the array of boundaries to be extended; obtaining a first target point and a second target point of the edge adjacent to the salient point; determining a connection order of the edges adjacent to the salient point according to the salient point, the first target point, and the second target point; determining a connection order of polygonal areas where any one of the edges adjacent to the salient point is located according to vertices in a polygonal area where any one of the edges adjacent to the salient point is located; determining whether the element is an internal boundary in a three-dimensional terrain grid body according to a connection order of the edges adjacent to the salient point and a connection order of the polygonal areas; repeating from obtaining the element in the array of boundaries to be extended until all elements in the array of boundaries to be extended are traversed; and optimizing the original three-dimensional model by repairing or reconstructing the internal boundary when it is determined that the three-dimensional terrain grid body includes the internal boundary.
[0011] In the above implementation process, for each element in the boundary array to be expanded, the connection order of the edges adjacent to the convex point in the element and the connection order of the polygonal area are used to determine whether the element is an internal area to identify the internal area of the three-dimensional model, and then corresponding processing can be performed on the internal area to improve the accuracy of the three-dimensional model.
[0012] In one embodiment, the optimizing the original three-dimensional model by reconstructing the internal boundary includes: determining whether a plurality of adjacent vertices in the internal boundary are collinear; when a plurality of adjacent vertices are not collinear, reconstructing the mesh structure of the three-dimensional model using the plurality of adjacent vertices as a plurality of vertices of a polygon; reconstructing the internal boundary based on the reconstructed mesh structure; and optimizing the original three-dimensional model based on the reconstructed internal boundary.
[0013] In the above implementation process, the network slice structure is reconstructed according to the vertices in the internal boundary, and then the internal boundary in the original three-dimensional model is reconstructed through the network slice structure to reduce the internal boundary area in the original three-dimensional model and improve the accuracy of the original three-dimensional model.
[0014] In one embodiment, the optimizing the original three-dimensional model by repairing the internal boundary includes: obtaining edge data vertices of edge data in the internal boundary array, and storing the edge data vertices in the edge data position array; obtaining convex point vertices and concave point vertices in the edge data position array to obtain a convex point vertex array and a concave point vertex array; updating the convex point vertex array and the edge data position array by using a target convex point vertex; re-obtaining the convex point vertices and concave point vertices in the updated edge data position array, and adding the newly identified convex point vertex to the updated convex point vertex array; updating the concave point vertex array according to the newly identified vertex when it is in the concave point vertex array before the newly identified vertex; repeating from obtaining the edge data vertices of the edge data in the internal boundary array and storing the edge data vertices in the edge data position array until the convex point vertex array and the concave point vertex array no longer update data; constructing a new polygonal area according to the concave point vertices in the final concave point vertex array and the convex point vertices in the final convex point vertex array, and repairing the holes in the internal boundary based on multiple new polygonal areas; optimizing the original three-dimensional model based on the repaired internal boundary.
[0015] In the above implementation process, the area in the internal boundary array is re-divided according to the convex vertices and concave vertices in the internal boundary array, and the internal boundary is repaired based on the divided polygons, thereby reducing the internal boundary in the original three-dimensional model and improving the accuracy of the original three-dimensional model.
[0016] In one embodiment, the obtaining of convex vertices and concave vertices in the edge data position array includes: obtaining whether multiple adjacent vertices in the internal boundary are collinear; when multiple adjacent vertices are not collinear, determining whether other vertices in the internal boundary are within a polygonal area formed by multiple adjacent vertices that are not collinear; if it is determined that other vertices in the internal boundary are not within the polygonal area formed by multiple adjacent vertices that are not collinear, determining that a middle vertex among the multiple adjacent vertices is a convex vertex; if it is determined that other vertices in the internal boundary are within the polygonal area formed by multiple adjacent vertices that are not collinear, determining whether an angle between a side formed by a middle vertex among the multiple adjacent vertices and two other vertices among the multiple adjacent vertices is less than 180°; if it is determined that an angle between a side formed by a middle vertex among the multiple adjacent vertices and two other vertices among the multiple adjacent vertices is less than 180°, determining that a middle vertex among the multiple adjacent vertices is a concave vertex.
[0017] In the above implementation process, the vertex type of each vertex is determined according to several adjacent vertices, and then each vertex in the edge data position array is classified, so as to reconstruct the internal boundary according to the concave vertices and convex vertices, reduce the internal holes in the original three-dimensional model, and improve the accuracy of the three-dimensional model.
[0018] In the second aspect, an embodiment of the present application also provides a three-dimensional model optimization device, including: an extraction module, used to extract edge contours in the original three-dimensional model data to form an edge data array; a traversal module, used to traverse the edges in the edge data array to form an array of boundaries to be connected; a storage module, used to connect the boundary segments that can be connected in the first position in the array of boundaries to be connected through common points to form a closed boundary or a non-closed boundary, and store the closed boundary or the non-closed boundary in the array of boundaries to be expanded; an optimization module, used to optimize the original three-dimensional model according to the boundary vertex coordinates in the array of boundaries to be expanded.
[0019] In a third aspect, an embodiment of the present application further provides an electronic device, comprising: a processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the machine-readable instructions are executed by the processor to perform the steps of the method in the above-mentioned first aspect, or any possible implementation of the first aspect.
[0020] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the three-dimensional model optimization method in the above-mentioned first aspect, or any possible implementation of the first aspect are executed.
[0021] In order to make the above-mentioned objects, features and advantages of the present application more obvious and understandable, embodiments are given below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0023] Figure 1 A block diagram of an electronic device provided in an embodiment of the present application;
[0024] Figure 2 A flowchart of a three-dimensional model optimization method provided in an embodiment of the present application;
[0025] Figure 3 A reconstructed grid body provided in an embodiment of the present application;
[0026] Figure 4 A schematic diagram of the functional modules of the three-dimensional model optimization device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0027] The technical solutions in the embodiments of the present application will be described below in conjunction with the accompanying drawings in the embodiments of the present application.
[0028] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0029] In the process of 3D modeling, the continuous LoD (Level of Detail) technology is mainly used to simplify terrain data at home and abroad, that is, different levels of detail are used to express the terrain as the viewpoint moves. However, due to the differences in the level of detail in the LoD technology, the elevation values of the grid points on the boundaries of adjacent terrain grids at different levels are not completely consistent, resulting in terrain cracks, holes and other problems when realizing real-time rendering of massive 3D terrain data, which seriously affects the real-time rendering effect of the terrain.
[0030] Terrain cracks usually occur at the junctions of different terrain blocks or in areas with inconsistent height data. Because the model mesh is not perfectly aligned or slightly misaligned at the junction, obvious fracture marks appear during rendering. This phenomenon is particularly common in terrain generated based on height maps, where small errors in height data or insufficient resolution can cause cracks. These cracks not only destroy the overall continuity of the terrain, but also appear particularly prominent under lighting and shadow effects, thereby reducing the realism of the scene.
[0031] Hole problems may be caused by missing data, wrong decisions during model simplification, or negligence during manual editing. They appear as blank areas that should not exist on the model surface. The presence of holes will cause obvious omissions or holes in the rendered terrain, affecting the integrity and aesthetics of the scene.
[0032] In view of this, the present application proposes a three-dimensional model optimization method, which identifies and processes the edge contour of the three-dimensional model and optimizes the original three-dimensional model based on the vertex coordinates of the edge contour. This can reduce the occurrence of cracks, holes and other problems in the three-dimensional model, improve the accuracy and completeness of the three-dimensional model, and further optimize the rendering effect of the three-dimensional model.
[0033] To facilitate understanding of this embodiment, an electronic device that executes the three-dimensional model optimization method disclosed in the embodiment of the present application is first introduced in detail.
[0034] like Figure 1, which is a block diagram of an electronic device. The electronic device 100 may include a memory 111, a processor 113, and a display unit 115. A person skilled in the art will understand that Figure 1 The structure shown is only for illustration and does not limit the structure of the electronic device 100. For example, the electronic device 100 may further include Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.
[0035] The memory 111, processor 113 and display unit 115 are directly or indirectly electrically connected to each other to achieve data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines. The processor 113 is used to execute the executable module stored in the memory.
[0036] The memory 111 may be, but not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable read-only memory (EEPROM), etc. The memory 111 is used to store programs, and the processor 113 executes the program after receiving the execution instruction. The method executed by the electronic device 100 defined by the process disclosed in any embodiment of the present application can be applied to the processor 113, or implemented by the processor 113.
[0037] The processor 113 here may be an integrated circuit chip with signal processing capabilities. The above-mentioned processor 113 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The various methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0038] The display unit 115 provides an interactive interface (e.g., a user operation interface) between the electronic device 100 and the user or is used to display image data for the user's reference. In this embodiment, the display unit may be a liquid crystal display or a touch display. If it is a touch display, it may be a capacitive touch screen or a resistive touch screen that supports single-point and multi-point touch operations. Supporting single-point and multi-point touch operations means that the touch display can sense touch operations generated simultaneously from one or more positions on the touch display, and the sensed touch operations are handed over to the processor for calculation and processing.
[0039] The electronic device 100 in this embodiment can be used to execute each step in each method provided in the embodiments of the present application. The implementation process of the three-dimensional model optimization method is described in detail below through several embodiments.
[0040] See also Figure 2 , is a flow chart of the three-dimensional model optimization method provided in the embodiment of the present application. Figure 2 The specific process shown is described in detail.
[0041] Step 201: extract edge contours from original three-dimensional model data to form an edge data array.
[0042] The mesh of the original three-dimensional model here is composed of multiple small polygonal (eg, triangle) patches. Inside the mesh, an edge of a polygon is contained by two polygons, while an edge on the boundary of an individual is contained by only one polygon.
[0043] Based on this, step 201 may be specifically as follows: traverse all edges in the grid, search for edges with unique polygon inclusions, determine the edges with unique polygon inclusions as edge contours, and store the edge contours into edge data arrays.
[0044] In one embodiment, before step 201, the method further includes: loading the original three-dimensional model into original three-dimensional model data of the original three-dimensional model.
[0045] Optionally, the original three-dimensional model may be a terrain model, a building model, an environment model, etc. The original three-dimensional model may be selected according to actual conditions.
[0046] The original 3D model data here is a standard file format for storing geometric information of a 3D model. The original 3D model data may include vertex data, texture coordinates, normal vectors, surface data, etc. The original 3D model data may be adjusted according to actual conditions.
[0047] Step 202, traverse the edges in the edge data array to form an array of boundaries to be connected.
[0048] Step 202 here may specifically include: traversing all edges in the edge data array, searching for edges adjacent to the start vertex or the end vertex of each edge, and forming an array of boundaries to be connected.
[0049] In one embodiment, the step of searching for edges adjacent to the start vertex or the end vertex of each edge may be: traversing all vertices of the edge data array, searching for intersection vertices, and storing the intersection vertices in the intersection vertex array.
[0050] The array of boundaries to be connected can be formed by searching from the first vertex in the edge data array, determining the intersection, storing any edge where the intersection is located (here referred to as the selected edge) into the array of boundaries to be connected, and determining whether the point at the other end of the selected edge is the intersection.
[0051] If the point at the other end of the selected edge is an intersection point, the sequence number of the selected edge in the array of edges to be connected is updated (ie, d=d+1, d is the sequence number of the edge in the array of edges to be connected).
[0052] If the point at the other end of the selected edge is not an intersection, continue to search for the adjacent edge to the selected edge in the edge data array, store the adjacent edge in the to-be-connected boundary array, and determine whether the point at the other end of the adjacent edge is an intersection. If the point at the other end of the adjacent edge is an intersection, update the sequence number of the adjacent edge in the to-be-connected boundary array; if the point at the other end of the adjacent edge is not an intersection, continue to search for the adjacent edge in the edge data array that is adjacent to the adjacent edge. Repeat from storing the selected edge in the to-be-connected boundary array until all edges where all starting vertices or ending vertices in the edge data array are located are traversed.
[0053] Step 203: connect the boundary segments that can be connected at the first position in the boundary array to be connected through a common point to form a closed boundary or an open boundary, and store the closed boundary or the open boundary in the boundary array to be extended.
[0054] It can be understood that the boundary segments that can be connected end to end in the boundary array to be connected are connected through a common point to form a closed boundary or an open boundary. These closed boundaries and / or open boundaries are stored in the boundary array to be extended.
[0055] Among them, non-closed boundaries may be caused by problems such as model cracks and model holes.
[0056] If the array of boundaries to be connected includes multiple closed boundaries, or multiple open boundaries, or multiple closed boundaries and open boundaries, the three-dimensional model corresponding to the array of boundaries to be connected may have problems such as model cracks and model holes.
[0057] Step 204: Optimize the original three-dimensional model according to the coordinates of the boundary vertices in the array of boundaries to be expanded.
[0058] The boundary vertex coordinates here refer to the coordinates of each vertex in the closed boundary in the boundary array to be extended, and / or the coordinates of each vertex in the non-closed boundary in the boundary array to be extended.
[0059] It is understandable that when there are cracks, holes, and other problems in the original 3D model, these cracks or holes may divide the originally completely closed 3D model into multiple closed areas or non-closed areas. By calculating the boundary vertex coordinates of these closed areas or non-closed areas, each area can be expanded or repaired, thereby optimizing the original 3D model.
[0060] In one embodiment, if there are cracks in the original three-dimensional model, the boundary vertex coordinates of the areas on both sides of the cracks can be expanded to cover the cracks and optimize the original three-dimensional model.
[0061] If there is a problem of holes in the original three-dimensional model, the shape and size of the holes can be determined to form a corresponding mesh body to fill the holes in the original three-dimensional model, thereby optimizing the original three-dimensional model.
[0062] If there are holes in the original three-dimensional model, the coordinates of the boundary vertices around the holes can be expanded to cover the holes and optimize the original three-dimensional model.
[0063] In the above implementation process, by identifying and processing the edge contour of the three-dimensional model and optimizing the original three-dimensional model based on the vertex coordinates of the edge contour, the occurrence of problems such as cracks and holes in the three-dimensional model can be reduced, the accuracy and completeness of the three-dimensional model can be improved, and the rendering effect of the three-dimensional model can be optimized.
[0064] In a possible implementation, step 203 includes: selecting the first boundary segment in the boundary array to be connected, and storing the first boundary segment in the boundary array to be extended; traversing the other boundary segments in the boundary array to be connected except the first boundary segment, and if it is determined that the boundary array to be extended and the other boundary segments have the same starting vertex or ending vertex, connecting the first boundary segment and the other boundary segments through the common vertex, and updating the boundary array to be extended; updating the boundary array to be extended through the updated boundary array to be extended, and repeatedly traversing the other boundary segments in the boundary array to be connected except the first boundary segment, until the stop condition is reached.
[0065] The first boundary segment here refers to any boundary in the to-be-connected boundary array, and the other boundary segments refer to the other boundary segments in the to-be-connected boundary array except the first boundary segment.
[0066] The data of the first boundary segment stored in the boundary array to be connected may include three-dimensional data of edge vertices, a start vertex, an end vertex, etc. The data of the first boundary segment stored in the boundary array to be connected may be adjusted according to actual conditions.
[0067] The stopping condition here may be that all boundary segments in the to-be-connected boundary array have been traversed, or a preset number of iterations has been reached, etc. The stopping adjustment may be selected according to actual conditions.
[0068] It can be understood that if it is determined that the boundary array to be expanded has the same starting vertex or ending vertex as other boundary segments, the first boundary segment and the other boundary segments are connected through the common vertex, so that the first boundary segment and the other boundary segments are connected through the common vertex to obtain a new edge, and the obtained edge is used as the new first boundary segment and stored in the boundary array to be connected, thereby updating the boundary array to be connected.
[0069] At this time, continue to traverse the other boundary segments in the boundary array to be connected except for the newly obtained edge, and determine whether the newly obtained edge and other boundary segments have the same starting vertex or ending vertex. If it is determined that the newly obtained edge and other boundary segments have the same starting vertex or ending vertex, then connect the newly obtained edge and other boundary segments through the common vertex, and update the boundary array to be extended and the boundary array to be extended. Repeat the above steps until all boundaries in the boundary array to be connected are traversed.
[0070] It should be understood that, through step 203, the edges in the array of edges to be connected are sequentially connected into one or more closed edges and / or one or more non-closed edges.
[0071] In one embodiment, after step 203, the method further includes: traversing all elements in the to-be-extended boundary array and deleting duplicate elements.
[0072] In another embodiment, after step 203, the method further includes: traversing all elements in the boundary array to be extended, determining whether the end vertex of the element in the boundary array to be extended coincides with other vertices of the element, and deleting the elements in the boundary array to be extended whose end vertex coincides with other vertices of the element.
[0073] In the above implementation process, the edges in the array of boundaries to be connected are connected in order by traversal, thereby forming one or more closed boundaries or non-closed boundaries to divide the original three-dimensional model into regions, which is conducive to the subsequent optimization of the original three-dimensional model according to the regional relationship between each region.
[0074] In one possible implementation, step 204 includes: obtaining the coordinates of the boundary vertices in the boundary array to be expanded to generate an original vertex coordinate array; performing coordinate mapping on the boundary vertex coordinates to generate a new vertex coordinate array; determining whether the first vertex in the original vertex coordinate array, and the second vertex and the third vertex in the new vertex coordinate array are collinear; when the first vertex, the second vertex, and the third vertex are not collinear, reconstructing the mesh structure of the three-dimensional model using the first vertex, the second vertex, and the third vertex as three vertices of a polygon; and optimizing the original three-dimensional model based on the reconstructed mesh structure.
[0075] The first vertex and the second vertex are vertices of the same boundary vertex before and after coordinate mapping, and the third vertex is an adjacent vertex of the second vertex.
[0076] The above boundary vertex coordinate mapping can be achieved in the following ways:
[0077] VNewPositions i .X=VPositions i .X+p1;
[0078] VNewPositions i .Y=VPositions i .Y+p2;
[0079] VNewPositions i .Z=VPositions i .Z-p3;
[0080] Among them, p1, p2, and p3 are custom parameters, and p3 ≥ 0, VNewPositionsi is the vertex after mapping, VPositionsi.X is the vertex before mapping, and i is the total number of elements.
[0081] In one embodiment, whether the first vertex, the second vertex, and the third vertex are collinear may be determined by cross product calculation.
[0082] For example, if the first vertex, the second vertex, and the third vertex are V1(x1, y1, z1), V2(x2, y2, z2), and V3(x3, y3, z3), respectively, and if the order of these three vertices in the array of boundaries to be expanded is V1, V2, and V3, then the cross product calculation method is: target = vector The cross product value of ; if the order of these three vertices in the array of boundaries to be expanded is V2, V1, and V3, then the cross product calculation method is: target = vector The cross product value of .
[0083] If the cross product result is not 0, it is determined that the first vertex, the second vertex and the third vertex are not collinear, and a polygon is reconstructed according to the first vertex, the second vertex and the third vertex, and the original three-dimensional model is reconstructed based on the reconstructed polygon.
[0084] It can be understood that when mapping the boundary vertex coordinates in the boundary array to be extended, since each boundary vertex coordinate is extended based on the original boundary vertex coordinates, the boundary formed according to the mapped boundary vertex coordinates is also extended. Based on this, Figure 3 As shown, the reconstructed polygons are the regions after the regions in the original 3D model are extended. For the original 3D model, two adjacent regions are extended in the above manner, and the extended regions may overlap at the junction of the regions, thereby achieving the purpose of repairing the cracks in the original 3D model and optimizing the original 3D model.
[0085] In one embodiment, the method further comprises: calculating normals, coordinate values and tangents of the polygon.
[0086] Specifically, normals, coordinate values, and tangents can be calculated as follows:
[0087] Among them, the coordinates of the new vertex are the corresponding original vertex coordinates.
[0088] The normal and tangent of the polygon here can be obtained as follows:
[0089] If VNewPositions l+1 、VNewPositionsl 、VPositions l+1 Three points form a polygon, and the normal calculation formula is: vector The tangent is obtained by cross-producting the normal with (0.0, 0.0, 1.0).
[0090] If VPositions l+1 、VNewPositions l 、VPositions l For a polygon composed of three points, the normal calculation formula is: vector The tangent is obtained by cross-producting the normal with (0.0, 0.0, 1.0).
[0091] Repeat the above steps until the total number of array elements in the boundary array to be extended is -1, and then the calculation of normals and tangents is terminated.
[0092] The above-mentioned normals and / or tangents are associated with the material of the three-dimensional model. After calculating the normals and tangents of the polygon, the material and color of the polygon boundary can be determined based on the normals and / or tangents, so that the expanded boundary can be filled with the corresponding material and color, so that the material and color of the filled area are consistent with the unfilled area, so that the final three-dimensional model can meet the aesthetic requirements in appearance and meet the requirements of accurate corresponding ground feature information.
[0093] In the above implementation process, by expanding the closed boundary or the non-closed boundary in the original three-dimensional model, two adjacent areas overlap at the junction, thereby filling the crack area, reducing the cracks in the three-dimensional model, and improving the accuracy of the three-dimensional model.
[0094] In a possible implementation, step 204 includes: obtaining an element in the array of boundaries to be extended; selecting any salient point among all vertices of the element, and obtaining an edge adjacent to the salient point in the array of boundaries to be extended; obtaining a first target point and a second target point of the edge adjacent to the salient point; judging a connection order of the edge adjacent to the salient point according to the salient point, the first target point, and the second target point; judging a connection order of the polygonal area where any edge adjacent to the salient point is located according to vertices in a polygonal area where any edge adjacent to the salient point is located; determining whether the element is an internal boundary in the three-dimensional terrain mesh body according to a connection order of the edge adjacent to the salient point and a connection order of the polygonal area; repeating from obtaining the element in the array of boundaries to be extended until all elements in the array of boundaries to be extended are traversed; and optimizing the original three-dimensional model by repairing or reconstructing the internal boundary when it is determined that the three-dimensional terrain mesh body includes an internal boundary.
[0095] Here, the first target point and the second target point are both coordinate points in the edge adjacent to the convex point, and the first target point and the second target point are respectively at the two ends of the edge adjacent to the convex point. The first target point can be the starting vertex, the middle vertex, or any point close to one end of the edge adjacent to the convex point, and the second target point can be the ending vertex, the middle vertex, or any point close to the other end of the edge adjacent to the convex point. The first target point and the second target point can be selected according to actual conditions.
[0096] In one embodiment, the connection order of the edges adjacent to the salient point can be calculated in the following manner: the salient point, the first target point and the second target point are calculated using a cross product method to calculate the vector cross product value. If the cross product value is a positive number, the edges adjacent to the salient point are connected in a counterclockwise order; if the cross product value is a negative number, the edges adjacent to the salient point are connected in a clockwise order; if the cross product value is 0, it means that the salient point, the first target point and the second target point are on a straight line.
[0097] It can be understood that before determining the connection order of the polygonal area where any one of the edges adjacent to the convex point is located, the method also includes: selecting any one of the two edges adjacent to the convex point, obtaining the polygonal area where the edge is located, and the vertices in the polygonal area.
[0098] The connection order of the polygonal area where any one of the edges adjacent to the convex point is located can be realized by the following method: extract the vertices where every two edges of the polygonal area intersect from the boundary array to be extended, and calculate the vector cross product value of the three extracted vertices using the cross product calculation method. If the cross product value is a positive number, the polygon is connected in a counterclockwise order; if the cross product value is a negative number, the polygon is connected in a clockwise order.
[0099] The rule for determining the internal boundary here may be: if the connection order of the edges adjacent to the salient point is inconsistent with the connection order of the polygonal area, then the element is determined to be an internal boundary.
[0100] In the above implementation process, for each element in the boundary array to be expanded, the connection order of the edges adjacent to the convex point in the element and the connection order of the polygonal area are used to determine whether the element is an internal area to identify the internal area of the three-dimensional model, and then corresponding processing can be performed on the internal area to improve the accuracy of the three-dimensional model.
[0101] In one possible implementation, the original three-dimensional model is optimized by reconstructing the internal boundary, including: determining whether multiple adjacent vertices in the internal boundary are collinear; when the multiple adjacent vertices are not collinear, reconstructing the mesh structure of the three-dimensional model using the multiple adjacent vertices as multiple vertices of a polygon; reconstructing the internal boundary based on the reconstructed mesh structure; and optimizing the original three-dimensional model based on the reconstructed internal boundary.
[0102] Among them, whether multiple adjacent vertices in the internal boundary are collinear can be determined by cross product calculation.
[0103] If the cross product result is not 0, it is determined that multiple adjacent vertices in the internal boundary are not collinear, and the network piece structure of the three-dimensional model is reconstructed based on the multiple adjacent vertices in the internal boundary as multiple vertices of the polygon, and the internal boundary area is reconstructed based on the reconstructed network piece structure.
[0104] In one embodiment, before determining whether multiple adjacent vertices in the internal boundary are collinear, the method also includes: constructing a vertex array based on the vertices in the internal boundary, and calculating multiple adjacent vertices as multiple vertices of the polygon based on the vertices in the vertex array to reconstruct the normals and tangents of the mesh structure of the three-dimensional model.
[0105] Specifically, normals and tangents can be calculated as follows:
[0106] The normal and tangent of the polygon here can be obtained as follows:
[0107] If Triangles l-1 、Triangles l 、Triangles l+1 Three points form a polygon, and the normal calculation formula is: vector The tangent is obtained by cross-producting the normal with (0.0, 0.0, 1.0).
[0108] Repeat the above steps until the total number of array elements in the vertex array is traversed to -1, then the calculation of normals and tangents is terminated.
[0109] The above-mentioned normals and / or tangents are associated with the material of the three-dimensional model. After calculating the normals and tangents of the polygon, the material and color of the polygon boundary can be determined based on the normals and / or tangents, so that the expanded boundary can be filled with the corresponding material and color so that the material and color of the filled area are consistent with the unfilled area.
[0110] In the above implementation process, the network slice structure is reconstructed according to the vertices in the internal boundary, and then the internal boundary in the original three-dimensional model is reconstructed through the network slice structure to reduce the internal boundary area in the original three-dimensional model and improve the accuracy of the original three-dimensional model.
[0111] In a possible implementation, the original three-dimensional model is optimized by repairing the internal boundary, including: obtaining edge data vertices of edge data in the internal boundary array, and storing the edge data vertices in the edge data position array; obtaining convex point vertices and concave point vertices in the edge data position array to obtain a convex point vertex array and a concave point vertex array; updating the convex point vertex array and the edge data position array through the target convex point vertex; re-obtaining the convex point vertices and concave point vertices in the updated edge data position array, and adding the newly identified convex point vertex to the updated convex point vertex array; updating the concave point vertex array according to the newly identified vertex when it is previously in the concave point vertex array; repeating from obtaining the edge data vertices of the edge data in the internal boundary array and storing the edge data vertices in the edge data position array until the convex point vertex array and the concave point vertex array no longer update data; constructing a new polygonal area according to the concave point vertices in the final concave point vertex array and the convex point vertices in the final convex point vertex array, and repairing the holes in the internal boundary based on multiple new polygonal areas; and optimizing the original three-dimensional model based on the repaired internal boundary.
[0112] Among them, updating the convex vertex array and the edge data position array through the target convex vertex can be achieved in the following way: traverse the convex vertex array, delete the target convex vertex array from the convex vertex array, and delete the corresponding same vertex in the target convex vertex array in the edge data position array to update the convex vertex array.
[0113] In one embodiment, reacquiring the convex vertices and concave vertices in the updated edge data position array, and adding the newly identified convex vertices to the updated convex vertex array, includes: reacquiring the convex vertices and concave vertices in the updated edge data position array, and adding the newly identified convex vertices to the end of the convex vertex array in the order of identification.
[0114] Specifically, updating the concave point vertex array according to the newly identified vertex can be achieved in the following way: if the newly identified vertex is in the concave point vertex array before, the newly identified vertex is deleted from the concave point vertex array, and the newly identified concave point is added to the end of the concave point vertex array in the order of identification.
[0115] The target salient point vertex mentioned above refers to any salient point in the salient point vertex array.
[0116] In the above implementation process, the area in the internal boundary array is re-divided according to the convex vertices and concave vertices in the internal boundary array, and the holes in the internal boundary are repaired based on the divided polygons, thereby reducing the internal boundary in the original three-dimensional model and improving the accuracy of the original three-dimensional model.
[0117] In a possible implementation, obtaining convex vertices and concave vertices in an edge data position array includes: obtaining whether multiple adjacent vertices in an internal boundary are collinear; when multiple adjacent vertices are not collinear, determining whether other vertices in the internal boundary are within a polygonal area formed by multiple adjacent vertices that are not collinear; if it is determined that other vertices in the internal boundary are not within the polygonal area formed by multiple adjacent vertices that are not collinear, determining that a middle vertex among the multiple adjacent vertices is a convex vertex; if it is determined that other vertices in the internal boundary are within the polygonal area formed by multiple adjacent vertices that are not collinear, determining whether the angles of the sides formed by the middle vertex among the multiple adjacent vertices and the other two vertices among the multiple adjacent vertices are less than 180°; if it is determined that the angles of the sides formed by the middle vertex among the multiple adjacent vertices and the other two vertices among the multiple adjacent vertices are less than 180°, determining that the middle vertex among the multiple adjacent vertices is a concave vertex.
[0118] It can be understood that for each vertex in the edge data position array, the above steps are repeated until all elements in the edge data position array are traversed.
[0119] Among them, whether multiple adjacent vertices in the internal boundary are collinear can be determined in the following way: obtain the vertex array, starting from the first element Ai in the vertex array, and use the cross product calculation method to determine whether the three vertices Ai-1, Ai, and Ai+1 are collinear. If the cross product calculation result is not 0, it indicates that the three points are not collinear.
[0120] The other vertices mentioned above refer to other vertices except for a plurality of adjacent vertices used to determine whether they are collinear.
[0121] In the above implementation process, the vertex type of each vertex is determined according to several adjacent vertices, and then each vertex in the edge data position array is classified, so as to reconstruct the internal boundary according to the concave vertices and convex vertices, reduce the internal holes in the original three-dimensional model, and improve the accuracy of the three-dimensional model.
[0122] Based on the same application concept, the embodiment of the present application also provides a three-dimensional model optimization device corresponding to the three-dimensional model optimization method. Since the principle of solving the problem by the device in the embodiment of the present application is similar to that of the aforementioned three-dimensional model optimization method embodiment, the implementation of the device in this embodiment can refer to the description in the embodiment of the above method, and the repeated parts will not be repeated.
[0123] See also Figure 4, is a functional module diagram of the 3D model optimization device provided in the embodiment of the present application. Each module in the 3D model optimization device in this embodiment is used to execute each step in the above method embodiment. The 3D model optimization device includes an extraction module 301, a traversal module 302, a storage module 303, and an optimization module 304; wherein,
[0124] The extraction module 301 is used to extract edge contours in the original three-dimensional model data to form an edge data array.
[0125] The traversal module 302 is used to traverse the edges in the edge data array to form an array of boundaries to be connected.
[0126] The storage module 303 is used to connect the boundary segments that can be connected at the first position in the boundary array to be connected through a common point to form a closed boundary or a non-closed boundary, and store the closed boundary or the non-closed boundary in the boundary array to be extended.
[0127] The optimization module 304 is used to optimize the original three-dimensional model according to the boundary vertex coordinates in the to-be-expanded boundary array.
[0128] In one possible implementation, the storage module 303 is specifically used to: select the first boundary segment in the boundary array to be connected, and store the first boundary segment in the boundary array to be extended; traverse the other boundary segments in the boundary array to be connected except the first boundary segment, and if it is determined that the boundary array to be extended and the other boundary segments have the same starting vertex or ending vertex, connect the first boundary segment and the other boundary segments through the common vertex, and update the boundary array to be extended; update the boundary array to be extended through the updated boundary array to be extended, and repeatedly traverse the other boundary segments in the boundary array to be connected except the first boundary segment until a stop condition is reached.
[0129] In a possible implementation, the optimization module 304 is specifically used to: obtain the coordinates of the boundary vertices in the boundary array to be expanded to generate an original vertex coordinate array; perform coordinate mapping on the boundary vertex coordinates to generate a new vertex coordinate array; determine whether the first vertex in the original vertex coordinate array, and the second vertex and the third vertex in the new vertex coordinate array are collinear; wherein the first vertex and the second vertex are vertices before and after the coordinate mapping of the same boundary vertex coordinates, and the third vertex is an adjacent vertex of the second vertex; when the first vertex, the second vertex and the third vertex are not collinear, reconstruct the mesh structure of the three-dimensional model by using the first vertex, the second vertex and the third vertex as three vertices of a polygon; and optimize the original three-dimensional model based on the reconstructed mesh structure.
[0130] In a possible implementation, the optimization module 304 is further used to: obtain an element in the array of boundaries to be extended; select any salient point among all vertices of the element, and obtain an edge adjacent to the salient point in the array of boundaries to be extended; obtain a first target point and a second target point of the edge adjacent to the salient point; determine a connection order of the edges adjacent to the salient point according to the salient point, the first target point, and the second target point; determine a connection order of polygonal regions where any one of the edges adjacent to the salient point is located according to vertices in a polygonal region where any one of the edges adjacent to the salient point is located; determine whether the element is an internal boundary in a three-dimensional terrain mesh body according to a connection order of the edges adjacent to the salient point and a connection order of the polygonal regions; repeat from obtaining the element in the array of boundaries to be extended until all elements in the array of boundaries to be extended are traversed; and when it is determined that the three-dimensional terrain mesh body includes the internal boundary, optimize the original three-dimensional model by repairing or reconstructing the internal boundary.
[0131] In one possible implementation, the optimization module 304 is specifically used to: determine whether multiple adjacent vertices in the internal boundary are collinear; when multiple adjacent vertices are not collinear, reconstruct the mesh structure of the three-dimensional model using multiple adjacent vertices as multiple vertices of a polygon; reconstruct the internal boundary based on the reconstructed mesh structure; and optimize the original three-dimensional model based on the reconstructed internal boundary.
[0132] In a possible implementation, the optimization module 304 is specifically used to: obtain edge data vertices of edge data in the internal boundary array, and store the edge data vertices into the edge data position array; obtain convex point vertices and concave point vertices in the edge data position array to obtain a convex point vertex array and a concave point vertex array; update the convex point vertex array and the edge data position array through the target convex point vertex; re-acquire the convex point vertices and concave point vertices in the updated edge data position array, and add the newly identified convex point vertex to the updated convex point vertex array; in the case where the newly identified vertex is in the concave point vertex array before, update the concave point vertex array according to the newly identified vertex; start from obtaining the edge data vertices of the edge data in the internal boundary array and storing the edge data vertices in the edge data position array and repeat until the convex point vertex array and the concave point vertex array no longer update data; construct a new polygonal area according to the concave point vertices in the final concave point vertex array and the convex point vertices in the final convex point vertex array, and repair the holes in the internal boundary based on multiple new polygonal areas; optimize the original three-dimensional model based on the repaired internal boundary.
[0133] In a possible implementation, the optimization module 304 is specifically used to: obtain whether multiple adjacent vertices in the internal boundary are collinear; when multiple adjacent vertices are not collinear, determine whether other vertices in the internal boundary are within the polygonal area formed by multiple adjacent vertices that are not collinear; if it is determined that other vertices in the internal boundary are not within the polygonal area formed by multiple adjacent vertices that are not collinear, determine that the middle vertex among the multiple adjacent vertices is a convex vertex; if it is determined that other vertices in the internal boundary are within the polygonal area formed by multiple adjacent vertices that are not collinear, determine whether the angles between the sides formed by the middle vertex among the multiple adjacent vertices and the other two vertices among the multiple adjacent vertices are less than 180°; if it is determined that the angles between the sides formed by the middle vertex among the multiple adjacent vertices and the other two vertices among the multiple adjacent vertices are less than 180°, determine that the middle vertex among the multiple adjacent vertices is a concave vertex.
[0134] In addition, an embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the three-dimensional model optimization method described in the above method embodiment are executed.
[0135] The computer program product of the three-dimensional model optimization method provided in the embodiment of the present application includes a computer-readable storage medium storing program code, and the instructions included in the program code can be used to execute the steps of the three-dimensional model optimization method described in the above method embodiment. For details, please refer to the above method embodiment, which will not be repeated here.
[0136] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0137] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0138] If the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a disk or an optical disk. It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprises" or any other variation thereof are intended to cover non-exclusive inclusion, so that a process, method, article or apparatus that includes a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or apparatus. In the absence of more restrictions, the elements defined by the sentence "includes..." do not exclude the presence of other identical elements in the process, method, article or apparatus that includes the elements.
[0139] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application. It should be noted that similar numbers and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings.
[0140] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A three-dimensional model optimization method, characterized in that: include: Extract edge contours from the original three-dimensional model data to form an edge data array; Traversing the edges in the edge data array to form an array of boundaries to be connected; Connecting the first-connected boundary segments in the boundary array to be connected through a common point to form a closed boundary or a non-closed boundary, and storing the closed boundary or the non-closed boundary in the boundary array to be extended; The original three-dimensional model is optimized according to the coordinates of the boundary vertices in the to-be-expanded boundary array.
2. The method according to claim 1, characterized in that The step of connecting the first-connected boundary segments in the boundary array to be connected through a common point to form a closed boundary or a non-closed boundary, and storing the closed boundary or the non-closed boundary in the boundary array to be extended includes: Selecting a first boundary segment in the array of boundaries to be connected, and storing the first boundary segment in the array of boundaries to be extended; Traversing the other boundary segments in the boundary array to be connected except the first boundary segment, if it is determined that the boundary array to be extended and the other boundary segments have the same starting vertex or ending vertex, connecting the first boundary segment and the other boundary segments through the common vertex, and updating the boundary array to be extended; The to-be-extended boundary array is updated by using the updated to-be-extended boundary array, and the boundary segments other than the first boundary segment in the to-be-connected boundary array are repeatedly traversed until a stop condition is reached.
3. The method according to claim 1, characterized in that The step of optimizing the original three-dimensional model according to the boundary vertex coordinates in the boundary array to be expanded includes: Obtaining the coordinates of the boundary vertices in the to-be-extended boundary array, and generating an array of original vertex coordinates; Performing coordinate mapping on the boundary vertex coordinates to generate a new vertex coordinate array; Determine whether the first vertex in the original vertex coordinate array, and the second vertex and the third vertex in the new vertex coordinate array are collinear; wherein the first vertex and the second vertex are vertices before and after coordinate mapping of the same boundary vertex coordinates, and the third vertex is an adjacent vertex of the second vertex; In a case where the first vertex, the second vertex and the third vertex are not collinear, reconstructing a mesh structure of the three-dimensional model by using the first vertex, the second vertex and the third vertex as three vertices of a polygon; Based on the reconstructed network slice structure, the original three-dimensional model is optimized.
4. The method according to claim 1, characterized in that: The step of optimizing the original three-dimensional model according to the coordinates of the boundary vertices in the boundary array to be expanded includes: Obtaining elements in the array of boundaries to be extended; Select any convex point among all vertices of the element, and obtain the edge adjacent to the convex point in the array of boundaries to be extended; Acquire a first target point and a second target point of an edge adjacent to the salient point; Determining a connection order of edges adjacent to the salient point according to the salient point, the first target point, and the second target point; According to the vertices in the polygonal area where any one of the edges adjacent to the convex point is located, determining the connection order of the polygonal area where any one of the edges adjacent to the convex point is located; according to the connection order of the edges adjacent to the convex point and the connection order of the polygonal area, determining whether the element is an internal boundary in the three-dimensional terrain grid; Repeating from obtaining the elements in the array of boundaries to be extended until all elements in the array of boundaries to be extended are traversed; When it is determined that the three-dimensional terrain grid volume includes the internal boundary, the original three-dimensional model is optimized by repairing or reconstructing the internal boundary.
5. The method according to claim 4, characterized in that The step of optimizing the original three-dimensional model by reconstructing the internal boundary comprises: Determining whether a plurality of adjacent vertices in the internal boundary are collinear; In the case where the plurality of adjacent vertices are not collinear, the plurality of adjacent vertices are used as a plurality of vertices of a polygon to reconstruct a mesh structure of the three-dimensional model; reconstructing the internal boundary based on the reconstructed network slice structure; The original three-dimensional model is optimized based on the reconstructed internal boundaries.
6. The method according to claim 4, characterized in that The step of optimizing the original three-dimensional model by repairing the internal boundary comprises: Obtain edge data vertices of edge data in the internal boundary array, and store the edge data vertices into the edge data position array; Obtaining the convex point vertices and the concave point vertices in the edge data position array to obtain a convex point vertex array and a concave point vertex array; Update the salient point vertex array and the edge data position array through the target salient point vertex; Re-acquire the convex point vertices and concave point vertices in the updated edge data position array, and add the newly identified convex point vertices to the updated convex point vertex array; In the case where the newly identified vertex was previously in the concave point vertex array, updating the concave point vertex array according to the newly identified vertex; The process starts from obtaining edge data vertices of edge data in the internal boundary array and storing the edge data vertices in the edge data position array, and repeats until the convex point vertex array and the concave point vertex array no longer update data; Constructing new polygonal areas according to the concave point vertices in the final concave point vertex array and the convex point vertices in the final convex point vertex array, and patching the holes in the internal boundary based on the multiple new polygonal areas; The original three-dimensional model is optimized based on the repaired internal boundaries.
7. The method according to claim 6, characterized in that The step of obtaining the convex point vertices and the concave point vertices in the edge data position array includes: Get whether multiple adjacent vertices in the internal boundary are collinear; In the case where the plurality of adjacent vertices are not collinear, determining whether other vertices in the internal boundary are within the polygonal region formed by the plurality of adjacent vertices that are not collinear; If it is determined that other vertices in the internal boundary are not within the polygonal area formed by multiple adjacent vertices that are not collinear, then the middle vertex among the multiple adjacent vertices is determined to be a salient vertex; If it is determined that other vertices in the internal boundary are within the polygonal region formed by multiple adjacent vertices that are not collinear, then determine whether the angles formed by the sides formed by the middle vertex among the multiple adjacent vertices and the other two vertices among the multiple adjacent vertices are less than 180°; If it is determined that the angles of the sides formed by the middle vertex among the multiple adjacent vertices and the other two vertices among the multiple adjacent vertices are less than 180°, the middle vertex among the multiple adjacent vertices is determined to be a concave vertex.
8. A three-dimensional model optimization device, characterized in that: include: An extraction module, used for extracting edge contours from the original three-dimensional model data to form an edge data array; A traversal module, used for traversing the edges in the edge data array to form an array of boundaries to be connected; A storage module, used for connecting the boundary segments that can be connected at the first position in the boundary array to be connected through a common point to form a closed boundary or a non-closed boundary, and storing the closed boundary or the non-closed boundary in the boundary array to be extended; The optimization module is used to optimize the original three-dimensional model according to the boundary vertex coordinates in the boundary array to be expanded.
9. An electronic device, characterized in that: include: A processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the machine-readable instructions are executed by the processor to perform the steps of any method described in claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are executed.
Citation Information
Cited By
Grassland three-dimensional model boundary optimization method and system, terminal and storage medium
CN121353576A
A meadow three-dimensional model boundary optimization method, system, terminal and storage medium
CN121353576B