def clamped(self, point_or_rect):
        """
        Returns the point or rectangle clamped to this rectangle.
        """
        if isinstance(point_or_rect, Rect):
            return Rect(np.minimum(self.mins, point_or_rect.mins),
                        np.maximum(self.maxes, point_or_rect.maxes))
        return np.clip(point_or_rect, self.mins, self.maxes)
Returns the point or rectangle clamped to this rectangle.