B
Brandon McCombs
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
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