NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/
November 24, 2017, 10:00:42 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Know yourself. Questioning. ...Socrates (469-399 BC)
Google Bookmarks Yahoo My Web MSN Live Netscape Del.icio.us FURL Stumble Upon Delirious Ask FaceBook

Pages: [1]   Go Down
  Print  
Author Topic: How to detect that the objects are just touching each other, and set the dv/dt=0  (Read 3775 times)
0 Members and 1 Guest are viewing this topic. Click to toggle author information(expand message area).
lookang
Hero Member
*****
Offline Offline

Posts: 1784


http://weelookang.blogspot.com


WWW
«
Embed this message
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?


* evolution.png (36.22 KB, 603x632 - viewed 268 times.)
« Last Edit: June 21, 2010, 10:25:19 pm by lookang » Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #1 on: June 21, 2010, 10:46:12 pm » posted from:Taipei,T\'ai-pei,Taiwan

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.
Logged
lookang
Hero Member
*****
Offline Offline

Posts: 1784


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #2 on: June 29, 2010, 02:44:28 pm » posted from:Singapore,,Singapore

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
Logged
Pages: [1]   Go Up
  Print  
Know yourself. Questioning. ...Socrates (469-399 BC)
 
Jump to:  


Related Topics
Subject Started by Replies Views Last post
About crashing objects in physlet
Question related to Physics or physics related simulation
jorgenio1 5 8747 Last post January 28, 2015, 01:38:10 pm
by Heihachi07
cylinder touching wall
Question related to Physics or physics related simulation
pradeep123 1 6918 Last post December 31, 2008, 09:48:12 pm
by Fu-Kwun Hwang
how to make the logic to detect 12 or 12.00 when the answer is 12.0?
Questions related to EJS
lookang 6 8434 Last post November 18, 2009, 07:40:31 pm
by lookang
how to detect a point is inside an area that is rotatable by cta ?
Questions related to EJS
lookang 2 4372 Last post April 22, 2010, 10:25:02 pm
by lookang
view alternating objects
illusion
Fu-Kwun Hwang 2 29337 Last post October 21, 2015, 01:39:22 pm
by freddygon
Powered by MySQL Powered by PHP Powered by SMF 1.1.13 | SMF © 2006-2011, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.066 seconds with 22 queries.since 2011/06/15