github.com/liucxer/courier@v1.7.1/h3/constants.go (about)

     1  package h3
     2  
     3  import (
     4  	"math"
     5  )
     6  
     7  /** pi */
     8  const M_PI = math.Pi
     9  
    10  /** pi / 2.0 */
    11  const M_PI_2 = math.Pi / 2
    12  
    13  /** 2.0 * PI */
    14  const M_2PI = math.Pi * 2
    15  
    16  /** pi / 180 */
    17  const M_PI_180 = math.Pi / 180
    18  
    19  /** 180 / pi  */
    20  const M_180_PI = 180 / math.Pi
    21  
    22  /** threshold epsilon */
    23  var EPSILON = float64(7.)/3 - float64(4.)/3 - float64(1.)
    24  
    25  /** sqrt(3) / 2.0 */
    26  var M_SQRT3_2 = math.Sqrt(3) / 2
    27  
    28  /** sin(60') */
    29  var M_SIN60 = M_SQRT3_2
    30  
    31  /** rotation angle between Class II and Class III resolution axes
    32   * (asin(sqrt(3.0 / 28.0))) */
    33  var M_AP7_ROT_RADS = math.Asin(math.Sqrt(3.0 / 28.0))
    34  
    35  /** sin(M_AP7_ROT_RADS) */
    36  var M_SIN_AP7_ROT = math.Sin(M_AP7_ROT_RADS)
    37  
    38  /** cos(M_AP7_ROT_RADS) */
    39  var M_COS_AP7_ROT = math.Cos(M_AP7_ROT_RADS)
    40  
    41  /** earth radius in kilometers using WGS84 authalic radius */
    42  const EARTH_RADIUS_KM = 6371.007180918475
    43  
    44  /** scaling factor from hex2d resolution 0 unit length
    45   * (or distance between adjacent cell center points
    46   * on the plane) to gnomonic unit length. */
    47  const RES0_U_GNOMONIC = 0.38196601125010500003
    48  
    49  /** max H3 resolution; H3 version 1 has 16 resolutions, numbered 0 through 15 */
    50  const MAX_H3_RES = 15
    51  
    52  /** The number of faces on an icosahedron */
    53  const NUM_ICOSA_FACES = 20
    54  
    55  /** The number of H3 base cells */
    56  const NUM_BASE_CELLS = 122
    57  
    58  /** The number of vertices in a hexagon */
    59  const NUM_HEX_VERTS = 6
    60  
    61  /** The number of vertices in a pentagon */
    62  const NUM_PENT_VERTS = 5
    63  
    64  /** The number of pentagons per resolution **/
    65  const NUM_PENTAGONS = 12
    66  
    67  type H3Mode int
    68  
    69  /** H3 index modes */
    70  const (
    71  	H3_HEXAGON_MODE H3Mode = 1
    72  	H3_UNIEDGE_MODE H3Mode = 2
    73  )