Mesh Spring Particle System simulation (Spring-mass system by Euler Integration)

Source: Internet
Author: User

The spring particle model is a method to simulate the deformation of an object by Newton's Law of motion. As shown, the model is a grid consisting of a virtual particle of MXN, which is connected to a spring with no mass and no natural length of zero. The following three types of connections are available:

1. Connect the particles [I, j] with [I+1,j],[i, j] and [i,j+1] springs, called "Structural Springs";

2. Connect the particle [I, j] with [I+1,j+1],[i+1,j] and [i,j+1] spring, called the "Shear Spring";

3. Connect the particle [I, j] with [I+2,j],[i, j] and [I, j+2] spring, called the "bending Spring".

The three springs are used for calculations related to structural forces (tensile or pressure), shear and bending moments respectively.

The spring particle movement is affected by internal force and external force, including spring elastic force and damping force, external force including gravity and air resistance.

The elastic force of the spring obeys the Hooke law, and the elastic force between the particle I and the particle J can be expressed as:  

Wherein:, KS represents the elasticity coefficient,xI represents the position of the particle I, l0 represents the natural length of the spring.

The damping force of the spring is proportional to the component of the particle relative velocity in the spring direction, which can be expressed as:

Wherein:vij = vJ – vi,kd represents the damping coefficient,vi represents the velocity of the particle i.

Newton's Law of motion is the key to the spring particle model, and the second-order differential equation is rewritten into two first differential equations:

(1)

Using the explicit Euler integral to solve the above differential equation can be obtained:

(2)

The pseudo code for the entire process is as follows:

The explicit Euler integral is simple, the solution is fast, but there is a limit to the integration step, and once the threshold value is T0, the integral result will be divergent. While the critical value of T0 is mainly related to spring elasticity coefficient, the greater the elasticity coefficient of spring, the smaller the critical value T0, the smaller the corresponding step size, which means that more iterations between two visual frames is needed to stabilize the result.

A method to improve the accuracy of integral is to use four-order Runge-kutta integral, and its precision can reach O (H4):

The pseudo code for the entire process is as follows:

The implicit Euler integral is more stable than the explicit Euler integral, and the implicit Euler integral expression of the spring particle model is as follows:

(3)

The F-T+h first-order Taylor expansion, substituting (3) a differential equation is obtained:

Organized by:

Multiply the sides by M:

M is a diagonal matrix with a 3x3 diagonal matrix, two Jacobian matrices and a sub-matrix is a 3x3 symmetric sparse matrix, only if the particle I and the particle J has a spring connection between the corresponding sub-matrix is not 0 (diagonal is not 0). The implicit Euler integral needs to solve the linear equation group to get the next state, but the stability is good, can take the larger step to calculate.

Reference documents:

[1] David Baraff and Andrew Witkin. 1998. Large steps in cloth simulation. In Proceedings of the 25th Annual Conference on Computer graphics and interactive techniques (SIGGRAPH ' 98). ACM, New York, NY, USA, 43-54.

[2] Matthias Müller, Jos Stam, Doug James, and Nils Thürey. Real Time Physics:class notes. In ACM SIGGRAPH classes (SIGGRAPH ' 08). ACM, New York, NY, USA,, article, pages.

Appendix

scalar function to the derivative of the vector:

, Where:x∈rn.

Vector function to the derivative of the vector (Jacques ratio matrix):

, Where:F: Rn→rm,x∈rn.

Vector-modulo-to-vector derivative:

, of which:.

The derivative of a unit vector to a vector:

Using the above formula, we can derive the expression of the Jacobian matrix in the implicit Euler integral:

Reference:

Http://blog.mmacklin.com/2012/05/04/implicitsprings

Mesh Spring Particle System simulation (Spring-mass system by Euler Integration)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.