trick/trick_sims/SIM_contact
Alex Lin 496de8c7a9
Disambiguate python use #1250 (#1251)
* Disambiguate python use #1250

Changed all calls to /usr/bin/python to /usr/bin/env python3.  Removed execute permissions on a lot of files that are not executable.

closes #1250
2022-03-22 15:15:40 -05:00
..
images Update image of Colliding Balls. Ref #995 2020-05-04 22:06:04 -05:00
models Disambiguate python use #1250 (#1251) 2022-03-22 15:15:40 -05:00
Modified_data Disambiguate python use #1250 (#1251) 2022-03-22 15:15:40 -05:00
RUN_ball_line Disambiguate python use #1250 (#1251) 2022-03-22 15:15:40 -05:00
RUN_multi_collision Disambiguate python use #1250 (#1251) 2022-03-22 15:15:40 -05:00
RUN_Newtons_cradle Disambiguate python use #1250 (#1251) 2022-03-22 15:15:40 -05:00
RUN_pool_break Disambiguate python use #1250 (#1251) 2022-03-22 15:15:40 -05:00
RUN_simple_collision Disambiguate python use #1250 (#1251) 2022-03-22 15:15:40 -05:00
RUN_test5 Disambiguate python use #1250 (#1251) 2022-03-22 15:15:40 -05:00
README.md Update README.md 2020-03-25 13:53:35 -05:00
S_define Disambiguate python use #1250 (#1251) 2022-03-22 15:15:40 -05:00
S_overrides.mk Disambiguate python use #1250 (#1251) 2022-03-22 15:15:40 -05:00

SIM_contact

SIM_contact simulates the motion, and the collisions of any arbitrary numbers of moving balls.

Each ball is defined by a position, velocity, radius, and mass.

Collisions are purely elastic. In addition to conserving momentum, they also conserve kinetic energy.

A graphics client allows you to see the balls in motion:

Graphics CLient showing two balls

Examples

The configuration for the above display is:

dyn.contact.nballs = 2
dyn.contact.balls = trick.TMM_declare_var_1d("Ball*", dyn.contact.nballs)
dyn.contact.balls[0] = trick.make_Ball(0.0, 0.0,  0.5, 0.0, 0.5, 1.0)
dyn.contact.balls[1] = trick.make_Ball(3.0, 0.0, -0.5, 0.0, 0.5, 1.0)

The initial state of the first ball is pos=<0.0, 0.0>, vel=<0.5,0.0>, radius=0.5, and mass=1.0.

The initial state of the second ball is pos=<3.0, 0.0>, vel=<-0.5,0.0>, radius=0.5, and mass=1.0.