MCPcopy Create free account
hub / github.com/python/cpython / acc

Method acc

Lib/turtledemo/planet_and_moon.py:50–56  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

48 self.a = self.acc()
49 self.v = self.v + 0.5*dt*self.a
50 def acc(self):
51 a = Vec(0,0)
52 for planet in self.gravSys.planets:
53 if planet != self:
54 v = planet.pos()-self.pos()
55 a += (G*planet.m/abs(v)**3)*v
56 return a
57 def step(self):
58 dt = self.gravSys.dt
59 self.setpos(self.pos() + dt*self.v)

Callers 2

initMethod · 0.95
stepMethod · 0.95

Calls 2

absFunction · 0.85
posMethod · 0.45

Tested by

no test coverage detected