Object simulation method and device based on position dynamics and medium

Through the object simulation method based on position dynamics, real-time simulation is performed using rod nodes and constraint functions, which solves the problem that traditional methods are difficult to simulate the complex morphological changes of linear objects, and achieves accurate and stable simulation of objects such as sutures.

CN118735990APending Publication Date: 2024-10-01SHENZHEN JINGFENG MEDICAL TECH CO LTD

Patent Information

Application Number
CN202310358272.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-30
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

Existing computer graphics technology is difficult to accurately simulate the complex morphological changes of linear objects such as sutures, especially during bending and torsion. Traditional methods such as FTL and particle spring models have problems such as hyperelastic phenomena and topological structures that are difficult to simulate.

Method used

An object simulation method based on position dynamics is adopted. By introducing rod nodes and constraint functions, the position is directly corrected to update the speed. The PBD algorithm is used for real-time simulation. The inter-frame offset threshold is set for interpolation processing to stabilize the calculation and reduce errors caused by user operations. Model parameters are unstable.

Benefits of technology

It achieves accurate real-time morphological change simulation of linear objects such as surgical sutures, improves the stability and authenticity of the simulation, and is suitable for dynamic simulation of objects with similar physical properties such as ropes and hair.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118735990A_ABST
    Figure CN118735990A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an object simulation method and device based on position dynamics and a medium. The method comprises the steps that according to motion information of a control body controlling a to-be-simulated object to move in a current frame, instruction pose offset corresponding to the current frame of the to-be-simulated object is determined; wherein the model of the to-be-simulated object comprises a plurality of particle points arranged in a chain shape and rod nodes connected between the adjacent particle points; performing inter-frame interpolation on the instruction pose offset according to an inter-frame offset threshold to determine a target pose offset of the current frame; according to the target pose offset, performing calculation based on position dynamics to obtain model parameters of the current frame; and displaying the object to be simulated according to the model parameters of the current frame.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer graphics technology, and in particular to an object simulation method based on position dynamics, a surgical simulation device, and a computer-readable storage medium. Background Art

[0002] In the field of computer graphics, it is difficult to find a suitable modeling method for linear objects, such as wires, ropes, hair, plants, etc., due to their physical properties, including that their length is much greater than their width, they are easier to bend and twist but not easy / unable to stretch.

[0003] The traditional FTL (Follow The Leader) method is a modeling method based on geometric models. It is not physically realistic enough for the representation of soft tissues such as sutures and human organs, and it is difficult to express complex interactive operations.

[0004] The simulation method based on the Mass-Spring Model (MSM) can well simulate the shape of linear objects, knotting and other common operations. However, since the mass-spring model transmits force between adjacent spring masses, as the number of force points increases, superelasticity will occur, making it difficult to simulate complex topological structures, so it is difficult to be widely used in practice. Summary of the invention

[0005] In order to solve the existing technical problems, the present application provides an object simulation method based on position dynamics, a surgical simulation device and a computer-readable storage medium that can accurately simulate the real-time morphological changes of surgical sutures.

[0006] In a first aspect of an embodiment of the present application, a method for simulating an object based on position dynamics is provided, comprising:

[0007] Determine the command posture offset corresponding to the current frame of the object to be simulated according to the motion information of the control body controlling the movement of the object to be simulated in the current frame; wherein the model of the object to be simulated includes a plurality of particle points arranged in a chain and rod nodes connected between adjacent particle points;

[0008] Performing inter-frame interpolation on the instruction pose offset according to an inter-frame offset threshold to determine a target pose offset of the current frame;

[0009] Obtaining the model parameters of the current frame using position dynamics-based calculation according to the target posture offset;

[0010] The object to be simulated is displayed according to the model parameters of the current frame.

[0011] According to a second aspect of an embodiment of the present application, there is provided a surgical simulation device, comprising a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the object simulation method based on position dynamics as described in any embodiment of the present application is implemented.

[0012] According to a third aspect of the embodiments of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the object simulation method based on position dynamics as described in any embodiment of the present application is implemented.

[0013] In the above embodiment, the object simulation method based on position dynamics sets an estimated value of the maximum position offset that can be stably calculated within a frame as an inter-frame offset threshold, and uses the inter-frame offset threshold to interpolate the command pose offset from the user operation, so that the target pose offset actually processed in each frame does not exceed the inter-frame offset threshold, and the remaining part is left for subsequent frames to process, thereby smoothing the command pose offset and reducing the instability of the object model parameters caused by the user's large-scale operations.

[0014] In the above embodiments, the surgical simulation device and the computer-readable storage medium respectively belong to the same concept as the corresponding embodiments of the object simulation method based on position dynamics, and thus have the same technical effects as the corresponding embodiments of the object simulation method based on position dynamics, which will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 A schematic diagram of a model of a linear object with an elastic rod introduced;

[0016] Figure 2 Flowchart for introducing position-based dynamics of elastic rods;

[0017] Figure 3 This is a flow chart of the first embodiment of the object simulation method based on PBD of the present application;

[0018] Figure 4 for Figure 3 The specific process diagram of S13;

[0019] Figure 5 This is a schematic diagram of a process for determining a first number in an embodiment of the present application;

[0020] Figure 6 A schematic diagram of a process for determining a second number in an embodiment of the present application;

[0021] Figure 7 This is a schematic diagram of the process of adjusting the time step in one embodiment of the present application;

[0022] Figure 8 This is a schematic diagram of a process for adjusting the elastic coefficient and the damping coefficient in one embodiment of the present application;

[0023] Fig. 9 This is a flow chart of a second embodiment of the object simulation method based on PBD of the present application;

[0024] Fig.10 This is a schematic diagram of a flow chart of inter-frame interpolation of a command position offset in one embodiment of the present application;

[0025] Fig.11 This is a flow chart of a third embodiment of the object simulation method based on PBD of the present application;

[0026] Fig.12 A flowchart of dynamically adjusting internal iteration parameters in one embodiment;

[0027] Fig.13 is a schematic structural diagram of an object simulation device based on position dynamics in one embodiment;

[0028] Fig.14 Schematic diagram of the structure of a surgical simulation device in one embodiment. DETAILED DESCRIPTION

[0029] The technical solution of the present application is further elaborated in detail below in conjunction with the accompanying drawings and specific embodiments of the specification.

[0030] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit the implementation of this application. The term "and / or" used herein includes any and all combinations of one or more related listed items.

[0031] In the following description, reference is made to “some embodiments” which describe a subset of possible embodiments, but it should be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0032] During the research process, the inventors of the present application have extensively analyzed the characteristics and advantages of the position based dynamics (PBD) algorithm, such as good stability, and simple, fast and easy-to-implement characteristics, in order to accurately represent the bending and torsion of linear objects such as sutures in real time, and have determined the availability and practicality of applying the PBD algorithm to surgical suture simulation. Therefore, the embodiments of the present application provide an object simulation method and device based on position dynamics, a surgical simulation device and a computer-readable storage medium. Among them, for the convenience of description and understanding, the object to be simulated is mainly explained by taking surgical sutures as an example, but it should be noted that the technical concept provided by the embodiments of the present application is also applicable to the real-time dynamic simulation of other deformable objects such as ropes, hair, plants, etc. that have similar physical properties to sutures, and the physical properties may include a length that is much larger than the width, easier to bend and twist but not easy / unstretchable, etc.

[0033] In the field of computer graphics, the common physical method for real-time simulation of object deformation generally updates the acceleration through external forces first, and then integrates to obtain the velocity and position. However, PBD directly corrects the position through the constraint function, and then updates the velocity through the position. The system equations in the PBD algorithm are constructed by the constraint function equation group, which includes multiple constraint function equations (which can be referred to as constraint functions).

[0034] In traditional PBD, the model of an object includes multiple particle points that make up the object, also called mass points. The parameters of the particle points include their position, velocity and mass. The parameters of the constraint function include the position of these particle points. The constraint function is used to describe the relationship between the particle points that make up the object.

[0035] For sutures and similar linear objects, rod nodes, also called elastic rods (rods), are further introduced to more accurately describe the shape of the objects. Figure 1 As shown, the model of the object includes a plurality of particle points arranged in a chain (e.g. Figure 1 p1,p2,…,p n ) and the rod nodes connecting adjacent particle points (e.g. Figure 1 q1,q2,…,q n-1 ). The extension direction in the figure is only used to specify the numbering order of the particle points and the rod nodes, and does not represent the actual extension direction. The parameters of the rod nodes include their posture, angular velocity and moment of inertia. Correspondingly, the parameters of the constraint function also include the posture of these rod nodes. Among them, for the convenience of calculation, the posture is generally represented by a unit quaternion. Of course, in other embodiments, the posture can also be represented by a transformation / rotation matrix.

[0036] The process of introducing PBD with elastic rod is as follows Figure 2As shown, the PBD process is described in detail below with reference to the accompanying drawings.

[0037] Figure 2 Steps 1-4 in the figure are the initial stage, in which the parameters of all the particle points and rod nodes that make up the object are initialized according to the preset object parameters, such as the initial position, initial posture, number of particle points, etc. Then the real-time simulation stage is entered, and the process of simulating the deformation of the object according to the environment (including possible operation instructions from the user) is executed cyclically in frames, that is, it is executed once for each frame. Figure 2 Steps 5-21 in the above process may specifically include three parts: prediction, constraint modification and variable update.

[0038] In the prediction part of the current frame (corresponding to Figure 2 In steps 6-12), the effect of the force of the external environment on the object in the current frame is converted into displacement as much as possible, and the external force that cannot be directly converted into displacement (such as gravity) is retained; the effect of the torque of the external environment on the object in the current frame is converted into angular displacement as much as possible, and the external torque that cannot be directly converted into angular displacement is retained. Based on the position of each particle point in the previous frame, the position of each particle point in the current frame is predicted in combination with the displacement obtained by conversion and the external force that cannot be directly converted; based on the posture of each rod node in the previous frame, the posture of each rod node in the current frame is predicted in combination with the angular displacement obtained by conversion and the external torque that cannot be directly converted.

[0039] The above prediction part often only uses integrals (such as explicit Euler integrals) to directly predict the position of each particle point and the posture of each rod node in the current frame, without considering the mechanical properties of the object and the interaction with the environment. Therefore, it cannot be directly used as the simulation result of the current frame, but the position of the particle point and the posture of the rod node must be corrected using constraint functions. Constraint functions are used to limit the relationship between particle points, rod nodes, and particle points and rod nodes. There are two main types: one is a temporary constraint function, which is generally generated temporarily when the object is detected to interact with external objects in the environment; the other is a regular constraint function, which is determined by the mechanical properties of the object. For example, for sutures and similar linear objects, the corresponding regular constraint function can be given according to their mechanical properties that are not easy to stretch and shear, but easy to bend and twist. The process of calculating the corrected position / posture that satisfies the constraint function as much as possible based on the constraint function and the current position / posture is called constraint projection, which is the core process of PBD. Constraint correction is essentially an iterative optimization of the particle point position and the rod node posture based on the constraint function equation group. The specific implementation is generally to iteratively execute the process of using the constraint functions in the constraint function equation group to perform constraint projection in turn until the set number of iterations is reached, so as to find the particle point position and rod node posture that satisfies all the constraint functions in the constraint function equation group as much as possible. The constraint correction part corresponds to Figure 2Steps 13-15 in which step 13 is used to perform collision detection to generate a temporary constraint function, and steps 14-15 are to iteratively optimize the positions of the particle points and the postures of the rod nodes using the constraint function equations.

[0040] Update some corresponding Figure 2 In steps 16-21 of the PBD, the result after constraint correction is the position of each particle point and the posture of each rod node in the current frame. Based on this, the velocity of each particle point and the angular velocity of each rod node in the current frame can be calculated, and then the corresponding variables are updated for display and calculation of the next frame. The Δt used in PBD is generally the default frame spacing, that is, the duration between two adjacent frames under normal circumstances.

[0041] After executing the simulated object deformation process of the current frame, the model parameters of the current frame can be obtained, including the parameters of the updated particle points and rod nodes, wherein the updated positions of each particle point and the postures of each rod node can be used to determine the shape of the object to be simulated in the current frame for display.

[0042] In the PBD-based object simulation method provided in the embodiment of the present application, the target pose offset corresponding to the current frame is first determined, and the internal iteration parameters are dynamically adjusted, including the number of internal iterations, the time step used for each internal iteration, and the segmented pose offset, etc., and then these parameters are used for internal iteration to obtain the model parameters required for displaying the object to be simulated in the current frame.

[0043] Combined with the above preliminary introduction to the object simulation method based on PBD, the following will combine Figures 1 to 12 The PBD-based object simulation method provided in the embodiment of the present application is further described in detail. Since object simulation is a real-time process, the specific process of PBD-based object simulation within a frame is generally described below by taking the current frame as an example. In fact, this process must be performed for each frame.

[0044] See also Figure 3 The first embodiment of the PBD-based object simulation method provided in this application includes the following steps.

[0045] S11, determining the target posture offset corresponding to the current frame of the object to be simulated.

[0046] The object to be simulated refers to a simulated object to be simulated for display in the current frame. In the embodiment of the present application, the object to be simulated refers to a suture, and other linear objects with similar physical properties to the suture, such as ropes, hair, plants, etc. In order to display the object to be simulated in real time and accurately in the current frame, it is mainly necessary to consider the dynamic simulation of the real-time morphological changes of the object to be simulated. The model of the object to be simulated includes a plurality of particle points arranged in a chain and rod nodes connected between adjacent particle points.

[0047] In practical applications, the object to be simulated is often connected to an external object, which controls the movement of the object to be simulated and can also be called a control body. For example, if the object to be simulated is a suture, then the control body is a suture needle, surgical forceps, tweezers, etc. that directly drives the movement of the suture; if the object to be simulated is hair, the control body is the skin and hair accessories that fix the hair, and objects that directly drive the movement of the hair such as fingers and combs. The particle point in the object to be simulated that is directly connected to the control body, that is, the particle point closest to the control body, can be called a control point.

[0048] The initial number of control points on the object to be simulated and the specific position of each control point can be determined according to the actual application scenario. For example, if the suture is not pre-fixed with the suture needle, refer to the threading operation before suturing, that is, first pass the suture through the hole at the tail end of the suture needle and then clamp the threaded thread at the front end of the needle holder. The simulated threaded suture actually has 3 control points, 1 connected to the suture needle and 2 connected to the needle holder; if the suture needle and the suture are pre-fixed together, the part directly connected to the suture needle is the control point of the suture; the control point of the hair can be the point connected to the skin or the hair accessories used for fixing.

[0049] The number and / or position of control points may change according to the user's operation. For example, during the suturing process, the user operates the needle holder to insert the suture needle into the tissue and then releases the needle holder. At this time, the control point of the threaded suture thread is only one connected to the suture needle; during the knotting stage, the user will use tweezers to clamp the suture thread left outside the needle insertion side of the tissue, and a new control point for connecting the tweezers will be added; if the user controls the character to use fingers, combs, and other objects to drive the hair movement, the corresponding control points need to be added.

[0050] The target pose offset is the pose offset of the connection part (hereinafter referred to as the connection part) where the control body is directly connected to the object to be simulated, including the target position offset and the target pose offset. According to the operation instructions given by the user, the pose of each connection part in the current frame can be calculated, and then the difference between the pose in the current frame and the pose in the previous frame is calculated as the command pose offset. If the pose is expressed in unit quaternions, the pose difference refers to the angle difference between the two quaternions. For example, if the pose in the previous frame is q n-1 , the pose of the current frame is q n , then the difference between the posture of the current frame and the previous frame is The superscript -1 indicates inversion. Without considering other factors, the command posture offset can be directly used as the target posture offset. Of course, the target posture offset can be obtained after processing the command posture offset, as described in the subsequent embodiments.

[0051] Each connection part has a corresponding control point, that is, a directly connected control point. The target position offset of each connection part is transmitted from the control body to the object to be simulated, and acts on the corresponding control point and the rod node corresponding to the control point, respectively. The target position offset acts on the control point, and the target attitude offset acts on the rod node corresponding to the control point. For ease of description, the following example is taken as an example to illustrate the case where the number of control points is 1, and the case when the number of control points is greater than 1 can be obtained by analogy.

[0052] The rod node corresponding to the control point is the rod node directly connected to the control point. If the control point is the endpoint of the object to be simulated, there is only one rod node directly connected to the control point as the rod node corresponding to the control point. Figure 1 For example, if Figure 1 If the particle point p1 is the control point, the corresponding rod node is q1. If the control point is not the endpoint of the object to be simulated, there are two rod nodes directly connected to the control point. The rod node corresponding to the control point can be one of the two rod nodes, or both of them can be used as the rod nodes corresponding to the control point. Figure 1 For example, if Figure 1 If the particle point p2 is the control point, the corresponding rod node can be at least one of q1 and q2.

[0053] The position of the control point in the current frame and the posture of the rod node corresponding to the control point are determined by the target posture offset. Specifically, the sum of the position of the control point in the previous frame and the target position offset is calculated as the position of the control point in the current frame, and the product of the posture of the rod node corresponding to the control point in the previous frame and the target posture offset is calculated as the posture of the rod node corresponding to the control point in the current frame. During the entire constraint correction process, the position of the control point is fixed to the calculated position in the current frame, and the posture of the rod node corresponding to the control point is fixed to the calculated posture in the current frame, which will not change like other particle points and rod nodes. In other words, the position of the control point and the posture of the rod node corresponding to the control point will not be updated by the constraint function equation group.

[0054] S13, determining the internal iteration parameters of the current frame based on the target posture offset.

[0055] In related technologies, the object deformation simulation process is performed only once per frame. Due to the characteristics of PBD that position is obtained first and velocity is later, its stability is significantly better than that of force-based simulation methods. That is to say, if the time and number of constraint corrections are not limited, a stable result will be obtained with a high probability. Stability generally means that the error between the result obtained by the last constraint projection using the constraint function equation group and the previous result is very small. However, in practical applications, in order to meet real-time requirements, the time available for executing PBD is limited, resulting in the actual model parameters not necessarily being stable. The larger the target posture offset, the more likely it is to be unstable.

[0056] In order to reduce the instability of the obtained model parameters, in this embodiment, multiple simulated object deformation processes are performed within one frame, and each simulated object deformation process is called an internal iteration. Each internal iteration is based on the model parameters obtained in the previous internal iteration, and PBD is executed to obtain the model parameters of this internal iteration. The model parameters obtained in the last internal iteration of each frame are the model parameters of the frame. The previous internal iteration of the first internal iteration of each frame is the last internal iteration of the previous frame of the frame. In other words, the first internal iteration of the current frame is based on the model parameters of the previous frame, that is, the model parameters of the last internal iteration of the previous frame.

[0057] Before starting the internal iteration, the internal iteration parameters can be determined based on the target pose offset. The internal iteration parameters are generally frame-specific, that is, the internal iteration parameters of different frames are independently determined and may be different. The internal iteration parameters may include the number of internal iterations and the time step and segment pose offset used for each internal iteration. The number of internal iterations refers to the number of internal iterations performed in the current frame. In addition to the number of internal iterations, the remaining internal iteration parameters are generally the parameters in the PBD algorithm used for each internal iteration.

[0058] Generally, the estimated value of the maximum position and / or attitude offset that can be stably calculated by a single internal iteration can be estimated in advance based on parameters such as hardware computing power and algorithm complexity (such as the number of objects in the environment, the number of particle points, etc.), and then the number of internal iterations can be determined based on the estimated value. The determination principle can include not more than the maximum number of internal iterations, trying to make the segmented position offset obtained by dividing the number of internal iterations less than or equal to the estimated value of the maximum position offset that can be stably calculated by a single internal iteration (hereinafter referred to as the single position estimate), and trying to make the segmented attitude offset obtained by dividing the number of internal iterations less than or equal to the estimated value of the maximum attitude offset that can be stably calculated by a single internal iteration (hereinafter referred to as the single attitude estimate). Generally speaking, as a universal threshold, a single position estimate and a single attitude estimate can be scalars without directionality. For example, a single position estimate can be the pre-estimated maximum distance that can be stably calculated by a single internal iteration, and a single attitude estimate can be the pre-estimated maximum rotation angle that can be stably calculated by a single internal iteration.

[0059] like Figure 4 As shown, in some embodiments, S13 specifically includes:

[0060] S131: Determine the number of internal iterations according to at least one of the target position offset and the target posture offset.

[0061] In order to dynamically match the number of internal iterations with the target posture offset, the number of internal iterations can be determined based on the target position offset and / or the target attitude offset, which can specifically include: determining the first number as the number of internal iterations based on the target position offset; or determining the second number as the number of internal iterations based on the target attitude offset; or determining the first number based on the target position offset and determining the second number based on the target attitude offset, and determining the number of internal iterations based on the larger value of the first number and the second number.

[0062] It should be noted that the first number and the second number are used to distinguish the internal iteration times under different strategies, and they do not indicate a necessary order in time or a quantitative relationship. Determining the internal iteration times based on the larger value of the first number and the second number means that when the first number is greater than the second number, the first number is used as the internal iteration times; when the first number is less than the second number, the second number is used as the internal iteration times; and when the first number is equal to the second number, the first number / the second number is used as the internal iteration times.

[0063] According to the above principle of determining the number of internal iterations, in some embodiments, determining the first number according to the target position offset may specifically include: dividing the target position offset by the single position offset, rounding up the obtained quotient and then comparing it with the maximum number of internal iterations, and taking the smaller of the two as the first number. Determining the second number according to the target posture offset may specifically include: dividing the rotation angle of the target posture offset by the single posture offset, rounding up the obtained quotient and then comparing it with the maximum number of internal iterations, and taking the smaller of the two as the second number. In other embodiments, other methods may also be used to determine the first number and / or the second number, and specific reference may be made to the subsequent description.

[0064] like Figure 5 As shown, in one embodiment, the process of determining the first number may specifically include:

[0065] S101: Compare the target position offset with the intra-frame position offset threshold.

[0066] The intra-frame position offset threshold is an estimate of the maximum position offset that can be stably calculated according to the default number of internal iterations. It is generally a scalar without direction and can be the product of a single position estimate and the default number of internal iterations. The comparison here generally refers to comparing the modulus of the target position offset with the intra-frame position offset threshold.

[0067] If the target position offset is less than or equal to the intra-frame position offset threshold, it means that for the target position offset, it is expected that a stable calculation result can be obtained using the default number of internal iterations, and the process jumps to S102; otherwise, the process jumps to S103.

[0068] S102: directly use the default number of internal iterations as the first number.

[0069] S103: Calculate the first ratio and the second ratio.

[0070] The first ratio is the ratio of the target position offset to the intra-frame position offset threshold. More specifically, the first ratio is the ratio of the modulus of the target position offset to the intra-frame position offset threshold. The second ratio is the ratio of the maximum number of internal iterations to the default number of internal iterations.

[0071] S104: Compare the first ratio and the second ratio.

[0072] If the first ratio is greater than the second ratio, jump to S105; otherwise, jump to S106.

[0073] S105: Determine the first number according to the maximum number of internal iterations.

[0074] Generally, the maximum number of internal iterations is taken as the first number.

[0075] S106: Determine the first number according to the product of the default number of internal iterations and the first ratio.

[0076] Generally, the product of the default number of internal iterations and the first ratio is taken as the first number.

[0077] like Figure 6 As shown, in one embodiment, the process of determining the second number may specifically include:

[0078] S111: Compare the target posture offset with the intra-frame posture offset threshold.

[0079] The intra-frame attitude offset threshold is an estimate of the maximum attitude offset that can be stably calculated according to the default number of internal iterations. It is generally a scalar without direction and can be the product of a single attitude estimate and the default number of internal iterations. The comparison here generally refers to comparing the rotation angle of the target attitude offset with the intra-frame attitude offset threshold.

[0080] If the target posture offset is greater than the intra-frame posture offset threshold, it means that for the target posture offset, it is expected that a stable calculation result can be obtained using the default number of internal iterations, and the process jumps to S112; otherwise, the process jumps to S113.

[0081] S112: Directly use the default number of internal iterations as the second number.

[0082] S113: Calculate the second ratio and the third ratio.

[0083] The second ratio is the ratio of the maximum number of internal iterations to the default number of internal iterations, and the third ratio is the ratio of the target posture offset to the intra-frame posture offset threshold. More specifically, the third ratio is the ratio of the rotation angle of the target posture offset to the intra-frame posture offset threshold.

[0084] S114: Compare the second ratio and the third ratio.

[0085] If the third ratio is greater than the second ratio, jump to S115; otherwise, jump to S116.

[0086] S115: Determine the second number according to the maximum number of internal iterations.

[0087] Generally, the maximum number of internal iterations is taken as the second number.

[0088] S116: Determine a second iteration number according to the product of a default number of internal iterations and the third ratio.

[0089] Generally, the product of the default number of internal iterations and the third ratio is taken as the second number.

[0090] If the number of control points is greater than 1, the number of internal iterations can be determined based on the target position offsets corresponding to different control points, and then the maximum value can be taken as the final number of internal iterations. Alternatively, the target position offset and / or target attitude offset that represents the most dramatic change can be found, and then the number of internal iterations can be determined accordingly. The larger the modulus of the target position offset, the more dramatic the change represented; the larger the rotation angle of the target attitude offset, the more dramatic the change represented. To further simplify the process, when the attitude is represented by a unit quaternion, the unit quaternion is in the form of Where v is the rotation axis and θ is the rotation angle. Since the real part of the unit quaternion In the value range of θ∈[0, 2π], it is a monotonically decreasing function, and the real part of the unit quaternion can be directly compared. The smaller the real part of the unit quaternion, the more drastic the change it represents.

[0091] S132: Divide the default frame spacing according to the number of internal iterations to obtain a time step, divide the target position offset according to the number of internal iterations to obtain a segmented position offset, and divide the target posture offset to obtain a segmented posture offset.

[0092] The segmented pose offset includes the segmented position offset and the pose offset. The division here is generally an average division, but other divisions are not excluded. Taking the average division as an example, assuming that the number of internal iterations is determined to be 10 and the default frame interval is 20ms, the Δt used for each internal iteration is 2ms; the target position offset is Δp, and the segmented position offset used for each internal iteration is 0.1Δp, and the position of the connection part in the previous frame is p n-1 , then the position of the control point in the first internal iteration is fixed to p n-1 +0.1Δp, the position of the control point in the second inner iteration is fixed to p n-1 +0.2Δp, ..., the position of the control point in the last internal iteration is fixed to p n-1 +Δp; the posture of the connection part in the previous frame is q n-1 , the target attitude offset is Δq, then the quaternion q n-1 to q n-1 The segmented posture offset is obtained by interpolating between Δq (which can be the posture of the connection part in the current frame). There are many ways to implement quaternion interpolation, including but not limited to linear interpolation, spherical linear interpolation, spherical quadrilateral interpolation, spline curve interpolation, etc. Taking spherical linear interpolation as an example, the segmented position offset used in each internal iteration is Δq 0.1 , after simplification, the posture calculation formula of the rod node corresponding to the control point of each internal iteration is: 1 is the rotation angle of Δq. In the first internal iteration, the posture of the rod node corresponding to the control point is fixed to the q calculated when t is 0.1.t In the second internal iteration, the posture of the rod node corresponding to the control point is fixed to q calculated when t is 0.2. t , ..., in the last internal iteration, the posture of the rod node corresponding to the control point is fixed to the q calculated when t is 1 t , that is qΔq.

[0093] After determining the segmented pose offset, it can be compared with the single position estimate and the single attitude estimate. If the modulus of the segmented position offset is greater than the single position estimate and / or the rotation angle of the segmented attitude offset is greater than the single attitude estimate, the obtained calculation result may still be unstable. To reduce the instability of the calculation result, the internal iteration parameters can be further adjusted. If the modulus of the segmented position offset is greater than the single position estimate, the further adjusted parameter is the time step; if the rotation angle of the segmented attitude offset is greater than the single attitude estimate, the further adjusted parameters are the elastic coefficient and the damping coefficient. Adjusting the time step, elastic coefficient and damping coefficient may affect the simulation effect, such as causing freezes, deformation, penetration, unrealism, etc. Therefore, taking the larger value of the first number and the second number as the internal iteration number can reduce the situation where the modulus of the segmented position offset is greater than the single position estimate and / or the rotation angle of the segmented attitude offset is greater than the single attitude estimate, thereby reducing the adjustment of the time step, elastic coefficient and damping coefficient that may affect the simulation effect.

[0094] like Figure 7 As shown, in some embodiments, adjusting the time step specifically includes:

[0095] S141: If the segment position offset is greater than the estimated value of the maximum position offset that can be stably calculated by a single internal iteration, increase the time step.

[0096] Before increasing the time step, that is, when the time step is not adjusted, the time step refers to the time step obtained in S132, that is, the default frame spacing is divided according to the number of internal iterations, and the sum of the time steps of all internal iterations is the default frame spacing.

[0097] S142: Perform test iteration according to the current internal iteration parameters to determine the far-end position offset.

[0098] Test iteration is also a process of simulating object deformation based on PBD, and its specific process can be the same as the process of internal iteration described in any embodiment of the present application, or it can be a simplified version of the internal iteration described in any embodiment of the present application, such as reducing collision detection, omitting collision detection, etc. Generally, the model parameters obtained by test iteration will not be used as the model parameters of internal iteration.

[0099] The far-end position offset is the position offset of the particle point farthest from the control point in the model parameters obtained in the last test iteration. The position offset refers to the length of the displacement between the position after constraint correction and the starting position during the deformation of the simulated object. Figure 2 p in step 17 i -x i Model.

[0100] S143: Compare the far-end position offset with a preset interval.

[0101] Specifically, the far-end position offset is compared with an upper limit and a lower limit of a preset interval, and the upper limit of the preset interval is greater than the lower limit.

[0102] If the remote position offset is greater than the upper limit of the preset interval, jump to S144; if the remote position offset is less than the lower limit of the preset interval, jump to S145; if the remote position offset is within the preset interval, jump to S146.

[0103] S144: Increase the time step.

[0104] Jump to S142.

[0105] S145: Reduce the time step.

[0106] Here the decrease in the time step is smaller than the increase in the previous time step.

[0107] Jump to S142.

[0108] S146: Keep the current value of the time step and stop adjusting.

[0109] The adjustment of the time step is actually the adjustment of the length of the current frame, that is, the frame spacing between the current frame and the next frame. The larger the time step, the larger the length of the current frame, and the faster it stabilizes. In this embodiment, the far-end position offset is used to determine whether the position of the particle point is stable. The smaller the difference between the positions of the particle points obtained in two adjacent iterations, the more stable it is. Based on the characteristics of the PBD algorithm, the process of iteratively updating the position of the particle point can be approximately understood as the process of the displacement of the control point being transmitted from near to far with the iterative calculation. In other words, the farther the particle point is from the control point, the slower it stabilizes. Therefore, selecting the particle point farthest from the control point can more accurately reflect whether the position of the particle point obtained in this round of test iteration is stable.

[0110] The upper and lower limits of the preset interval can be obtained based on experiments / experience. If the far position offset is greater than the upper limit of the preset interval, it means that the current time step is not enough to stabilize the particle point position obtained by this round of test iteration, and the time step can be further increased.

[0111] Since the frame spacing in the actual display process is generally the default frame spacing, that is, the length of the current frame used for display is still the default frame spacing, the larger the time step, the greater the difference between the length of the current frame used for calculation and the length of the current frame used for display, and the greater the possibility and / or degree of impact on the simulation effect. Therefore, when the far-end position offset is less than the lower limit of the preset interval, the time step can be reduced to try to find a smaller time step that meets the requirements of particle point position stability. In order to avoid an infinite loop of increasing and decreasing the time step, the amplitude of reducing the time step should be smaller than the amplitude of the previous increase in the time step. In addition, the maximum value of the time step can be set. If the time step reaches its maximum value but the far-end position offset obtained by the test iteration is still greater than the upper limit of the preset interval, the current value of the time step is retained and adjustment is stopped.

[0112] The process of reducing the time step is generally applicable to the case where the time step increases by a large amplitude, for example, increasing the time step by a fixed large amplitude, gradually increasing the increase amplitude of the time step, etc. In some embodiments, the lower limit of the preset interval can be omitted or the lower limit of the preset interval can be set to a value that the far-end position offset cannot be less than, such as 0, a negative number or a minimum value. In this case, comparing the far-end position offset with the preset interval is essentially comparing the far-end position offset with a single threshold value (i.e., the upper limit of the preset interval), which is more applicable to the case where the increase amplitude of the time step is not large.

[0113] like Figure 8 As shown, in some embodiments, adjusting the elastic coefficient and the damping coefficient specifically includes:

[0114] S151: If the segmented posture offset is greater than the estimated value of the maximum posture offset that can be stably calculated by a single internal iteration, increase the elastic coefficient.

[0115] The unadjusted elastic coefficient and damping coefficient, that is, the preset values ​​of the elastic coefficient and damping coefficient are pre-set according to the characteristics of the object to be simulated. The elastic coefficient reflects the hardness of the object to be simulated, and acts on the posture of each rod node in the constraint function. The larger the elastic coefficient, the easier it is to stabilize. The damping coefficient reflects the resistance of the object to be simulated, and acts on the updated angular velocity and speed. The smaller the damping coefficient means the greater the resistance, the easier it is to stabilize.

[0116] S152: Perform test iteration according to the current internal iteration parameters to determine the far-end posture offset.

[0117] S153: Compare the distal posture offset with a preset threshold.

[0118] If the far-end posture offset is less than or equal to the preset threshold, jump to S154, otherwise jump to S155.

[0119] Test iteration is also a process of simulating object deformation based on PBD, and its specific process can be the same as the process of internal iteration described in any embodiment of the present application, or it can be a simplified version of the internal iteration described in any embodiment of the present application, such as reducing collision detection, omitting collision detection, etc. Generally, the model parameters obtained by test iteration will not be used as the model parameters of internal iteration.

[0120] The far-end attitude offset is the attitude offset of the rod node farthest from the control point in the model parameters obtained in the last test iteration. The attitude offset can refer to the rotation angle of the difference between the attitude after constraint correction and the initial attitude during the deformation of the simulated object. In order to reduce the amount of calculation, when the attitude is expressed in unit quaternion, the real part of the difference between the attitude after constraint correction and the initial attitude can also be selected as the attitude offset. In this case, due to the real part of the unit quaternion In the value range of θ∈[0, 2π], it is a monotonically decreasing function, and the jump condition needs to be modified, that is, in response to the far-end posture offset being greater than or equal to the preset threshold, jump to S154, otherwise jump to S155.

[0121] S154: retain the current values ​​of the elastic coefficient and the damping coefficient and stop adjusting.

[0122] S155: Compare the elastic coefficient with the elastic coefficient threshold.

[0123] If the elastic coefficient is less than the elastic coefficient threshold, jump to S156; if the elastic coefficient is greater than or equal to the elastic coefficient threshold, jump to S157.

[0124] S156: Increase the elastic coefficient.

[0125] Jump to S152.

[0126] S157: Compare the damping coefficient with the damping coefficient threshold.

[0127] If the damping coefficient is less than or equal to the damping coefficient threshold, jump to S154; if the damping coefficient is greater than the damping coefficient threshold, jump to S158.

[0128] S158: Reduce the damping coefficient.

[0129] Jump to S152.

[0130] In this embodiment, the distal attitude offset is used to determine whether the attitude of the rod node is stable. The smaller the difference between the attitudes of the rod nodes obtained in two adjacent iterations, the more stable it is. Based on the characteristics of the PBD algorithm, the process of iteratively updating the attitude of the rod node can be roughly understood as the process in which the attitude change of the rod node corresponding to the control point is transmitted from near to far with the iterative calculation. In other words, the farther the rod node is from the control point, the slower it stabilizes. Therefore, selecting the rod node farthest from the control point can more accurately reflect whether the attitude of the rod node obtained in this round of test iteration is stable.

[0131] The preset threshold and elastic coefficient threshold can be obtained based on experiments / experience. If the distal attitude offset is greater than the preset threshold, it means that the current elastic coefficient and damping coefficient are not sufficient to stabilize the rod node attitude obtained in this round of test iterations, and the elastic coefficient and / or damping coefficient can be further adjusted.

[0132] The larger the adjustment range of the elastic coefficient and the damping coefficient, the greater the deviation between the current elastic coefficient and the damping coefficient and the default value set according to the characteristics of the object to be simulated, and the greater the possibility and / or degree of influence on the simulation effect, among which the influence of the damping coefficient is more obvious, so it is selected to adjust the elastic coefficient first and then adjust the damping coefficient. For the last one in the adjustment order of the multiple internal iteration parameters adjusted continuously, such as the internal iteration parameter in this embodiment, when it reaches the set threshold, the last round of test iteration can be omitted and the current value can be directly retained and the adjustment can be stopped. For example, the last internal iteration parameter adjusted is the damping coefficient, and the maximum number of adjustments of the damping coefficient is limited to n times, where n is a positive integer. After the damping coefficient is reduced for the n-1th time, if the distal attitude offset still does not meet the requirements of the stability of the rod node attitude, then after the damping coefficient is reduced for the nth time, no test iteration is performed and the current values ​​of the elastic coefficient and the damping coefficient are directly retained and the adjustment is stopped. If n=1, when the elastic coefficient is greater than or equal to the elastic coefficient threshold, the damping coefficient is directly reduced and then the current values ​​of the elastic coefficient and the damping coefficient are retained and the adjustment is stopped. In some embodiments, the adjustment of the damping coefficient may be reduced, for example, by reducing the adjustment step of the damping coefficient, reducing the number of adjustments of the damping coefficient, or even omitting the adjustment of the damping coefficient.

[0133] In the above-mentioned process of adjusting the internal iteration parameters, in the process of comparing the internal iteration parameters with their thresholds, the threshold used can be the threshold of the corresponding internal iteration parameter itself, or the threshold of the number of adjustments calculated based on the threshold and default value of the internal iteration parameter and the adjustment step size.

[0134] S15: Performing internal iteration based on position dynamics according to the internal iteration parameters to obtain model parameters of the object to be simulated in the current frame.

[0135] In the current frame, each internal iteration is based on the model parameters obtained in the previous internal iteration. PBD is executed according to the internal iteration parameters to update the model parameters to obtain the model parameters of this internal iteration, where the model parameters obtained in the last internal iteration are the model parameters of the current frame.

[0136] Specifically, the i-th internal iteration is to execute the i-th iteration in the current frame. Figure 2 In 6-21, i is a positive integer less than or equal to the determined number of internal iterations. The basis of the i-th internal iteration is the model parameters calculated in the i-1-th internal iteration. If i=1, the model parameters of the i-1-th internal iteration are the model parameters of the previous frame. In the i-th internal iteration, the model parameters obtained in the i-1-th internal iteration are used as the unupdated position x in 6-11. i , speed v i , Posture q j , and angular velocity ω j Participate in prediction; in the subsequent constraint correction process, the position of the control point is fixed as the sum of the position of the corresponding control point in the model parameters obtained by the i-1th internal iteration and the segment position offset used in the i-th internal iteration and is not corrected, the posture of the rod node corresponding to the control point is fixed as the product of the posture of the corresponding rod node in the model parameters obtained by the i-1th internal iteration and the segment posture offset used in the i-th internal iteration and is not corrected, the position of the remaining particle points and the posture of the rod node are corrected under the constraints of the constraint function equation group; after completing the constraint correction, execute the variable update to obtain the model parameters of the i-th internal iteration.

[0137] S17: Displaying the object to be simulated according to the model parameters of the current frame.

[0138] The model parameters obtained by the last internal iteration are the model parameters of the current frame, where the positions of each particle point and the posture of each rod node determine the shape of the model of the object to be simulated in the current frame. On this basis, the model can be rendered and then output to the display device for display. In some embodiments, the model parameters can be further processed before rendering, such as smooth interpolation of the postures of some rod nodes near the control point, as described in the subsequent embodiments.

[0139] In the above embodiment, compared with the related art in which the object deformation simulation process is performed only once in one frame, performing multiple object deformation simulation processes (i.e., internal iteration) in one frame can reduce the instability of the obtained model parameters while meeting the real-time requirements, thereby improving the display effect of the object. Further, in the process of determining the internal iteration parameters, if the modulus of the segmented position offset is greater than the single position estimation value and / or the rotation angle of the segmented attitude offset is greater than the single attitude estimation value, at least one of the time step, elastic coefficient, and damping coefficient can be adjusted to further reduce the instability of the obtained model parameters.

[0140] See also Fig. 9 The second embodiment of the PBD-based object simulation method provided in this application includes the following steps.

[0141] S21: Determine the command posture offset corresponding to the current frame according to the motion information of the control body that controls the movement of the object to be simulated in the current frame.

[0142] For the parts of this embodiment that are the same or similar to those in the foregoing embodiments, reference may be made to the relevant descriptions of the foregoing embodiments, which will not be repeated here.

[0143] S23: Perform inter-frame interpolation on the command posture offset according to the inter-frame offset threshold to determine the target posture offset.

[0144] The command posture offset includes the command position offset and the command attitude offset. The command position offset and / or the command attitude offset can be inter-frame interpolated, and the corresponding inter-frame offset threshold can include the inter-frame position offset threshold and / or the inter-frame attitude offset threshold, wherein the inter-frame position offset threshold is an estimated value of the maximum position offset that can be stably calculated within a frame, and the inter-frame attitude offset threshold is an estimated value of the maximum attitude offset that can be stably calculated within a frame. Generally, the inter-frame offset threshold can be pre-estimated based on hardware computing power, algorithm complexity, etc.

[0145] If only the command position offset is interpolated between frames, the command posture offset is directly used as the target posture offset; if only the command posture offset is interpolated between frames, the command position offset is directly used as the target position offset.

[0146] The following is an example of the specific process of interpolating the command position offset between frames in conjunction with the accompanying drawings. By analogy, the specific process of interpolating the command posture offset between frames can be obtained. The specific difference is that the sum of the positions corresponds to the product of the postures.

[0147] like Fig.10 As shown, in one embodiment, interpolating the command position offset between frames may specifically include:

[0148] S231: Determine the required position offset of the current frame according to the command position offset and the remaining position offset of the previous frame.

[0149] The required position offset of the current frame may be the sum of the command position offset of the current frame and the remaining position offset of the previous frame. If the command posture offset is interpolated, the required posture offset of the current frame may be the product of the command posture offset of the current frame and the remaining posture offset of the previous frame.

[0150] S232: Compare the required position offset of the current frame with the inter-frame offset threshold.

[0151] If the required position offset of the current frame is greater than the inter-frame offset threshold, jump to S233; otherwise jump to S234.

[0152] S233: Calculate the difference between the required position offset of the current frame and the inter-frame offset threshold as the remaining position offset of the current frame, and set the target position offset as the inter-frame offset threshold.

[0153] S234: setting the target position offset to the required position offset of the current frame, and setting the remaining position offset of the current frame to 0.

[0154] The remaining position offset of the current frame can be used to calculate the required position offset of the next frame.

[0155] In practical applications, in order to reduce storage usage, two variables ΔP and ΔP_l can be used to complete the inter-frame interpolation of position offsets. Start by calculating the command pose offset of the current frame and assign it to ΔP. At this time, ΔP stores the command pose offset of the current frame; calculate the sum of ΔP and ΔP_l and assign it to ΔP, that is, ΔP = ΔP + ΔP_l. At this time, ΔP stores the required position offset of the current frame, and ΔP_l stores the remaining position offset of the previous frame; then determine whether ΔP>PT is satisfied, PT is the inter-frame offset threshold; if so, calculate the difference between ΔP and PT and assign it to ΔP_l, and then assign PT to ΔP, that is, ΔP_l = ΔP-PT, ΔP = PT, otherwise assign 0 to ΔP_l, and do not modify ΔP. At this time, ΔP stores the target position offset of the current frame, and ΔP_l stores the remaining position offset of the current frame.

[0156] S25: Obtain model parameters of the current frame using position dynamics-based calculations according to the target posture offset.

[0157] The position of the control point and the posture of the rod node corresponding to the control point are directly calculated based on the target posture offset and do not participate in the update of PBD. There is no restriction on whether PBD introduces multiple internal iterations.

[0158] S27: Displaying the object to be simulated according to the model parameters of the current frame.

[0159] In this embodiment, an estimated value of the maximum position and / or posture offset that can be stably calculated within a frame is set as an inter-frame offset threshold, and the inter-frame offset threshold is used to interpolate the command posture offset from the user operation, so that the target posture offset actually processed in each frame does not exceed the inter-frame offset threshold, and the remaining part is left for subsequent frames to process, thereby smoothing the command posture offset and reducing the instability of the object model parameters caused by the user's large-scale operations.

[0160] See also Fig.11 The third embodiment of the PBD-based object simulation method provided in this application includes the following steps.

[0161] S31: Determine the target posture offset corresponding to the current frame of the object to be simulated.

[0162] For the parts of this embodiment that are the same or similar to those in the foregoing embodiments, reference may be made to the relevant descriptions of the foregoing embodiments, which will not be repeated here.

[0163] S33: Obtain model parameters of the current frame using position dynamics-based calculations according to the target posture offset.

[0164] The position of the control point and the posture of the rod node corresponding to the control point are directly calculated based on the target posture offset and do not participate in the update of PBD. There is no restriction on whether PBD introduces multiple internal iterations.

[0165] S35: In the model parameters of the current frame, starting from the first rod node after the rod node corresponding to the control point, searching for the target rod node within a preset range.

[0166] The first rod node after the rod node corresponding to the control point refers to a rod node that is located on a side of the reference point relatively far from the control point and adjacent to the reference point, taking the rod node corresponding to the control point as the reference point.

[0167] The preset range can be determined experimentally / empirically. The preset range can be limited in numerical form, that is, the number of rod nodes to be searched is limited. In practical applications, except for the case where the control point is the end point of the object to be simulated, there are two directions away from the control point, and there may be one or two rod nodes corresponding to the control point, which can be determined according to actual needs. The preset range can also be an interval defined by the rod node corresponding to the control point as a reference point.

[0168] The difference between the posture of the target rod node and the posture of the previous rod node of the target rod node is greater than a preset threshold, and the previous rod node of the target rod node is adjacent to the target rod node and closer to the control point than the target rod node.

[0169] If the number of target rod nodes is greater than the preset value, jump to S37; otherwise jump to S39.

[0170] S37: Update the model parameters of the current frame according to the posture of the target rod node.

[0171] The specific updating method may be to interpolate the posture from the rod node corresponding to the control point to the last target rod node farthest from the control point, or to interpolate the posture from the rod node corresponding to the control point to the N rod nodes after the rod node corresponding to the control point, where N is the number of target rod nodes. The interpolation here refers to smooth interpolation, and the specific implementation method is not limited.

[0172] S39: Displaying the object to be simulated according to the model parameters of the current frame.

[0173] Based on the mechanical properties of linear objects, the degree of change in the posture of the rod nodes generally decreases from the control point to the direction away from the control point. Therefore, when the target posture offset caused by the user operation is large, the posture change of the adjacent rod nodes near the control point may be relatively large, resulting in jagged edges when displayed, which is more obvious when the model parameters are unstable. To reduce this phenomenon, after using PBD to obtain the model parameters of the current frame, this embodiment starts with the first rod node after the rod node corresponding to the control point, and searches for the target rod node within a preset range. If the number of target rod nodes is greater than the preset value, the model parameters of the current frame are updated before display. The update is specifically to interpolate the posture of the rod node starting from the rod node corresponding to the control point, thereby reducing jagged edges and making the object display effect smoother.

[0174] In order to have a more comprehensive understanding of the object simulation method based on position dynamics provided by the embodiment of the present application, a specific embodiment is described below. Fig.12 The fourth embodiment of the PBD-based object simulation method provided in this application specifically includes the following steps.

[0175] S401: Determine the command posture offset corresponding to the current frame according to the motion information of the control body that controls the movement of the object to be simulated in the current frame.

[0176] This embodiment is a combination of the above multiple embodiments, wherein the same or similar parts as the above embodiments are not repeated.

[0177] S402: Perform inter-frame interpolation on the command posture offset according to the inter-frame offset threshold to determine the target posture offset.

[0178] S403: Determine the number of internal iterations according to at least one of the target position offset and the target posture offset.

[0179] S404: Divide the default frame spacing according to the number of internal iterations to obtain a time step, divide the target position offset according to the number of internal iterations to obtain a segmented position offset, and divide the target posture offset to obtain a segmented posture offset.

[0180] S405: Determine whether the segment position offset is greater than the single position estimation value.

[0181] If yes, jump to S406; otherwise jump to S407.

[0182] S406: Adjust the time step.

[0183] Specific adjustment method reference Figure 7 and corresponding description.

[0184] S407: Determine whether the segmented posture offset is greater than the single posture estimation value.

[0185] If yes, jump to S408; otherwise jump to S409.

[0186] S408: Adjust the elastic coefficient and damping coefficient.

[0187] Specific adjustment method reference Figure 8 and corresponding description.

[0188] In this embodiment, the time step is adjusted first, and then the elastic coefficient and the damping coefficient are adjusted. In other embodiments, the elastic coefficient and the damping coefficient may be adjusted first, and then the time step is adjusted, or the adjustments may be made in parallel.

[0189] S409: Perform internal iteration using PBD according to internal iteration parameters.

[0190] The model parameters obtained by the last internal iteration are the model parameters of the current frame.

[0191] S410: In the model parameters of the current frame, starting from the first rod node after the rod node corresponding to the control point, search for the target rod node within a preset range.

[0192] S411: Determine whether the number of target rod nodes is greater than a preset value.

[0193] If so, jump to S412; otherwise jump to S413.

[0194] S412: interpolating the posture of the rod node corresponding to the control point to the last target rod node farthest from the control point.

[0195] In other embodiments, other interpolation ranges may also be selected.

[0196] S413: Displaying the object to be simulated according to the model parameters of the current frame.

[0197] See also Fig.13 As shown, it is an object simulation device based on position dynamics provided according to an embodiment of the present application, including: an acquisition module 201, used to determine the instruction posture offset corresponding to the current frame of the object to be simulated according to the motion information of the control body that controls the movement of the object to be simulated in the current frame; wherein the model of the object to be simulated includes a plurality of particle points arranged in a chain and rod nodes connected between adjacent particle points; a determination module 202, used to perform inter-frame interpolation on the instruction posture offset according to an inter-frame offset threshold to determine the target posture offset of the current frame; a parameter module 203, used to obtain the model parameters of the current frame according to the target posture offset using the position dynamics-based calculation; a display module 204, used to display the object to be simulated according to the model parameters of the current frame.

[0198] Among them, the inter-frame offset threshold includes an inter-frame position offset threshold, and the inter-frame position offset threshold is an estimated value of the maximum position offset that can be stably calculated within a frame; the determination module 202 is also used to determine the required position offset corresponding to the current frame according to the command position offset and the remaining position offset corresponding to the previous frame; if the required position offset of the current frame is greater than the inter-frame position offset threshold, the difference between the required position offset of the current frame and the inter-frame position offset threshold is calculated as the remaining position offset of the current frame, and the target position offset is set to the inter-frame position offset threshold; if the required position offset of the current frame is not greater than the inter-frame position offset threshold, the target position offset is set to the required position offset of the current frame, and the remaining position offset of the current frame is set to 0.

[0199] Among them, the inter-frame offset threshold includes an inter-frame posture offset threshold, and the inter-frame posture offset threshold is an estimated value of the maximum posture offset that can be stably calculated within a frame; the determination module 202 is also used to determine the required posture offset corresponding to the current frame based on the command posture offset and the remaining posture offset corresponding to the previous frame; if the required posture offset of the current frame is greater than the inter-frame posture offset threshold, the difference between the required posture offset of the current frame and the inter-frame posture offset threshold is calculated as the remaining posture offset of the current frame, and the target posture offset is set to the inter-frame posture offset threshold; if the required posture offset of the current frame is not greater than the inter-frame posture offset threshold, the target posture offset is set to the required posture offset of the current frame, and the remaining posture offset of the current frame is set to 0.

[0200] The determination module 202 is used to determine the internal iteration parameters of the current frame according to the target posture offset.

[0201] Wherein, the determination module 202 is also used to determine the number of internal iterations based on the comparison result of the target position offset and the intra-frame position offset threshold; wherein the intra-frame position offset threshold is an estimated value of the maximum position offset that can be stably calculated according to the default number of internal iterations; the number of internal iterations is determined based on the comparison result of the target posture offset threshold and the intra-frame posture offset threshold; wherein the intra-frame posture offset threshold is an estimated value of the maximum posture offset that can be stably calculated according to the default number of internal iterations; the time step is determined based on the current number of internal iterations and the default frame spacing, a test iteration is performed based on the current internal iteration parameters, and the time step is adjusted based on the judgment result of whether the position offset of each particle point exceeds the preset interval after the test iteration.

[0202] The determination module 202 is further used to perform test iteration according to the current internal iteration parameters, and adjust the elastic coefficient and / or damping coefficient according to the comparison result between the posture offset of each rod node and the preset threshold after the test iteration.

[0203] The display module 204 is used to search for the target rod node in sequence within a preset range, starting from the first rod node after the rod node connected to the control point in the particle point, according to the model parameter result obtained in the last iteration in the internal iteration; wherein the difference between the posture of the target rod node and the posture of the previous rod node of the target rod node is greater than a preset threshold, and the previous rod node of the target rod node is adjacent to the target rod node and closer to the control point than the target rod node; wherein the control point is a particle point connected to the control body; if the number of the target rod nodes is greater than a preset value, the model parameters obtained in the last iteration are updated according to the posture of the target rod node; and the object to be simulated is displayed according to the updated model parameters.

[0204] Among them, the display module 204 is used to perform linear interpolation on the posture of the rod node corresponding to the control point to the N rod nodes after the rod node corresponding to the control point, where N is the number of the target rod nodes; or, to perform linear interpolation on the posture of the rod node corresponding to the control point to the last target rod node that is farthest from the control point.

[0205] Wherein, the object to be simulated is a suture, and the control body is at least one of a suture needle, surgical forceps, and tweezers.

[0206] It should be noted that: the object simulation device based on position dynamics provided in the above embodiment only uses the division of the above program modules as an example to illustrate the process of implementing the object simulation method based on position dynamics. In actual applications, the above processing can be assigned to different program modules as needed, that is, the internal structure of the device can be divided into different program modules to complete all or part of the method steps described above. In addition, the object simulation device based on position dynamics provided in the above embodiment and the object simulation method embodiment based on position dynamics belong to the same concept. The specific implementation process is detailed in the method embodiment, which will not be repeated here.

[0207] See also Fig.14 As shown, it is a schematic diagram of the structure of an object simulation device based on position dynamics provided according to an embodiment of the present application. The object simulation device provided in the embodiment of the present application includes a memory 212 and a processor 211, wherein the memory 212 stores a computer program executable by the processor 211, and when the computer program is executed by the processor 211, the object simulation method described in any embodiment of the present application is implemented.

[0208] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, each process of the above-mentioned method for simulating an object based on position dynamics is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. Computer-readable storage media, such as read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk, etc.

[0209] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A method for simulating an object based on position dynamics, characterized in that: include: Determine the command posture offset corresponding to the current frame of the object to be simulated according to the motion information of the control body controlling the movement of the object to be simulated in the current frame; wherein the model of the object to be simulated includes a plurality of particle points arranged in a chain and rod nodes connected between adjacent particle points; Performing inter-frame interpolation on the instruction pose offset according to an inter-frame offset threshold to determine a target pose offset of the current frame; Obtaining the model parameters of the current frame using position dynamics-based calculation according to the target posture offset; The object to be simulated is displayed according to the model parameters of the current frame.

2. The object simulation method based on position dynamics according to claim 1, wherein the inter-frame offset threshold comprises an inter-frame position offset threshold, the inter-frame position offset threshold is an estimated value of a maximum position offset that can be stably calculated within a frame, and the inter-frame interpolation of the instruction pose offset according to the inter-frame offset threshold to determine the target pose offset of the current frame comprises: Determine the required position offset corresponding to the current frame according to the command position offset and the remaining position offset corresponding to the previous frame; If the required position offset of the current frame is greater than the inter-frame position offset threshold, the difference between the required position offset of the current frame and the inter-frame position offset threshold is calculated as the remaining position offset of the current frame, and the target position offset is set as the inter-frame position offset threshold; If the required position offset of the current frame is not greater than the inter-frame position offset threshold, the target position offset is set to the required position offset of the current frame, and the remaining position offset of the current frame is set to 0.

3. The object simulation method according to claim 1, characterized in that: The inter-frame offset threshold includes an inter-frame posture offset threshold, which is an estimated value of a maximum posture offset that can be stably calculated within a frame, and inter-frame interpolation of the instruction posture offset according to the inter-frame offset threshold to determine the target posture offset of the current frame includes: Determine the required posture offset corresponding to the current frame according to the command posture offset and the remaining posture offset corresponding to the previous frame; If the required posture offset of the current frame is greater than the inter-frame posture offset threshold, the difference between the required posture offset of the current frame and the inter-frame posture offset threshold is calculated as the remaining posture offset of the current frame, and the target posture offset is set as the inter-frame posture offset threshold; If the required posture offset of the current frame is not greater than the inter-frame posture offset threshold, the target posture offset is set to the required posture offset of the current frame, and the remaining posture offset of the current frame is set to 0.

4. The object simulation method according to claim 1, characterized in that: Before displaying the object to be simulated according to the model parameters of the current frame, the method includes: Determine the internal iteration parameters of the current frame according to the target posture offset.

5. The object simulation method according to claim 4, characterized in that: Determining the internal iteration parameters of the current frame according to the target posture offset includes at least one of the following: Determine the number of internal iterations according to a comparison result between the target position offset and an intra-frame position offset threshold; wherein the intra-frame position offset threshold is an estimated value of a maximum position offset that can be stably calculated according to a default number of internal iterations; Determine the number of internal iterations according to the comparison result between the target posture offset threshold and the intra-frame posture offset threshold; wherein the intra-frame posture offset threshold is an estimated value of the maximum posture offset that can be stably calculated according to the default number of internal iterations; The time step is determined according to the current number of internal iterations and the default frame spacing, a test iteration is performed according to the current internal iteration parameters, and the time step is adjusted according to the judgment result of whether the position offset of each particle point exceeds a preset interval after the test iteration.

6. The object simulation method according to claim 4, characterized in that: Determining the internal iteration parameters of the current frame according to the target posture offset includes: A test iteration is performed according to the current internal iteration parameters, and the elastic coefficient and / or the damping coefficient is adjusted according to the comparison result between the posture offset of each of the rod nodes after the test iteration and the preset threshold value.

7. The object simulation method according to claim 4, characterized in that: The displaying the object to be simulated according to the model parameters of the current frame includes: According to the model parameter result obtained in the last iteration in the internal iteration, starting from the first rod node after the rod node connected to the control point in the particle point, the target rod node is searched in sequence within the preset range; wherein the difference between the posture of the target rod node and the posture of the previous rod node of the target rod node is greater than a preset threshold, and the previous rod node of the target rod node is adjacent to the target rod node and closer to the control point than the target rod node; wherein the control point is a particle point connected to the control body; If the number of the target rod nodes is greater than a preset value, updating the model parameters obtained in the last iteration according to the postures of the target rod nodes; The object to be simulated is displayed according to the updated model parameters.

8. The object simulation method according to claim 7, characterized in that: The updating of the model parameters obtained from the last iteration according to the posture of the target rod node comprises: Performing linear interpolation on the postures of N rod nodes after the rod node corresponding to the control point to the rod node corresponding to the control point, where N is the number of the target rod nodes; or Linear interpolation is performed on the posture from the rod node corresponding to the control point to the last target rod node farthest from the control point.

9. The object simulation method according to any one of claims 1 to 8, characterized in that: The object to be simulated is a suture thread, and the control body is at least one of a suture needle, surgical forceps, and tweezers.

10. A surgical simulation device, characterized in that: It comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the object simulation method based on position dynamics as claimed in any one of claims 1 to 9 is implemented.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the object simulation method based on position dynamics according to any one of claims 1 to 9 is implemented.

Citation Information

Patent Citations

  • Technique for simulating the dynamics of hair

    CN103870628A

  • Keyframe based autonomous vehicle operation system and computer implementation method

    CN109624990A

  • Method and system for simulating endotracheal intubation

    CN112587233A

  • Hair treatment method, device and equipment for virtual object, medium and program product

    CN115641375A

  • Object simulation method and device based on position dynamics and medium

    CN118735991A

Cited By

  • Space curve real-time generation and editing method and system for augmented reality

    CN121937687A

  • A spatial curve real-time generation and editing method and system for extended reality

    CN121937687B