user3645335
user3645335

Reputation: 11

to determine if an azimuth is between two given azimuths

Azimuth is the angle a line makes between North pole/axis and itself. They can vary from 0 degree to 360 if rotated in a circular path. Lets say we have two such azimuths, Alpha and Beta. We wish to determine of another azimuth ,say Gamma, falls between two azimuths alpha and beta.

Can someone please help me out with a simple algorithm or formula to be used in excel to determine if the line corresponding to gamma is between two lines corresponding to alpha and beta. gamma can assume different values.

Thanks

Upvotes: 1

Views: 750

Answers (1)

MBo
MBo

Reputation: 80197

Gamma is between two lines corresponding to alpha and beta when both expressions:

ag = atan2(cos(a)*sin(g)-sin(a)*cos(g), cos(a)*cos(g)+sin(a)*sin(g))
gb = atan2(cos(g)*sin(b)-sin(g)*cos(b), cos(g)*cos(b)+sin(g)*sin(b))

- have the same sign,
- (probably important - both values lie in range [0..Pi] or [-Pi..0]),
- and their sum is equal to

ab = atan2(cos(a)*sin(b)-sin(a)*cos(b), cos(a)*cos(b)+sin(a)*sin(b))

These expressions are angles between azimuths, taking into account possible angle wrapping around 360

Upvotes: 1

Related Questions