NTNUJAVA Virtual Physics LaboratoryEnjoy the fun of physics with simulations! Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/
April 21, 2021, 09:54:26 am

Wisdom is to form a good attitude and a healthy lifestyle. ...Wisdom

 Pages: 1 2 [3]   Go Down
 Author Topic: Collision 2D  (Read 159966 times) 0 Members and 1 Guest are viewing this topic. Click to toggle author information(expand message area).
Bluzkin
Newbie

Offline

Posts: 3

 « Embed this message Reply #60 on: November 19, 2010, 02:08:33 am »

Hello Fu-Kwun Hwang. This really helped me. For my finals I chose to make a physics simulation application (in Game Maker 8.0) including brownian motion.

I have tried to get the final formula for v1' with the first two equations but I just can't get it right. Could you maybe send me the the steps you took to get there? That would be great.

I also don't know how to calculate the component of a force (or other vector) in a certain direction so if you could help me with that I would really appreciate it.

(I don't know if I double posted but I think my first post wasn't processed or something...)
 Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3086

 « Embed this message Reply #61 on: November 19, 2010, 11:53:24 am »

I assume you know how to find vector which connect between center of two particles.
if one is (x1,y1,z1),another one is (x2,y2,z1). then the vector $\vec{r}$ is (x2-x1,y2-y1,z2-z1).
Assume velocity of particle 1 is$vec{v}$= (vx1,vy1,vz1),
The velocity component in the vector $vec{r}$ direction can be calculated as $\vec{v_p}=(\vec{v}\cdot\vec{r})/r^2 \vec{r}$,where $r$ is the length of velocity $\vec{r}=\sqrt{(x2-x1)^2+(y2-y1)^2+(z2-z1)^2}$

i.e.
vx1'=((vx1*(x2-x1)+vy1*(y2-y1)+vz1*(z2-z1))/r^2) (x2-x1)
vy1'=((vx1*(x2-x1)+vy1*(y2-y1)+vz1*(z2-z1))/r^2) (y2-y1)
vz1'=((vx1*(x2-x1)+vy1*(y2-y1)+vz1*(z2-z1))/r^2) (z2-z1)

And the velocity compendicular to $vec{r}$ is $\vec{v_n}=\vec{v}-\vec{v_p}$

P.S. The inner product between $\vec{A}$ and unit vector $\hat{n}$ will give you magnitude of projection of vector $\vec{A}$ in the direction of $\hat{n}=\vec{r}/r$, so the component in the direction $\hat{n}$ is $(\vec{A}\cdot\hat{n}) \hat{n}$
 Logged
Bluzkin
Newbie

Offline

Posts: 3

 « Embed this message Reply #62 on: November 21, 2010, 12:40:39 am »

Thanks! that really helped.

Now I just need to understand JS and have a look at the source code
 Logged
lookang
Hero Member

Offline

Posts: 1796

http://weelookang.blogspot.com

 « Embed this message Reply #63 on: April 11, 2011, 07:51:27 am »

some more error when clicking 'VIEW  ejs xml source'
OOPS! EJS XML file (airplane.xml) does not exists!

 Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3086

 « Embed this message Reply #64 on: April 11, 2011, 05:51:32 pm »

Thank you for reporting the problem. It is fixed now.
 Logged
 Pages: 1 2 [3]   Go Up
Wisdom is to form a good attitude and a healthy lifestyle. ...Wisdom