Пример #1
0
 def velocity(self, P):
     p = P * self.dx
     vel = ts.vec2(0.0)
     for v in range(self.vorts.shape[0]):
         dis = (p - self.vorts[v])
         dis = ts.normalizePow(dis, -1, 0.001)
         dis = dis.yx * ts.vec(-1, 1) * self.vorty[v]
         vel += dis
     return vel * 0.01
Пример #2
0
def gravity_func(distance):
    return tl.normalizePow(distance, -2, 1e-3)