A
AJ
AJ
Hey everybody, I don't know if this a programming question or more of
a math question. I need to rotate a image around a canvas window that
represents a graph. So what i know is this i take the images x and y
coordinates and put them into the atan2 function that gives me the
original angle. In my main program i have a variable named theta that
increments each frame. The theta variable tells me how many degrees to
rotate the original image to get the next frame. Know i am confused
with how to use the new angle and to find the new position of the
image. I am really stumped. What I have worked out so far is that i
will probably need to use cosine or sine with the new angle. But from
what I can understand the x and y are different so what should i enter
into the trig functions to get the new image.
Here is the program thus far
##########################################################################################
ConvertPoint::ConvertPoint(double& x, double& y, double angle)
{
// x_rot, y_rot and a are all member variables
x_rot = x;
y_rot = y;
a = angle;
x_rot = x_rot - 250;
y_rot = y_rot - 250;
double angle = atan2(x_rot,y_rot)
a = a + angle;
}
##########################################################################################
Hey everybody, I don't know if this a programming question or more of
a math question. I need to rotate a image around a canvas window that
represents a graph. So what i know is this i take the images x and y
coordinates and put them into the atan2 function that gives me the
original angle. In my main program i have a variable named theta that
increments each frame. The theta variable tells me how many degrees to
rotate the original image to get the next frame. Know i am confused
with how to use the new angle and to find the new position of the
image. I am really stumped. What I have worked out so far is that i
will probably need to use cosine or sine with the new angle. But from
what I can understand the x and y are different so what should i enter
into the trig functions to get the new image.
Here is the program thus far
##########################################################################################
ConvertPoint::ConvertPoint(double& x, double& y, double angle)
{
// x_rot, y_rot and a are all member variables
x_rot = x;
y_rot = y;
a = angle;
x_rot = x_rot - 250;
y_rot = y_rot - 250;
double angle = atan2(x_rot,y_rot)
a = a + angle;
}
##########################################################################################