NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/
December 12, 2017, 11:02:00 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  
Wisdom consists of the anticipation of consequences. ..."Norman Cousins(1913-1990, American author)"
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 make the mass m dragable n the world view in circular motion?  (Read 10730 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: July 12, 2010, 11:01:11 am » posted from:Singapore,,Singapore

Hi Prof Hwang and Ejs community,

how to make the mass m dragable n the world view in circular motion?

i seems to have encounter a problem which i need someone else to discuss with to understand why the mass cannot be drag.

in the fixed relation
x=R*Math.sin(cta);
y=R*Math.cos(cta); // jamming the on drag codes


in the object m
on drag i added these codes to execute when drag.
cta = Math.atan2(y,x);
R = Math.sqrt(x*x+y*y);
_initialize();

i don't see anything wrong with the method i used to make the mass m execute
cta = Math.atan2(y,x);
R = Math.sqrt(x*x+y*y);
but it does not work.

the remixed work is here http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=1892.0

Embed a running copy of this simulation

Embed a running copy link(show simulation in a popuped window)
Full screen applet or Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
Press the Alt key and the left mouse button to drag the applet off the browser and onto the desktop. This work is licensed under a Creative Commons Attribution 2.5 Taiwan License
  • Please feel free to post your ideas about how to use the simulation for better teaching and learning.
  • Post questions to be asked to help students to think, to explore.
  • Upload worksheets as attached files to share with more users.
Let's work together. We can help more users understand physics conceptually and enjoy the fun of learning physics!


* massdraggable.png (26.58 KB, 608x631 - viewed 323 times.)
« Last Edit: July 12, 2010, 11:20:22 am by lookang » Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #1 on: July 12, 2010, 06:57:55 pm » posted from:Taipei,T\'ai-pei,Taiwan

What is the constraints when the mass was being dragged?
Is it has to be at fixed radius R or it can be at any radius?
Logged
lookang
Hero Member
*****
Offline Offline

Posts: 1784


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #2 on: July 13, 2010, 09:36:00 am » posted from:Singapore,,Singapore

x=R*Math.sin(cta);
y=R*Math.cos(cta); // jamming the on drag codes
i made a yellow object which is on (x000, y000) seems to be able to drag.

i think the fixed relation
x=R*Math.sin(cta);
y=R*Math.cos(cta);
does not allow on drag.

let me look at it more closely Grin
Logged
lookang
Hero Member
*****
Offline Offline

Posts: 1784


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #3 on: July 13, 2010, 01:02:27 pm » posted from:Singapore,,Singapore

i did it!

i assign another variable (x000,y000)
cta = -Math.atan2(y000,x000)+pi/2; // to make drag by angle
R = Math.sqrt(x000*x000+y000*y000); // to make radius vary as well
x= x000; // may not be needed
y= y000; // may not be needed
_initialize();

in fixed relation
x000=R*Math.sin(cta); // code for making object x000,y000 follow the equation of motion
y000=R*Math.cos(cta);


i reflect back in the method, i still don't see the codes that cause the jam in the first place, the difference is just x000,y000 assign another variables.
maybe the problem is
cta = Math.atan2(y,x);
R = Math.sqrt(x*x+y*y); in the old mass object (x,y).

while, it works now! enjoy! http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=1892.msg6846#msg6846
thanks! this forum rocks! & i am working towards human kind’s well-being too  Grin


« Last Edit: July 13, 2010, 01:19:12 pm by lookang » Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #4 on: July 13, 2010, 07:51:37 pm » posted from:Taipei,T\'ai-pei,Taiwan

Normally, I will add
Code:
cta = Math.atan2(x,y);
R = Math.sqrt(x*x+y*y);
in the drag action.

And add
Code:
x=R*Math.cos(cta);
y=R*Math.sin(cta);
in the fixed relation section.

Please check out Circular motion in vertical plane
(It has been updated so that the particle is drag-able)
Logged
lookang
Hero Member
*****
Offline Offline

Posts: 1784


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #5 on: July 13, 2010, 08:39:59 pm » posted from:Singapore,,Singapore

it is very close to what i was doing conceptually, i follow your method as you have explained before about the codes inside on drag.
it could have been some additional codes i introduce.
not to worry! thanks!
Logged
ahmedelshfie
Ahmed
Hero Member
*
Offline Offline

Posts: 954



«
Embed this message
Reply #6 on: July 17, 2010, 10:58:52 pm » posted from:Uberaba,Minas Gerais,Brazil

I try make the same that prof Hwang do in original applet that i drag by mouse
The mass to control in size of circular how ever i copy code from original applet with modified from me in initialization page
But work first time only and after i cant control in size of circular so i restor EJS and run again work applet and i drag circular
For control in size of circular.
Second test no work again can you prof Hwang check code that i do.


*** There are 1 more attached files. You need to login to acces it!
« Last Edit: July 17, 2010, 11:01:04 pm by ahmedelshfie » Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #7 on: July 18, 2010, 10:38:10 am » posted from:Taipei,T\'ai-pei,Taiwan

It is because you have 3 GUI elements all connect to (x,y) and there are all dragable.
1. Particle
2. mg
3. rod
So only the last one will receive mouse drag action.

The above order is the same order shown in the EJS GUI tree.
So the action for mouse move to (x,y) and drag was assigned to rod.

Because your action code is assigned to Particle
What you can do is
1. Change the above order so the Particle appear as the last GUI element
2. Change the dragable property for mg and rod to false

Remember: If there are several GUI elements assigned to the same variable, then the last one's action will be the one being executed.
Logged
lookang
Hero Member
*****
Offline Offline

Posts: 1784


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #8 on: July 19, 2010, 02:11:40 pm » posted from:Chicago,Illinois,United States

I try make the same that prof Hwang do in original applet that i drag by mouse
The mass to control in size of circular how ever i copy code from original applet with modified from me in initialization page
But work first time only and after i cant control in size of circular so i restor EJS and run again work applet and i drag circular
For control in size of circular.
Second test no work again can you prof Hwang check code that i do.
maybe my code can help u figure out, the drag works on this
http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=1892.msg6846#msg6846
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #9 on: July 19, 2010, 05:14:55 pm » posted from:Taipei,T'ai-pei,Taiwan

"Drag" is not working properly for the applet shown at the top (first message).
Logged
ahmedelshfie
Ahmed
Hero Member
*
Offline Offline

Posts: 954



«
Embed this message
Reply #10 on: July 19, 2010, 06:26:13 pm » posted from:Uberaba,Minas Gerais,Brazil

Finish,, work very well i will attach jar file because no accept upload on Site.
I have ask source code of applets path is ejs not XML so i don't know
If this make applet no accept upload on site or me no understand this way of path to upload,, but im near sure problem is path ejs .
Could you prof Hwang explain to me please about path ejs and how i change to upload in site
Thanks
Here is a new version from circular motion!!


*** There are 1 more attached files. You need to login to acces it!
« Last Edit: July 19, 2010, 06:40:46 pm by ahmedelshfie » Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #11 on: July 19, 2010, 08:25:50 pm » posted from:Taipei,T\'ai-pei,Taiwan

It seems that you rename the ejs_circularvwee.jar to ejs_circularvwee25.jar.

I used the filename of the uploaded jar to find the ejs source (.xml or .ejs).
Because you rename ejs_circularvwee.jar to ejs_circularvwee.jar. so the server can not find the ejs source
and it stop the process.

Do not change the ejs generated jar filename. Upload as it is generated.
If you want another jar name, you should change the ejs source name.

I tried to change the code on the server so that it will accept .ejs as source.
Logged
ahmedelshfie
Ahmed
Hero Member
*
Offline Offline

Posts: 954



«
Embed this message
Reply #12 on: July 19, 2010, 08:37:59 pm » posted from:Uberaba,Minas Gerais,Brazil

When i download modified version by lookang
I find he save path by ejs not by XML
But prof you mean if convert source code by path ejs and after upload on site server will understand this and accept upload or no?
And if no accept what i must do to me can upload jar file what i must change in source ?
I finish applet and i do all steps that you explain and work very well.
Thanks  Smiley
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #13 on: July 19, 2010, 09:52:56 pm » posted from:Taipei,T\'ai-pei,Taiwan

EJS 4.3 support utf-32 characters and extension for the default source become "ejs" instead of "xml".

Before this evening: The upload jar file option at this server only support jar files generated with "xml" type source.
I have modified the code, so it is also support jar file generated with "ejs" type source now ( at least it works fine when I tested it).

You can try it again and it should work fine now.
Logged
ahmedelshfie
Ahmed
Hero Member
*
Offline Offline

Posts: 954



«
Embed this message
Reply #14 on: July 19, 2010, 11:15:32 pm » posted from:Uberaba,Minas Gerais,Brazil

I see is work fine now i test applet work very well,, i notice no have download XML source code but this i think because
Now source code is another path so cant have XML source code.
A modified version on Circular motion in vertical plane
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #15 on: July 20, 2010, 12:46:21 am » posted from:Taipei,T\'ai-pei,Taiwan

I just modified the code to display link for ejs source with ".ejs" type.
However, I still need to modify code for view it online later.
It is really late now. I need to go to bed! May be work on it tomorrow!
Logged
ahmedelshfie
Ahmed
Hero Member
*
Offline Offline

Posts: 954



«
Embed this message
Reply #16 on: July 20, 2010, 12:49:12 am » posted from:Uberaba,Minas Gerais,Brazil

Thanks for help prof,, I'm worked in applets that you design by JDK I'm improve my self in translations Cheesy Good night
« Last Edit: July 20, 2010, 02:33:32 am by ahmedelshfie » Logged
ahmedelshfie
Ahmed
Hero Member
*
Offline Offline

Posts: 954



«
Embed this message
Reply #17 on: July 20, 2010, 08:59:54 am » posted from:Uberaba,Minas Gerais,Brazil

I understand now part about path ejs but have another part im no understand is how i make
Applet source code ejs not XML for example im create or modified applet but i want path of source is ejs
How i do it.
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #18 on: July 20, 2010, 05:58:09 pm » posted from:Taipei,T\'ai-pei,Taiwan

Before EJS version 4.2, the default file extension for ejs is "xml".
It has been changed to "ejs" since EJS 4.3
When you create a new ejs simulation and save it, you can just type the filename.
And EJS will save the file with extension ".ejs".

However, if you open previous simulation source where the extension is "xml".
Then, EJS will not change the extension so that previous version can be run as well.

If you really want to save the file with extension "ejs", then you can type the full filename (filename + extension".

May I know why you want the source to become "ejs" type? 
Logged
ahmedelshfie
Ahmed
Hero Member
*
Offline Offline

Posts: 954



«
Embed this message
Reply #19 on: July 20, 2010, 06:08:59 pm » posted from:SAO PAULO,SAO PAULO,BRAZIL

Thanks prof,, i don't want source become ejs I'm ask for me understand every thing about ejs path i like more XML because if you remember
From time i begin learn EJS i work by XML but i meet some applets have path ejs so i think is more good i building database about this kind of path
Even i will not use,,but is good i have idea how it work.
By the way prof i worked in your applets by JDK is really wonderful and I'm sure for develop applets by JDK is very hard.
I have ask have applet i meet is RC Circuits when i work in translation
I find some words inside applet like click red switch to start and other words like voltage,,current,,time have away to translation this words to portages.
Because i think this is inside class file for me change to portages i need to enter in file class right?
So have a way to me do it,, translation words inside applet or i cant do it ?
Thanks prof
« Last Edit: July 20, 2010, 07:46:16 pm by ahmedelshfie » Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #20 on: July 20, 2010, 10:44:10 pm » posted from:Taipei,T\'ai-pei,Taiwan

You will find a button "translate this message (and the strings in the simulation) into your local language.
Just click that button and you will find editable area for you to translate that posted message into your local language.
You will also find a table to translate strings used in the simulation.
Just edit that page and submit your result.
And you will received translated result in your email box after you post the translated data and click download button.
Please try it and you will find out it can be done easily.

"Click red switch to start" was not included in the translation. I will need to modify the code to add that one.
Do you really need it?
Logged
ahmedelshfie
Ahmed
Hero Member
*
Offline Offline

Posts: 954



«
Embed this message
Reply #21 on: July 20, 2010, 11:08:10 pm » posted from:SAO PAULO,SAO PAULO,BRAZIL

Im really test it before and work good with me i perfer translation by HTML is more good,,  about "Click red switch to start" i dont want busy you if have time
To modified okay if you no have time is no problem i will publish by this way.
Logged
Pages: [1]   Go Up
  Print  
Wisdom consists of the anticipation of consequences. ..."Norman Cousins(1913-1990, American author)"
 
Jump to:  


Related Topics
Subject Started by Replies Views Last post
Circular motion
Kinematics
Fu-Kwun Hwang 1 22960 Last post November 20, 2007, 05:15:01 am
by bizzopt
relations between simple harmonic motion and circular motion
Kinematics
Fu-Kwun Hwang 2 36969 Last post April 15, 2016, 11:21:50 pm
by lookang
how to make a Earth Globe realistic enough when view show correct orientation?
Questions related to EJS
lookang 0 5940 Last post January 03, 2009, 10:06:53 pm
by lookang
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.084 seconds with 23 queries.since 2011/06/15