# How Do i Get the X,Y Position After Rotation

This topic is 4932 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Ok the thing is that After i apply a set of Transformation and Concatenate them i was wondering how to get the new Position After the Object is Rotated. I try getting the _.41,._42,._43 of the Matrix but it keeps on giving me the same Thing which makes sense because all i am doing is Rotating but the problem is that with my bounding box i want to know what are the coordinates of the points that make the quad so i can reposition my bounding box around the mesh. This is For a 2D Game that i am making that uses Realtime Physics.

##### Share on other sites
If I have understood your problem correctly, you should be able to get your positions by adding cos(rotation) to your x coordinate and sin(rotation) to your y coordinate.

##### Share on other sites
Reading values straight out of the matrix does work in some cases, but for the most part it's just not going to work [smile]

D3DXVec2TransformCoord( ) is the function you'll be wanting. The raw maths behind matrix transforms isn't too difficult, so if you don't want to be using D3DX post back here and I'll see if I can dig out the actual formulae.

hth
Jack

##### Share on other sites
// Rotate point POS (X: float, Y:float) by fAngle degreesvoid RotatePoint(POS* pPosition, double fAngle){        float iOldX = pPosition->X;        double fCos = cos(fAngle * 0.01745329251988);        double fSin = sin(fAngle * 0.01745329251988);        pPosition->X = (float)( (fCos * (double)pPosition->X) - (fSin * (double)pPosition->Y) );        pPosition->Y = (float)( (fSin * (double)iOldX       ) + (fCos * (double)pPosition->Y) );}

##### Share on other sites
Thak you guys, especially jolly that function is exaclty what i was looking for,.

##### Share on other sites
Ok the function takes three parameters. i am checking the sdk but they don't say what the second parameter is about.

##### Share on other sites
Forget it i figure it out

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 15
• 9
• 11
• 9
• 9
• ### Forum Statistics

• Total Topics
634136
• Total Posts
3015755
×