A mass spring model for hair simulation - MathOverflow most recent 30 from http://mathoverflow.net2013-05-24T07:02:14Zhttp://mathoverflow.net/feeds/question/65768http://www.creativecommons.org/licenses/by-nc/2.5/rdfhttp://mathoverflow.net/questions/65768/a-mass-spring-model-for-hair-simulationA mass spring model for hair simulationSebastian Wyngaard2011-05-23T15:04:12Z2011-11-14T15:32:24Z
<p>A strand of hair is represented by a set of particles connected by springs.</p>
<p>The velocity for a particular particle is calculated implicitly using the following formula:
$\boldsymbol{v}^{n+1/2}=\boldsymbol{v}^{n}+\frac{\Delta t}{2}\boldsymbol{a}(t^{n+1/2},\boldsymbol{x}^{n},\boldsymbol{v}^{n+1/2})$</p>
<p>The force or acceleration (<code>$\boldsymbol{a}$</code> in the above equation) produced by the spring between two adjacent particles is given by the following:
<code>$\boldsymbol{F}^{n+1}=\frac{k}{l_{0}}\left((\boldsymbol{x}_{2}^{n}-\boldsymbol{x}_{1}^{n})^{\mathrm{T}}\hat{\boldsymbol{d}}^{n}-l_{0}\right)\hat{\boldsymbol{d}}^{n}+\Delta t\frac{k}{l_{0}}(\boldsymbol{v}_{2}^{n+1}-\boldsymbol{v}_{1}^{n+1})^{\mathrm{T}}\hat{\boldsymbol{d}}^{n}\hat{\boldsymbol{d}}^{n}$</code></p>
<p>where <code>$\hat{d}^{n}=(x_{2}^{n}-x_{1}^{n})/\left\Vert x_{2}^{n}-x_{1}^{n}\right\Vert$</code></p>
<p>My question is, how do you numerically calculate <code>$\boldsymbol{v}_{1}^{n+1}$</code> and <code>$\boldsymbol{v}_{2}^{n+1}$</code> in order to calculate the force?</p>
<p>I've tried using Newton's Method but calculating derivative the spring force is just so complicated.</p>
<p>I'm attempting to implement the techniques found in this paper: <a href="http://physbam.stanford.edu/~aselle/papers/9/" rel="nofollow">link</a></p>
http://mathoverflow.net/questions/65768/a-mass-spring-model-for-hair-simulation/80899#80899Answer by unknown (google) for A mass spring model for hair simulationunknown (google)2011-11-14T15:32:24Z2011-11-14T15:32:24Z<p>Notice that the only unknown quantities in your force equation are the updated velocities $v_i^{n+1}$, and that force depends linearly on these. Everything else is either known from the last time step, e.g. $x_i^n$, or is a simulation parameter/material constant.</p>
<p>Therefore, after substituting for $\mathbf{a}$ in your first equation, you will end up with a set of <em>linear</em> equations in the unknowns $v_i^{n+1/2}$; in particular the system will be of the form
$$(\mathbf{I} - c\Delta t^2\ \mathbf{d}\mathbf{d}^T)\mathbf{v}^{n+1/2} = \mathbf{b}$$
for some scalar $c$ and right-hand side $\mathbf{b}$. You can readily solve this system without Newton's method. In particular, for sufficiently small time steps $\Delta t$ the matrix is positive-definite, in which case I recommend using Conjugate Gradients to solve the system iteratively without ever even needing to form the dense matrix $\mathbf{d}\mathbf{d}^T.$</p>