Model simplification method, apparatus, device, and storage medium
By calculating the coordinates and cost value of the candidate shrinkage surface and the center point, the target cost value is determined. By selecting the candidate shrinkage surface that matches the target cost value for shrinkage, the problem of the center point and shrinkage surface being too small in the prior art is solved, and the model is effectively simplified and orderly shrunk.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NEUSOFT CORP
- Filing Date
- 2022-12-29
- Publication Date
- 2026-07-21
AI Technical Summary
In existing methods for reducing the number of polygons in a model, the distance between the center point and the shrinking surface is too small, or the center point is on the shrinking surface, resulting in poor polygon reduction performance.
By obtaining the model to be simplified, a set of candidate shrinking surfaces is determined, and the coordinates of the center point matching each candidate shrinking surface and the cost value are calculated. The candidate shrinking surface matching the target cost value is selected for shrinking, ensuring that the center point is not on the target shrinking surface. The coordinates of the center point and the cost value are determined using the candidate shrinking surfaces and their adjacent surfaces, thus achieving orderly model simplification.
This solves the problem of the center point being too close to the adjacent surface when it is bent, ensuring that the center point is located far from the target contraction surface, thus achieving effective simplification of the model. It also avoids the problem of the center point being on the surface when the initial surface is tilted, and achieves an orderly simplification process.
Smart Images

Figure CN115861583B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of model processing technology, and in particular relates to a model simplification method, apparatus, device and storage medium. Background Technology
[0002] With the continuous development of computer hardware and software technology and the increasing popularity of augmented reality, virtual reality, and mixed reality, the demand for 3D modeling is increasing exponentially, and the structure of 3D models is becoming increasingly complex. In practical applications, there are often requirements for model processing speed, necessitating the simplification of 3D models. Methods for model simplification mainly include polygon reduction and baking. Polygon reduction can effectively reduce the space storage cost of the model, simplify the calculation of subsequent texture mapping, and save rendering time.
[0003] However, current model reduction methods suffer from problems such as the center point being too close to the shrinking surface or the center point being on the shrinking surface, which reduces the effectiveness of model reduction. Summary of the Invention
[0004] This application aims to at least partially address one of the technical problems in the related art. To this end, one objective of this application is to provide a model simplification method, apparatus, device, and storage medium.
[0005] To address the aforementioned technical problems, embodiments of this application provide the following technical solutions:
[0006] A model simplification method includes:
[0007] Obtain the model to be simplified, and determine a set of candidate shrinkage surfaces based on the model to be simplified; wherein the set of candidate shrinkage surfaces includes at least one candidate shrinkage surface;
[0008] For each candidate shrinkage surface in the candidate shrinkage surface set, the coordinates of the center point matching each candidate shrinkage surface are calculated;
[0009] The cost value of each candidate shrinkage surface is calculated based on the coordinates of the center point that matches each candidate shrinkage surface.
[0010] Based on the cost value of each candidate shrinkage surface, a target cost value is determined, and the candidate shrinkage surface that matches the target cost value is determined as the target shrinkage surface;
[0011] The target shrinkage surface is shrunk to obtain the target model.
[0012] Optionally, before obtaining the model to be simplified and determining the candidate shrinkage surface set based on the model to be simplified, the method further includes:
[0013] Obtain the model to be simplified and obtain multiple initial faces;
[0014] Obtain each initial edge of each initial face and determine a first number of initial faces containing each initial edge;
[0015] The first inclusion number of each initial edge of each initial face is compared with a first inclusion number threshold. If there is an initial edge in the initial face whose first inclusion number is not greater than the first inclusion number threshold, then the initial face is determined as a boundary face.
[0016] Optionally, before obtaining the model to be simplified and determining the candidate shrinkage surface set based on the model to be simplified, the method further includes:
[0017] Obtain the model to be simplified and obtain multiple initial faces;
[0018] Obtain each vertex of each of the initial faces, and determine a second number of the initial faces containing each of the vertices;
[0019] The second inclusion number of each vertex of each initial face is compared with a second inclusion number threshold. If there is a vertex in the initial face whose second inclusion number is not greater than the second inclusion number threshold, then the initial face is determined as a boundary face.
[0020] Optionally, for each of the candidate contraction surfaces in the candidate contraction surface set, the coordinates of the center point matching each candidate contraction surface are calculated, including:
[0021] Obtain multiple adjacent surfaces that are adjacent to each of the candidate contraction surfaces;
[0022] Obtain multiple vertices of each of the adjacent faces adjacent to each of the candidate contraction faces, and obtain the first coordinates of each of the vertices;
[0023] Based on the first coordinates of each of the contained vertices that match each of the candidate contraction surfaces, a first distance from each of the contained vertices to the candidate contraction surface that matches each of the contained vertices is calculated.
[0024] Based on the plurality of first distances that match each of the candidate contraction surfaces, the target distance that matches each of the candidate contraction surfaces is calculated respectively.
[0025] Based on the plurality of first coordinates that match each of the candidate contraction surfaces, second coordinates that match each of the candidate contraction surfaces are calculated respectively;
[0026] Based on the second coordinates matching each candidate contraction surface and the target distance, the coordinates of the center point matching each candidate contraction surface are calculated respectively.
[0027] Optionally, the step of calculating a second coordinate matching each candidate contraction surface based on a plurality of first coordinates matching each candidate contraction surface includes:
[0028] The mean of the plurality of first coordinates that match each candidate contraction surface is calculated, and the second coordinates that match each candidate contraction surface are calculated respectively.
[0029] Optionally, the step of calculating the center point coordinates matching each candidate contraction surface based on the second coordinates matching each candidate contraction surface and the target distance includes:
[0030] The second coordinate that matches each candidate contraction surface is translated along a preset direction by the target distance, and the coordinates of the center point that matches each candidate contraction surface are calculated respectively.
[0031] Optionally, the step of calculating the cost value of each candidate shrinkage surface based on the coordinates of the center point matched with each candidate shrinkage surface includes:
[0032] Based on the coordinates of the center point that matches each candidate shrinkage surface, calculate the distance from each center point that matches the center point coordinates to the center of the corresponding candidate shrinkage surface;
[0033] Obtain the reference value corresponding to each of the candidate shrinkage surfaces;
[0034] The cost value of each candidate shrinkage surface is calculated based on the reference value corresponding to each candidate shrinkage surface and the center distance.
[0035] Optionally, determining the target cost value based on the cost value of each of the candidate contraction surfaces includes:
[0036] The cost value of each candidate shrinkage surface is compared to obtain the comparison result;
[0037] Based on the comparison results, a lower limit for the cost value is determined, and the lower limit for the cost value is set as the target cost value.
[0038] Optionally, shrinking the target shrinkage surface to obtain the target model includes:
[0039] Obtain a plurality of adjacent faces that are adjacent to the target contraction surface, and a common vertex that the target contraction surface shares with each of the adjacent faces;
[0040] The target contraction surface is contracted to the center point that matches the target contraction surface;
[0041] Each of the common vertices is replaced based on the center point, and the center point is included in each of the adjacent faces adjacent to the target contraction surface.
[0042] Embodiments of this application also provide a model simplification apparatus, comprising:
[0043] The first determining module is used to obtain the model to be simplified and determine a set of candidate shrinkage surfaces based on the model to be simplified; wherein the set of candidate shrinkage surfaces includes at least one candidate shrinkage surface;
[0044] The first calculation module is used to calculate each of the candidate contraction surfaces in the candidate contraction surface set, and obtain the coordinates of the center point that matches each candidate contraction surface;
[0045] The second calculation module is used to calculate the cost value of each candidate shrinkage surface based on the coordinates of the center point that matches each candidate shrinkage surface.
[0046] The second determining module is used to determine a target cost value based on the cost value of each candidate contraction surface, and to determine the candidate contraction surface that matches the target cost value as the target contraction surface;
[0047] The shrinkage module is used to shrink the target shrinkage surface to obtain the target model.
[0048] Embodiments of this application also provide an electronic device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor executes the computer program to implement the method described above.
[0049] Embodiments of this application also provide a computer-readable storage medium, the computer-readable storage medium including a stored computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to perform the method described above.
[0050] The embodiments of this application have the following technical effects:
[0051] The above-mentioned technical solution of this application determines the center point and coordinates of the candidate shrinking surface by using the candidate shrinking surface and multiple adjacent surfaces adjacent to the candidate shrinking surface, and determines the cost value of the candidate shrinking surface based on the center point coordinates, and determines the target shrinking surface based on the cost value, thereby simplifying the model. In the embodiments of this application, the calculated center point will not be on the target shrinking surface, but at a position far away from the target shrinking surface, which solves the problem that the distance from the center point to the shrinking surface is very small when adjacent surfaces bend in two directions due to the simple average value of the related technology for surface shrinkage; at the same time, it also solves the problem that when there is an initial surface with half of it tilted upward and half of it tilted downward, the center point is exactly on the initial surface.
[0052] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description
[0053] Figure 1 This is a flowchart illustrating a model simplification method provided in an embodiment of this application;
[0054] Figure 2 This is a schematic diagram of a candidate shrinkage surface and its adjacent surfaces provided in an embodiment of this application;
[0055] Figure 3 This is a schematic diagram of a model simplification device provided in an embodiment of this application. Detailed Implementation
[0056] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this application, and should not be construed as limiting this application.
[0057] like Figure 1 As shown, embodiments of this application provide a model simplification method, including:
[0058] Step S11: Obtain the model to be simplified, and determine the candidate shrinkage surface set based on the model to be simplified; wherein the candidate shrinkage surface set includes at least one candidate shrinkage surface;
[0059] In an optional embodiment of this application, before simplifying the model to be simplified, each initial face of the model to be simplified is first obtained. Multiple initial faces are screened to select those that do not need to be shrunk and define them as boundary faces. The remaining multiple initial faces are defined as candidate shrinkable faces. Then, based on at least one remaining candidate shrinkable face, a set of candidate shrinkable faces is obtained. Specifically, in the embodiment of this application, each boundary face is found based on the properties of each initial edge or each vertex of the polygon.
[0060] An optional embodiment of this application further includes, before obtaining the model to be simplified and determining the candidate shrinkage surface set based on the model to be simplified:
[0061] Obtain the model to be simplified and obtain multiple initial faces;
[0062] Obtain each initial edge of each initial face and determine a first number of initial faces containing each initial edge;
[0063] The first inclusion number of each initial edge of each initial face is compared with a first inclusion number threshold. If there is an initial edge in the initial face whose first inclusion number is not greater than the first inclusion number threshold, then the initial face is determined as a boundary face.
[0064] In an optional embodiment of this application, for example, the first inclusion quantity threshold can be 1. If there is an initial edge in the initial surface with a first inclusion quantity not greater than 1, the initial surface is determined as a boundary surface, and the boundary surface does not participate in the subsequent calculation process of the target shrinkage surface.
[0065] That is, if there is an initial edge in the initial surface that is contained only in the initial surface, then the initial surface is determined as the boundary surface.
[0066] An optional embodiment of this application further includes, before obtaining the model to be simplified and determining the candidate shrinkage surface set based on the model to be simplified:
[0067] Obtain the model to be simplified and obtain multiple initial faces;
[0068] Obtain each vertex of each of the initial faces, and determine a second number of initial faces containing each of the vertices;
[0069] The second inclusion number of each vertex of each initial face is compared with a second inclusion number threshold. If there is a vertex in the initial face whose second inclusion number is not greater than the second inclusion number threshold, then the initial face is determined as a boundary face.
[0070] In one optional embodiment of this application, for example, the second inclusion quantity threshold can be 1. If the second inclusion quantity of a vertex in the initial face is not greater than 1, then the initial face is determined as a boundary face, and the boundary face does not participate in the subsequent calculation process of the target shrinkage face.
[0071] That is, if there is a vertex in the initial face that is contained only in the initial edge of the initial face, then the initial face is determined as the boundary face.
[0072] Step S12: Calculate the coordinates of the center point that matches each candidate shrinkage surface in the candidate shrinkage surface set;
[0073] In an optional embodiment of this application, the step of calculating the coordinates of the center point matching each candidate contraction surface in the candidate contraction surface set includes:
[0074] Obtain multiple adjacent surfaces that are adjacent to each of the candidate contraction surfaces;
[0075] Obtain multiple vertices of each of the adjacent faces adjacent to each of the candidate contraction faces, and obtain the first coordinates of each of the vertices;
[0076] Based on the first coordinates of each of the contained vertices that match each of the candidate contraction surfaces, a first distance from each of the contained vertices to the candidate contraction surface that matches each of the contained vertices is calculated.
[0077] Based on the plurality of first distances that match each of the candidate contraction surfaces, the target distance that matches each of the candidate contraction surfaces is calculated respectively.
[0078] Based on the plurality of first coordinates that match each of the candidate contraction surfaces, second coordinates that match each of the candidate contraction surfaces are calculated respectively;
[0079] Based on the second coordinates matching each candidate contraction surface and the target distance, the coordinates of the center point matching each candidate contraction surface are calculated respectively.
[0080] like Figure 2 As shown, each candidate shrinkage surface has multiple adjacent surfaces. Let's take any candidate shrinkage surface as an example for explanation:
[0081] Specifically, obtain the candidate contraction surface and all vertices of each adjacent surface, and obtain the first coordinates of each vertex;
[0082] Based on the first coordinates of each vertex, calculate the first distance from the corresponding vertex to the candidate contraction surface;
[0083] The first distance of each vertex is compared to obtain the comparison result. Based on the comparison result, the first distance with the largest value is determined and set as the target distance.
[0084] And based on multiple first coordinates, a second coordinate is calculated to obtain;
[0085] Based on the second coordinate and the target distance, the center point that matches the candidate contraction surface and the coordinates of the corresponding center point can be calculated.
[0086] It should be noted that the first distance corresponding to each first coordinate can be calculated based on the relevant algorithm and each first coordinate. In the embodiments of this application, the relevant algorithm will not be described in detail.
[0087] In an optional embodiment of this application, the step of calculating a second coordinate matching each candidate contraction surface based on a plurality of first coordinates matching each candidate contraction surface includes:
[0088] The mean of the plurality of first coordinates that match each candidate contraction surface is calculated, and the second coordinates that match each candidate contraction surface are calculated respectively.
[0089] An optional embodiment of this application, such as... Figure 2 As shown, the explanation will be based on an arbitrary candidate contraction surface:
[0090] Suppose that the candidate contraction surface and all the vertices of the multiple adjacent surfaces adjacent to the candidate contraction surface are: P1(x1,y1,z1,), P2(x2,y2,z2,), P3(x3,y3,z3,), P4(x4,y4,z4,), ..., P9(x9,y9,z9,);
[0091] The second coordinate P can then be calculated based on the following formula. 参考 (x 参考 y 参考 , z 参考 );
[0092]
[0093]
[0094]
[0095] Similarly, regardless of how many adjacent faces a candidate contraction surface has, or how many vertices a candidate contraction surface and its adjacent faces have, the second coordinates matching any candidate contraction surface can be calculated based on the above algorithm.
[0096] In an optional embodiment of this application, the step of calculating the coordinates of the center point matching each candidate contraction surface based on the second coordinates matching each candidate contraction surface and the target distance includes:
[0097] The second coordinate that matches each candidate contraction surface is translated along a preset direction by the target distance, and the coordinates of the center point that matches each candidate contraction surface are calculated respectively.
[0098] In one optional embodiment of this application, the preset direction can be the direction of the normal vector of the candidate contraction surface. For any candidate contraction surface, after obtaining the second coordinates of the candidate contraction surface and the target distance, the normal vector of the candidate contraction surface is obtained.
[0099] By translating the second coordinate of the candidate shrinkage surface along the direction of the normal vector of the candidate shrinkage surface by a target distance, the center point matching the candidate shrinkage surface and its coordinates can be obtained.
[0100] Step S13: Calculate the cost value of each candidate shrinkage surface based on the coordinates of the center point that matches each candidate shrinkage surface;
[0101] In an optional embodiment of this application, the step of calculating the cost value of each candidate shrinkage surface based on the coordinates of the center point matching each candidate shrinkage surface includes:
[0102] Based on the coordinates of the center point that matches each candidate shrinkage surface, calculate the distance from each center point that matches the center point coordinates to the center of the corresponding candidate shrinkage surface;
[0103] Obtain the reference value corresponding to each of the candidate shrinkage surfaces;
[0104] The cost value of each candidate shrinkage surface is calculated based on the reference value corresponding to each candidate shrinkage surface and the center distance.
[0105] In an optional embodiment of this application, since the area of any candidate shrinkage surface is reduced before reducing the area of the candidate shrinkage surface, the reference value involved in the embodiment of this application can be the area S of the candidate shrinkage surface.
[0106] Furthermore, based on the center coordinates M(x) of the center point matching the candidate contraction surface... M y M , z M ), calculate the distance d from the center point to the center of the candidate contraction surface;
[0107] Then, based on the area S corresponding to the candidate shrinkage surface and the center distance d, the cost of the obtained candidate shrinkage surface is calculated.
[0108] It should be noted that the calculation method for the center distance d can be obtained based on relevant algorithms, and the embodiments of this application will not elaborate on this.
[0109] In an optional embodiment of this application, the cost of any candidate shrinkage surface can be calculated based on the following formula:
[0110] cos 候选收缩面 =d*S.
[0111] Step S14: Determine the target cost value based on the cost value of each candidate shrinkage surface, and determine the candidate shrinkage surface that matches the target cost value as the target shrinkage surface;
[0112] In an optional embodiment of this application, determining the target cost value based on the cost value of each candidate shrinkage surface includes:
[0113] The cost value of each candidate shrinkage surface is compared to obtain the comparison result;
[0114] Based on the comparison results, a lower limit for the cost value is determined, and the lower limit for the cost value is set as the target cost value.
[0115] In an optional embodiment of this application, after calculating the cost value of each candidate shrinkage surface in the candidate shrinkage surface set, the cost value of each candidate shrinkage surface is compared, and the cost value with the largest value is determined as the lower limit of the cost value, and the lower limit of the cost value is determined as the target cost value.
[0116] Step S15: Shrink the target shrinkage surface to obtain the target model.
[0117] In an optional embodiment of this application, shrinking the target shrinkage surface to obtain the target model includes:
[0118] Obtain a plurality of adjacent faces that are adjacent to the target contraction surface, and a common vertex that the target contraction surface shares with each of the adjacent faces;
[0119] The target contraction surface is contracted to the center point that matches the target contraction surface;
[0120] Each of the common vertices is replaced based on the center point, and the center point is included in each of the adjacent faces adjacent to the target contraction surface.
[0121] In an optional embodiment of this application, after the target shrinkage surface is determined, the target shrinkage surface is shrunk to the center point.
[0122] The center point is then used to replace the shared vertex of each adjacent face and the target shrinking face. The center point is then included in each adjacent face as a new vertex of each adjacent face, forming a new face and obtaining a simplified model.
[0123] In the embodiments of this application, a center point matching the candidate shrinking surface and its coordinates are determined using a candidate shrinking surface and multiple adjacent surfaces. The cost value of the candidate shrinking surface is determined based on the center point coordinates, and a target shrinking surface is determined based on this cost value. The target shrinking surface is then shrunk to the center point matching the target shrinking surface, thereby simplifying the model. In the embodiments of this application, the calculated center point is not on the target shrinking surface but at a position far from it. This solves the problem in related technologies where the distance from the center point to the shrinking surface is very small when adjacent surfaces bend in two directions due to surface shrinkage based on simple average values. Simultaneously, it also solves the problem that when half of the initial surface is tilted upwards and the other half downwards, the center point is exactly on the initial surface.
[0124] In an optional embodiment of this application, after completing one model simplification, the above steps are repeated to continue searching for the next new target shrinkage surface and shrinking the new target shrinkage surface to form a new surface. After completing this model simplification, the above steps are repeated until the number of remaining candidate shrinkage surfaces reaches the shrinkage threshold, or the calculated cost value is empty, then the model simplification process ends and the target model is obtained.
[0125] In the embodiments of this application, after calculating the cost value of each candidate contraction surface, the cost value with the largest value is selected as the target cost value, and the candidate contraction surface that matches the target cost value is determined as the target contraction surface. This achieves control over the contraction order of the surfaces and makes the simplification process of the model proceed in an orderly manner.
[0126] like Figure 3 As shown, embodiments of this application also provide a model simplification device 30, comprising:
[0127] The first determining module 31 is used to obtain the model to be simplified and determine a set of candidate shrinkage surfaces based on the model to be simplified; wherein the set of candidate shrinkage surfaces includes at least one candidate shrinkage surface;
[0128] The first calculation module 32 is used to calculate each of the candidate contraction surfaces in the candidate contraction surface set, and obtain the center point coordinates that match each candidate contraction surface respectively;
[0129] The second calculation module 33 is used to calculate the cost value of each candidate shrinkage surface based on the coordinates of the center point that matches each candidate shrinkage surface.
[0130] The second determining module 34 is used to determine a target cost value based on the cost value of each candidate shrinkage surface, and to determine the candidate shrinkage surface that matches the target cost value as the target shrinkage surface;
[0131] The shrinkage module 35 is used to shrink the target shrinkage surface to obtain the target model.
[0132] Optionally, before obtaining the model to be simplified and determining the candidate shrinkage surface set based on the model to be simplified, the method further includes:
[0133] Obtain the model to be simplified and obtain multiple initial faces;
[0134] Obtain each initial edge of each initial face and determine a first number of initial faces containing each initial edge;
[0135] The first inclusion number of each initial edge of each initial face is compared with a first inclusion number threshold. If there is an initial edge in the initial face whose first inclusion number is not greater than the first inclusion number threshold, then the initial face is determined as a boundary face.
[0136] Optionally, before obtaining the model to be simplified and determining the candidate shrinkage surface set based on the model to be simplified, the method further includes:
[0137] Obtain the model to be simplified and obtain multiple initial faces;
[0138] Obtain each vertex of each of the initial faces, and determine a second number of the initial faces containing each of the vertices;
[0139] The second inclusion number of each vertex of each initial face is compared with a second inclusion number threshold. If there is a vertex in the initial face whose second inclusion number is not greater than the second inclusion number threshold, then the initial face is determined as a boundary face.
[0140] Optionally, for each of the candidate contraction surfaces in the candidate contraction surface set, the coordinates of the center point matching each candidate contraction surface are calculated, including:
[0141] Obtain multiple adjacent surfaces that are adjacent to each of the candidate contraction surfaces;
[0142] Obtain multiple vertices of each of the adjacent faces adjacent to each of the candidate contraction faces, and obtain the first coordinates of each of the vertices;
[0143] Based on the first coordinates of each of the contained vertices that match each of the candidate contraction surfaces, a first distance from each of the contained vertices to the candidate contraction surface that matches each of the contained vertices is calculated.
[0144] Based on the plurality of first distances that match each of the candidate contraction surfaces, the target distance that matches each of the candidate contraction surfaces is calculated respectively.
[0145] Based on the plurality of first coordinates that match each of the candidate contraction surfaces, second coordinates that match each of the candidate contraction surfaces are calculated respectively;
[0146] Based on the second coordinates matching each candidate contraction surface and the target distance, the coordinates of the center point matching each candidate contraction surface are calculated respectively.
[0147] Optionally, the step of calculating a second coordinate matching each candidate contraction surface based on a plurality of first coordinates matching each candidate contraction surface includes:
[0148] The mean of the plurality of first coordinates that match each candidate contraction surface is calculated, and the second coordinates that match each candidate contraction surface are calculated respectively.
[0149] Optionally, the step of calculating the center point coordinates matching each candidate contraction surface based on the second coordinates matching each candidate contraction surface and the target distance includes:
[0150] The second coordinate that matches each candidate contraction surface is translated along a preset direction by the target distance, and the coordinates of the center point that matches each candidate contraction surface are calculated respectively.
[0151] Optionally, the step of calculating the cost value of each candidate shrinkage surface based on the coordinates of the center point matched with each candidate shrinkage surface includes:
[0152] Based on the coordinates of the center point that matches each candidate shrinkage surface, calculate the distance from each center point that matches the center point coordinates to the center of the corresponding candidate shrinkage surface;
[0153] Obtain the reference value corresponding to each of the candidate shrinkage surfaces;
[0154] The cost value of each candidate shrinkage surface is calculated based on the reference value corresponding to each candidate shrinkage surface and the center distance.
[0155] Optionally, determining the target cost value based on the cost value of each of the candidate contraction surfaces includes:
[0156] The cost value of each candidate shrinkage surface is compared to obtain the comparison result;
[0157] Based on the comparison results, a lower limit for the cost value is determined, and the lower limit for the cost value is set as the target cost value.
[0158] Optionally, shrinking the target shrinkage surface to obtain the target model includes:
[0159] Obtain a plurality of adjacent faces that are adjacent to the target contraction surface, and a common vertex that the target contraction surface shares with each of the adjacent faces;
[0160] The target contraction surface is contracted to the center point that matches the target contraction surface;
[0161] Each of the common vertices is replaced based on the center point, and the center point is included in each of the adjacent faces adjacent to the target contraction surface.
[0162] Embodiments of this application also provide an electronic device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor executes the computer program to implement the method described above.
[0163] Embodiments of this application also provide a computer-readable storage medium, the computer-readable storage medium including a stored computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to perform the method described above.
[0164] Furthermore, other configurations and functions of the apparatus in the embodiments of this application are known to those skilled in the art, and will not be described in detail here to reduce redundancy.
[0165] It should be noted that the logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include: an electrical connection having one or more wires (electronic device), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Alternatively, the computer-readable medium may be paper or other suitable media on which the program can be printed, since the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in a computer memory.
[0166] It should be understood that various parts of this application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0167] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0168] In the description of this application, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", "clockwise", "counterclockwise", "axial", "radial", "circumferential", etc., indicating the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, are only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this application.
[0169] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0170] In this application, unless otherwise expressly specified and limited, the terms "installation," "connection," "joining," and "fixing," etc., should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components, unless otherwise expressly limited. Those skilled in the art can understand the specific meaning of the above terms in this application according to the specific circumstances.
[0171] In this application, unless otherwise expressly specified and limited, "above" or "below" the second feature can mean that the first feature is in direct contact with the second feature, or that the first feature is in indirect contact with the second feature through an intermediate medium. Furthermore, "above," "on top of," and "over" the second feature can mean that the first feature is directly above or diagonally above the second feature, or simply that the first feature is at a higher horizontal level than the second feature. "Below," "below," and "under" the second feature can mean that the first feature is directly below or diagonally below the second feature, or simply that the first feature is at a lower horizontal level than the second feature.
[0172] Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of this application.
Claims
1. A model simplification method, characterized in that, include: Obtain the model to be simplified, and determine a set of candidate shrinkage surfaces based on the model to be simplified; wherein the set of candidate shrinkage surfaces includes at least one candidate shrinkage surface; For each candidate shrinkage surface in the candidate shrinkage surface set, the coordinates of the center point matching each candidate shrinkage surface are calculated; The cost value of each candidate shrinkage surface is calculated based on the coordinates of the center point that matches each candidate shrinkage surface. Based on the cost value of each candidate shrinkage surface, a target cost value is determined, and the candidate shrinkage surface that matches the target cost value is determined as the target shrinkage surface; The target shrinkage surface is shrunk to obtain the target model; The step of calculating the center point coordinates matching each candidate contraction surface in the candidate contraction surface set includes: Obtain multiple adjacent surfaces that are adjacent to each of the candidate contraction surfaces; Obtain multiple vertices of each of the adjacent faces adjacent to each of the candidate contraction faces, and obtain the first coordinates of each of the vertices; Based on the first coordinates of each of the contained vertices that match each of the candidate contraction surfaces, a first distance from each of the contained vertices to the candidate contraction surface that matches each of the contained vertices is calculated. Based on the plurality of first distances that match each of the candidate contraction surfaces, the target distance that matches each of the candidate contraction surfaces is calculated respectively. Based on the plurality of first coordinates that match each of the candidate contraction surfaces, second coordinates that match each of the candidate contraction surfaces are calculated respectively; Based on the second coordinates matching each candidate contraction surface and the target distance, the coordinates of the center point matching each candidate contraction surface are calculated respectively.
2. The method according to claim 1, characterized in that, Before obtaining the model to be simplified and determining the candidate shrinkage surface set based on the model to be simplified, the method further includes: Obtain the model to be simplified and obtain multiple initial faces; Obtain each initial edge of each initial face and determine a first number of initial faces containing each initial edge; The first inclusion number of each initial edge of each initial face is compared with a first inclusion number threshold. If there is an initial edge in the initial face whose first inclusion number is not greater than the first inclusion number threshold, then the initial face is determined as a boundary face.
3. The method according to claim 1, characterized in that, Before obtaining the model to be simplified and determining the candidate shrinkage surface set based on the model to be simplified, the method further includes: Obtain the model to be simplified and obtain multiple initial faces; Obtain each vertex of each of the initial faces, and determine a second number of the initial faces containing each of the vertices; The second inclusion number of each vertex of each initial face is compared with a second inclusion number threshold. If there is a vertex in the initial face whose second inclusion number is not greater than the second inclusion number threshold, then the initial face is determined as a boundary face.
4. The method according to claim 1, characterized in that, The step of calculating second coordinates matching each candidate contraction surface based on a plurality of first coordinates matching each candidate contraction surface includes: The mean of the plurality of first coordinates that match each candidate contraction surface is calculated, and the second coordinates that match each candidate contraction surface are calculated respectively.
5. The method according to claim 1, characterized in that, The step of calculating the coordinates of the center point matching each candidate contraction surface based on the second coordinates matching each candidate contraction surface and the target distance includes: The second coordinate that matches each candidate contraction surface is translated along a preset direction by the target distance, and the coordinates of the center point that matches each candidate contraction surface are calculated respectively.
6. The method according to claim 1, characterized in that, The step of calculating the cost value of each candidate shrinkage surface based on the coordinates of the center point matched with each candidate shrinkage surface includes: Based on the coordinates of the center point that matches each candidate shrinkage surface, calculate the distance from each center point that matches the center point coordinates to the center of the corresponding candidate shrinkage surface; Obtain the reference value corresponding to each of the candidate shrinkage surfaces; The cost value of each candidate shrinkage surface is calculated based on the reference value corresponding to each candidate shrinkage surface and the center distance.
7. The method according to claim 1, characterized in that, Determining the target cost value based on the cost value of each candidate shrinkage surface includes: The cost value of each candidate shrinkage surface is compared to obtain the comparison result; Based on the comparison results, a lower limit for the cost value is determined, and the lower limit for the cost value is set as the target cost value.
8. The method according to claim 6, characterized in that, The process of shrinking the target shrinkage surface to obtain the target model includes: Obtain a plurality of adjacent faces that are adjacent to the target contraction surface, and a common vertex that the target contraction surface shares with each of the adjacent faces; The target contraction surface is contracted to the center point that matches the target contraction surface; Each of the common vertices is replaced based on the center point, and the center point is included in each of the adjacent faces adjacent to the target contraction surface.
9. A model simplification device, characterized in that, include: The first determining module is used to obtain the model to be simplified and determine a set of candidate shrinkage surfaces based on the model to be simplified; wherein the set of candidate shrinkage surfaces includes at least one candidate shrinkage surface; The first calculation module is used to calculate each of the candidate contraction surfaces in the candidate contraction surface set, and obtain the coordinates of the center point that matches each candidate contraction surface; The second calculation module is used to calculate the cost value of each candidate shrinkage surface based on the coordinates of the center point that matches each candidate shrinkage surface. The second determining module is used to determine a target cost value based on the cost value of each candidate contraction surface, and to determine the candidate contraction surface that matches the target cost value as the target contraction surface; A shrinkage module is used to shrink the target shrinkage surface to obtain a target model; The first calculation module is specifically used for: Obtain multiple adjacent surfaces that are adjacent to each of the candidate contraction surfaces; Obtain multiple vertices of each of the adjacent faces adjacent to each of the candidate contraction faces, and obtain the first coordinates of each of the vertices; Based on the first coordinates of each of the contained vertices that match each of the candidate contraction surfaces, a first distance from each of the contained vertices to the candidate contraction surface that matches each of the contained vertices is calculated. Based on the plurality of first distances that match each of the candidate contraction surfaces, the target distance that matches each of the candidate contraction surfaces is calculated respectively. Based on the plurality of first coordinates that match each of the candidate contraction surfaces, second coordinates that match each of the candidate contraction surfaces are calculated respectively; Based on the second coordinates matching each candidate contraction surface and the target distance, the coordinates of the center point matching each candidate contraction surface are calculated respectively.
10. An electronic device, characterized in that, The method includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor, when executing the computer program, implements the method as claimed in any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored computer program, wherein, when the computer program is executed, it controls the device on which the computer-readable storage medium is located to perform the method as described in any one of claims 1 to 8.