module S2Cells

Overview

helper functions

Defined in:

s2_cells.cr:4
s2_cells.cr:55
s2_cells/interval.cr
s2_cells/metric.cr

Constant Summary

AVG_ANGLE_SPAN = LengthMetric.new(Math::PI / 2)
AVG_AREA = AreaMetric.new((4 * Math::PI) / 6.0)
AVG_DIAG = LengthMetric.new(2.060422738998471683)
AVG_EDGE = LengthMetric.new(1.459213746386106062)
AVG_WIDTH = LengthMetric.new(1.434523672886099389)
FACE_CELLS = {Cell.from_face_pos_level(0, 0_u64, 0), Cell.from_face_pos_level(1, 0_u64, 0), Cell.from_face_pos_level(2, 0_u64, 0), Cell.from_face_pos_level(3, 0_u64, 0), Cell.from_face_pos_level(4, 0_u64, 0), Cell.from_face_pos_level(5, 0_u64, 0)}
INVERT_MASK = 2
LINEAR_PROJECTION = 0
LOOKUP_BITS = 4_u64
LOOKUP_IJ = Array.new((1_u64 << ((2 * LOOKUP_BITS) + 2)), 0_u64)
LOOKUP_POS = Array.new((1_u64 << ((2 * LOOKUP_BITS) + 2)), 0_u64)
MAX_ANGLE_SPAN = LengthMetric.new(1.704897179199218452)
MAX_AREA = AreaMetric.new(2.635799256963161491)
MAX_DIAG = LengthMetric.new(2.438654594434021032)
MAX_EDGE = LengthMetric.new(MAX_ANGLE_SPAN.deriv)
MAX_WIDTH = LengthMetric.new(MAX_ANGLE_SPAN.deriv)
MIN_ANGLE_SPAN = LengthMetric.new(4.0 / 3.0)
MIN_AREA = AreaMetric.new((8 * (Math.sqrt(2.0))) / 9.0)
MIN_DIAG = LengthMetric.new((8 * (Math.sqrt(2.0))) / 9.0)
MIN_EDGE = LengthMetric.new((2 * (Math.sqrt(2.0))) / 3.0)
MIN_WIDTH = LengthMetric.new((2 * (Math.sqrt(2.0))) / 3.0)
POS_TO_IJ = { {0_u64, 1_u64, 3_u64, 2_u64}, {0_u64, 2_u64, 3_u64, 1_u64}, {3_u64, 2_u64, 0_u64, 1_u64}, {3_u64, 1_u64, 0_u64, 2_u64} }
POS_TO_ORIENTATION = {SWAP_MASK, 0, 0, INVERT_MASK | SWAP_MASK}
QUADRATIC_PROJECTION = 2
SWAP_MASK = 1
TAN_PROJECTION = 1

Class Method Summary

Class Method Detail

def self.at(lat : Float64, lng : Float64) : CellId #

[View source]
def self.at(point : LatLng) : CellId #

[View source]
def self.face_uv_to_xyz(face : Int32, u : Float64, v : Float64) #

[View source]
def self.face_xyz_to_uv(face : Int32, p : Point) #

[View source]
def self.in(p1 : LatLng, p2 : LatLng) : Array(CellId) #

[View source]
def self.is_unit_length(p : Point) : Bool #

[View source]
def self.valid_face_xyz_to_uv(face : Int32, p : Point) #

[View source]
def self.xyz_to_face_uv(p : Point) : Tuple(Int32, Float64, Float64) #

[View source]