Skip to content

Commit 7cc2da4

Browse files
Added more features to the library
Added four cross
1 parent 1631918 commit 7cc2da4

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

tools/icbuilder.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,4 +216,32 @@ def three_body_figure_eight(mass=1.0):
216216
(x1, y1, 0.0, vx1, vy1, 0.0, m),
217217
(x2, y2, 0.0, vx2, vy2, 0.0, m),
218218
(x3, y3, 0.0, vx3, vy3, 0.0, m),
219+
]
220+
221+
def four_body_cross(mass=1.0):
222+
"""
223+
Symmetric four-body 'cross' choreography.
224+
Four equal masses start on cardinal axes and orbit the barycenter.
225+
"""
226+
227+
m = mass
228+
229+
# Standard symmetric initial conditions (scaled for G = 1)
230+
# Positions:
231+
x1, y1 = 1.0, 0.0
232+
x2, y2 = -1.0, 0.0
233+
x3, y3 = 0.0, 1.0
234+
x4, y4 = 0.0, -1.0
235+
236+
# Velocities chosen to produce the cross choreography
237+
vx1, vy1 = 0.0, 0.5
238+
vx2, vy2 = 0.0, -0.5
239+
vx3, vy3 = -0.5, 0.0
240+
vx4, vy4 = 0.5, 0.0
241+
242+
return [
243+
(x1, y1, 0.0, vx1, vy1, 0.0, m),
244+
(x2, y2, 0.0, vx2, vy2, 0.0, m),
245+
(x3, y3, 0.0, vx3, vy3, 0.0, m),
246+
(x4, y4, 0.0, vx4, vy4, 0.0, m),
219247
]

0 commit comments

Comments
 (0)