A simulation method, device, electronic device and medium based on connection relationship
By building connection units on the overlapping surface of the composite body and establishing a spring model, the problem of high grid division requirements and inability to slide in the prior art is solved, and the flexible simulation effect of the composite body is achieved.
Patent Information
- Application Number
- CN202411008284.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-25
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2044-07-25
AI Technical Summary
The prior art requires high meshing requirements for material areas in simulated composites, and the connection relationship on the overlapping surface cannot slide, which limits the simulation effect of the composite.
The connecting unit is constructed on the overlapping surface of the composite body, and a spring model is established based on the connection relationship of multiple objects, including vertical and in-plane springs, and the vertex simulation parameters on the connecting unit are derived to support the relative motion of the object in vertical and parallel directions. .
It reduces the requirements for mesh division, expands the simulation flexibility of the composite, supports the relative movement of the composite on the overlapping surface, and improves the simulation effect.
Smart Images

Figure CN118536237B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer simulation technology, and in particular to a simulation method, device, electronic device and medium based on connection relationship. Background Art
[0002] Objects in the real world will deform when they are subjected to force, but the ability of different objects to deform varies greatly. Objects such as rubber, cloth, and paper are easy to deform, while objects such as metal, rock, and the ground are difficult to deform. There are also composite objects made of multiple materials such as table tennis rackets, which have parts that are easy to deform and parts that are not easy to deform.
[0003] In the process of graphics simulation, it is often necessary to divide such composite objects into multiple regions, and then assign different physical properties to different regions. Taking the racket as an example, the flexible surface rubber layer is simulated as a soft body, while the wooden racket body is simulated as a rigid body that cannot be deformed.
[0004] At present, the overlapping surface between the surface rubber layer and the racket body usually needs to be bound to the surface rubber layer and the racket body based on topological fusion, and the complex body is uniformly meshed. The flexible body area and the rigid body area are continuous on the mesh, and the specific material is assigned to different mesh areas in subsequent simulations to calculate accurate mesh deformation and movement.
[0005] However, the meshes of different material areas are naturally a whole, and the simulation solution can strictly ensure the consistency of deformation between multiple areas, but the requirements for mesh division are high. In addition, the connection relationship between multiple objects with topological fusion on the overlapping surface is completely bound and cannot slide against each other, which will limit the simulation effect of many complex objects. Summary of the invention
[0006] In order to overcome the problems existing in the related art, the present application provides a simulation method, device, electronic device and medium based on connection relationship.
[0007] According to a first aspect of any embodiment of the present application, a simulation method based on a connection relationship is provided, the method comprising:
[0008] Constructing a connection unit on the overlapped surface in the composite body; the connection unit connects a plurality of objects in the composite body on the overlapped surface, the plurality of objects having different deformation capabilities;
[0009] According to the connection relationship of the multiple objects, a spring model is established for the connection unit; wherein the spring model includes: a vertical spring perpendicular to the overlap surface, and an in-plane spring parallel to the overlap surface;
[0010] Based on the endpoint simulation parameters of the spring model, simulation parameters of each vertex on the connection unit are derived to simulate the composite body.
[0011] According to a second aspect of any embodiment of the present application, a simulation device based on a connection relationship is provided, the device comprising:
[0012] A connection unit construction module is used to construct a connection unit on the overlapped surface in the complex; the connection unit connects a plurality of objects in the complex on the overlapped surface, and the plurality of objects have different deformation capabilities;
[0013] A spring model building module, used to build a spring model for the connection unit according to the connection relationship of the multiple objects; wherein the spring model includes: a vertical spring perpendicular to the overlap surface, and an in-plane spring parallel to the overlap surface;
[0014] The composite body simulation module is used to derive simulation parameters of each vertex on the connection unit based on the endpoint simulation parameters of the spring model to simulate the composite body.
[0015] According to a third aspect of any embodiment of the present application, there is provided an electronic device, including:
[0016] processor;
[0017] a memory for storing processor-executable instructions;
[0018] The processor implements the method described in any embodiment of the present application by running the executable instructions.
[0019] According to a fourth aspect of any embodiment of the present application, a computer-readable storage medium is provided, on which computer instructions are stored. When the instructions are executed by a processor, the method described in any embodiment of the present application is implemented.
[0020] According to a fifth aspect of any embodiment of the present application, a computer program product is provided, on which a computer program / instruction is stored. When the computer program / instruction is executed by a processor, the method described in any embodiment of the present application is implemented.
[0021] The technical solution provided by this application may have the following beneficial effects:
[0022] According to the above embodiments, a connection unit is constructed on the overlapping surface in the composite body, and according to the connection relationship of the multiple objects, a vertical spring perpendicular to the overlapping surface and an in-plane spring parallel to the overlapping surface are established for the connection unit. Based on the endpoint simulation parameters of the spring model, the simulation parameters of each vertex on the connection unit are derived to simulate the composite body. Since the multiple objects on the overlapping surface are bound to the connection unit through the spring model, the endpoints of the spring model will not be restricted by the divided grid. While greatly reducing the requirements for grid division, it supports the relative movement of multiple objects in the perpendicular and parallel directions of the overlapping surface, expands the simulation effects of different connection relationships, and improves the flexibility of the simulated composite body.
[0023] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The accompanying drawings, which are incorporated in the specification and constitute a part of this application, illustrate embodiments consistent with the application and, together with the description, serve to explain the principles of the application.
[0025] Figure 1 is a schematic diagram of a topologically fused complex according to an exemplary embodiment of the present application;
[0026] Figure 2 is a schematic diagram of a compression and extension spring model according to an exemplary embodiment of the present application;
[0027] Figure 3 is a flow chart of a simulation method based on connection relationship according to an exemplary embodiment of the present application;
[0028] Figure 4 is a schematic diagram of a composite body according to an exemplary embodiment of the present application;
[0029] Figure 5 is a schematic diagram of a connection unit and a spring model according to an exemplary embodiment of the present application;
[0030] Figure 6 is a flow chart of another simulation method based on connection relationship according to an exemplary embodiment of the present application;
[0031] Figure 7 is a structural schematic diagram of an electronic device according to an exemplary embodiment of the present application;
[0032] Figure 8 It is a block diagram of a simulation device based on connection relationship according to an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0033] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0034] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0035] It should be understood that although the terms first, second, third, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0036] Currently, objects of different materials are usually bound based on topological fusion. Figure 1 A schematic diagram showing a topologically fused complex, assuming Figure 1 The black-edged cube 101 in the figure is a soft body, and the red-edged tetrahedron 102 is a rigid body.
[0037] During the simulation, the composite body is uniformly meshed, the flexible body region and the rigid body region are continuous on the mesh, and different mesh regions are assigned to the cube 101 and the tetrahedron 102 to calculate accurate mesh deformation and movement.
[0038] This simulation method has high requirements for mesh division, and the cube 101 and the tetrahedron 102 are completely bound on the overlapping surface, and there is no sliding between them. This binding method limits the simulation effect of many complex objects. For example, a human hand can be simply modeled as a skeleton and a thin layer of skin. Through topological fusion, this layer of skin cannot slide on the surface of the skeleton to a certain extent.
[0039] In order to solve the above problems, the present application proposes a simulation method based on connection relationship. Before introducing the simulation method, in order to make the description of the simulation method easier to understand, some concepts involved in the subsequent description of the embodiments of the present application are first explained:
[0040] 1) Spring model
[0041] The spring model is a basic physical model. Figure 2 , Figure 2 A schematic diagram of a compression and extension spring model is shown. The basic components of the spring model are multiple endpoints ( , ), original length and spring stiffness .
[0042] The elastic energy formula of the spring model is shown in formula (1):
[0043] (1)
[0044] in, represents the spring energy in the spring model, represents the original length of the spring model, represents the spring stiffness of the spring model, Represents the distance between the two end points of the spring.
[0045] This distance deviates from the original length The larger the elastic energy in the spring model The larger the value, the greater the spring force on both ends of the spring model, and the force ( and ) always points in the direction that returns the spring to its original length.
[0046] The core information of the spring model used in the simulation process is the spring force and the Hessian Matrix. The Hessian Matrix is used to characterize the strength of the spring model against external forces.
[0047] The spring force on the spring model can be calculated based on the first-order partial derivative formula (2) of the spring energy with respect to the end point position of the spring model:
[0048] (2)
[0049] in, represents the vector composed of spring forces at multiple endpoints, Represents the endpoint vector composed of the coordinates of multiple endpoints, referred to as endpoint position. Represents the spring energy within the spring model.
[0050] The Hessian matrix can be calculated based on the second-order partial derivative formula (3) of the spring energy with respect to the end point position:
[0051] (3)
[0052] in, represents the Hessian matrix, represents the end point position of the spring model, Represents the spring energy in the spring model. Hessian matrix The number of matrix rows and columns is the number of endpoints of the spring model.
[0053] To further illustrate the present application, the following examples are provided:
[0054] See also Figure 3 , Figure 3 This is a flow chart of a simulation method based on connection relationship according to an exemplary embodiment of the present application. The execution subject of the simulation method can be a terminal device or a server, and the terminal device is an electronic device such as a computer, a tablet computer, a smart phone, a laptop computer, a personal digital assistant, etc.
[0055] Taking the execution subject as a terminal device as an example, the simulation method based on the connection relationship may include the following steps:
[0056] Step 302: constructing a connection unit on the overlapping surfaces in the complex; the connection unit connects multiple objects in the complex on the overlapping surfaces, and the multiple objects have different deformation capabilities.
[0057] In this step, the terminal device may construct a connection unit on the overlapping surface in the complex according to a preset connection unit, and the connection unit connects multiple objects in the complex on the overlapping surface.
[0058] The terminal device can divide the surfaces of multiple objects using a triangular mesh, a quadrilateral mesh, or other meshes based on a mesh method. According to the meshes divided by the multiple objects on the overlapping surfaces, connection units such as point-triangular mesh, triangle mesh-triangular mesh, etc. are constructed on the overlapping surfaces.
[0059] The terminal device can also construct point-to-point connection units on the overlapping surface based on the particle-free grid method and several particles of multiple objects on the overlapping surface. This point-to-point connection unit is not restricted by the grid and can be established more freely.
[0060] Among them, multiple objects in the complex have different deformation capabilities, and multiple objects are bound by overlapping surfaces. Multiple objects in the complex, for example: skin and bones, the surface rubber layer and the racket body of a racket, etc.
[0061] The connection unit is used to characterize the connection status between multiple objects bound by overlapping surfaces, such as point-point, point-triangle mesh, triangle mesh-triangle mesh, point-quadrilateral mesh, triangle mesh-quadrilateral mesh, etc.
[0062] The preset connection unit may be a connection unit pre-selected by the receiving user according to needs, or may be set according to factors such as the binding relationship and material of multiple objects.
[0063] Figure 4 A schematic diagram of a complex is shown. Figure 4 As shown in the oblique view in FIG. 4 , the complex body includes: a soft body 401 and a rigid body 402. A thin layer of soft body 401 (red transparent area) is connected to the top surface of the rectangular rigid body 402. The soft body 401 and the rigid body 402 have different deformation capabilities.
[0064] Since the material of the soft body 401 is very thin, the soft body 401 is represented by its center plane ( Figure 4 The blue plane in the figure represents the Figure 4 As shown in the front view in , the deformation of the center plane is used to represent the deformation of the flexible body, h represents the distance between the center plane and the rigid body 402, that is, half of the thickness of the flexible body 401, and N is the normal vector on the coincident surface of the flexible body 401 and the rigid body 402.
[0065] Understandably, Figure 4 The composite body shown is only an example. The composite body may also include multiple composite surfaces and multiple objects bound by the multiple composite surfaces. The multiple objects bound by the composite surfaces may also be multiple flexible bodies with different deformation capabilities. The embodiments of the present application do not impose any restrictions on this.
[0066] Step 304: Establish a spring model for the connection unit according to the connection relationship between the multiple objects; wherein the spring model includes: a vertical spring perpendicular to the overlap surface, and an in-plane spring parallel to the overlap surface.
[0067] In this step, the terminal device can receive the connection relationship of multiple objects in the complex on the composite surface set by the user according to the simulation requirements. According to the connection relationship of the multiple objects, spring models such as vertical springs and in-plane springs are established for the connection units, so that each connection relationship can achieve the corresponding simulation effect through the spring model.
[0068] The connection relationship is used to characterize the connection mode, interaction and other combination relationships of multiple objects on the overlapping surface, for example: elastic connection within the overlapping surface, vertical elastic connection, elastic connection at a preset angle, etc.
[0069] Elastic connection within the overlapping surface refers to the elastic connection of multiple objects on the overlapping surface in a direction parallel to the overlapping surface, vertical elastic connection refers to the elastic connection of multiple objects in a direction perpendicular to the overlapping surface, and elastic connection at a preset angle refers to the elastic connection of multiple objects in a direction at a preset angle such as 45°, 60°, etc. of the overlapping surface.
[0070] The spring model at least includes: a vertical spring perpendicular to the overlap surface, and an in-plane spring parallel to the overlap surface. The vertical spring is a spring model perpendicular to the overlap surface, which is used to simulate the interaction and deformation of multiple objects in the perpendicular direction of the overlap surface. The in-plane spring is a spring model parallel to the overlap surface, which is used to simulate the interaction and deformation of multiple objects in the parallel direction of the overlap surface.
[0071] The terminal device can also set basic parameters such as material properties and spring stiffness of the spring model according to the connection relationship, and simulate the simulation effect corresponding to the connection relationship through the spring model.
[0072] Step 306: Based on the endpoint simulation parameters of the spring model, the simulation parameters of each vertex on the connection unit are derived, and the composite body is simulated.
[0073] In this step, the terminal device calculates the simulation parameters of each vertex on the connection unit based on the spring force of the spring model and the endpoint simulation parameters such as the Hessian matrix by direct derivation method, chain rule, etc. According to the simulation parameters, the complex is simulated to update the positions and velocities of multiple objects in the complex.
[0074] The endpoint simulation parameters are used to describe the dynamic behavior of the endpoints of the spring model, and may include parameters such as the spring force and Hessian matrix of the endpoints. The simulation parameters are used to describe the dynamic behavior of each vertex on the connection unit, and may include parameters such as the spring force and Hessian matrix.
[0075] The connection relationship-based simulation method of this embodiment constructs a connection unit on the overlapping surface in the composite body, and according to the connection relationship between the two objects, establishes a vertical spring perpendicular to the overlapping surface and an in-plane spring parallel to the overlapping surface for the connection unit, and derives the simulation parameters of each vertex on the connection unit based on the endpoint simulation parameters of the spring model to simulate the composite body. Since the two objects on the overlapping surface are bound on the connection unit through the spring model, the endpoints of the spring model will not be restricted by the divided grid. While greatly reducing the requirements for grid division, it supports the relative movement of the two objects in the perpendicular and parallel directions of the overlapping surface, expands the simulation effects of different connection relationships, and improves the flexibility of the simulated composite body.
[0076] In the above-mentioned embodiment, it is introduced that according to the connection relationship of multiple objects on the coincident surface, a spring model is established for the connection unit, and based on the endpoint simulation parameters of the spring model, the simulation parameters of each vertex on the connection unit are calculated to simulate the complex body. In the following embodiment, a more detailed description will be given on how to use the in-plane spring and the vertical spring to simulate the complex body, which can be applied to any of the above embodiments.
[0077] In one embodiment, the connection relationship between the multiple objects on the overlapped surface includes at least: elastic connection within the overlapped surface and vertical elastic connection. The terminal device establishes at least a vertical spring and an in-plane spring for the connection unit.
[0078] The terminal device establishes a vertical spring for the connection unit according to the vertical elastic connection on the overlap surface, so that multiple objects on the overlap surface can slide against each other in the vertical direction of the overlap surface through the vertical spring.
[0079] Furthermore, according to the elastic connection within the overlapped surface, an in-plane spring is established for the connection unit, and multiple objects on the overlapped surface can slide relative to each other in a direction parallel to the overlapped surface through the in-plane spring.
[0080] As described above, a vertical spring is established for the connection unit based on the vertical elastic connection on the overlapping surface, and an in-plane spring is established for the connection unit based on the in-plane elastic connection on the overlapping surface. The in-plane spring and the vertical spring are used to realize the connection relationship between the in-plane elastic connection and the vertical elastic connection of multiple objects on the overlapping surface, thereby realizing the simulation effect of two objects sliding against each other on the overlapping surface.
[0081] Furthermore, the endpoints of the vertical spring are respectively a first endpoint and a second endpoint, and the endpoints of the in-plane spring are respectively a third endpoint and a fourth endpoint.
[0082] The terminal device vertically establishes a vertical spring between the first unit and the second unit of the connection unit, the first end point of the vertical spring is connected to the first unit, and the second end point of the vertical spring is connected to the second unit.
[0083] An in-plane spring is established between the first unit and the second unit, the third end point of the in-plane spring is connected to a fixed position on the first unit, and the fourth end point of the in-plane spring is connected to a fixed position on the second unit, so that multiple objects on the overlapping surface can be elastically connected in the vertical direction and parallel direction of the overlapping surface.
[0084] The multiple objects in the complex include: a first object and a second object. The first object and the second object have different deformation capabilities, and may be a flexible body and a rigid body, two flexible bodies with different deformation capabilities, etc. The overlap surface is the connection surface of the first object and the second object.
[0085] The connection unit includes: a first unit corresponding to the first object and a second unit corresponding to the second object. The first unit is used to characterize the deformation information and speed of the first object, and the second unit is used to characterize the deformation information and speed of the second object. The first unit and the second unit can be points, triangular meshes, quadrilateral meshes, etc.
[0086] The fixed position on the first unit is used to fix the connection between the first unit and the in-plane spring, and the fixed position on the second unit is used to fix the connection between the second unit and the in-plane spring.
[0087] See also Figure 5 , Figure 5 A schematic diagram of a connection unit and a spring model is shown. Figure 4 Taking the composite body shown as an example, the first object is a flexible body 401, and the second object is a rigid body 402. The terminal device divides the surface meshes of both the flexible body 401 and the rigid body 402 into triangular meshes.
[0088] Since the flexible body 401 is entirely located on the surface of the rigid body 402, it can be known that each point of the flexible body 401 on the coincident surface falls on a certain triangle mesh of the rigid body 402. A point-triangle mesh connection unit can be constructed on the coincident surface in the composite body.
[0089] The first unit is the blue dot. , the first unit is a vertex on the mesh of the blue center plane of the soft body 401. The second unit is a triangle , the second unit is a triangular mesh of the surface of the rigid body 402.
[0090] At the same time, the second unit is also the first unit point The binding surface of The height to the triangle mesh is , For point Projected point on the triangle mesh.
[0091] Exemplarily, the simulation requirements of the flexible body 401 and the rigid body 402 in the composite body are that the flexible body 401 is always in close contact with the surface of the rigid body 402, and the flexible body 401 can slide on the surface of the rigid body 402 after receiving a force, and return to its original state after the external force is removed.
[0092] The terminal device splits the simulation requirements into independent connection relationships, and the connection relationship between the flexible body 401 and the rigid body 402 is a vertical elastic connection and an elastic connection within the overlapped surface.
[0093] According to the connection relationship of the vertical elastic connection, a vertical spring 501 is vertically established between the first unit and the second unit, and the vertical spring 501 is always perpendicular to the coincidence surface. Connect, with the second endpoint at point In the triangle mesh Projection point The second terminal and the second unit Connect. When When moving in a parallel direction, the point The projection point Also moves synchronously.
[0094] Among them, the initial length of the vertical spring 501 for , spring strength It needs to be very strong to ensure that the length of the vertical spring 501 is always , thereby achieving a simulation effect in which the soft body 401 is always closely attached to the surface of the rigid body 402 .
[0095] According to the connection relationship of the elastic connection in the coincidence surface, the fixed position on the first unit is the first unit point , the fixed position on the second unit is the first unit point The initial position, that is, at point Initial projection point on the second element The height directly above is fixed position.
[0096] An in-plane spring 502 is established between the first unit and the second unit. The in-plane spring 502 is always parallel to the overlapped surface. The third end point of the in-plane spring 502 is aligned with the first unit point. The fourth end point of the in-plane spring 502 is fixedly connected to the first unit point The initial position of the connection is fixed.
[0097] The vertical spring 501 ensures that the first unit point Always with the second unit The distance is After the external force is removed, the flexible body 401 will return to its original position on the surface of the rigid body 402, and the fourth end point of the in-plane spring 502 is always fixed at the first unit point. The initial position and the initial length of the in-plane spring 502 is 0, ensuring the first unit point Always located at the second unit for within the plane.
[0098] The spatial position of the triangular mesh may change during the simulation. The initial position needs to pass through the initial projection point and height Calculate the strength of the in-plane spring 502 It needs to be determined according to the sliding effect of the soft body 401 required by the user.
[0099] Understandably, Figure 5The connection unit and spring model shown are only examples. Point-to-point, triangle mesh-to-triangle mesh or other connection units can also be established, and spring models can be established at other locations of multiple objects on the overlapping surface. The embodiments of the present application are not limited to this.
[0100] As described above, by establishing a vertical spring vertically between the first unit and the second unit, the first object and the second object are bound by the first end point and the second end point of the vertical spring, thereby realizing the simulation effect of elastic connection in the vertical direction of the overlapping surface; an in-plane spring is established between the first unit and the second unit, so that the third end point of the in-plane spring is connected to a fixed position on the first unit, and the fourth end point of the in-plane spring is connected to a fixed position on the second unit, thereby realizing the simulation effect of elastic connection in the parallel direction of the overlapping surface.
[0101] Furthermore, based on the vertex positions of the mesh vertices in the connection unit, the normal information of the coincident surface on the connection unit is calculated to obtain the endpoint position of the spring model. If the endpoint of the spring model is connected to a fixed position on the surface of the connection unit, the endpoint position of the spring model is calculated based on the local coordinates corresponding to the fixed position.
[0102] The local coordinates are used to record the relative position of the fixed position relative to the connection unit, for example, the local coordinates of the initial projection point of the initial position of the first unit on the second unit.
[0103] The endpoint position is the position information of the endpoint of the spring model, and is used to represent the endpoint simulation parameters of the spring model. The vertex position is the position information of the mesh vertex of the mesh in the connection unit.
[0104] Please continue reading Figure 5 The second end of the vertical spring 501 is connected to the second unit Connectivity, triangle mesh Normal information of the plane .
[0105] Since the side length of the triangle mesh does not change, only the spatial position of the vertices of the triangle mesh changes, the terminal device can calculate the normal information according to the following formula (4):
[0106] (4)
[0107] in, Represents a triangular mesh Normal information of the plane, Represents a triangular mesh The product of the two side lengths, is the vertex and The absolute value of the coordinate difference between represents the side length Length, is the vertex and The absolute value of the coordinate difference between represents the side length Length.
[0108] End point position of the first end point of the vertical spring 501 , the endpoint position of the second endpoint Located at point In the triangle mesh Projection point The terminal device can calculate the endpoint position of the second endpoint according to the following formula (5):
[0109] (5)
[0110] in, represents the endpoint position of the second endpoint of the vertical spring 501, Indicate point With triangle mesh The distance between. , , Respectively represent the vertex positions of the three vertices of the triangle.
[0111] The fourth end point of the in-plane spring 502 is aligned with the first unit point The initial position of the fixed connection, the local coordinates corresponding to the fixed position are used to record the initial projection point corresponding to the fixed position The relative position on the triangle mesh.
[0112] This local coordinate will be used to constrain the point of soft body 401 Sliding in the transverse plane, the in-plane spring 502 points The force will always point to the point The local coordinates corresponding to the fixed positions will be used as constants in the simulation.
[0113] The terminal device can calculate the local coordinates of the fixed position according to the following formula (6) before the simulation is started:
[0114] (6)
[0115] in, Indicates the coordinate position of the initial projection point , and Represents the local coordinates of the initial projection point. Respectively represent the vertex positions of the three vertices in the triangle.
[0116] The end point position of the third end point of the in-plane spring 502 , the endpoint position of the fourth endpoint Fixed at point Above The terminal device can calculate the endpoint position of the fourth endpoint according to the following formula (7):
[0117] (7)
[0118] in, represents the endpoint position of the fourth endpoint of the in-plane spring 502, Indicate point With triangle mesh The distance between. Respectively represent the vertex positions of the three vertices in the triangle.
[0119] It can be understood that the mathematical expression of the endpoint positions of the vertical spring and the in-plane spring shown in the embodiment of the present application is only an example, and the endpoint positions can also be calculated by other mathematical expressions, and the embodiment of the present application is not limited to this.
[0120] As described above, the endpoint position of the spring model is obtained by calculating the normal information of the overlapping surface on the connection unit based on the vertex positions of the mesh vertices in the connection unit, ensuring that the stretching and compression directions of the spring model are consistent with the plane directions of the mesh; if the endpoint of the spring model is connected to a fixed position on the surface in the connection unit, the endpoint position of the spring model is calculated based on the local coordinates corresponding to the fixed position, ensuring that the behavior of the spring model is consistent with the local motion corresponding to the fixed position, thereby further enhancing the authenticity of the simulation.
[0121] Furthermore, the terminal device may use the chain rule of derivation to deduce the endpoint simulation parameters corresponding to the spring model based on the energy model of the spring model, and obtain the simulation parameters of each vertex of each spring model on the connection unit.
[0122] The chain rule of derivation is used for all spring models corresponding to the connection unit to calculate the endpoint simulation parameters of each spring model on multiple vertices of the connection unit. The endpoint simulation parameters corresponding to each spring model on the same vertex are added together to obtain the final simulation parameters of multiple vertices.
[0123] The energy model of the spring model is used to represent the elastic energy in the spring model, which can be obtained using the elastic energy formula of formula (1).
[0124] Taking the simulation parameters of spring force and Hessian matrix as an example, the terminal device can calculate the spring force and Hessian matrix corresponding to the spring model according to the following formula (8):
[0125] (8)
[0126] in, and It can be calculated by applying formula (1), formula (2) and formula (3), and the remaining term and It can be derived from the relationship between the end point position of the spring model and the vertex position of each vertex on the connection unit, that is, it can be derived from formula (5) and formula (7).
[0127] Formula (8) is applied to all spring models corresponding to the connection unit to calculate the spring force and Hessian matrix of each spring model at multiple vertices of the connection unit. The spring forces corresponding to each spring model at the same vertex are added together, and the Hessian matrices corresponding to each spring model at the same vertex are added together to obtain the final spring force and Hessian matrix of multiple vertices.
[0128] The calculation of the final simulation parameters has no requirements on the type of spring model. As long as the end point positions of the spring model can be represented by the vertex positions of the connection unit, the simulation can be performed.
[0129] As mentioned above, by adopting the chain rule and based on the energy model of the spring model, the endpoint simulation parameters corresponding to the spring model are derived, and the endpoint simulation parameters corresponding to the spring model are added to obtain the simulation parameters of each vertex. The derivative calculation of complex connection relationships can be decomposed into a series of simple derivative calculations, greatly reducing the difficulty of derivative calculations of complex connection relationships.
[0130] In the above-mentioned embodiment, it is introduced that the connection unit is constructed by the grid method, the in-plane spring and the vertical spring are established for the connection unit, and the simulation parameters of each vertex on the connection unit are calculated based on the endpoint simulation parameters of the in-plane spring and the vertical spring by using the chain rule. In the following embodiment, how to construct a spring model according to the connection relationship of multiple objects will be described in more detail, and it can be applied to any of the above embodiments.
[0131] In one embodiment, the simulation requirement between multiple objects on the overlapping surface is that it is easier to slide up and down on the overlapping surface than left and right. In addition to the elastic connection within the overlapping surface and the vertical elastic connection, the connection relationship of the multiple objects also includes the difficulty of sliding.
[0132] When establishing the spring model, the terminal device can set the spring strength of the spring model according to the difficulty of sliding on the overlapped surface. The more difficult the sliding difficulty is, the greater the spring stiffness of the spring model is; the easier the sliding difficulty is, the smaller the spring stiffness of the spring model is.
[0133] The sliding difficulty is used to constrain the difficulty of sliding between multiple objects on the overlapping surface. The sliding difficulty is determined according to the placement direction of the spring model, for example: the sliding difficulty in the parallel direction, the sliding difficulty in the vertical direction, etc.
[0134] Taking the above-mentioned simulation requirement that sliding up and down on the overlapping surface is easier than sliding left and right as an example, sliding in the vertical direction on the overlapping surface is easier than sliding in the parallel direction. When establishing the in-plane spring and the vertical spring, the terminal device can set the spring stiffness of the vertical spring to be smaller than the spring stiffness of the in-plane spring.
[0135] As described above, by setting the spring strength of the spring model according to the difficulty of sliding on the overlapping surface, the simulation effect of the connection relationship with different sliding difficulties on the overlapping surface is achieved.
[0136] In one embodiment, the simulation requirement between multiple objects on the overlapping surface is that the objects cannot return to the original position after the sliding distance on the overlapping surface exceeds a certain limit. In addition to the elastic connection within the overlapping surface and the vertical elastic connection, the connection relationship between the multiple objects also includes a sliding distance constraint.
[0137] During the simulation of the terminal device, if the stretching length of the spring model exceeds the preset threshold corresponding to the sliding distance constraint, the multiple objects on the overlapping surface do not need to return to their initial positions. The spring model is invalidated and the spring model is re-established according to the current positions of the multiple objects on the overlapping surface.
[0138] The sliding distance constraint is used to constrain the sliding distance between multiple objects on the overlapping surface. The sliding distance is determined according to the placement direction of the spring model, for example: the sliding distance in the parallel direction, the sliding distance in the vertical direction, etc.
[0139] As described above, by re-establishing the spring model if the stretching length of the spring model exceeds the preset threshold corresponding to the sliding distance constraint, a simulation effect corresponding to the sliding distance constraint, such as the inability of the two objects to return to the original position after the sliding distance exceeds a certain limit, is achieved.
[0140] In one embodiment, the simulation requirement between multiple objects on the overlapping surface is that the faster the sliding speed on the overlapping surface, the harder it is to slide. Therefore, the connection relationship between the multiple objects includes not only elastic connection within the overlapping surface and vertical elastic connection, but also sliding speed constraint.
[0141] When establishing the spring model, the terminal device can calculate the velocity vector of the endpoint of the spring model based on the sliding velocity constraints such as the maximum velocity and allowed direction on the overlapping surface, and the physical properties such as the elastic coefficient and damping of the spring model and the current state such as the position and velocity.
[0142] Project the velocity vector onto the coincident surface to ensure that it satisfies the sliding velocity constraint. Add the velocity vector that satisfies the sliding velocity constraint to equations (5) and (7), and use the velocity vector to calculate the end point simulation parameters of the spring model.
[0143] The sliding speed constraint is used to constrain the sliding speed of multiple objects on the overlapping surface. The sliding speed is determined according to the placement direction of the spring model, for example: the sliding speed in the parallel direction, the sliding speed in the vertical direction, etc.
[0144] Taking the simulation requirement that the faster the sliding speed on the overlapping surface, the harder it is to slide as an example, the terminal device adjusts the velocity vector of the endpoint to reflect this damping effect, and can calculate the damping force based on the sliding speed constraint. The damping force can be a simple linear function or a more complex nonlinear function.
[0145] The velocity change caused by the damping force is subtracted from the endpoint's velocity vector to obtain a new velocity vector. The updated velocity vector and the given time step (usually the simulation frame time) are used to calculate the endpoint simulation parameters for the endpoint on the coincident surface.
[0146] As described above, by calculating the endpoint simulation parameters of the spring model based on the velocity vector of the endpoint of the spring model according to the sliding velocity constraint on the overlap surface, the simulation effect of the connection relationship of different sliding velocity constraints on the overlap surface is achieved.
[0147] To further illustrate the simulation process based on connection relationship, Figure 6 A flowchart of another simulation method based on connection relationship is shown. The simulation method based on connection relationship may include the following steps:
[0148] Step 602: Construct connection units on the coincident surfaces in the composite body.
[0149] In this step, the terminal device constructs a connection unit connecting multiple objects in the complex on the overlapping surface in the complex.
[0150] Step 604: Establish a vertical spring for the connection unit according to the vertical elastic connection on the overlapped surface.
[0151] In this step, the terminal device establishes a vertical spring for the connection unit according to the connection relationship of the vertical elastic connection on the overlapped surface. A vertical spring is vertically established between the first unit and the second unit, the first end of the vertical spring is connected to the first unit, and the second end of the vertical spring is connected to the second unit.
[0152] Step 606: Establish an in-plane spring for the connection unit according to the in-plane elastic connection on the overlapping surface.
[0153] In this step, the terminal device establishes an in-plane spring for the connection unit according to the connection relationship of the elastic connection in the overlapped surface on the overlapped surface, and establishes an in-plane spring between the fixed position on the first unit and the fixed position on the second unit.
[0154] Step 608: According to the difficulty of sliding on the overlapping surface, the spring strength of the spring model is set.
[0155] In this step, the terminal device sets the spring strength of the in-plane spring according to the ease of sliding of the multiple objects in the parallel direction of the overlapped surface, and sets the spring strength of the vertical spring according to the ease of sliding of the multiple objects in the vertical direction of the overlapped surface.
[0156] Step 610: The terminal device calculates the normal information of the coincident surface on the connection unit based on the vertex positions of the mesh vertices in the connection unit, and obtains the endpoint position of the spring model.
[0157] Step 612: The terminal device calculates the endpoint position of the spring model based on the local coordinates corresponding to the fixed position.
[0158] Step 614: Calculate the endpoint simulation parameters of the spring model according to the sliding velocity constraint on the coincident surface and the velocity vector of the endpoint of the spring model.
[0159] In this step, the terminal device calculates the endpoint simulation parameters of the spring model based on the sliding speed constraint on the coincident surface, the normal vector of the plane where the grid is located, the local coordinates and other parameters, combined with the velocity vector and the endpoint position of the spring model.
[0160] Step 616: Using the chain rule and based on the energy model of the spring model, derive the endpoint simulation parameters corresponding to the spring model.
[0161] In this step, the terminal device uses the chain rule to derive the endpoint simulation parameters corresponding to the spring model based on the energy model of the spring model.
[0162] Step 618: Add the endpoint simulation parameters corresponding to the spring model to obtain simulation parameters of multiple vertices.
[0163] In this step, the terminal device adds the endpoint simulation parameters corresponding to each spring model on the same vertex to obtain the final simulation parameters of multiple vertices.
[0164] Step 620: Simulate the composite body based on the simulation parameters on the connection unit.
[0165] In this step, the complex is simulated based on the simulation parameters of the multiple vertices on the connection unit to achieve a simulation effect corresponding to the connection relationship.
[0166] Step 622: According to the sliding distance constraint on the overlapped surface, if the stretching length of the spring model exceeds a preset threshold value corresponding to the sliding distance constraint, the spring model is re-established.
[0167] In this step, during the simulation process, according to the sliding distance constraint on the overlapped surface, if the stretching length of the spring model exceeds a preset threshold value corresponding to the sliding distance constraint, the spring model is re-established.
[0168] Figure 7 1 is a schematic diagram of a structure of an electronic device according to an exemplary embodiment of the present application. The electronic device may be, for example, a mobile phone, a computer, a digital broadcast terminal, a message transceiver device, a game console, a tablet device, a personal digital assistant, a server, a smart home appliance, etc. Figure 7 At the hardware level, the electronic device includes a processor 702, an internal bus 704, a network interface 706, a memory 708, and a non-volatile memory 710, and may also include hardware required for other services. The processor 702 reads the corresponding computer program from the non-volatile memory 710 into the memory 708 and then runs it, forming a simulation device based on the connection relationship at the logical level. Of course, in addition to the software implementation, this application does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0169] Figure 8 is a block diagram of a simulation device based on a connection relationship according to an exemplary embodiment of the present application. Figure 8 The device may include: a connection unit construction module 802, a spring model establishment module 804 and a complex body simulation module 806, wherein:
[0170] The connection unit construction module 802 is used to construct a connection unit on the overlapped surface in the composite body; the connection unit connects multiple objects in the composite body on the overlapped surface, and the multiple objects have different deformation capabilities;
[0171] The spring model building module 804 is used to build a spring model for the connection unit according to the connection relationship of the multiple objects; wherein the spring model includes: a vertical spring perpendicular to the overlap surface, and an in-plane spring parallel to the overlap surface;
[0172] The composite body simulation module 806 is used to derive simulation parameters of each vertex on the connection unit based on the endpoint simulation parameters of the spring model, and simulate the composite body.
[0173] In one example, the composite body simulation module 806, when used to derive simulation parameters of each vertex on the connection unit based on the endpoint simulation parameters of the spring model, when simulating the composite body, includes: using the chain rule to derive the endpoint simulation parameters corresponding to the spring model based on the energy model of the spring model; adding the endpoint simulation parameters corresponding to the spring model to obtain the simulation parameters of each vertex.
[0174] In one example, the connection relationship includes: an elastic connection within the overlapping surface and a vertical elastic connection; the spring model establishing module 804, when used to establish a spring model for the connection unit according to the connection relationship of the multiple objects, includes: establishing the vertical spring for the connection unit according to the vertical elastic connection on the overlapping surface; establishing the in-plane spring for the connection unit according to the elastic connection within the overlapping surface on the overlapping surface.
[0175] In one example, the multiple objects in the complex include: a first object and a second object; the overlapping surface is the connecting surface of the first object and the second object; the connecting unit includes: a first unit corresponding to the first object and a second unit corresponding to the second object; the spring model establishment module 804, when used to establish a spring model for the connecting unit according to the connection relationship of the multiple objects, includes: vertically establishing the vertical spring between the first unit and the second unit; the first end point of the vertical spring is connected to the first unit, and the second end point of the vertical spring is connected to the second unit; establishing the in-plane spring between the first unit and the second unit; the third end point of the in-plane spring is connected to a fixed position on the first unit, and the fourth end point of the in-plane spring is connected to a fixed position on the second unit.
[0176] In one example, the composite body simulation module 806, before being used to derive simulation parameters of each vertex on the connection unit based on the endpoint simulation parameters of the spring model and simulating the composite body, further includes: calculating the normal information of the overlapping surface on the connection unit based on the vertex positions of the mesh vertices in the connection unit to obtain the endpoint position of the spring model; wherein the endpoint position is used to represent the endpoint simulation parameters; if the endpoint of the spring model is connected to a fixed position on the surface in the connection unit, calculating the endpoint position based on the local coordinates corresponding to the fixed position.
[0177] In one example, the connection relationship also includes: the difficulty of sliding; the spring model establishment module 804, when used to establish a spring model for the connection unit according to the connection relationship of the multiple objects, includes: setting the spring strength of the spring model according to the difficulty of sliding on the overlapping surface.
[0178] In one example, the connection relationship further includes: a sliding distance constraint; the spring model establishment module 804 is also used to re-establish the spring model if the stretching length of the spring model exceeds a preset threshold corresponding to the sliding distance constraint.
[0179] In one example, the connection relationship also includes: a sliding speed constraint; the composite body simulation module 806 is used to derive simulation parameters of each vertex on the connection unit based on the endpoint simulation parameters of the spring model, and before simulating the composite body, it also includes: according to the sliding speed constraint on the overlapping surface, based on the velocity vector of the endpoint of the spring model, calculating the endpoint simulation parameters of the spring model.
[0180] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.
[0181] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present application scheme. A person of ordinary skill in the art can understand and implement it without paying creative labor.
[0182] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory including instructions. The above instructions can be executed by a processor of a simulation device based on a connection relationship to implement a method as described in any of the above embodiments.
[0183] The non-temporary computer-readable storage medium may be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc., and the present application does not limit this.
[0184] In an exemplary embodiment, a computer program product including a computer program / instruction is also provided. The computer program / instruction can be executed by a processor of a simulation device based on a connection relationship to implement any of the methods described in the above embodiments.
[0185] The above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0186] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the inventions claimed herein. The present application is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
[0187] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A simulation method based on connection relationship, characterized in that: The method comprises: Constructing a connection unit on the overlapped surface in the composite body; the connection unit connects a plurality of objects in the composite body on the overlapped surface, the plurality of objects having different deformation capabilities; According to the connection relationship of the multiple objects, a spring model is established for the connection unit; wherein the spring model includes: a vertical spring perpendicular to the overlap surface, and an in-plane spring parallel to the overlap surface; the connection relationship includes: an elastic connection in the overlap surface and a vertical elastic connection; Based on the endpoint simulation parameters of the spring model, the simulation parameters of each vertex on the connection unit are derived to simulate the composite body; the endpoint simulation parameters are used to describe the dynamic behavior of the endpoints of the spring model, and the simulation parameters are used to describe the dynamic behavior of each vertex on the connection unit; The step of establishing a spring model for the connection unit according to the connection relationship of the plurality of objects comprises: According to the vertical elastic connection on the overlapped surface, establishing the vertical spring for the connection unit; According to the in-plane elastic connection on the overlap surface, the in-plane spring is established for the connection unit.
2. The method according to claim 1, characterized in that: The step of deriving simulation parameters of each vertex on the connection unit based on the endpoint simulation parameters of the spring model and simulating the composite body comprises: Using the chain rule, based on the energy model of the spring model, deriving the endpoint simulation parameters corresponding to the spring model; The simulation parameters of the endpoints corresponding to the spring model are added together to obtain the simulation parameters of each vertex.
3. The method according to claim 1, characterized in that The plurality of objects in the complex include: a first object and a second object; the overlapped surface is a connecting surface between the first object and the second object; The connection unit includes: a first unit corresponding to the first object and a second unit corresponding to the second object; The step of establishing a spring model for the connection unit according to the connection relationship of the plurality of objects comprises: The vertical spring is vertically established between the first unit and the second unit; the first end point of the vertical spring is connected to the first unit, and the second end point of the vertical spring is connected to the second unit; The in-plane spring is established between the first unit and the second unit; the third end point of the in-plane spring is connected to a fixed position on the first unit, and the fourth end point of the in-plane spring is connected to a fixed position on the second unit.
4. The method according to claim 1, characterized in that: Before deriving simulation parameters of each vertex on the connection unit based on the endpoint simulation parameters of the spring model and simulating the composite body, the method further includes: Based on the vertex positions of the mesh vertices in the connection unit, the normal information of the coincident surface on the connection unit is calculated to obtain the endpoint position of the spring model; wherein the endpoint position is used to represent the endpoint simulation parameter; If the endpoint of the spring model is connected to a fixed position on a surface in the connection unit, the position of the endpoint is calculated based on the local coordinates corresponding to the fixed position.
5. The method according to claim 1, characterized in that The connection relationship also includes: sliding difficulty; The step of establishing a spring model for the connection unit according to the connection relationship of the plurality of objects comprises: The spring strength of the spring model is set according to the sliding difficulty on the overlapping surface.
6. The method according to claim 1, characterized in that The connection relationship further includes: a sliding distance constraint; The method further comprises: If the stretching length of the spring model exceeds a preset threshold corresponding to the sliding distance constraint, the spring model is reestablished.
7. The method according to claim 1, characterized in that The connection relationship also includes: sliding speed constraints; Before deriving simulation parameters of each vertex on the connection unit based on the endpoint simulation parameters of the spring model and simulating the composite body, the method further includes: According to the sliding velocity constraint on the coincident surface, endpoint simulation parameters of the spring model are calculated based on velocity vectors of the endpoints of the spring model.
8. A simulation device based on connection relationship, characterized in that: The device comprises: A connection unit construction module is used to construct a connection unit on the overlapped surface in the complex; the connection unit connects a plurality of objects in the complex on the overlapped surface, and the plurality of objects have different deformation capabilities; A spring model building module is used to build a spring model for the connection unit according to the connection relationship of the multiple objects; wherein the spring model includes: a vertical spring perpendicular to the overlap surface, and an in-plane spring parallel to the overlap surface; the connection relationship includes: an elastic connection in the overlap surface and a vertical elastic connection; A composite body simulation module, used to derive simulation parameters of each vertex on the connection unit based on the endpoint simulation parameters of the spring model, and simulate the composite body; the endpoint simulation parameters are used to describe the dynamic behavior of the endpoints of the spring model, and the simulation parameters are used to describe the dynamic behavior of each vertex on the connection unit; The spring model establishment module, when used to establish a spring model for the connection unit according to the connection relationship between the multiple objects, includes: establishing the vertical spring for the connection unit according to the vertical elastic connection on the overlapping surface; and establishing the in-plane spring for the connection unit according to the in-plane elastic connection on the overlapping surface.
9. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor implements the method according to any one of claims 1 to 7 by running the executable instructions.
10. A computer-readable storage medium having computer instructions stored thereon, characterized in that: When the instruction is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
11. A computer program product having a computer program / instructions stored thereon, characterized in that: When the computer program / instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Cloth simulation method and system for anisotropic materials based on spring mass point model, electronic equipment and storage medium
CN113191018A
Method and device for simplifying automobile model aiming at collision simulation analysis and storage medium
CN115081102A
Simulation method and device based on meshless finite element, electronic equipment and medium
CN115391913A
Method and system for predicting mold shrinkage rate of plastic product
WO2022048101A1
Simulation method for shear fracture of deformable object and material simulation method
WO2023116456A1
