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;
        }
Ejemplo n.º 3
0
 public VParticle Other(VParticle p)
 {
     if (a == p)
     {
         return(b);
     }
     else
     {
         return(a);
     }
 }
Ejemplo n.º 4
0
 public VEdge(VParticle a, VParticle b, float len)
 {
     this.a      = a;
     this.b      = b;
     this.length = len;
 }
Ejemplo n.º 5
0
 public VEdge(VParticle a, VParticle b)
 {
     this.a      = a;
     this.b      = b;
     this.length = (a.position - b.position).magnitude;
 }