Do not count on it, but it would seem that:
dx = movement * cos(rotation) * cos(rotation)
dy = movement * sin(rotation) * sin(rotation)
At least, it makes some sense to me.
what exactly do you mean by movement?
If movement is the distance which the object moved then:
dx = distance * sin;
dy = distance * cos;
And if you really mean speed then it depends on how long your object moved.
@lux this:
dx = distance * sin;
is a bit nonsence. Sin isn't just a number: sin is a result of a calculation with a number,
like danpost was saying.
And with movement, he means the amount of pixels/cells/whatever you will move facing your direction.
@SPower:
tought it was obvious that a trigonometric function needs an angle as an argument ...
maybe I should have been more accurate.
If movement is the distance my version should be correct:
double dx = distance * Math.sin(angle);
double dy = distance * Math.cos(angle);
It would seem that dy would use the 'sin' function and dx would use the 'cos' function, since when the angle is zero, the y offset is zero and the x offset is the distance moved (or the radius). And as the rotation increases, dy increases from zero, and dx decreases from the movement amount.
Yes you are right!
I answered that out of my head and mixed opposite and adjacent.
@danpost: thank you for correcting ^^
@kiarocks: finally this should work :