A bit late to the party, but @Hawthourne, vec_to_angle can be used with 2d coordinates too. But since 2d works with only 2 coordinates, and not 3 like 3d, you need to set the z coordinates of the vector to zero and generally speaking pos_y = x and pos_x = y (see below code to understand what I mean by that). The code below uses mouse_pos as vector for vec_to_angle and so it lets mypanel rotate towards the cursor:

Code:
ANGLE vectoangle_ang;
 VECTOR temp_vec1, temp_vec2; 

 while (1)
 {
  vec_set(temp_vec1, vector(mypanel.pos_y, mypanel.pos_x, 0));
  vec_set(temp_vec2, vector(mouse_pos.y, mouse_pos.x, 0));
  vec_sub(temp_vec2, temp_vec1);	
  vec_to_angle(vectoangle_ang, temp_vec2);
  
  mypanel.center_x = (mypanel.size_x / 2); // set the rotation center at the panel center
  mypanel.center_y = (mypanel.size_y / 2);
  mypanel.angle = integer(vectoangle_ang.pan); //! only pan is usefull here
  
  DEBUG_VAR(vectoangle_ang.pan, 80); //just for testing purposes
  
  wait(1);
 }



I don't know if this great code or whatever, just know it works and its fairly easy to understand & to work with.