22
22
23
23
class Body :
24
24
def __init__ (
25
- self : Body ,
25
+ self ,
26
26
position_x : float ,
27
27
position_y : float ,
28
28
velocity_x : float ,
@@ -44,7 +44,7 @@ def __init__(
44
44
self .color = color
45
45
46
46
def update_velocity (
47
- self : Body , force_x : float , force_y : float , delta_time : float
47
+ self , force_x : float , force_y : float , delta_time : float
48
48
) -> None :
49
49
"""
50
50
Euler algorithm for velocity
@@ -71,7 +71,7 @@ def update_velocity(
71
71
self .velocity_x += force_x * delta_time
72
72
self .velocity_y += force_y * delta_time
73
73
74
- def update_position (self : Body , delta_time : float ) -> None :
74
+ def update_position (self , delta_time : float ) -> None :
75
75
"""
76
76
Euler algorithm for position
77
77
@@ -107,7 +107,7 @@ class BodySystem:
107
107
"""
108
108
109
109
def __init__ (
110
- self : BodySystem ,
110
+ self ,
111
111
bodies : list [Body ],
112
112
gravitation_constant : float = 1.0 ,
113
113
time_factor : float = 1.0 ,
@@ -118,7 +118,7 @@ def __init__(
118
118
self .time_factor = time_factor
119
119
self .softening_factor = softening_factor
120
120
121
- def update_system (self : BodySystem , delta_time : float ) -> None :
121
+ def update_system (self , delta_time : float ) -> None :
122
122
"""
123
123
For each body, loop through all other bodies to calculate the total
124
124
force they exert on it. Use that force to update the body's velocity.
0 commit comments