Skip to content

Commit 841176f

Browse files
committed
minor
1 parent 674d150 commit 841176f

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

0_getting_started/simulator0.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
x = np.array([0.0, 0.0]) # position of particle
99
v = np.array([0.0, 0.0]) # velocity of particle
1010
g = np.array([0.0, -10.0]) # gravitational acceleration
11-
h = 0.01 # time step size in seconds
11+
h = 0.01 # time step size in seconds
1212

1313
# visualization/rendering setup
1414
pygame.init()
@@ -39,13 +39,13 @@ def screen_projection(x): # convert simulated coordinates to window co
3939
pygame.display.flip() # flip the display
4040
pygame.time.wait(int(1000.0 / render_FPS)) # wait to render the next frame
4141

42-
# step forward the simulation by updating particle velocity and position
43-
v += h * g
44-
x += h * v
45-
4642
# pause the simulation when the particle touches on the ground
4743
if x[1] <= -1:
4844
input()
4945
break
5046

47+
# step forward the simulation by updating particle velocity and position
48+
v += h * g
49+
x += h * v
50+
5151
time_step += 1 # update time step counter

0_getting_started/simulator1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
# simulation setup
88
m = 1000 # mass of particle
9-
x = np.array([0.3, 0.0]) # position of particle
9+
x = np.array([0.4, 0.0]) # position of particle
1010
v = np.array([0.0, 0.0]) # velocity of particle
1111
g = np.array([0.0, -10.0]) # gravitational acceleration
1212
spring_rest_len = 0.3 # rest length of the spring ###

0_getting_started/simulator2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
import square_mesh # for generating a square mesh
77

88
# simulation setup
9-
m = 1000 # mass of each particle
109
side_length = 1 # side length of the square
1110
n_seg = 4 # number of springs per side of the square
11+
m = 1000 # mass of each particle
1212
[x, e] = square_mesh.generate(side_length, n_seg) # array of particle positions and springs ###
1313
v = np.array([[0.0, 0.0]] * len(x)) # velocity array of particles ###
1414
g = np.array([0.0, -10.0]) # gravitational acceleration

0 commit comments

Comments
 (0)