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