Repository: ManimCommunity/manim
File: manim/mobject/geometry.py (Python)

Code before:

    .. manim:: PolygonExample
        :save_last_frame:

        class PolygonExample(Scene):
            def construct(self):
                isosceles = Polygon([-5, 1.5, 0], [-2, 1.5, 0], [-3.5, -2, 0])
                position_list = [
                    [4, 1, 0],  # middle right
                    [4, -2.5, 0],  # bottom right
                    [0, -2.5, 0],  # bottom left
                    [0, 3, 0],  # top left
                    [2, 1, 0],  # middle
                    [4, 3, 0],  # top right
                ]
                square_and_triangles = Polygon(*position_list, color=PURPLE_B)
                self.add(isosceles, square_and_triangles)
    """

    def __init__(self, *vertices, color=BLUE, **kwargs):
        VMobject.__init__(self, color=color, **kwargs)
        # There are actually four corners, and the first one is repeated twice to form the four vertices.
        self.set_points_as_corners([*vertices, vertices[0]])

    def get_vertices(self):
        """Get the vertices of a given polygon.

        Examples
        --------
        ::

            >>> sq = Square()
            >>> points = sq.get_vertices()
            >>> points
            array([[-1.,  1.,  0.],
                   [ 1.,  1.,  0.],
                   [ 1., -1.,  0.],
                   [-1., -1.,  0.]])

        Returns
        -------
        :class:`numpy.ndarray`
            Returns a list of the coordinates of polygon's vertices.
        """

        return self.get_start_anchors()

    def round_corners(self, radius=0.5):
        """Rounds off the corners of a polygon.

        Parameters

Review comment (suggestion):
Minor language nitpick: I think "a given polygon" is too unspecific, and we can actually just speak of "the polygon" here.

```suggestion
        """Get the vertices of the polygon.
```

Code after:

    .. manim:: PolygonExample
        :save_last_frame:

        class PolygonExample(Scene):
            def construct(self):
                isosceles = Polygon([-5, 1.5, 0], [-2, 1.5, 0], [-3.5, -2, 0])
                position_list = [
                    [4, 1, 0],  # middle right
                    [4, -2.5, 0],  # bottom right
                    [0, -2.5, 0],  # bottom left
                    [0, 3, 0],  # top left
                    [2, 1, 0],  # middle
                    [4, 3, 0],  # top right
                ]
                square_and_triangles = Polygon(*position_list, color=PURPLE_B)
                self.add(isosceles, square_and_triangles)
    """

    def __init__(self, *vertices, color=BLUE, **kwargs):
        VMobject.__init__(self, color=color, **kwargs)
        # There are actually four corners, and the first one is repeated twice to form the four vertices.
        self.set_points_as_corners([*vertices, vertices[0]])

    def get_vertices(self):
        """Gets the vertices of the polygon.

        Examples
        --------
        ::

            >>> sq = Square()
            >>> points = sq.get_vertices()
            >>> points
            array([[-1.,  1.,  0.],
                   [ 1.,  1.,  0.],
                   [ 1., -1.,  0.],
                   [-1., -1.,  0.]])

        Returns
        -------
        :class:`numpy.ndarray`
            Returns a list of the coordinates of polygon's vertices.
        """

        return self.get_start_anchors()

    def round_corners(self, radius=0.5):
        """Rounds off the corners of the polygon.

        Parameters