Basically I wanted to become more familiar with matrix usage, starting 2D, so I put up a basic setup where I have an "interactive wheel" that spits out whatever angle its handle is set to (image below)
Now I have my basisVector y and x because I get the feeling those are needed, and I have a horizontal line floating on top of y.
My goal would be to rotate that line with a vector Matrix multiplication based on the angle I get from my interactive wheel, as you would do in 3d I guess (the whole point of this is to get me familiar with matrices usage after all, so it need to be done that way), the problem is that from here I don't know how to proceed to build my rotation matrix, where to place my elements, what multiply with what...I am kind of lost.
so this below is the code situation, and I need some help to get from where I am to where I want to be...
float angle = mHandle->getHandleAngle();
D2D1_POINT_2F basisX = { 1,0 };
D2D1_POINT_2F basisY = { 0,1 };
//draw line
mBrush->SetColor(D2D1::ColorF(0.87f, 0.3f, 0.36f, 1.f));
D2D1_POINT_2F lineP1 = D2D1::Point2F(mOriginX - 100, mOriginY - 150);
D2D1_POINT_2F lineP2 = D2D1::Point2F(mOriginX + 100, mOriginY - 150);
mRenderTarget->DrawLine(lineP1, lineP2, mBrush, 2.f);
//replace draw line above with a line rotated by a rotation matrix
mRenderTarget->DrawLine(D2D1::Point2F(),//Begin point
D2D1::Point2F(),//End point
mBrush, 2.f);
↧