def clip_polygon(cls, polygon):
        """
        Clip the Polygon. Make it fit into the map region and throw away the part outside the map region
        Args:
            map_center: center point of the map
            polygon: a list of 2D points

        Returns: A list of polygon or None

        """
        x = y = cls.map_region_size / 2
        _rect_polygon = Polygon([(-x, y), (x, y), (x, -y), (-x, -y)])
        polygon = Polygon(polygon)
        try:
            polygon = _rect_polygon.intersection(polygon)
            # Extract the points of the clipped polygon.
            if polygon.is_empty:
                return None
            else:
                # Handle cases where the intersection might result in multiple geometries
                return [list(polygon.exterior.coords)] if isinstance(polygon, Polygon) else \
                    [list(geom.exterior.coords) for geom in polygon.geoms]
        except Exception as error:
            return None

        Clip the Polygon. Make it fit into the map region and throw away the part outside the map region
        Args:
            map_center: center point of the map
            polygon: a list of 2D points

        Returns: A list of polygon or None

        
metadrive/constants.py