code: def _compute_regular_polygon_vertices(
      bounding_circle, n_sides, rotation
  ):
      """
      Generate a list of vertices for a 2D regular polygon.
  
      :param bounding_circle: The bounding circle is a tuple defined
          by a point and radius. The polygon is inscribed in this circle.
          (e.g. ``bounding_circle=(x, y, r)`` or ``((x, y), r)``)
      :param n_sides: Number of sides
          (e.g. ``n_sides=3`` for a triangle, ``6`` for a hexagon)
      :param rotation: Apply an arbitrary rotation to the polygon
          (e.g. ``rotation=90``, applies a 90 degree rotation)
      :return: List of regular polygon vertices
          (e.g. ``[(25, 50), (50, 50), (50, 25), (25, 25)]``)
  
      How are the vertices computed?
      1. Compute the following variables
          - theta: Angle between the apothem & the nearest polygon vertex
          - side_length: Length of each polygon edge
          - centroid: Center of bounding circle (1st, 2nd elements of bounding_circle)
          - polygon_radius: Polygon radius (last element of bounding_circle)
          - angles: Location of each polygon vertex in polar grid
              (e.g. A square with 0 degree rotation => [225.0, 315.0, 45.0, 135.0])
  
      2. For each angle in angles, get the polygon vertex at that angle
          The vertex is computed using the equation below.
              X= xcos(φ) + ysin(φ)
              Y= −xsin(φ) + ycos(φ)
  
          Note:
              φ = angle in degrees
              x = 0
              y = polygon_radius
  
          The formula above assumes rotation around the origin.
          In our case, we are rotating around the centroid.
          To account for this, we use the formula below
              X = xcos(φ) + ysin(φ) + centroid_x
              Y = −xsin(φ) + ycos(φ) + centroid_y
      """
      # 1. Error Handling
      # 1.1 Check `n_sides` has an appropriate value
      if not isinstance(n_sides, int):
          msg = "n_sides should be an int"
          raise TypeError(msg)
      if n_sides < 3:
          msg = "n_sides should be an int > 2"
          raise ValueError(msg)
  
      # 1.2 Check `bounding_circle` has an appropriate value
      if not isinstance(bounding_circle, (list, tuple)):
          msg = "bounding_circle should be a tuple"
          raise TypeError(msg)
  
      if len(bounding_circle) == 3:
          *centroid, polygon_radius = bounding_circle
      elif len(bounding_circle) == 2:
          centroid, polygon_radius = bounding_circle
      else:
          msg = (
              "bounding_circle should contain 2D coordinates "
              "and a radius (e.g. (x, y, r) or ((x, y), r) )"
          )
          raise ValueError(msg)
  
      if not all(
          isinstance(i, (int, float))
          for i in (*centroid, polygon_radius)
      ):
          msg = "bounding_circle should only contain numeric data"
          raise ValueError(msg)
  
      if not len(centroid) == 2:
          msg = "bounding_circle centre should contain 2D coordinates (e.g. (x, y))"
          raise ValueError(msg)
  
      if polygon_radius <= 0:
          msg = "bounding_circle radius should be > 0"
          raise ValueError(msg)
  
      # 1.3 Check `rotation` has an appropriate value
      if not isinstance(rotation, (int, float)):
          msg = "rotation should be an int or float"
          raise ValueError(msg)
  
      # 2. Define Helper Functions
      def _apply_rotation(point, degrees, centroid):
          return (
              round(
                  point[0] * math.cos(math.radians(360 - degrees))
                  - point[1] * math.sin(math.radians(360 - degrees))
                  + centroid[0],
                  2,
              ),
              round(
                  point[1] * math.cos(math.radians(360 - degrees))
                  + point[0] * math.sin(math.radians(360 - degrees))
                  + centroid[1],
                  2,
              ),
          )
  
      def _compute_polygon_vertex(centroid, polygon_radius, angle):
          start_point = [polygon_radius, 0]
          return _apply_rotation(start_point, angle, centroid)
  
      def _get_angles(n_sides, rotation):
          angles = []
          degrees = 360 / n_sides
          # Start with the bottom left polygon vertex
          current_angle = (270 - 0.5 * degrees) + rotation
          for _ in range(0, n_sides):
              angles.append(current_angle)
              current_angle += degrees
              if current_angle > 360:
                  current_angle -= 360
          return angles
  
      # 3. Variable Declarations
      angles = _get_angles(n_sides, rotation)
  
      # 4. Compute Vertices
      return [
          _compute_polygon_vertex(centroid, polygon_radius, angle)
          for angle in angles
      ]
  
imports: from __future__ import annotations
  import math
  import numbers
  import struct
  from .None import Image, ImageColor
label_desc: Use image node_id 4 for calling a global function with example usage: _compute_regular_polygon_vertices(bounding_circle, n_sides, rotation) and returns: unknown, round,  round, _apply_rotation, angles