Enjoy the fun of physics with simulations!

Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/

Title: How to detect that the objects are just touching each other, and set the dv/dt=0Post by: lookang on June 21, 2010, 09:59:21 pm
How to detect that the objects are just touching each other, and set the dv/dt =0?
i realised the new evolution event codes help to achieve the time to go on which answers the question i posted earlier on. the code is i have adopted your zero crossing method Code: if (v>0) return x+carSize/2-xbumperbottom; // bounced at x=xmax else if(v<0)return x-carSize/2-xbumpertop; // bounced at x=xmin or x+carSize/2 return 1.0; //return 1.0; action Code: v=-e*v; thx! thx! but now, if e=0.1 to 0.9 the car will move beyond the bummer at the bottom if the velocity is low. what is the elegant way to overcome this new problem? thx! oh another problem e=0, it doesn't move at all due to v=0 at start. if i use wolfgang's and paco evolution codes, it solves the problems above, but time stops running when they car is stationary against the bummer. any way to make time continue? Title: Re: How to detect that the objects are just touching each other, and set the dv/dt=0Post by: Fu-Kwun Hwang on June 21, 2010, 10:46:12 pm
There are infinite value in number system (mathematical point of view), but computer has finite memory.
So the computation always has numerical error. That is the reason why there is a error range when you set up the event. If the difference in event checking is less than the error range, it is assume to be the same. Because your object starts at one end, so the condition is match in the beginning (unless you also add velocity checking condition). If e=0 , then the bouncing speed is zero. How would you expect the object to move??? For e<1: the velocity will decrease by the same ratio with each collision. Eventually, it will reach near zero and the event condition will match all the time. So more code is needed to take care of it. Physically, the object is stopped when the velocity is smaller than experimental error. And no one can notice the differences when the moving is less than the resolution of the computer screen resolution. You should pause the simulation when the object is very close to one of the event position and the velocity is less than some minimum value. More calculation is useless. Title: Re: How to detect that the objects are just touching each other, and set the dv/dt=0Post by: lookang on June 29, 2010, 02:44:28 pm
the solution to this problem has been solved here
http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=1841.0 hope this info helps someone too |