- #1
RossH
- 75
- 0
@Admin: question doesn't really lend itself to the template, so I'm not going to use it.
Hello. I am writing an N-body simulation program and am currently trying to add deflection/collision functionality and am having trouble figuring out how to do this.
So, I have two bodies coming towards each other at arbitrary vectors. Say, I have one at (0,0) moving along the vector (1,3) and one at (5,5) moving along the vector (-4,-2). These will obviously collide at the point (1,3) and then I have to figure out how they are going to deflect. (this is only in the x-y plane)
As I see it, there should be some sort of plane between the two bodies that I can pretend they reflect off of, and then use the angle incidence=angle deflection with that plane. I know the velocity of my bodies in the x and y directions, so it would be that hard to find the new velocity of the two bodies if I knew the plane, using trigonometry, but I am unsure how I would go about finding that plane. The problem is, of course, that both bodies are moving.
Thanks for any help you can provide.
Hello. I am writing an N-body simulation program and am currently trying to add deflection/collision functionality and am having trouble figuring out how to do this.
So, I have two bodies coming towards each other at arbitrary vectors. Say, I have one at (0,0) moving along the vector (1,3) and one at (5,5) moving along the vector (-4,-2). These will obviously collide at the point (1,3) and then I have to figure out how they are going to deflect. (this is only in the x-y plane)
As I see it, there should be some sort of plane between the two bodies that I can pretend they reflect off of, and then use the angle incidence=angle deflection with that plane. I know the velocity of my bodies in the x and y directions, so it would be that hard to find the new velocity of the two bodies if I knew the plane, using trigonometry, but I am unsure how I would go about finding that plane. The problem is, of course, that both bodies are moving.
Thanks for any help you can provide.