A method, apparatus, computer device, and storage medium for processing a virtual model

By calculating the distance and area weighting parameters of the normal direction vector of the virtual model and the center position, the coordinates of the center point of the virtual model are corrected, and the error problem caused by manual observation is solved and the accuracy of model processing is improved.

CN116168187BActive Publication Date: 2025-07-04NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310187853.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-22
Publication Date
2025-07-04
Estimated Expiration
2043-02-22

AI Technical Summary

Technical Problem

In the prior art, it is determined by manual observation that there is a large error in the center point of the polygon surface model, which affects the subsequent processing effect.

Method used

By obtaining the center position and normal direction vector of candidate model surfaces in the virtual model, calculate the distance between the closest position and the center position on the normal direction vector, determine the weighting parameters based on the area and distance, correct the center point coordinates, and traverse all model surfaces to obtain the accurate center point.

Benefits of technology

The accurate determination of the center point of the virtual model is achieved, and the processing accuracy of the polygon surface model is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116168187B_ABST
    Figure CN116168187B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a method, apparatus, computer device, and computer-readable storage medium for processing a virtual model. In this solution, a candidate model surface is selected from the model surfaces of the virtual model, the normals of each model surface other than the candidate model surface are traversed, and the distance between the position on the normal of the candidate model surface closest to the normal of each model surface and the center position of the candidate model surface is determined. Then, the weight of this distance is calculated based on the area of the model surfaces participating in the calculation. After traversing all other model surfaces, the weighted distance average value of all model surfaces is obtained, and the approximate center coordinates located on the normal of the candidate model surface and based on the candidate model surface are calculated through the center position, normal direction, and weighted distance average value of the candidate model surface. In this way, the accurate center point of the virtual model can be obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and particularly to a method and apparatus for processing virtual models, a computer device, and a computer-readable storage medium. Background Art

[0002] In an ideal state, a polygon surface with the same curvature should have a center where the normals converge. The normals of each face of the polygon surface radiate outward from this center. Such a surface is a standard spherical surface in terms of visual effect. However, in actual production, there is no accurate common center point for the normals of the faces of the polygon surface model, and there is only a region where the extension lines of the normals are relatively concentrated.

[0003] When rotating or scaling a polygon surface model, a center point needs to be determined. In related technologies, after displaying the normals of each face of the polygon surface model, the production staff observes from multiple angles and determines a region where the passing normals are the densest based on visual observation, and then estimates the center point of this region. However, the method of determining the center point by manual observation has a large error, which affects the subsequent processing effect of the polygon surface model. Summary of the Invention

[0004] Embodiments of this application provide a method and apparatus for processing virtual models, a computer device, and a computer-readable storage medium, which can obtain the accurate center point of a virtual model.

[0005] Embodiments of this application provide a method for processing a virtual model, including:

[0006] Obtain the first center position and the first normal direction vector of a candidate model face in the virtual model, and the second center position and the second normal direction vector of the current reference model face of the candidate model face, where the current reference model face and the candidate model face are not the same model face;

[0007] Based on the first center position, the first normal direction vector, the second center position, and the second normal direction vector, determine the target distance between the position on the first normal direction vector closest to the second normal direction vector and the first center position;

[0008] Obtain the area of the current reference model face, and determine the weighting parameter of the first normal direction vector based on the area and the target distance;

[0009] Based on the first normal direction vector, the weighting parameter, and the first center position, determine the center correction vector corresponding to the current reference model face;

[0010] Based on the central correction vector, the area of the candidate model surface, and the central point coordinate weighting vector corresponding to the previous reference model surface, obtain the central point coordinate weighting vector corresponding to the current reference model surface;

[0011] Based on the central point coordinate weighting vector corresponding to the current reference model surface, and the total area of the candidate model surface and the reference model surfaces that have participated in central correction, determine the currently corrected central point coordinates of the virtual model.

[0012] Correspondingly, an embodiment of the present application further provides a processing device for a virtual model, including:

[0013] A first acquisition unit, configured to acquire the first central position and the first normal direction vector of a candidate model surface in the virtual model, and the second central position and the second normal direction vector of the current reference model surface of the candidate model surface, where the current reference model surface and the candidate model surface are not the same model surface;

[0014] A first determination unit, configured to determine, based on the first central position, the first normal direction vector, the second central position, and the second normal direction vector, the target distance between the position closest to the second normal direction vector on the first normal direction vector and the first central position;

[0015] A second acquisition unit, configured to acquire the area of the current reference model surface, and determine the weighting parameter of the first normal direction vector based on the area and the target distance;

[0016] A second determination unit, configured to determine the central correction vector corresponding to the current reference model surface based on the first normal direction vector, the weighting parameter, and the first central position;

[0017] A third determination unit, configured to obtain the central point coordinate weighting vector corresponding to the current reference model surface based on the central correction vector, the area of the candidate model surface, and the central point coordinate weighting vector corresponding to the previous reference model surface;

[0018] A fourth determination unit, configured to determine the currently corrected central point coordinates of the virtual model based on the central point coordinate weighting vector corresponding to the current reference model surface, and the total area of the candidate model surface and the reference model surfaces that have participated in central correction.

[0019] Correspondingly, an embodiment of the present application further provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor executes the processing method for a virtual model provided in any embodiment of the present application.

[0020] Correspondingly, an embodiment of the present application further provides a computer-readable storage medium. The computer-readable storage medium stores multiple instructions, and the instructions are suitable for being loaded by a processor to execute the processing method of the virtual model as described above.

[0021] In an embodiment of the present application, a candidate model surface is selected from the model surfaces of the virtual model, the normal vectors of other model surfaces except the candidate model surface are traversed, the distance between the position closest to the normal vector of the candidate model surface and the center position of the candidate model surface is determined for each model surface, and then the weight of this distance is calculated based on the area of the model surfaces participating in the calculation. After traversing all other model surfaces, the weighted distance average value of all model surfaces is obtained, and the approximate center coordinates located on the normal vector of the candidate model surface and based on the candidate model surface are calculated through the center position, normal vector direction, and weighted distance average value of the candidate model surface. In this way, the accurate center point of the virtual model can be obtained. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] To more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative efforts.

[0023] Figure 1 It is a schematic flowchart of a processing method for a virtual model provided by an embodiment of the present application.

[0024] Figure 2 It is a schematic diagram of an application scenario of a processing method for a virtual model provided by an embodiment of the present application.

[0025] Figure 3 It is a schematic diagram of another application scenario of a processing method for a virtual model provided by an embodiment of the present application.

[0026] Figure 4 It is a schematic diagram of another application scenario of a processing method for a virtual model provided by an embodiment of the present application.

[0027] Figure 5 It is a schematic diagram of another application scenario of a processing method for a virtual model provided by an embodiment of the present application.

[0028] Figure 6 It is a schematic diagram of another application scenario of a processing method for a virtual model provided by an embodiment of the present application.

[0029] Figure 7 It is a schematic diagram of another application scenario of a processing method for a virtual model provided by an embodiment of the present application.

[0030] Figure 8Schematic diagram of an application scenario of another method for processing a virtual model provided by an embodiment of the present application.

[0031] Figure 9 Schematic diagram of an application scenario of another method for processing a virtual model provided by an embodiment of the present application.

[0032] Figure 10 Block diagram of the structure of a device for processing a virtual model provided by an embodiment of the present application.

[0033] Figure 11 Schematic diagram of the structure of a computer device provided by an embodiment of the present application. Detailed implementation manners

[0034] Next, the technical solutions in the embodiments of the present application will be clearly and completely described with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative efforts shall fall within the protection scope of the present application.

[0035] The embodiments of the present application provide a method, a device, a computer-readable storage medium, and a computer device for processing a virtual model. Specifically, the method for processing a virtual model in the embodiments of the present application can be executed by a computer device, where the computer device can be a terminal or a server, etc. The terminal can be a smart phone, a tablet computer, a notebook computer, a touch screen, a personal computer (PC), a personal digital assistant (PDA), and other terminal devices. The server can be an independent physical server, or a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.

[0036] For example, the computer device can be a terminal, and the terminal can obtain a first object model of a source object and a second object model of a target object; perform topological deformation processing on the first object model with the shape of the second object model as the topological deformation target shape to obtain a deformed topological model; obtain the relative position information between the bone points of the first object model and the model surface points corresponding to the bone points; perform topological deformation processing on the first object model according to the deformed topological model to obtain a third object model of the target object; adjust the positions of the bone points in the third object model based on the positions of the model surface points of the third object model and the first object model and the relative position information.

[0037] Based on the above problems, the embodiments of the present application provide a processing method, device, computer device and computer-readable storage medium for the first virtual model, which can obtain the accurate center point of the virtual model.

[0038] The following will be described in detail respectively. It should be noted that the description order of the following embodiments does not limit the preferred order of the embodiments.

[0039] The embodiments of the present application provide a processing method for a virtual model. This method can be executed by a terminal or a server. The embodiments of the present application will be described by taking the processing method of the virtual model being executed by the terminal as an example.

[0040] Please refer to Figure 1 , Figure 1 , which is a schematic flowchart of a processing method for a virtual model provided by the embodiments of the present application. The specific process of this processing method for the virtual model can be as follows:

[0041] 101. Obtain the first center position and the first normal direction vector of the candidate model surface in the virtual model, as well as the second center position and the second normal direction vector of the current reference model surface of the candidate model surface.

[0042] In the embodiments of the present application, the virtual model is a model created according to the shape of the virtual object, and the virtual model can be a three-dimensional model. Among them, the virtual model can be a model with a curved surface shape composed of multiple polygons. For example, the virtual model can be a sphere model.

[0043] For example, please refer to Figure 2 , Figure 2 , which is a schematic diagram of an application scenario of a processing method for a virtual model provided by the embodiments of the present application. Figure 2 The shown virtual model is composed of multiple model surfaces, and each model surface can be a polygon. The multiple model surfaces are spliced to form a virtual model with a curved surface shape.

[0044] Among them, the candidate model surface refers to any model surface in the virtual model selected for correcting the position of the center point of the virtual model. Among them, the center point of the virtual model refers to the common center point corresponding to the normal lines of each model surface of the virtual model.

[0045] Specifically, the first center position refers to the center point position of the candidate model surface, and the first normal direction vector refers to the normal vector corresponding to the center point position of the candidate model surface.

[0046] Among them, the current reference model surface refers to the point model surface selected from the model surfaces of the virtual model and used together with the candidate model surface to correct the center of the virtual model. The current reference model surface and the candidate model surface are not the same model surface.

[0047] Specifically, the second center position refers to the center point position of the current reference model surface, and the second normal direction vector refers to the normal vector corresponding to the center point position of the current reference model surface.

[0048] In the embodiment of the present application, a control module is provided, and the control module reads the center point positions and normal data of each model surface of the virtual model.

[0049] First, transform and obtain the model surfaces selected by the production staff in the virtual model (or directly obtain the partial model surfaces selected by the production staff in the virtual model) and record them in the surface set F.

[0050] Traverse each surface F1, F2, F3,..., Fi,..., Fn in the set F, and sequentially obtain the three-dimensional coordinates (x, y, z) of the center position of each model surface Fi. The three-dimensional coordinates of the center position of the model surface can be written in the form of a vector <<x, y, z>> and recorded in the i-th position of the vector sequence Pf. For example, the vector sequence Pf may include: Among them, is the vector corresponding to the three-dimensional coordinates of the center position of surface F1, is the vector corresponding to the three-dimensional coordinates of the center position of surface F2,... is the vector corresponding to the three-dimensional coordinates of the center position of surface Fn.

[0051] Then, sequentially obtain the normal direction vectors of each model surface Fi, and after normalizing the normal direction vectors, record them in the i-th position of the vector sequence Nf (if all the vectors in the sequence Nf are equal, it means that the model surfaces in the set F belong to the same plane, and the calculation can be directly aborted). For example, the vector sequence Nf may include: Among them, is

[0052] the normal direction vector of surface F2, is the normal direction vector of surface F2,... is the normal direction vector of surface Fn.

[0053] For example, the candidate model surface can be model surface Fk, and the current reference model surface can be Fi. Then, the first center point position of model surface Fk obtained from the vector sequence Pf can be: The first center point position of model surface Fi obtained can be: And the first normal direction vector of model surface Fk obtained from the vector sequence Nf can be: The second normal direction vector of model surface Fi obtained can be:

[0054] 102. Determine the target distance between the position on the first normal vector that is closest to the second normal vector and the first central position, based on the first central position, the first normal vector, the second central position, and the second normal vector.

[0055] In an embodiment of the present application, after obtaining the first central position and the first normal vector of the candidate model surface, and the second central position and the second normal vector of the current reference model surface, the distance between the position on the first normal vector that is closest to the second normal vector and the first central position can be calculated according to the first central position, the first normal vector, the second central position, and the second normal vector.

[0056] In some embodiments, to improve the calculation accuracy, the step of "determining the target distance between the position on the first normal vector that is closest to the second normal vector and the first central position, based on the first central position, the first normal vector, the second central position, and the second normal vector" may include the following processes:

[0057] Calculate the first distance between the first normal vector and the second normal vector based on the vector perpendicular to the first normal vector and the second normal vector, the first central position, and the second central position;

[0058] Determine the moved position corresponding to the second central position after moving the first distance along the first normal vector;

[0059] Calculate the target distance based on the distance between the moved position and the first central position, the first included angle between the vector pointing from the moved position to the first central position and the second normal vector, and the second included angle between the first normal vector and the second normal vector.

[0060] In an embodiment of the present application, a calculation module is set up. When the two lines (such as L1 and L2) passing through two points (such as P1 and P2) are closest to each other in three-dimensional space, the distance between the intersection point PL1 of the edge (the edge is perpendicular to both lines) connecting the two lines and one of the lines (such as L1) and the point (P1) on this line (L1) is obtained through the calculation module.

[0061] For example, please refer to Figure 3 , Figure 3 which is a schematic diagram of an application scenario of another method for processing a virtual model provided by an embodiment of the present application. When the two lines L1 and L2 passing through points P1 and P2 are closest to each other in three-dimensional space, the distance between the intersection point PL1 of the edge LC (LC is perpendicular to both L1 and L2) connecting the two lines and L1 and P1 is obtained.

[0062] In the embodiments of the present application, for the convenience of calculation by the calculation module, P1 can be used as the first center position of the candidate model surface, and L1 can be used as the first normal direction vector of the candidate model surface; and P2 can be used as the second center position of the current reference model surface, and L2 can be used as the second normal direction vector of the current reference model surface. Then, the calculation module calculates the distance between the position where the second normal direction vector is closest to the first normal direction vector and the first center position to obtain the target distance.

[0063] Specifically, the operation of calculating the target distance by the calculation module can be as follows:

[0064] First, obtain the coordinates of two vertices P1 and P2 from the control module. Write the three-dimensional coordinates (x1, y1, z1) of vertex P1 in the form of a vector <<x1, y1, z1>>, which can be: And write the three-dimensional coordinates (x2, y2, z2) of vertex P2 in the form of a vector <<x2, y2, z2>>, which can be:

[0065] Furthermore, obtain the vector of the straight line L1 passing through P1 And the vector of the straight line L2 passing through P2 And perform normalization processing And

[0066] For example, please refer to Figure 4 , Figure 4 which is a schematic diagram of the application scenario of another processing method of the virtual model provided by the embodiments of the present application. In Figure 4 , P1 is the first center position of the candidate model surface, P2 is the second center position of the current reference model surface, is the first normal direction vector of the candidate model surface, is the second normal direction vector of the current reference model surface.

[0067] In some embodiments, the step of "calculating the first distance between the first normal direction vector and the second normal direction vector based on the vector perpendicular to the first normal direction vector and the second normal direction vector, the first center position, and the second center position" may include the following operations:

[0068] Calculate the vector product of the first normal direction vector and the second normal direction vector to obtain a first vector perpendicular to the first normal direction vector and the second normal direction vector;

[0069] Based on the coordinates of the first center position and the second center position, and the first vector, calculate the first distance between the first normal direction vector and the second normal direction vector.

[0070] Among them, the vector product, also known as the cross product (i.e., the cross multiplication) and the outer product, is a binary operation of vectors in a vector space.

[0071] Specifically, the vector product of the first normal direction vector and the second normal direction vector can be calculated according to the following calculation formula:

[0072]

[0073] Among them, refers to the first normal direction vector, refers to the second normal direction vector. Calculate and The cross product of, to obtain a first vector that is perpendicular to both the first normal direction vector and the second normal direction vector, that is, Then it can be normalized

[0074] For example, please refer to Figure 5 , Figure 5 is a schematic diagram of the application scenario of another method for processing a virtual model provided by an embodiment of the present application. In Figure 5 , calculate the first normal direction vector of the candidate model surface and the second normal direction vector of the current reference model surface, and obtain a first vector

[0075] that is perpendicular to both the first normal direction vector and the second normal direction vector. In some embodiments, the step of "calculating the first distance between the first normal direction vector and the second normal direction vector based on the coordinates of the first center position and the second center position, and the first vector" may include the following operations:

[0076] Calculate the coordinate difference between the coordinates of the first center position and the coordinates of the second center position to determine a second vector pointing from the second center position to the first center position;

[0077] Calculate the dot product of the second vector and the first vector, and obtain the first distance based on the ratio of the dot product to the first vector.

[0078] Specifically, based on the coordinates of the first center position and the second center position, and the first vector, the first distance between the first normal direction vector and the second normal direction vector can be calculated according to the following calculation formula:

[0079]

[0080] Among them, refers to the vector representation of the coordinates of the first center position, refers to the vector representation of the coordinates of the second center position. Then Represents the coordinate difference between the coordinates of the first central position and the coordinates of the second central position, that is, the second vector.

[0081] Furthermore, calculate the second vector and the first vector to obtain the dot product, getting the first distance. Among them, refers to the modulus of the first vector (that is, the length of the vector ), refers to normalizing the vector .

[0082] Among them, the dot product, that is, the scalar product (dot product / scalar product, also known as dot multiplication), is a binary operation that accepts two vectors on the real number R and returns a real-valued scalar. It is the standard inner product of Euclidean space.

[0083] Among them, the method for finding the modulus of a vector can be: a = (x, y, z), |a| = √(x 2 + y 2 + z 2 ).

[0084] In the embodiments of the present application, for the convenience of calculation, normalize , then Therefore, the above formula for calculating the first distance can be simplified to:

[0085]

[0086] For example, please refer to Figure 6 , Figure 6 is a schematic diagram of an application scenario of another method for processing a virtual model provided by the embodiments of the present application. In Figure 6 , by taking the dot product of the difference between the position coordinates of two points P1 and P2 and , calculate the component of the vector pointing from P2 to P1 in the direction, and obtain the length d1 of the connecting edge LC.

[0087] After determining the first distance, the moved position corresponding to moving the second central position along the first vector by the first distance can be obtained. Its calculation formula can be as follows:

[0088]

[0089] Among them, refers to the vector of the coordinate of the second central position of the current reference model surface, and d1 is also the first distance calculated in the previous step, refers to the first vector. Then Refers to the coordinates of the moved position obtained by moving the second center position by a first distance in the first vector direction.

[0090] For example, please refer to Figure 7 , Figure 7 which is a schematic diagram of the application scenario of another method for processing a virtual model provided by an embodiment of the present application. In Figure 7 , calculate the coordinates of point P2' after moving point P2 a distance of unit d1 in the direction.

[0091] In some embodiments, the step of "calculating the target distance based on the distance between the moved position and the first center position, the first angle between the vector pointing from the moved position to the first center position and the second normal vector direction, and the second angle between the first normal vector direction and the second normal vector direction" may include the following operations:

[0092] Based on the coordinates of the moved position and the first center position, calculate the second distance between the moved position and the first center position;

[0093] Based on the second distance, the angle between the vector pointing from the moved position to the first center position and the second normal vector direction, and the angle between the first normal vector direction and the second normal vector direction, calculate the target distance.

[0094] First, according to the coordinates of the first center position and the coordinates of the moved position, calculate the third vector pointing from the moved position to the first center position. The calculation formula can be as follows:

[0095]

[0096] where refers to the coordinates of the first center position, refers to the coordinates of the moved position, calculate and to obtain the coordinate difference, and get the third vector pointing from the moved position to the first center position

[0097] Furthermore, calculate the modulus of the third vector to obtain the second distance, as follows:

[0098]

[0099] where represents calculating the modulus of the third vector to obtain the second distance d2.

[0100] For example, please refer to Figure 8 , Figure 8This is a schematic diagram of the application scenario of another processing method for virtual models provided by the embodiments of the present application. In Figure 8 The vector pointing from point P2' to point P1 Obtain the distance d2 between P1 and P2'.

[0101] In some embodiments, the step of "calculating the target distance based on the second distance, the angle between the vector pointing from the moved position to the first central position and the second normal direction vector, and the angle between the first normal direction vector and the second normal direction vector" may include the following operations:

[0102] Obtain the first angle between the vector pointing from the moved position to the first central position and the second normal direction vector, and calculate the first sine value of the first angle;

[0103] Obtain the second angle between the first normal direction vector and the second normal direction vector, and calculate the second sine value of the second angle;

[0104] Determine the target distance based on the ratio of the product of the first sine value and the second distance to the second sine value.

[0105] Specifically, the calculation formula for calculating the target distance based on the second distance, the angle between the vector pointing from the moved position to the first central position and the second normal direction vector, and the angle between the first normal direction vector and the second normal direction vector can be as follows:

[0106]

[0107] Wherein, A1 refers to the first angle between the vector pointing from the moved position to the first central position and the second normal direction vector, and sin(A1) is the first sine value calculated for the first angle; A2 refers to the second angle between the first normal direction vector and the second normal direction vector, and sin(A2) is the second sine value calculated for the second angle.

[0108] Specifically, first calculate the product of the second distance and the first sine value, and then calculate the ratio of this product to the second sine value to obtain the target distance.

[0109] For example, please refer to Figure 9 , Figure 9 This is a schematic diagram of the application scenario of another processing method for virtual models provided by the embodiments of the present application. In Figure 9 Obtain and The angle between them is denoted as A1, and obtain and The angle between them is denoted as A2, and calculate the distance d between PL1 and P1 according to the sine theorem to obtain the target distance.

[0110] 103. Obtain the area of the current reference model surface, and determine the weighting parameter of the first normal direction vector based on the area and the target distance.

[0111] In the embodiments of the present application, a distance weighting value Dsum is set and initialized, and Dsum = 0. After each time a reference model surface and a candidate model surface are selected from the model surfaces of the virtual model to participate in the center correction of the virtual model, the distance weighting value Dsum can be updated, and the update method can be:

[0112] Dsum’ = Dsum + d * Si;

[0113] where d represents the target distance calculated based on the reference model surface and the candidate model surface selected in each round, Si represents the area of the reference model surface in each round, and Dsum’ represents the updated distance weighting value.

[0114] In some embodiments, the step of "determining the weighting parameter of the first normal direction vector based on the area and the target distance" may include the following operations:

[0115] Calculate the product of the area and the target distance to obtain the weighting parameter.

[0116] Specifically, after the previous reference model surface before the current reference model surface and the candidate model surface perform center correction on the virtual model, obtain the updated distance weighting value. If the current reference model surface is the reference model surface selected for the first time, the distance weighting value Dsum = 0.

[0117] Specifically, the calculation of the weighting parameter of the current reference model surface can be: calculate the product of the target distance corresponding to the current reference model surface and the area of the current reference model surface, and then add this product to the distance weighting value Dsum to obtain the weighting parameter Dsum corresponding to the current reference model surface.

[0118] 104. Determine the center correction vector corresponding to the current reference model surface based on the first normal direction vector, the weighting parameter, and the first center position.

[0119] In some embodiments, the step of "determining the center correction vector corresponding to the current reference model surface based on the first normal direction vector, the weighting parameter, and the first center position" may include the following operations:

[0120] Obtain the total area of all the model surfaces of the virtual model, and calculate the difference between the total area and the area of the candidate model surface to obtain the first area difference;

[0121] Calculate the product of the ratio of the weighting parameter and the first area difference and the first normal direction vector to obtain the weighted first normal direction vector;

[0122] A center correction vector is obtained based on the sum value of the weighted first normal direction vector and the coordinates of the first center position.

[0123] Specifically, according to the first normal direction vector, the weighting parameter, and the first center position, determining the center correction vector corresponding to the current reference model face can be calculated according to the following formula:

[0124]

[0125] Wherein, refers to the coordinates of the first center position of the candidate model face, refers to the first normal direction vector of the candidate model face. D sum refers to the weighting parameter corresponding to the current reference model face; SA refers to the total area of all model faces of the virtual model, and S refers to the area of the candidate model face.

[0126] First, calculate the difference between the total area and the area of the candidate model face to obtain the first area difference: (SA - S), then calculate the ratio of the weighting parameter to the first area difference, multiply the ratio by the first normal direction vector to obtain the weighted first normal direction vector, and finally, calculate the sum value of the weighted first normal direction vector and the coordinates of the first center position to obtain the correction value of the center point coordinates of the virtual model obtained based on the current reference model face and the candidate model face, that is, the center correction vector

[0127] 105. A center point coordinate weighting vector corresponding to the current reference model face is obtained based on the center correction vector, the area of the candidate model face, and the center point coordinate weighting vector corresponding to the previous reference model face.

[0128] In some embodiments, the step "obtaining a center point coordinate weighting vector corresponding to the current reference model face based on the center correction vector, the area of the candidate model face, and the center point coordinate weighting vector corresponding to the previous reference model face" may include the following operations:

[0129] Obtain the previous center point coordinate weighting vector corresponding to the previous reference model face that has participated in the center correction of the virtual model with the candidate model face;

[0130] Calculate the sum value of the product of the center correction vector and the area of the candidate model face and the previous center point coordinate weighting vector to obtain the current center point coordinate weighting vector for the current reference model face to participate in the center correction of the virtual model.

[0131] In the embodiments of the present application, set the total sum of the center point coordinate weighting vectors Initialize Let After each selection of a reference model surface and a candidate model surface from the model surfaces of the virtual model to participate in the center correction of the virtual model, the sum of the center point coordinate weighted vectors can be updated. The update method can be:

[0132]

[0133] Among them, represents the center correction vector calculated based on the reference model surface and the candidate model surface selected in each round. Sk represents the area of the candidate model surface. represents the sum of the updated center point coordinate weighted vectors.

[0134] Specifically, obtain the previous center point coordinate weighted vector corresponding to the previous reference model surface that has participated in the center correction of the virtual model with the candidate model surface. This previous center point coordinate weighted vector is also the cumulative center point coordinate weighted vector obtained after correcting the center point position coordinates of the virtual model through multiple reference model surfaces.

[0135] Among them, if the current reference model surface is the first selected reference model surface, then the sum of the center point coordinate weighted vectors

[0136] Furthermore, calculate the sum of the product of the center correction vector and the area of the candidate model surface and the previous center point coordinate weighted vector to obtain the center point coordinate weighted vector corresponding to the current reference model surface.

[0137] 106. Based on the center point coordinate weighted vector corresponding to the current reference model surface, and the total area of the candidate model surface and the reference model surfaces that have participated in the center correction, determine the currently corrected center point coordinates of the virtual model.

[0138] In some embodiments, the step "Based on the center point coordinate weighted vector corresponding to the current reference model surface, and the total area of the candidate model surface and the reference model surfaces that have participated in the center correction, determine the currently corrected center point coordinates of the virtual model" may include the following operations:

[0139] Obtain the sum of the areas of all the reference model surfaces that have participated in the center correction of the virtual model with the candidate model surface and the area of the candidate model surface;

[0140] Calculate the ratio of the center point coordinate weighted vector corresponding to the current reference model surface to the sum of the areas to obtain the currently corrected center point coordinates.

[0141] In the embodiments of the present application, a weighted area Ssum is set and initialized, such that Ssum = 0. After each selection of a reference model surface and a candidate model surface from the model surfaces of the virtual model to participate in the center correction of the virtual model, the weighted area Ssum can be updated. The update method can be:

[0142] Ssum’ = Ssum + Si;

[0143] Among them, Ssum represents the weighted area calculated based on the reference model surface and the candidate model surface selected in each round. Si refers to the area of the reference model surface in the current round. Ssum’ represents the updated weighted area.

[0144] Specifically, obtain the sum value of the areas of all the reference model surfaces that have participated in the center correction of the virtual model with the candidate model surface and the area of the candidate model surface, to obtain the weighted area corresponding to the current reference model surface, that is, the sum value of the areas.

[0145] Among them, if the current reference model surface is the reference model surface selected for the first time, the weighted area Ssum corresponding to the current reference model surface = 0.

[0146] Specifically, based on the center point coordinate weighted vector corresponding to the current reference model surface and the sum value of the areas, the current corrected center point coordinate can be calculated as follows:

[0147]

[0148] Among them, refers to the total sum of the center point coordinate weighted vectors corresponding to the current reference model surface, S sum refers to the weighted area corresponding to the current reference model surface, refers to the current corrected center point coordinate obtained by correcting the center point coordinate of the virtual model through the current reference model surface and the candidate model surface.

[0149] In some embodiments, in order to determine the accurate center point of the virtual model, the following steps can also be included:

[0150] Select a model surface from the model surfaces of the virtual model that have not participated in the center correction as the new current reference model surface of the candidate model surface, to obtain a new corrected center point coordinate, until the correction end condition is met, to obtain the final center point coordinate of the virtual model.

[0151] Among them, the correction end condition refers to that all the model surfaces (except the candidate model surface) in the virtual model have participated in the center correction with the candidate model surface, or all the preset model surfaces in the virtual model have participated in the center correction with the candidate model surface. Among them, the preset model surface can be the model surface that the production staff has preset to need to participate in the center correction with the candidate model surface.

[0152] For example, sort all the model faces in the virtual object except the candidate model face to obtain a model face sequence. Select a model face from the model face sequence in turn to perform center correction together with the candidate model face, calculate the weighted vector of the center point coordinates corresponding to each model face and the candidate model face, and calculate the corrected center point coordinates according to the weighted vector of the center point coordinates corresponding to the last model face in the model face sequence and the candidate model face.

[0153] In the embodiment of the present application, after obtaining the vector sequence Pf of the three-dimensional coordinates of the center position of the face Fi and the vector sequence Nf of the normal direction vector of the face Fi, the area of the face Fi can also be obtained in sequence and recorded in the i-th position of the set Sf; sum all the values in Sf to obtain the total area of all the faces in the set F and record it as SA.

[0154] Specifically, the steps of correcting the position of the center point of the virtual model through the center point positions and normal direction vectors of the model faces of the virtual model may include:

[0155] First, sort the values in the set Sf in descending order and record them as the sequence Sf′, create an empty set Done, and create the sum of the weighted vectors of the center point coordinates Let Let the cumulative weighted area Ssum = 0.

[0156] Read the values of the set Sf′ one by one in order from the beginning and repeat the following steps: record the read value as S, record the sum of S and the current Ssum as the new Ssum, find the serial number k where S is located in the set Sf, if k already exists in the set Done (this situation will occur when the areas of multiple model faces are equal), then continue to find the serial number of the next value in the set Sf′ that matches S until the serial number does not exist in the set Done, record the serial number as k, if k does not exist in the set Done, then add k to the set Done and execute the step of correcting the position of the center point of the virtual object based on the candidate model face and the reference model face, and iteratively refresh the approximate common center point coordinates

[0157] Among them, the correction end condition can be to complete traversing the set Sf′ or the production staff aborting the iteration process.

[0158] Among them, if the production staff does not choose to abort the iteration, continue to read the next value in the set Sf′ and record it as the new S and repeat the above steps until completing traversing the set Sf′ or the production staff aborting the iteration process.

[0159] Furthermore, read the vector with the serial number k in the sequences Pf and Nf and Let Initialize the distance weighting value Dsum. Let Dsum = 0, and repeat the following steps: Traverse all vectors with serial number i (i ≠ k) in sequences Pf and Nf and Let If (the normal vectors of the two faces are not parallel), then take Input to the calculation module, and calculate the distance d through the calculation module. For specific details, refer to the above description.

[0160] Specifically, record the result returned by the calculation module as d, read the area Si of the face with serial number i in the Sf set, and record the sum of the current distance weighting value Dsum and d * Si as the new Dsum; if then record the sum of the current S value and Si as the new S value, and then continue to calculate the next serial number until all serial numbers except k are traversed. This calculation method, after calculating the point on the normal line closest to the face Fi and the distance d between them, uses the area Si of the face Fi as the weighting coefficient to reflect the influence of the face Fi on the distance between the approximate center point based on Fi and

[0161] Finally, obtain the coordinate correction value corresponding to the face Fk Let Take and the sum of the current central point coordinate weighting vector total as the new Refresh the approximate common central point coordinates Let:

[0162]

[0163] will approach the ideal approximate common central point with each iteration, thus obtaining the accurate central point of the virtual model.

[0164] Specifically, in this solution, each polygon on the virtual model of the spherical surface is sorted according to its area size. The faces are iterated in descending order, the coordinates of the center point based on each face are calculated, and the average coordinate values in each axial direction are calculated by using its area as the weight affecting the approximate center point coordinates. During the calculation process for each face, it is necessary to traverse the normal vectors of other faces, find the distance between the position of the point on the normal vector of the current face that is closest to the normal vector of another face and the position of the current face, and then calculate the weight of this distance according to the area of the other face participating in the calculation. After traversing all other faces, the weighted distance average value of all faces is obtained. Based on the center coordinates, normal direction, and weighted distance average value of the current face, the approximate center coordinates located on the normal vector of the current face are obtained, and the iteration for the current face is completed. Finally, the area of the current face is used as the weight to be included in the global center point coordinates during each iteration, and finally, the iterative calculation of all faces is completed, or the production staff aborts the iteration to obtain a result that can meet the usage requirements.

[0165] In some embodiments, the virtual model may be a virtual sphere model including multiple curved surfaces. For the virtual sphere model for determining the final center point, various operations can be performed, and the method may further include the following steps:

[0166] In response to a rotation operation on the virtual model, control the virtual model to rotate based on the final center point coordinates.

[0167] Among them, the rotation operation refers to the rotation of the virtual model by the designer through design software. Specifically, the final center point coordinates can be used as the center of the virtual sphere model. When performing a rotation operation on the virtual sphere model, the virtual sphere model can be controlled to rotate according to the final center point.

[0168] In some embodiments, for the virtual model for determining the final center point coordinates, various editing operations based on the center point, such as moving and scaling the virtual model, can also be performed based on the final center point, which can facilitate the production staff to conveniently edit and process the virtual model.

[0169] An embodiment of the present application discloses a method for processing a virtual model. The method includes: obtaining a first center position and a first normal direction vector of a candidate model surface in the virtual model, and a second center position and a second normal direction vector of the current reference model surface of the candidate model surface, where the current reference model surface and the candidate model surface are not the same model surface; determining, based on the first center position, the first normal direction vector, the second center position, and the second normal direction vector, a target distance between a position on the first normal direction vector closest to the second normal direction vector and the first center position; obtaining the area of the current reference model surface, and determining a weighting parameter of the first normal direction vector based on the area and the target distance; determining, based on the first normal direction vector, the weighting parameter, and the first center position, a center correction vector corresponding to the current reference model surface; obtaining, based on the center correction vector, the area of the candidate model surface, and a center point coordinate weighting vector corresponding to the previous reference model surface, a center point coordinate weighting vector corresponding to the current reference model surface; and determining the currently corrected center point coordinates of the virtual model based on the center point coordinate weighting vector corresponding to the current reference model surface and the total area of the candidate model surface and the reference model surfaces that have participated in center correction. In this way, an accurate center point of the virtual model can be obtained.

[0170] To facilitate better implementation of the method for processing a virtual model provided by the embodiments of the present application, the embodiments of the present application further provide a processing device for a virtual model based on the above method for processing a virtual model. The meanings of the nouns are the same as those in the above method for processing a virtual model, and the specific implementation details can refer to the descriptions in the method embodiments.

[0171] Please refer to Figure 10 , Figure 10 which is a structural block diagram of a processing device for a virtual model provided by an embodiment of the present application. The device includes:

[0172] A first acquisition unit 301, configured to obtain a first center position and a first normal direction vector of a candidate model surface in the virtual model, and a second center position and a second normal direction vector of the current reference model surface of the candidate model surface, where the current reference model surface and the candidate model surface are not the same model surface;

[0173] A first determination unit 302, configured to determine, based on the first center position, the first normal direction vector, the second center position, and the second normal direction vector, a target distance between a position on the first normal direction vector closest to the second normal direction vector and the first center position;

[0174] A second acquisition unit 303, configured to obtain the area of the current reference model surface, and determine a weighting parameter of the first normal direction vector based on the area and the target distance;

[0175] A second determination unit 304, configured to determine a center correction vector corresponding to the current reference model surface based on the first normal direction vector, the weighting parameter, and the first center position;

[0176] A third determination unit 305, configured to obtain a weighted vector of the center point coordinates corresponding to the current reference model surface based on the center correction vector, the area of the candidate model surface, and a weighted vector of the center point coordinates corresponding to the previous reference model surface;

[0177] A fourth determination unit 306, configured to determine the currently corrected center point coordinates of the virtual model based on the weighted vector of the center point coordinates corresponding to the current reference model surface, and the total area of the candidate model surface and the reference model surfaces that have participated in center correction.

[0178] In some embodiments, the first determination unit 302 may include:

[0179] A first calculation subunit, configured to calculate a first distance between the first normal direction vector and the second normal direction vector based on a vector perpendicular to the first normal direction vector and the second normal direction vector, the first center position, and the second center position;

[0180] A first determination subunit, configured to determine a moved position corresponding to the second center position after moving the first distance along the first normal direction vector;

[0181] A second calculation subunit, configured to calculate the target distance based on the distance between the moved position and the first center position, a first included angle between a vector pointing from the moved position to the first center position and the second normal direction vector, and a second included angle between the first normal direction vector and the second normal direction vector.

[0182] In some embodiments, the first calculation subunit may specifically be configured to:

[0183] Calculate a vector product of the first normal direction vector and the second normal direction vector to obtain a first vector perpendicular to the first normal direction vector and the second normal direction vector;

[0184] Based on the coordinates of the first center position and the second center position, and the first vector, calculate the first distance between the first normal direction vector and the second normal direction vector.

[0185] In some embodiments, the first calculation subunit may specifically be configured to:

[0186] Calculate the cross product of the first normal direction vector and the second normal direction vector to obtain a first vector perpendicular to the first normal direction vector and the second normal direction vector;

[0187] Calculate the coordinate difference between the coordinates of the first center position and the coordinates of the second center position to determine a second vector pointing from the second center position to the first center position; calculate the dot product of the second vector and the first vector, and based on the ratio of the dot product to the first vector, obtain the first distance.

[0188] In some embodiments, the second calculation subunit may specifically be configured to:

[0189] Based on the coordinates of the moved position and the first center position, calculate a second distance between the moved position and the first center position;

[0190] Based on the second distance, the angle between the vector pointing from the moved position to the first center position and the second normal direction vector, and the angle between the first normal direction vector and the second normal direction vector, calculate the target distance.

[0191] In some embodiments, the second calculation subunit may specifically be configured to:

[0192] Based on the coordinates of the moved position and the first center position, calculate a second distance between the moved position and the first center position;

[0193] Obtain a first angle between the vector pointing from the moved position to the first center position and the second normal direction vector, and calculate a first sine value of the first angle; obtain a second angle between the first normal direction vector and the second normal direction vector, and calculate a second sine value of the second angle; based on the ratio of the product of the first sine value and the second distance to the second sine value, determine the target distance.

[0194] In some embodiments, the second obtaining unit 303 may include:

[0195] A third calculation subunit, configured to calculate the product of the area and the target distance to obtain the weighting parameter.

[0196] In some embodiments, the second determining unit 304 may include:

[0197] A first obtaining subunit, configured to obtain the total area of all model faces of the virtual model, and calculate the difference between the total area and the area of the candidate model face to obtain a first area difference;

[0198] A fourth calculation subunit, configured to calculate a product of a ratio of the weighted parameter and the first area difference and the first normal direction vector to obtain a weighted first normal direction vector;

[0199] A second determination subunit, configured to obtain the center correction vector based on a sum value of the weighted first normal direction vector and coordinates of the first center position.

[0200] In some embodiments, the third determination unit 305 may include:

[0201] A second acquisition subunit, configured to acquire a previous center point coordinate weighted vector corresponding to a previous reference model surface that has participated in center correction of the virtual model with the candidate model surface;

[0202] A fifth calculation subunit, configured to calculate a sum value of a product of the center correction vector and an area of the candidate model surface and the previous center point coordinate weighted vector to obtain a current center point coordinate weighted vector for the current reference model surface to participate in center correction of the virtual model.

[0203] In some embodiments, the fourth determination unit 306 may include:

[0204] A third acquisition subunit, configured to acquire a sum value of areas of all reference model surfaces that have participated in center correction of the virtual model with the candidate model surface and an area of the candidate model surface;

[0205] A sixth calculation subunit, configured to calculate a ratio of the center point coordinate weighted vector corresponding to the current reference model surface to the area sum value to obtain the current corrected center point coordinates.

[0206] In some embodiments, the apparatus may further include:

[0207] A fifth determination unit, configured to select a model surface from model surfaces in the virtual model that have not participated in center correction as a new current reference model surface for the candidate model surface, obtain new corrected center point coordinates, and until a correction end condition is met, obtain final center point coordinates of the virtual model.

[0208] In some embodiments, the apparatus may further include:

[0209] A control unit, configured to control the virtual model to rotate based on the final center point coordinates in response to a rotation operation on the virtual model.

[0210] An embodiment of the present application discloses a processing device for a virtual model. The first acquisition unit 301 acquires the first center position and the first normal direction vector of a candidate model surface in the virtual model, as well as the second center position and the second normal direction vector of the current reference model surface of the candidate model surface, where the current reference model surface and the candidate model surface are not the same model surface; the first determination unit 302 determines, based on the first center position, the first normal direction vector, the second center position, and the second normal direction vector, the target distance between the position on the first normal direction vector closest to the second normal direction vector and the first center position; the second acquisition unit 303 acquires the area of the current reference model surface and determines the weighting parameter of the first normal direction vector based on the area and the target distance; the second determination unit 304 determines the center correction vector corresponding to the current reference model surface based on the first normal direction vector, the weighting parameter, and the first center position; the third determination unit 305 obtains the center point coordinate weighting vector corresponding to the current reference model surface based on the center correction vector, the area of the candidate model surface, and the center point coordinate weighting vector corresponding to the previous reference model surface; the fourth determination unit 306 determines the currently corrected center point coordinates of the virtual model based on the center point coordinate weighting vector corresponding to the current reference model surface and the total area of the candidate model surface and the reference model surfaces that have participated in center correction. In this way, the accurate center point of the virtual model can be obtained.

[0211] Correspondingly, an embodiment of the present application further provides a computer device, which may be a terminal. As Figure 11 shown, Figure 11 is a schematic structural diagram of the computer device provided by the embodiment of the present application. The computer device 500 includes a processor 501 with one or more processing cores, a memory 502 with one or more computer-readable storage media, and a computer program stored in the memory 502 and executable on the processor. Among them, the processor 501 is electrically connected to the memory 502. Those skilled in the art can understand that the structural diagram of the computer device shown in the figure does not constitute a limitation on the computer device, and it may include more or fewer components than shown in the figure, or combine some components, or have different component arrangements.

[0212] The processor 501 is the control center of the computer device 500, connecting various parts of the entire computer device 500 through various interfaces and lines. By running or loading software programs and / or modules stored in the memory 502, and by calling data stored in the memory 502, it executes various functions of the computer device 500 and processes data, thereby monitoring the entire computer device 500.

[0213] In an embodiment of the present application, the processor 501 in the computer device 500 will load the instructions corresponding to the processes of one or more application programs into the memory 502 according to the following steps, and the processor 501 will run the application programs stored in the memory 502 to implement various functions:

[0214] Obtain the first center position and the first normal direction vector of the candidate model surface in the virtual model, as well as the second center position and the second normal direction vector of the current reference model surface of the candidate model surface, where the current reference model surface and the candidate model surface are not the same model surface;

[0215] Based on the first center position, the first normal direction vector, the second center position, and the second normal direction vector, determine the target distance between the position on the first normal direction vector closest to the second normal direction vector and the first center position;

[0216] Obtain the area of the current reference model surface, and determine the weighting parameter of the first normal direction vector based on the area and the target distance;

[0217] Based on the first normal direction vector, the weighting parameter, and the first center position, determine the center correction vector corresponding to the current reference model surface;

[0218] Based on the center correction vector, the area of the candidate model surface, and the center point coordinate weighting vector corresponding to the previous reference model surface, obtain the center point coordinate weighting vector corresponding to the current reference model surface;

[0219] Based on the center point coordinate weighting vector corresponding to the current reference model surface, and the total area of the candidate model surface and the reference model surfaces that have participated in center correction, determine the currently corrected center point coordinates of the virtual model.

[0220] In some embodiments, based on the first center position, the first normal direction vector, the second center position, and the second normal direction vector, determining the target distance between the position on the first normal direction vector closest to the second normal direction vector and the first center position includes:

[0221] Based on the vector perpendicular to the first normal direction vector and the second normal direction vector, the first center position, and the second center position, calculate the first distance between the first normal direction vector and the second normal direction vector;

[0222] Determine the moved position corresponding to the second center position after moving the first distance along the first normal direction vector;

[0223] Calculate the target distance based on the distance between the post-move position and the first center position, the first angle between the vector pointing from the post-move position to the first center position and the second normal vector, and the second angle between the first normal vector and the second normal vector.

[0224] In some embodiments, calculating the first distance between the first normal vector and the second normal vector based on a vector perpendicular to the first normal vector and the second normal vector, the first center position, and the second center position includes:

[0225] Calculate the cross product of the first normal vector and the second normal vector to obtain a first vector perpendicular to the first normal vector and the second normal vector;

[0226] Based on the coordinates of the first center position and the second center position, and the first vector, calculate the first distance between the first normal vector and the second normal vector.

[0227] In some embodiments, calculating the first distance between the first normal vector and the second normal vector based on the coordinates of the first center position and the second center position, and the first vector includes:

[0228] Calculate the coordinate difference between the coordinates of the first center position and the coordinates of the second center position to determine a second vector pointing from the second center position to the first center position;

[0229] Calculate the dot product of the second vector and the first vector, and based on the ratio of the dot product to the first vector, obtain the first distance.

[0230] In some embodiments, calculating the target distance based on the distance between the post-move position and the first center position, the first angle between the vector pointing from the post-move position to the first center position and the second normal vector, and the second angle between the first normal vector and the second normal vector includes:

[0231] Based on the coordinates of the post-move position and the first center position, calculate a second distance between the post-move position and the first center position;

[0232] Based on the second distance, the angle between the vector pointing from the post-move position to the first center position and the second normal vector, and the angle between the first normal vector and the second normal vector, calculate the target distance.

[0233] In some embodiments, calculating the target distance based on the second distance, the angle between the vector pointing from the post-move position to the first center position and the second normal vector, and the angle between the first normal vector and the second normal vector includes:

[0234] Obtain the first included angle between the vector pointing from the moved position to the first central position and the second normal direction vector, and calculate the first sine value of the first included angle;

[0235] Obtain the second included angle between the first normal direction vector and the second normal direction vector, and calculate the second sine value of the second included angle;

[0236] Determine the target distance based on the ratio of the product value of the first sine value and the second distance to the second sine value.

[0237] In some embodiments, determining the weighting parameter of the first normal direction vector based on the area and the target distance includes:

[0238] Calculate the product value of the area and the target distance to obtain the weighting parameter.

[0239] In some embodiments, determining the center correction vector corresponding to the current reference model surface based on the first normal direction vector, the weighting parameter, and the first central position includes:

[0240] Obtain the total area of all model surfaces of the virtual model, and calculate the difference between the total area and the area of the candidate model surface to obtain the first area difference;

[0241] Calculate the product of the ratio of the weighting parameter and the first area difference and the first normal direction vector to obtain the weighted first normal direction vector;

[0242] Obtain the center correction vector based on the sum value of the weighted first normal direction vector and the coordinates of the first central position.

[0243] In some embodiments, obtaining the weighted vector of the center point coordinates corresponding to the current reference model surface based on the center correction vector, the area of the candidate model surface, and the weighted vector of the center point coordinates corresponding to the previous reference model surface includes:

[0244] Obtain the weighted vector of the previous center point coordinates corresponding to the previous reference model surface that has participated in the center correction of the virtual model with the candidate model surface;

[0245] Calculate the sum value of the product of the center correction vector and the area of the candidate model surface and the previous weighted vector of the center point coordinates to obtain the weighted vector of the current center point coordinates of the current reference model surface participating in the center correction of the virtual model.

[0246] In some embodiments, determining the center point coordinates of the virtual model after the current correction based on the weighted vector of the center point coordinates corresponding to the current reference model surface, and the total area of the candidate model surface and the reference model surfaces that have participated in the center correction includes:

[0247] Obtain the sum value of the areas of all reference model surfaces that have participated in the center correction of the virtual model with the candidate model surface and the area of the candidate model surface;

[0248] Calculate the ratio of the weighted vector of the center point coordinates corresponding to the current reference model face to the area sum value to obtain the current corrected center point coordinates.

[0249] In some embodiments, the method further includes:

[0250] Select a model face from the model faces in the virtual model that have not participated in the center correction as the new current reference model face of the candidate model face, obtain the new corrected center point coordinates, and until the correction end condition is satisfied, obtain the final center point coordinates of the virtual model.

[0251] In some embodiments, the method further includes:

[0252] In response to a rotation operation on the virtual model, control the virtual model to rotate based on the final center point coordinates.

[0253] In this solution, a candidate model face is selected from the model faces of the virtual model, the normal vectors of each model face except the candidate model face are traversed, the distance between the position on the normal vector of the candidate model face that is closest to the normal vector of each model face and the center position of the candidate model face is determined, and then the weight of this distance is calculated based on the area of the model faces participating in the calculation. After traversing all other model faces, the weighted distance average value of all model faces is obtained, and the approximate center coordinates located on the normal vector of the candidate model face and based on the candidate model face are calculated through the center position, normal vector direction, and weighted distance average value of the candidate model face. In this way, the accurate center point of the virtual model can be obtained.

[0254] For the specific implementation of each of the above operations, reference can be made to the previous embodiments, which will not be elaborated here.

[0255] Optionally, as Figure 11 shown, the computer device 500 further includes: a touch display screen 503, a radio frequency circuit 504, an audio circuit 505, an input unit 506, and a power supply 507. Among them, the processor 501 is electrically connected to the touch display screen 503, the radio frequency circuit 504, the audio circuit 505, the input unit 506, and the power supply 507 respectively. Those skilled in the art can understand that Figure 11 the computer device structure shown in

[0256] The touch display screen 503 can be used to display a graphical user interface and receive operation instructions generated by a user acting on the graphical user interface. The touch display screen 503 may include a display panel and a touch panel. Among them, the display panel can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of the computer device. These graphical user interfaces can be composed of graphics, guiding information, icons, videos, and any combination thereof. Optionally, the display panel can be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc. The touch panel can be used to collect touch operations of the user on or near it (such as operations of the user using any suitable object or accessory such as a finger or a stylus on or near the touch panel), and generate corresponding operation instructions, and the operation instructions execute the corresponding program. Optionally, the touch panel may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the touch orientation of the user, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact coordinates, and then sends it to the processor 501, and can receive and execute the commands sent by the processor 501. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it is transmitted to the processor 501 to determine the type of touch event. Subsequently, the processor 501 provides a corresponding visual output on the display panel according to the type of touch event. In the embodiments of the present application, the touch panel and the display panel can be integrated into the touch display screen 503 to implement input and output functions. However, in some embodiments, the touch panel and the display panel can be implemented as two independent components to implement input and output functions. That is, the touch display screen 503 can also be used as part of the input unit 506 to implement the input function.

[0257] The radio frequency circuit 504 can be used to transmit and receive radio frequency signals to establish wireless communication with a network device or other computer devices through wireless communication, and transmit and receive signals with the network device or other computer devices.

[0258] The audio circuit 505 can be used to provide an audio interface between the user and the computer device through a speaker and a microphone. The audio circuit 505 can transmit the electrical signal after converting the received audio data to the speaker, and the speaker converts it into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 505 and then converted into audio data. After the audio data is output to the processor 501 for processing, it is transmitted through the radio frequency circuit 504 to, for example, another computer device, or the audio data is output to the memory 502 for further processing. The audio circuit 505 may also include an earphone jack to provide communication between a peripheral earphone and the computer device.

[0259] The input unit 506 can be used to receive input numerical, character information or user feature information (such as fingerprint, iris, facial information, etc.), and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.

[0260] The power supply 507 is used to supply power to each component of the computer device 500. Optionally, the power supply 507 can be logically connected to the processor 501 through a power management system, so as to realize functions such as management of charging, discharging, and power consumption management through the power management system. The power supply 507 can also include any components such as one or more DC or AC power supplies, a recharge system, a power failure detection circuit, a power converter or inverter, and a power status indicator.

[0261] Although Figure 1 not shown in the figure, the computer device 500 may also include a camera, a sensor, a Wi-Fi module, a Bluetooth module, etc., which will not be elaborated here.

[0262] In the above embodiments, the descriptions of the respective embodiments have their own focuses. For parts not detailed in a certain embodiment, reference may be made to the relevant descriptions of other embodiments.

[0263] As can be seen from the above, the computer device provided in this embodiment can obtain the first center position and the first normal direction vector of the candidate model surface in the virtual model, as well as the second center position and the second normal direction vector of the current reference model surface of the candidate model surface, where the current reference model surface and the candidate model surface are not the same model surface; based on the first center position, the first normal direction vector, the second center position, and the second normal direction vector, determine the target distance between the position on the first normal direction vector closest to the second normal direction vector and the first center position; obtain the area of the current reference model surface, and determine the weighting parameter of the first normal direction vector based on the area and the target distance; based on the first normal direction vector, the weighting parameter, and the first center position, determine the center correction vector corresponding to the current reference model surface; based on the center correction vector, the area of the candidate model surface, and the center point coordinate weighting vector corresponding to the previous reference model surface, obtain the center point coordinate weighting vector corresponding to the current reference model surface; based on the center point coordinate weighting vector corresponding to the current reference model surface, and the total area of the candidate model surface and the reference model surfaces that have participated in center correction, determine the currently corrected center point coordinates of the virtual model.

[0264] Those of ordinary skill in the art can understand that all or part of the steps in the above various methods can be completed by instructions, or by controlling relevant hardware through instructions. The instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.

[0265] To this end, an embodiment of the present application provides a computer-readable storage medium, which stores multiple computer programs that can be loaded by a processor to execute the steps in any of the virtual model processing methods provided by the embodiments of the present application. For example, the computer program can execute the following steps:

[0266] Obtain the first center position and the first normal direction vector of the candidate model surface in the virtual model, as well as the second center position and the second normal direction vector of the current reference model surface of the candidate model surface, where the current reference model surface and the candidate model surface are not the same model surface;

[0267] Based on the first center position, the first normal direction vector, the second center position, and the second normal direction vector, determine the target distance between the position on the first normal direction vector closest to the second normal direction vector and the first center position;

[0268] Obtain the area of the current reference model surface, and determine the weighting parameter of the first normal direction vector based on the area and the target distance;

[0269] Based on the first normal direction vector, the weighting parameter, and the first center position, determine the center correction vector corresponding to the current reference model surface;

[0270] Based on the center correction vector, the area of the candidate model surface, and the center point coordinate weighting vector corresponding to the previous reference model surface, obtain the center point coordinate weighting vector corresponding to the current reference model surface;

[0271] Based on the center point coordinate weighting vector corresponding to the current reference model surface, and the total area of the candidate model surface and the reference model surfaces that have participated in center correction, determine the currently corrected center point coordinates of the virtual model.

[0272] In some embodiments, based on the first center position, the first normal direction vector, the second center position, and the second normal direction vector, determining the target distance between the position on the first normal direction vector closest to the second normal direction vector and the first center position includes:

[0273] Based on the vector perpendicular to the first normal direction vector and the second normal direction vector, the first center position, and the second center position, calculate the first distance between the first normal direction vector and the second normal direction vector;

[0274] Determine the moved position corresponding to the second center position after moving the first distance along the first normal direction vector;

[0275] Calculate a target distance based on the distance between the post - movement position and the first central position, the first angle between the vector pointing from the post - movement position to the first central position and the second normal vector, and the second angle between the first normal vector and the second normal vector.

[0276] In some embodiments, calculating a first distance between the first normal vector and the second normal vector based on a vector perpendicular to the first normal vector and the second normal vector, the first central position, and the second central position includes:

[0277] Calculate the cross - product of the first normal vector and the second normal vector to obtain a first vector perpendicular to the first normal vector and the second normal vector;

[0278] Based on the coordinates of the first central position and the second central position, and the first vector, calculate the first distance between the first normal vector and the second normal vector.

[0279] In some embodiments, calculating a first distance between the first normal vector and the second normal vector based on the coordinates of the first central position and the second central position, and the first vector includes:

[0280] Calculate the coordinate difference between the coordinates of the first central position and the coordinates of the second central position to determine a second vector pointing from the second central position to the first central position;

[0281] Calculate the dot - product of the second vector and the first vector, and based on the ratio of the dot - product to the first vector, obtain the first distance.

[0282] In some embodiments, calculating a target distance based on the distance between the post - movement position and the first central position, the first angle between the vector pointing from the post - movement position to the first central position and the second normal vector, and the second angle between the first normal vector and the second normal vector includes:

[0283] Based on the coordinates of the post - movement position and the first central position, calculate a second distance between the post - movement position and the first central position;

[0284] Based on the second distance, the angle between the vector pointing from the post - movement position to the first central position and the second normal vector, and the angle between the first normal vector and the second normal vector, calculate the target distance.

[0285] In some embodiments, calculating a target distance based on the second distance, the angle between the vector pointing from the post - movement position to the first central position and the second normal vector, and the angle between the first normal vector and the second normal vector includes:

[0286] Obtain a first included angle between a vector pointing from the moved position to the first central position and the second normal direction vector, and calculate a first sine value of the first included angle;

[0287] Obtain a second included angle between the first normal direction vector and the second normal direction vector, and calculate a second sine value of the second included angle;

[0288] Determine a target distance based on the ratio of the product value of the first sine value and the second distance to the second sine value.

[0289] In some embodiments, determining a weighting parameter of the first normal direction vector based on the area and the target distance includes:

[0290] Calculate the product value of the area and the target distance to obtain the weighting parameter.

[0291] In some embodiments, determining a center correction vector corresponding to the current reference model surface based on the first normal direction vector, the weighting parameter, and the first central position includes:

[0292] Obtain the total area of all model surfaces of the virtual model, and calculate the difference between the total area and the area of the candidate model surface to obtain a first area difference;

[0293] Calculate the product of the ratio of the weighting parameter and the first area difference and the first normal direction vector to obtain a weighted first normal direction vector;

[0294] Obtain the center correction vector based on the sum value of the weighted first normal direction vector and the coordinates of the first central position.

[0295] In some embodiments, obtaining the weighted vector of the center point coordinates corresponding to the current reference model surface based on the center correction vector, the area of the candidate model surface, and the weighted vector of the center point coordinates corresponding to the previous reference model surface includes:

[0296] Obtain the weighted vector of the previous center point coordinates corresponding to the previous reference model surface that has participated in the center correction of the virtual model with the candidate model surface;

[0297] Calculate the sum value of the product of the center correction vector and the area of the candidate model surface and the previous weighted vector of the center point coordinates to obtain the weighted vector of the current center point coordinates of the current reference model surface participating in the center correction of the virtual model.

[0298] In some embodiments, determining the corrected center point coordinates of the virtual model currently based on the weighted vector of the center point coordinates corresponding to the current reference model surface, and the total area of the candidate model surface and the reference model surfaces that have participated in the center correction includes:

[0299] Obtain the sum value of the areas of all reference model surfaces that have participated in the center correction of the virtual model with the candidate model surface and the area of the candidate model surface;

[0300] Calculate the ratio of the weighted vector of the center point coordinates corresponding to the current reference model face to the area sum value to obtain the current corrected center point coordinates.

[0301] In some embodiments, the method further includes:

[0302] Select a model face from the model faces in the virtual model that have not participated in the center correction as the new current reference model face of the candidate model face, obtain the new corrected center point coordinates, and until the correction end condition is met, obtain the final center point coordinates of the virtual model.

[0303] In some embodiments, the method further includes:

[0304] In response to a rotation operation on the virtual model, control the virtual model to rotate based on the final center point coordinates.

[0305] In this solution, by selecting a candidate model face from the model faces of the virtual model, traversing the normal vectors of other model faces except the candidate model face, determining the distance between the position on the normal vector of the candidate model face that is closest to the normal vector of each model face and the center position of the candidate model face, then calculating the weight of this distance based on the area of the model faces participating in the calculation, after traversing all other model faces, obtaining the weighted distance average value of all model faces, and calculating the approximate center coordinates on the normal vector of the candidate model face based on the candidate model face through the center position, normal vector direction, and weighted distance average value of the candidate model face. In this way, the accurate center point of the virtual model can be obtained.

[0306] For the specific implementation of each of the above operations, reference can be made to the previous embodiments, which will not be elaborated here.

[0307] Wherein, the computer-readable storage medium may include: read-only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disc, etc.

[0308] Since the computer program stored in the computer-readable storage medium can execute the steps in any of the virtual model processing methods provided in the embodiments of the present application, therefore, the beneficial effects that can be achieved by any of the virtual model processing methods provided in the embodiments of the present application can be realized. For details, refer to the previous embodiments, which will not be elaborated here.

[0309] The above has introduced in detail a method, apparatus, computer-readable storage medium, and computer device for processing a virtual model provided by an embodiment of the present application. Specific examples are used herein to illustrate the principle and implementation manner of the present application. The description of the above embodiments is only for helping to understand the method and its core idea of the present application; at the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation on the present application.

Claims

1. A method for processing a virtual model, characterized in that The method includes: Obtaining a first center position and a first normal direction vector of a candidate model surface in a virtual model, and a second center position and a second normal direction vector of a current reference model surface of the candidate model surface, where the current reference model surface and the candidate model surface are not the same model surface; Based on the first center position, the first normal direction vector, the second center position, and the second normal direction vector, determining a target distance between a position on the first normal direction vector closest to the second normal direction vector and the first center position; Obtaining the area of the current reference model surface, and calculating a product value of the area and the target distance to obtain a weighting parameter; Based on the first normal direction vector, the weighting parameter, and the first center position, determining a center correction vector corresponding to the current reference model surface, including: determining a ratio of the weighting parameter to a difference between a total area of all model surfaces of the virtual model and the area of the candidate model surface; obtaining the center correction vector based on a product of the ratio and the first normal direction vector and a coordinate sum value of the first center position; Obtaining a previous center point coordinate weighting vector corresponding to a previous reference model surface that has participated in center correction of the virtual model with the candidate model surface; Calculating a sum value of a product of the center correction vector and the area of the candidate model surface and the previous center point coordinate weighting vector to obtain a current center point coordinate weighting vector for the current reference model surface to participate in center correction of the virtual model; Obtaining a sum value of areas of all reference model surfaces that have participated in center correction of the virtual model with the candidate model surface and the area of the candidate model surface; Calculating a ratio of the center point coordinate weighting vector corresponding to the current reference model surface to the area sum value to obtain the currently corrected center point coordinates.

2. The method according to claim 1, wherein The determining, based on the first center position, the first normal direction vector, the second center position, and the second normal direction vector, a target distance between a position on the first normal direction vector closest to the second normal direction vector and the first center position includes: Calculating a first distance between the first normal direction vector and the second normal direction vector based on a vector perpendicular to the first normal direction vector and the second normal direction vector, the first center position, and the second center position; Determining a moved position corresponding to the second center position after moving the first distance along the first normal direction vector; Calculating the target distance based on a distance between the moved position and the first center position, a first angle between a vector pointing from the moved position to the first center position and the second normal direction vector, and a second angle between the first normal direction vector and the second normal direction vector.

3. The method according to claim 2, wherein The calculating, based on a vector perpendicular to the first normal direction vector and the second normal direction vector, the first center position, and the second center position, a first distance between the first normal direction vector and the second normal direction vector includes: Calculate the vector product of the first normal direction vector and the second normal direction vector to obtain a first vector perpendicular to the first normal direction vector and the second normal direction vector; Based on the coordinates of the first center position and the second center position, and the first vector, calculate the first distance between the first normal direction vector and the second normal direction vector.

4. The method according to claim 3, characterized in that, The calculating the first distance between the first normal direction vector and the second normal direction vector based on the coordinates of the first center position and the second center position, and the first vector includes: Calculate the coordinate difference between the coordinates of the first center position and the coordinates of the second center position to determine a second vector pointing from the second center position to the first center position; Calculate the dot product of the second vector and the first vector, and based on the ratio of the dot product to the first vector, obtain the first distance.

5. The method according to claim 2, wherein The calculating the target distance based on the distance between the moved position and the first center position, the first angle between the vector pointing from the moved position to the first center position and the second normal direction vector, and the second angle between the first normal direction vector and the second normal direction vector includes: Based on the coordinates of the moved position and the first center position, calculate the second distance between the moved position and the first center position; Based on the second distance, the angle between the vector pointing from the moved position to the first center position and the second normal direction vector, and the angle between the first normal direction vector and the second normal direction vector, calculate the target distance.

6. The method according to claim 5, characterized in that, The calculating the target distance based on the second distance, the angle between the vector pointing from the moved position to the first center position and the second normal direction vector, and the angle between the first normal direction vector and the second normal direction vector includes: Obtain the first angle between the vector pointing from the moved position to the first center position and the second normal direction vector, and calculate the first sine value of the first angle; Obtain the second angle between the first normal direction vector and the second normal direction vector, and calculate the second sine value of the second angle; Based on the ratio of the product value of the first sine value and the second distance to the second sine value, determine the target distance.

7. The method according to claim 1, wherein The determining the center correction vector corresponding to the current reference model surface based on the first normal direction vector, the weighting parameter, and the first center position includes: Obtain the total area of all model surfaces of the virtual model, and calculate the difference between the total area and the area of the candidate model surface to obtain a first area difference; Calculate the product of the ratio of the weighting parameter and the first area difference and the first normal direction vector to obtain a weighted first normal direction vector; Based on the sum value of the weighted first normal direction vector and the coordinates of the first center position, obtain the center correction vector.

8. The method according to claim 1, wherein The method further includes: From the model surfaces in the virtual model that do not participate in the center correction, select a model surface as the new current reference model surface of the candidate model surface, obtain the new corrected center point coordinates, and continue until the correction end condition is met to obtain the final center point coordinates of the virtual model.

9. The method according to claim 8, wherein The method further includes: In response to a rotation operation on the virtual model, controlling the virtual model to rotate based on the final center point coordinates.

10. A processing device for a virtual model, characterized in that, The apparatus includes: A first acquisition unit, configured to acquire a first center position and a first normal direction vector of a candidate model surface in the virtual model, and a second center position and a second normal direction vector of the current reference model surface of the candidate model surface, where the current reference model surface and the candidate model surface are not the same model surface; A first determination unit, configured to determine, based on the first center position, the first normal direction vector, the second center position, and the second normal direction vector, a target distance between a position on the first normal direction vector closest to the second normal direction vector and the first center position; A second acquisition unit, configured to acquire an area of the current reference model surface and calculate a product value of the area and the target distance to obtain a weighting parameter; A second determination unit, configured to determine a center correction vector corresponding to the current reference model surface based on the first normal direction vector, the weighting parameter, and the first center position, including: determining a ratio of the weighting parameter to a difference between a total area of all model surfaces of the virtual model and an area of the candidate model surface; obtaining the center correction vector based on a product of the ratio and the first normal direction vector and a coordinate sum value of the first center position; A third determination unit, configured to acquire a previous center point coordinate weighting vector corresponding to a previous reference model surface that has participated in the center correction of the virtual model with the candidate model surface; calculate a sum value of a product of the center correction vector and an area of the candidate model surface and the previous center point coordinate weighting vector to obtain a current center point coordinate weighting vector for the current reference model surface to participate in the center correction of the virtual model; A fourth determination unit, configured to acquire a sum value of areas of all reference model surfaces that have participated in the center correction of the virtual model with the candidate model surface and the area of the candidate model surface; calculate a ratio of the center point coordinate weighting vector corresponding to the current reference model surface to the area sum value to obtain the currently corrected center point coordinates.

11. A computer device, comprising a memory, a processor, and a computer program stored on the memory and running on the processor, wherein, When the processor executes the program, it implements the method for processing a virtual model according to any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores multiple instructions, and the instructions are suitable for being loaded by a processor to execute the method for processing a virtual model according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Trimming method of detail level of 3D geometric virtual model based on point, line and surface

    CN109410332A

  • Spatial model processor

    JP2018106643A