Something about how to locate the coordinates
Hello guys, I got problem in locating coordinates, and kinda hoping anybody can help me out.
I am intend to draw a circle and small 3D Rectangle. I want to use a Timer to rapaint the painting and make the rectangle can move on the circleSMOOTHLY, so I use the code
xRec = (int) xCentre + radius * Math.cos(angle);
yRec = (int) yCentre + radius * Math.sin(angle);
angle += 1;
to produce the coordinates of the rectangle, I want to use "double" in the code, but because either the draw3DRec or fill3DRec method can only support "integer", so I have to parse the coordinates from double to int, and it causes a problem: because the angle has to change 1 degree each time, but not like 0.1, 0.2....... so it causes the difference values between the last coordinates of rectangle and the current one too large and make the rectangle looks like jumping on the circle but not smoothly moving.
Does anyone has idea to solve my problem please?
Million thanks.
Jack

