Does anyone know how to compute the azimuth in degrees from the given slope. If the two components (the numerator and the denominatory or x component and y component) are known. This is what I have but I am not sure that it is correct.

Code:double ComputeAzimuth(double dbY, double dbX) { int iQuadrant = 0; double slope; slope = dbY/dbX; if( dbX > 0 && dbY > 0) { iQuadrant = 1; } else if( dbX < 0 && dbY > 0) { iQuadrant = 2; } else if( dbX < 0 && dbY < 0) { iQuadrant = 3; } else if( dbX > 0 && dbY < 0) { iQuadrant = 4; } switch( iQuadrant ) { case 1: return 90 - (atan(slope) * (180/PI)); case 2: return 270 - (atan(slope) * (180/PI)); case 3: return 270 - (atan(slope) * (180/PI)); case 4: return 90 - (atan(slope) * (180/PI)); } return 0.0; }