NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/
November 22, 2017, 11:41:49 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  
"Nothing in life is to be feared, it is only to be understood." ..."Marie Curie 1867-1934, Polish born French Physicist, Twice Nobel Prize Winner- Physics and Chemistry)"
Google Bookmarks Yahoo My Web MSN Live Netscape Del.icio.us FURL Stumble Upon Delirious Ask FaceBook

Pages: [1]   Go Down
  Print  
Author Topic: any example xml on angle always made with positive x axis  (Read 11487 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: August 15, 2007, 12:59:28 am » posted from:Singapore,,Singapore

i ran into a bug in my codes

my alpha is good for angle 90 to -90 degree.

but when my velocity vector goes to 91 to 180 degree, my alpha is storing the acute angle made with negative x axis.

for example angle made = 150 degree, but my alpha shows -30 degree in the field.

is it because of

1. the conversion from degree to radian ?
2. the Math.sin Math.cos Math.tan formula ? is there another formula for the angle always made with positive x axis ?

attached is my xml Smiley
« Last Edit: August 15, 2007, 01:35:11 am by lookang » Logged
lookang
Hero Member
*****
Offline Offline

Posts: 1784


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #1 on: August 15, 2007, 01:14:13 am » posted from:Singapore,,Singapore

alpha =  Math.atan2(vy/vx);

should work but it does not.

strange  Huh
Logged
lookang
Hero Member
*****
Offline Offline

Posts: 1784


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #2 on: August 15, 2007, 07:41:21 am » posted from:Singapore,,Singapore

Did it!!

alpha =(Math.atan2(vy,vx))*180/Math.PI;


tricky, noted the comma and it works beautifully.

i am starting to look at the optics examples

a lot of things i want to do can be found !!!

thanks
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #3 on: August 15, 2007, 08:59:59 am »

There are some basic information about java programming at http://enjoy.phy.ntnu.edu.tw/mod/resource/view.php?id=8465 (in Chinese).
You will find all the mathematic functions available in java.

Detail information about all the properties in GUI elements can be found at http://enjoy.phy.ntnu.edu.tw/mod/resource/view.php?id=8468
And you can download those html files from http://www.phy.ntnu.edu.tw/demolab/phpBB/osejs/EJS_view_reference.zip
Logged
lookang
Hero Member
*****
Offline Offline

Posts: 1784


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #4 on: August 15, 2007, 09:54:39 am » posted from:Singapore,,Singapore

polygon seems a bit harder to implement than analytic curve.

analytic curve is very easy to use for drawing part of a circle

may i suggest that future version of EJS the analytic curve has the same function as polygon " start type and end type"

then EJS can draw a line with an arrow head using  analytic curve.

this is especially useful for drawing angles !
 
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #5 on: August 15, 2007, 10:27:49 am »

We try to minimum the parameters need to be changed for all the GUI elements, so user would not think it too complicated.
If you just want to draw angle, It will be easier to use "Line" GUI elements.
Actually, it is a 2D version of polygon.

Your suggestion can be implemented very easily (because it was implemented with polygon element.).
I will ask Paco to add it to the code for the next version.
Logged
lookang
Hero Member
*****
Offline Offline

Posts: 1784


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #6 on: August 15, 2007, 12:52:56 pm » posted from:Singapore,,Singapore

prof hwang and prof paco,

you guys are the most helpful people i know online !!

thanks  Cheesy

wish more people will use EJS to build more diverse applets
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #7 on: August 15, 2007, 02:37:23 pm »

I will be happy if you can keep building more physics simulations with EJS.
And, I hope you can post it here to share with others. Grin
Logged
Pages: [1]   Go Up
  Print  
"Nothing in life is to be feared, it is only to be understood." ..."Marie Curie 1867-1934, Polish born French Physicist, Twice Nobel Prize Winner- Physics and Chemistry)"
 
Jump to:  


Related Topics
Subject Started by Replies Views Last post
how to make x and y axis automatically on the drawing panel
Questions related to EJS
lookang 4 13289 Last post August 10, 2007, 02:35:48 pm
by lookang
how to draw a fraction of a circle for angle showing in plotting panel
Questions related to EJS
lookang 7 16406 Last post August 15, 2007, 08:55:15 am
by Fu-Kwun Hwang
what is the best way to share java applets made by EJS ?
Questions related to EJS
lookang 11 12372 Last post April 05, 2015, 02:08:36 am
by Femida
How to make an applet that is controlled by F (length) and angle (cta)
Questions related to EJS
lookang 4 7967 Last post March 02, 2009, 10:22:45 pm
by Fu-Kwun Hwang
how to transform about an axis a rotation using Matrix3DTransformation ?
Questions related to EJS
lookang 2 13874 Last post August 24, 2012, 03:16:04 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.062 seconds with 22 queries.since 2011/06/15