coordinate transformation

Here's a problem. I have box2d world and i need to display it in different angles and positions.
It's all clear with positions: i just substract x y coordinates of point of view from bodies coordinates. But how do i rotate the whole world on angle?

I don't remember maths very well, i know there must be some multiplication vector*matrix

so i've learned so far there's b2Mat22 class and
Code:
void  Set (float32 angle) //Initialize this matrix using an angle. 

method

Let say i have a point (x,y) and i want to rotate it on alpha.
Give me code please how to do it?
artems wrote:
Let say i have a point (x,y) and i want to rotate it on alpha.

You can use simple coodinate rotation function if you don't want to use b2Mat22 =)
Code:
public static function rotateVector(vect:b2Vec2, angle:Number): b2Vec2
      {
         var nX:Number = (vect.x * Math.cos(angle)) + (vect.y * Math.sin(angle));
         var nY:Number = (vect.y * Math.cos(angle)) - (vect.x * Math.sin(angle));
         return new b2Vec2(nX, nY);
      }
here's some code. in case someone will need it.
Code:
//this is current camera position
b2Vec2 g_camPos(0, 0);
//this is current camera angle
float g_camAngle=0.0;

bool FrameFunc()
{
//...
   //first we define vector that is camera offset on current frame
   b2Vec2 step(0, 0);
   if (g_hge->Input_GetKeyState(HGEK_LEFT)) step.x-=1;  //step left
   else if (g_hge->Input_GetKeyState(HGEK_RIGHT)) step.x+=1; //right
   if (g_hge->Input_GetKeyState(HGEK_UP)) step.y+=1; //up
   else if (g_hge->Input_GetKeyState(HGEK_DOWN)) step.y-=1; //down

//then we rotate vector step on g_camAngle, because we step depending on camera direction
   b2Mat22 rotmat;
   rotmat.Set(g_camAngle);
   g_camPos+=rotmat.Solve(step);
//...
}

//now rendering function
bool RenderFunc()
{
//...
//first we need rotation matrix against the direction of rotation of camera
   b2Mat22 rotmat;
   rotmat.Set(-g_camAngle);
//foreach loop for game sprites
   foreach (GameSprite* gamesprite, g_sprites)
   {
//sprite position
      b2Vec2 scrpoint = gamesprite->position ;

//now wetransform sprite position from world coordinate system
//to camera coordinate system

//first substract camera position vec from sprite position vec
      b2Vec2 scrpoint -= g_camPos;
//now rotate result against cam rotation
      scrpoint = rotmat.Solve(scrpoint);
//we get sprite point in camera coord sys

//but we also need to transform it to screen coord sys
//as for HGE - the (0,0) screen point is upper laft corner
//and Y-axis is headed down
//so i render this way
      gamesprite->sprite->RenderEx(
      scrpoint.x+GAME_SCREEN_WIDTH/2,
      -scrpoint.y+GAME_SCREEN_HEIGHT/2,
      gamesprite->angle-g_camAngle
      );
   }

   g_hge->Gfx_EndScene();
   return false;
}

Original thread: https://box2d.org/forum/viewtopic.php?t=2795