reset password
Author Message
Anon
Posts: 134
Posted 13:28 Nov 13, 2015 |

Lab 6 description: 

"The main work will be in pp-update-objects so that you take into account all possible ball-to-ball interactions. You must compute repulsions between each pair of balls. 
Hint: For each ball make a list of the interactions with the other balls. Then add them up. Don't worry—at least initially— about computing the same interaction twice, once when a ball is influenced by another and once when it influences another. Once you have done that see if you can eliminate the duplicate computation."

In the hint, does each "interaction" represent a repulsion? If so, does it mean to add all the repulsion values (a list of repulsion values from comparing the current ball to the other balls) to get a new summed up repulsion value for the current ball?

Last edited by Anon at 13:29 Nov 13, 2015.
rabbott
Posts: 1649
Posted 13:35 Nov 13, 2015 |

If I understand your question, the answer is "yes." But an interaction could be an attraction if your world includes attractions.

Look at the hint below that. It shows how to find all the interactions between any two balls. For each ball you have a list of interactions. (An interaction will be a change in the ball's velocity.) Apply those interactions to the ball (either one at a time or by summing them up and then applying the sum) to get the ball's new velocity. 

Last edited by rabbott at 13:48 Nov 13, 2015.