import math


def to_degrees(angle, round_to_int=False):
  """Transforms an angle in radians to degrees.

  Args:
    angle: The angle in radians.
    round_to_int: If set to True, we return the closest integer to the floating
      point value of the angle in degrees.
  Returns:
    The angle in radians, ranging from 0 to 360.
  """
  degrees = math.degrees(angle) % 360
  if round_to_int:
    return int(round(degrees))
  return degrees