import math


def getAngles(normal):
    """Get the azimuth and altitude from the normal vector."""
    #-- Convert from polar system to azimuth
    azimuth = 90 - math.degrees(math.atan2(normal[1], normal[0]))
    if azimuth >= 360.0:
        azimuth -= 360.0
    elif azimuth < 0.0:
        azimuth += 360.0
    t = math.sqrt(normal[0]**2 + normal[1]**2)
    if t == 0:
        tilt = 0.0
    else:
        tilt = 90 - math.degrees(math.atan(normal[2] / t)) #0 for flat roof, 90 for wall
    tilt = round(tilt, 3)

    return azimuth, tilt