Math.cos() problems



Hello,

I'm trying to do something simple but Java turns it into a federal case. All I want to do is draw a couple circles on a Graphics2D canvas with one movable and attracted to the 2nd one which is stationary. Basically I'm just trying to get basic functionality working that simulates gravitational attraction between the spheres.

I had everything working concerning the movement calculations (force, acceleration, velocity) up to the point of performing the calculation that would generate each new pixel positions for the circle that I am allowing to move. I ran into problems because I had to determine the angle between the moving circle and the stationary one and use the angle in the equations x = rCos(angle) and y = rSin(angle) so I could determine how much the movable circle should move.

The problem is that I have no clue how Java is calculating the cosine and xine of the angle I calculate (even calculating the angle is a chore which may be confusing the problem even further). With respect to what screen location are the trig functions being evaluated? (0,0) on the drawing canvas? Does it matter? I thought it did especially since my angle is based on the location of one of my circles and it isn't at 0,0 on the canvas. Where am I going wrong? This is frustrating. If you need more info let me know.

thanks
.



Relevant Pages

  • Re: Math.cos() problems
    ... I'm trying to do something simple but Java turns it into a federal case. ... I had everything working concerning the movement calculations up to the point of performing the calculation that would generate each new pixel positions for the circle that I am allowing to move. ... I ran into problems because I had to determine the angle between the moving circle and the stationary one and use the angle in the equations x = rCosand y = rSinso I could determine how much the movable circle should move. ... The problem is that I have no clue how Java is calculating the cosine and xine of the angle I calculate. ...
    (comp.lang.java.programmer)
  • Re: Math.cos() problems
    ... I had everything working concerning the movement calculations up to the point of performing the calculation that would generate each new pixel positions for the circle that I am allowing to move. ... I ran into problems because I had to determine the angle between the moving circle and the stationary one and use the angle in the equations x = rCosand y = rSinso I could determine how much the movable circle should move. ... The problem is that I have no clue how Java is calculating the cosine and xine of the angle I calculate. ...
    (comp.lang.java.programmer)
  • Re: Mr. PV teaches jb spreadsheet geometry (Re: Garlics contouring article
    ... Placing the insert's edge length of .600 in A122, the vertex angle in I122, ... you want the em to move *just as it would in cutter comp*. ... Nowhere on the spreadsheet do you see the actual coordinates of the vertices ... the circle dropped in the 60 deg V, and flipping it 180 deg around the chord ...
    (alt.machines.cnc)
  • Re: Math.cos() problems
    ... I had everything working concerning the movement calculations up to the point of performing the calculation that would generate each new pixel positions for the circle that I am allowing to move. ... I ran into problems because I had to determine the angle between the moving circle and the stationary one and use the angle in the equations x = rCosand y = rSinso I could determine how much the movable circle should move. ... The problem is that I have no clue how Java is calculating the cosine and xine of the angle I calculate. ...
    (comp.lang.java.programmer)
  • Re: Cranks
    ... I am the one who mentioned "angle ... trisection" and "circle squaring". ... "trisect an angle" and thinks "hey, ... The crank ignores the proof, or ignores its reasoning, ...
    (sci.math)