zbz.lvlv
zbz.lvlv

Reputation: 3797

Convert azimuth to degrees

What is a generic formula for converting azimuth(from -180 to 180) to degrees(from 0 to 360)?

double azimuth = (Math.toDegrees(matrixValues[0]));
           if(azimuth < 0){
               azimuth += 360;
           }
           azimuth -= 90;
           if(azimuth < 0){
               azimuth += 360;
           }

That's what I have tried but it doesn't seemed to work.

Upvotes: 0

Views: 5057

Answers (1)

Jakub
Jakub

Reputation: 573

There are several conventions for azimuths ("geological", "geohraphical" - clockwise, anticlockwise). What´s wrong with double azimuth = (Math.toDegrees(matrixValues[0])) + 180.0; ? Seems to do what you request.

Upvotes: 1

Related Questions