实现碰撞的最简单方法是什么? 假设所有粒子都具有相同的速度和相同的质量,但方向不同。即使在碰撞后,它们的速度和质量仍然保持不变,但前进方向发生了变化。 是否可以实现两个以上粒子之间的碰撞?
最佳答案
这是一个example implementation遵循以下规则:
Particles behave according to the following rules:
- A particle moves in a straight line without changing its speed, unless it collides with another particle or bounces off the wall. The particles are aimed to hit each other at the origin.
- Two particles "collide" if they find themselves on the same patch (the world is composed of a grid of small squares called patches).
- A random axis is chosen, as if they are two balls that hit each other and this axis is the line connecting their centers.
- They exchange momentum and energy along that axis, according to the conservation of momentum and energy. This calculation is done in the center of mass system.
- Each turtle is assigned its new velocity, energy, and heading.
- If a turtle finds itself on or very close to a wall of the container, it "bounces" -- that is, reflects its direction and keeps its same speed.
如果您对此逻辑的任何部分有具体问题,请随时发表评论。
关于netlogo - 在NetLogo中实现碰撞的最简单方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24711128/