1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Collision of an expanding disc with another disc.

  1. Aug 10, 2011 #1
    Like a lot of people programming, I created a simplistic 2D collision engine. This engine handles the collisions of circles (I know I typed "disc" in the title, but I wanted to avoid replies like "circles don't really exist so they can't collide".)

    The simulation is friction-less, so since the circles do not rotate initially, they never end up rotating. The collisions are also totally elastic and since there is no deformation, the collisions happen instantly. The detection model is an a-priori model. I want my engine to handles circles that expand or shrink.

    It works fine with regular ("regular", opposed to "expanding" or "shrinking") circles, but when it comes to non-regular circles, I'm having an issue :
    I can detect when the collision will occur, but I have no clues how to calculate the movement of the circles after the collision. I can't base the impact forces on the velocity of the circles since it's possible for 2 non-moving circles to collide if one (or both) of them expands.

    I thought about taking into account the "radius growth speed" into the velocity, but that's just a wild guess. Anyone can steer me in the right direction?

  2. jcsd
  3. Aug 11, 2011 #2
    Your collision model is fundamentally based on the conservation of momentum... but from your post it is not clear how a moving, expanding disk has a conserved momentum. Does its density fall to keep its mass constant? At the point of collision, do you assume the disk is not expanding? (otherwise it would expand into the other disk!)
  4. Aug 11, 2011 #3


    User Avatar
    Science Advisor

    Sounds reasonable. You modify the velocity vector of the disc center with the radial velocity of the circumference due to explansion/shinking. The sum of both vectors gives you the velocity of the collision point at the discs circumference, used for the collision calculations.
  5. Aug 11, 2011 #4
    Oh, forgot to specify, sorry. The mass of the disk is deemed in the middle of the disk and remains constant through the expansion.

    As for preventing the disk from further expanding when it collides : I though that since the collision is totally elastic, after any given collision, the 2 colliding disks will move away from each other at at-least the "Radius Growth speed". This is if I manage to take the radius growth speed into account. The following code is how I handle the collision for now. I'll mention the changes I plan to make after :

    float collAMass = collidableA.Mass;
    Vector2 collASpeed = collidableA.Speed;
    float collAGrowth = collidableA.RadiusGrowth;

    float collBMass = collidableB.Mass;
    Vector2 collBSpeed = collidableB.Speed;
    float collBGrowth = collidableB.RadiusGrowth;

    // Center of Mass Speed
    Vector2 cmSpeed = (collAMass * collASpeed + collBMass * collBSpeed) / (collAMass + collBMass);

    Vector2 collAInitialRelativeSpeed = collASpeed - cmSpeed;
    Vector2 collBInitialRelativeSpeed = collBSpeed - cmSpeed;

    Vector2 collAParallelSpeed = Vector2Tools.Projection(collAInitialRelativeSpeed, impulseNormal);
    Vector2 collBParallelSpeed = Vector2Tools.Projection(collBInitialRelativeSpeed, impulseNormal);

    Vector2 collAPerpendicularSpeed = collAInitialRelativeSpeed - collAParallelSpeed;
    Vector2 collBPerpendicularSpeed = collBInitialRelativeSpeed - collBParallelSpeed;

    Vector2 collAFinalRelativeSpeed = -collAParallelSpeed + collAPerpendicularSpeed;
    Vector2 collBFinalRelativeSpeed = -collBParallelSpeed + collBPerpendicularSpeed;

    Vector2 collAFinalSpeed = collAFinalRelativeSpeed + cmSpeed;
    Vector2 collBFinalSpeed = collBFinalRelativeSpeed + cmSpeed;

    So I know I need to take into account the RadiusGrowth, but where I'm unsure, is how to incorporate it in the "Center of Mass Speed". I think I'll have to add the growth of one disk and subtract the growth of the other one when calculating cmSpeed. I know it sounds silly because the actual center of mass doesn't change, but that's the only way I see to transfer the "Expansion" from one disk into another disk (as a motion). For example if we lose one dimension for the time being :

    Disk A (CollidableA) :
    * Position : 0
    * Speed : 0
    * Mass : 10
    * Radius : 1
    * Radius Growth : 1/sec

    Disk B (CollidableB) :
    * Position : 3
    * Speed : 0
    * Mass : 5
    * Radius : 1
    * Radius Growth : 0

    There should be a collision after 1sec. I expect Disk A to end up with a negative speed (relative to the referential) that is about half of how fast Disk B should be going the other way. If I don't change cmSpeed, Disk A would end up moving after the collision, and not Disk B.

    (Just explaining this helps me see my problem clearer, as always!)
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook