def wrapPos(angDeg):
    """Returns the angle (in degrees) wrapped into the range [0, 360)"""
    res = angDeg % 360.0
    # First wrap into [0, 360]; result is 360 if ctrAng < 0 but so near 0 that adding 360 rounds it
    if res == 360.0:
        return 0.0
    return res