java - Stupid Math issue -


Look at the gray circles with lines, they should be kept equally to represent hours, here is their code , where did I go wrong? (Int i = 0; i & lt; 12; i ++) {c.drawCircle (140 * (float) Math.cos ((double) (i * 30)

 for  ) + Width / 2, 140 * (float) math.Syn ((double * (i * 30)) + height / 2, 1, p); }  

enter image details here

The angle must be provided in radians ( 0 and 2 * Math.PI ).

Then, use

  Math.cos ((double) (i * 30))  

instead of

  Math.cos (i * Math.PI / 6.0)  

Note that I also repeated the waste cast: one int multiplication and one double first Produces a double from itself.


Comments

Popular posts from this blog

java - NullPointerException for a 2d Array -

python - Assemble mpeg file unable to play in mediaplayer -

c# - NameSpace Manager or XsltContent to parse aspx page -