class_docstr: Randomly rotate the image, boxes, and polygons. For recognition task,
  only the image will be rotated. If set ``use_canvas`` as True, the shape of
  rotated image might be modified based on the rotated angle size, otherwise,
  the image will keep the shape before rotation.
  
  Required Keys:
  
  - img
  - img_shape
  - gt_bboxes (optional)
  - gt_polygons (optional)
  
  Modified Keys:
  
  - img
  - img_shape (optional)
  - gt_bboxes (optional)
  - gt_polygons (optional)
  
  Added Keys:
  
  - rotated_angle
  
  Args:
      max_angle (int): The maximum rotation angle (can be bigger than 180 or
          a negative). Defaults to 10.
      pad_with_fixed_color (bool): The flag for whether to pad rotated
          image with fixed value. Defaults to False.
      pad_value (tuple[int, int, int]): The color value for padding rotated
          image. Defaults to (0, 0, 0).
      use_canvas (bool): Whether to create a canvas for rotated image.
          Defaults to False. If set true, the image shape may be modified.
class_docstr_tok: ["Randomly","rotate","the","image",",","boxes",",","and","polygons",".","For","recognition","task",",","only","the","image","will","be","rotated",".","If","set","``","use_canvas","``","as","True",",","the","shape","of","rotated","image","might","be","modified","based","on","the","rotated","angle","size",",","otherwise",",","the","image","will","keep","the","shape","before","rotation",".","Required","Keys",":","-","img","-","img_shape","-","gt_bboxes","(","optional",")","-","gt_polygons","(","optional",")","Modified","Keys",":","-","img","-","img_shape","(","optional",")","-","gt_bboxes","(","optional",")","-","gt_polygons","(","optional",")","Added","Keys",":","-","rotated_angle","Args",":","max_angle","(","int",")",":","The","maximum","rotation","angle","(","can","be","bigger","than","180","or","a","negative",")",".","Defaults","to","10.","pad_with_fixed_color","(","bool",")",":","The","flag","for","whether","to","pad","rotated","image","with","fixed","value",".","Defaults","to","False",".","pad_value","(","tuple","[","int",",","int",",","int","]",")",":","The","color","value","for","padding","rotated","image",".","Defaults","to","(","0",",","0",",","0",")",".","use_canvas","(","bool",")",":","Whether","to","create","a","canvas","for","rotated","image",".","Defaults","to","False",".","If","set","true",",","the","image","shape","may","be","modified","."]
docstr: Rotating a set of points according to the given theta.
  
  Args:
      center (Tuple[float, float]): The coordinate of the canvas center
      points (np.array): A set of points needed to be rotated
      theta (float): Rotation angle
      center_shift (Tuple[int, int]): The shifting offset of the center
          coordinate
  
  Returns:
      np.array: The rotated coordinates of the input points
docstr_tok: ["Rotating","a","set","of","points","according","to","the","given","theta",".","Args",":","center","(","Tuple","[","float",",","float","]",")",":","The","coordinate","of","the","canvas","center","points","(","np.array",")",":","A","set","of","points","needed","to","be","rotated","theta","(","float",")",":","Rotation","angle","center_shift","(","Tuple","[","int",",","int","]",")",":","The","shifting","offset","of","the","center","coordinate","Returns",":","np.array",":","The","rotated","coordinates","of","the","input","points"]
code: def _rotate_points(
      center: Tuple[float, float],
      points: np.array,
      theta: float,
      center_shift: Tuple[int, int] = (0, 0),
  ) -> np.array:
      """Rotating a set of points according to the given theta.
  
      Args:
          center (Tuple[float, float]): The coordinate of the canvas center
          points (np.array): A set of points needed to be rotated
          theta (float): Rotation angle
          center_shift (Tuple[int, int]): The shifting offset of the center
              coordinate
  
      Returns:
          np.array: The rotated coordinates of the input points
      """
      (center_x, center_y) = center
      center_y = -center_y
      x, y = points[::2], points[1::2]
      y = -y
  
      theta = theta / 180 * math.pi
      cos = math.cos(theta)
      sin = math.sin(theta)
  
      x = x - center_x
      y = y - center_y
  
      _x = center_x + x * cos - y * sin + center_shift[0]
      _y = -(center_y + x * sin + y * cos) + center_shift[1]
  
      points[::2], points[1::2] = _x, _y
      return points
  
imports: import math
  from typing import Dict, Tuple
  import cv2
  import mmcv
  import numpy
  from mmcv.transforms import Resize
  from mmcv.transforms.base import BaseTransform
  from mmcv.transforms.utils import avoid_cache_randomness, cache_randomness
  from mmocr.registry import TRANSFORMS
  from mmocr.utils import bbox2poly, crop_polygon, is_poly_inside_rect, poly2bbox, poly2shapely, poly_make_valid, remove_pipeline_elements, rescale_polygon, shapely2poly
  from .wrappers import ImgAugWrapper
label_desc: Use image node_id 4 for calling the RandomRotate obj's underlying member method code with example usage: obj._rotate_points(center, points, theta, center_shift) and returns: points