void Solve(VParticle particle)
 {
     particle.Connection.ForEach(e =>
     {
         var other = e.Other(particle);
         Solve(particle, other, e.Length);
     });
 }
        void Solve(VParticle a, VParticle b, float rest)
        {
            var delta   = a.position - b.position;
            var current = delta.magnitude;
            var f       = (current - rest) / current;

            a.position -= f * 0.5f * delta;
            b.position += f * 0.5f * delta;
        }
Example #3
0
 public VParticle Other(VParticle p)
 {
     if (a == p)
     {
         return(b);
     }
     else
     {
         return(a);
     }
 }
Example #4
0
 public VEdge(VParticle a, VParticle b, float len)
 {
     this.a      = a;
     this.b      = b;
     this.length = len;
 }
Example #5
0
 public VEdge(VParticle a, VParticle b)
 {
     this.a      = a;
     this.b      = b;
     this.length = (a.position - b.position).magnitude;
 }