<-- Previous || Up || Next -->

Degrees To Direction Function
Math Miscellaneous Class

Public Function DegreesToDirection( _
      ByVal vDegrees As Variant _
    , Optional ByVal vPrecision As Variant _
    ) As Variant

Return the compass direction from a measurement in degrees.

Examples:
    DegreesToDirection(0) = "N"
    DegreesToDirection(45) = "N"
    DegreesToDirection(46) = "E"
    DegreesToDirection(333) = "N"
    DegreesToDirection(890) = "S" ' #5
    DegreesToDirection(-90) = "W"
    DegreesToDirection(0, 2) = "N"
    DegreesToDirection(67, 2) = "NE"
    DegreesToDirection(220, 2) = "SW"
    DegreesToDirection(220, 3) = "SW"
    DegreesToDirection(130, 3) = "SE"
    DegreesToDirection(150, 3) = "SSE"
    DegreesToDirection(330, 3) = "NNW"
See also:
    DirectionToDegrees Function
    SpellDirection Function
    RadiansToDegrees Function
vDegrees: Number representing a measurement in degrees. Function returns Null if vDegrees is Null or cannot be fixed up to a number. Number does not have to be between 0 and 360.

vPrecision: The precision of the direction that is to be returned (also the number of characters in the return string). vPrecision defaults to 1 (one) if it is missing or Null or cannot be fixed up to a number. Direction will have a precision between 1 (four possible directions), 2 (eight possible directions) and 3 (sixteen possible positions).

If vPrecision is less than one, this function uses a precision of 1. If vPrecision is greater than three, this function uses a precision of 3.

Return value: These are the possible directions returned by this function: E, ENE, ESE, N, NE, NNE, NNW, NW, S, SE, SSE, SSW, SW, W, WNW, and WSW.

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.