Simulating a Collision: Sphere & Particle

In summary: Vector } }In summary, the conversation discusses a simulation of a collision between a particle and a stationary sphere. The goal is to set the velocity of the particle to be zero after the collision, and to make sure that the particle has a velocity that is orthogonal to the vector of the point of collision from the center of the sphere. The conversation also delves into the mathematical calculations involved in achieving this goal, including the use of dot products and vectors. Finally, the conversation touches on the issue of momentum and the potential for a "damp" collision.
  • #1
khalsa
6
0
Hi, I am trying to simulate a collision. A particle falls down on a sphere and a collision between sphere and particle takes place. The sphere always remain stationary and the collision itself is not elastic.I was trying to set the velocity of particle to be zero after the collision. But that does not give good simulation when the collision does not occur on top of sphere but along the side of sphere.

So now after the collision i need to make sure that the particle has a velocity which is orthogonal to the vector of the point of collision from the center of sphere. The velocity along the vector from center of sphere to point of collision should become zero. How do i do that?

I am a bit mathematically challenged but i think it has something to do with dot product of vectors. Or maybe i am wrong :)

Thanks

Edit: You can check the image describing the collision at http://www.freeimagehosting.net/image.php?c5ae01b476.jpg
 
Last edited:
Physics news on Phys.org
  • #2
There is an immediate problem in conversation of momentum in the horizontal direction. If the sphere remains stationary the particle cannot move sideways. You could perhaps bend the rules and claim an equal collision occurs on the other side of the sphere to alleviate this problem.

I also do not understand why you think the particle will move along a tangent to the sphere. Assuming there is no deformation, the collision will occur at a point, and the surface of a sphere can, at a point, be approximated to a flat surface. So the particle will bounce such that the angle of incidence to the normal is the same as the angle at which it departs from the surface, like the reflection of light from a mirror.
 
  • #3
MikeyW said:
There is an immediate problem in conversation of momentum in the horizontal direction. If the sphere remains stationary the particle cannot move sideways. You could perhaps bend the rules and claim an equal collision occurs on the other side of the sphere to alleviate this problem.

I also do not understand why you think the particle will move along a tangent to the sphere. Assuming there is no deformation, the collision will occur at a point, and the surface of a sphere can, at a point, be approximated to a flat surface. So the particle will bounce such that the angle of incidence to the normal is the same as the angle at which it departs from the surface, like the reflection of light from a mirror.

I can't reflect it like light because i want a damp(with loss) collision. So had the particle collided with the sphere right on the top of sphere, its velocity would have been zero. Only when it strikes the sphere on the side will it have some residual velocity along the tangent
 
Last edited:
  • #4
I have a feeling I've calculated this before, but I couldn't find it... anyway: you could calculate the dot product of the initial velocity vector with a unit vector tangent to the sphere (in the direction of the new velocity) and use that as the magnitude of the new velocity vector. Or alternatively, it would be
[tex]\vert\vec{v}_f\vert = \vert\vec{v}_i\vert \sin\theta[/tex]
where [itex]\theta[/itex] is the angle from the top of the sphere (as in your image) to the point of impact.
 
  • #5
diazona said:
I have a feeling I've calculated this before, but I couldn't find it... anyway: you could calculate the dot product of the initial velocity vector with a unit vector tangent to the sphere (in the direction of the new velocity) and use that as the magnitude of the new velocity vector. Or alternatively, it would be
[tex]\vert\vec{v}_f\vert = \vert\vec{v}_i\vert \sin\theta[/tex]
where [itex]\theta[/itex] is the angle from the top of the sphere (as in your image) to the point of impact.

Thanks for the reply.
But only things that i know at the time of collision are the velocity vector of the particle and the 'rvector' which runs along the radius from the point of collision
 
  • #6
khalsa said:
Thanks for the reply.
But only things that i know at the time of collision are the velocity vector of the particle and the 'rvector' which runs along the radius from the point of collision
By 'rvector' do you mean the vector which points from the center of the sphere to the point of impact? If that's the case, the formula I gave can be expressed as
[tex]\vert\vec{v}_f\vert = \vert\vec{v}_i\vert\sqrt{1 - \frac{(\vec{r}\cdot\vec{v}_i)^2}{(\vec{r}\cdot\vec{r})(\vec{v}_i\cdot\vec{v}_i)}[/tex]
 
  • #7
Or, now that I think about it, if you wanted the final velocity as a vector (magnitude and direction), it should be just a matter of subtracting off the component parallel to the radius:
[tex]\vec{v}_f = \vec{v}_i - \frac{\vec{r}\cdot\vec{v}_i}{\vec{r}\cdot\vec{r}}\vec{r}[/tex]
 
  • #8
diazona said:
Or, now that I think about it, if you wanted the final velocity as a vector (magnitude and direction), it should be just a matter of subtracting off the component parallel to the radius:
[tex]\vec{v}_f = \vec{v}_i - \frac{\vec{r}\cdot\vec{v}_i}{\vec{r}\cdot\vec{r}}\vec{r}[/tex]

Thanks diazona for reply.
My original pseudo code was:-
Code:
            foreach (particle particle in particlesCollections)
            {
                //sphere.x, sphere.y sphere.z give the center of the sphere
                dist = particle.pos - vector(sphere.x, sphere.y, sphere.z);

                //detect if a collision has taken place.
                if (dist.mag < sphere.radius)
                {
                    rVector = dist / dist.mag * sphere.radius;
                    particle.pos = vector(sphere.x, sphere.y, sphere.z) + rVector;

                    //particle.Velocity gives the velocity vector of the particle at the time of collision
                    //i need to modify particle.Velocity so that the component of velocity that runs along 
                    // with the rvector becomes zero as i have a non elsatic collision. The remaining  
                    //velocity that the particle will have is the one which runs along with tangent to the  
                    //rVector. The sphere remains stationary.
                    //example values: particle.Velocity == <-1.03054, -1.56563, .006> 
                    //and rVector = <2.04406, 2.19587, 1.0514>
                }
            }

Now after implementing the logic u gave it would be:-
Code:
foreach (particle particle in particlesCollections)
            {
                //sphere.x, sphere.y sphere.z give the center of the sphere
                dist = particle.pos - vector(sphere.x, sphere.y, sphere.z);

                //detect if a collision has taken place.
                if (dist.mag < sphere.radius)
                {
                    rVector = dist / dist.mag * sphere.radius;
                    particle.pos = vector(sphere.x, sphere.y, sphere.z) + rVector;
                    particle.velocity = particle.velocity - (dot(particle.velocity, rVector) / dot(rVector, rVector)) * rVector;
                    
                }
            }

Is my understanding correct?
 
Last edited:
  • #9
Why, is there something you think is wrong with it?

By the way, when you asked this on StackOverflow you initially phrased it as a physics question, which is why it got closed (also because there's no point asking the same question in two places concurrently). But at this point, if you have specific problems with the code, then you can ask those on SO.
 
  • #10
diazona said:
Why, is there something you think is wrong with it?
first of all thanks for replying.
well i think there is something wrong with it as after doing this step:
particle.velocity = particle.velocity - (dot(particle.velocity, rVector) / dot(rVector, rVector)) * rVector;
the velocity of of the particle becomes 0 in the y dimension and there is no other change.

diazona said:
By the way, when you asked this on StackOverflow you initially phrased it as a physics question, which is why it got closed (also because there's no point asking the same question in two places concurrently). But at this point, if you have specific problems with the code, then you can ask those on SO.

it was a coding problem which basically involved physics and nothing else. So can be asked in both as different forums have people with different set of with expertise. But it suits more here than stackoverflow.

I am again asking it here as it is not coding which is causing the problem but the wrong formula to get the velocity component.
 
  • #11
khalsa said:
first of all thanks for replying.
well i think there is something wrong with it as after doing this step:
particle.velocity = particle.velocity - (dot(particle.velocity, rVector) / dot(rVector, rVector)) * rVector;
the velocity of of the particle becomes 0 in the y dimension and there is no other change.
Maybe that's what is supposed to happen...?

What numbers are you using for the particle velocity and the radius vector?
 
  • #12
diazona said:
Maybe that's what is supposed to happen...?

What numbers are you using for the particle velocity and the radius vector?

I changed this
Code:
    particle.velocity = particle.velocity - (dot(particle.velocity, rVector) / dot(rVector, rVector)) * rVector;

to

Code:
particle.velocity = particle.velocity - (dot(particle.velocity ,rVector)/dot(rVector,rVector))*(rVector/dot(rVector,rVector))

And this seems to give acceptable result.

For a initial velocity vector say:
initial velocity = <-0.33, -1.41, 21>
using formula 1 after collision = <-0.33, 0, 21>
using formula 2 after collision =<-0.33, 11.28, 21>
 
Last edited:

1. How do you simulate a collision between a sphere and a particle?

To simulate a collision between a sphere and a particle, you will need to use a physics engine or software that allows for accurate simulations. First, you will need to define the properties of the sphere, such as its size, mass, and initial velocity. Next, you will need to define the properties of the particle, including its size, mass, and initial velocity. Finally, you will need to set up the simulation to calculate the forces acting on both objects and determine their resulting motion, taking into account factors such as gravity and friction.

2. What are the key factors to consider when simulating a collision between a sphere and a particle?

When simulating a collision between a sphere and a particle, there are several key factors that need to be considered. These include the initial velocity and mass of both objects, the angle and direction of their collision, and any external forces such as gravity or friction. It is also important to accurately model the physical properties of both objects, such as their elasticity and shape, in order to achieve a realistic simulation.

3. How can you ensure accuracy in a simulated collision between a sphere and a particle?

To ensure accuracy in a simulated collision between a sphere and a particle, it is important to use a physics engine or software that is designed for accurate simulations. Additionally, it is important to accurately define the properties of both objects and take into account all relevant factors, such as external forces and the objects' physical properties. It may also be helpful to compare the simulated results to real-world collisions to ensure accuracy.

4. Can you simulate multiple collisions between a sphere and a particle?

Yes, it is possible to simulate multiple collisions between a sphere and a particle. To do so, you will need to set up the simulation to account for the objects' new positions and velocities after each collision. This can become increasingly complex as the number of collisions increases, so it is important to carefully track the objects' properties and the forces acting on them.

5. Are there any limitations to simulating a collision between a sphere and a particle?

While simulations can provide valuable insights into the behavior of objects in collisions, they are not a perfect representation of real-world events. Some potential limitations of simulating a collision between a sphere and a particle include simplifying assumptions about the objects' properties, uncertainties in the simulation setup, and computational limitations. Additionally, the accuracy of the simulation may be limited by the quality of the physics engine or software being used.

Similar threads

  • Mechanics
Replies
6
Views
1K
Replies
14
Views
1K
  • Mechanics
Replies
5
Views
581
  • Mechanics
Replies
9
Views
1K
Replies
5
Views
849
Replies
4
Views
921
Replies
3
Views
1K
Replies
3
Views
1K
Replies
27
Views
14K
Replies
9
Views
1K
Back
Top