MCPcopy Create free account
hub / github.com/Apress/python-for-matlab-development / Ball

Class Ball

code/OO/Ball.py:35–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33import time
34
35class Ball:
36 def __init__(self, x,y,r):
37 self.x = x
38 self.y = y
39 self.r = r
40 def collides_with(self, other):
41 dx = self.x - other.x
42 dy = self.y - other.y
43 sep = np.sqrt( dx**2 + dy**2 )
44 sum_r = self.r + other.r
45 return sep < sum_r
46
47def run_oo_sim(N, n_iter):
48 box_x, box_y = 10., 6.

Callers 1

run_oo_simFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected