Problem with spring force in growth algorithm

(Just realized I forgot to update the thread with the solution I had found)

The problem was towfold:

  • I had to keep the first and last edges instead of removing/rebuilding them (connecting order is important)
  • Planar force was missing
def planarForce(self):
    center, count = Vec3D(), 0
    for l in self.links:
        center.addSelf(cells[l])
        count += 1
                
    center.scaleSelf(1.0/count)
    dif = center.sub(self)
    f = dif.sub(self.getVelocity().scale(.3))
    self.addForce(f)


gif

3 Likes