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 the polygons based on the given angle.
  
  Args:
      results (dict): Result dict containing the data to transform.
      center_shift (Tuple[int, int]): The shifting offset of the
          center point
docstr_tok: ["Rotating","the","polygons","based","on","the","given","angle",".","Args",":","results","(","dict",")",":","Result","dict","containing","the","data","to","transform",".","center_shift","(","Tuple","[","int",",","int","]",")",":","The","shifting","offset","of","the","center","point"]
code: def _rotate_polygons(
      self, results: Dict, center_shift: Tuple[int, int]
  ) -> None:
      """Rotating the polygons based on the given angle.
  
      Args:
          results (dict): Result dict containing the data to transform.
          center_shift (Tuple[int, int]): The shifting offset of the
              center point
      """
      if results.get("gt_polygons", None) is not None:
          height, width = results["img_shape"]
          polygon_list = []
          for poly in results["gt_polygons"]:
              rotated_poly = self._rotate_points(
                  (width / 2, height / 2),
                  poly,
                  results["rotated_angle"],
                  center_shift,
              )
              polygon_list.append(rotated_poly)
          results["gt_polygons"] = polygon_list
  
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 7 for calling the RandomRotate obj's underlying member method code with example usage: obj._rotate_polygons(results, center_shift) without return types