Ask your own question, for FREE!
Computer Science 9 Online
OpenStudy (anonymous):

Planning on making an analog clock in java, but I need some help with the math, how do I know what angle the arms will be at? http://ns223506.ovh.net/rozne/2e711370ae956a8c89ba1b0724d9d21d/wallpaper-195849.png the plan is to make that working as a widget

OpenStudy (anonymous):

consider time x:y:z where x is the hours, y is the minutes, and z the seconds. The big "arm" will point at 6z/360, the smaller at 6y/360, and the smallest at 15x/360.This will give you all the math you need..

OpenStudy (anonymous):

and then just use cos/sin multiplied with the desired length to get the x/y position?

OpenStudy (anonymous):

the x/y of the tip of each arm

OpenStudy (anonymous):

actually yes :) good job

OpenStudy (anonymous):

sweet... you happen to know if java uses degrees or radians?

OpenStudy (anonymous):

i don't know java.. but most programming languages use raians.. you can google it to be sure but i think radians..

OpenStudy (anonymous):

so for the x point it should be: \[\cos ((4z \div 360)\div2\pi)*r\] where z is seconds and r is the radius of the clock

OpenStudy (anonymous):

6z*

OpenStudy (anonymous):

it looks fine.. try it out and we'll see :P too tired to thoroughly..

OpenStudy (anonymous):

yeah.. i think now it's correct.. the whole 4z thing was not right

OpenStudy (anonymous):

yeah, now that I got all the math straight I'm going to make the graphics and then start coding it

OpenStudy (anonymous):

good ;)

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!