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
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..
and then just use cos/sin multiplied with the desired length to get the x/y position?
the x/y of the tip of each arm
actually yes :) good job
sweet... you happen to know if java uses degrees or radians?
i don't know java.. but most programming languages use raians.. you can google it to be sure but i think radians..
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
6z*
it looks fine.. try it out and we'll see :P too tired to thoroughly..
yeah.. i think now it's correct.. the whole 4z thing was not right
yeah, now that I got all the math straight I'm going to make the graphics and then start coding it
good ;)
Join our real-time social learning platform and learn together with your friends!