Module: H3::UnidirectionalEdges
Overview
Unidirectional edge functions
Instance Method Summary collapse
-
#destination_from_unidirectional_edge(edge) ⇒ Integer
Derive destination H3 index from edge.
-
#h3_indexes_from_unidirectional_edge(edge) ⇒ Object
deprecated
Deprecated.
Please use #origin_and_destination_from_unidirectional_edge instead.
-
#h3_indexes_neighbors?(origin, destination) ⇒ Boolean
deprecated
Deprecated.
Please use #neighbors? instead.
-
#h3_unidirectional_edge(origin, destination) ⇒ Object
deprecated
Deprecated.
Please use #unidirectional_edge instead.
-
#h3_unidirectional_edge_boundary(edge) ⇒ Object
deprecated
Deprecated.
Please use #unidirectional_edge_boundary instead.
-
#h3_unidirectional_edge_valid?(h3_index) ⇒ Boolean
deprecated
Deprecated.
Please use #unidirectional_edge_valid? instead.
-
#h3_unidirectional_edges_from_hexagon(origin) ⇒ Object
deprecated
Deprecated.
Please use #unidirectional_edges_from_hexagon instead.
-
#origin_and_destination_from_unidirectional_edge(edge) ⇒ Array<Integer>
Derive origin and destination H3 indexes from edge.
-
#origin_from_unidirectional_edge(edge) ⇒ Integer
Derive origin H3 index from edge.
-
#unidirectional_edge(origin, destination) ⇒ Integer
Derives the H3 index of the edge from the given H3 indexes.
-
#unidirectional_edge_boundary(edge) ⇒ Array<Array<Float>>
Derive coordinates for edge boundary.
-
#unidirectional_edges_from_hexagon(origin) ⇒ Array<Integer>
Derive unidirectional edges for a H3 index.
Methods included from Bindings::Base
Instance Method Details
#destination_from_unidirectional_edge(edge) ⇒ Integer
Derive destination H3 index from edge.
91 92 93 94 |
# File 'lib/h3/unidirectional_edges.rb', line 91 attach_function :destination_from_unidirectional_edge, :getDestinationH3IndexFromUnidirectionalEdge, %i[h3_index], :h3_index |
#h3_indexes_from_unidirectional_edge(edge) ⇒ Object
Please use #origin_and_destination_from_unidirectional_edge instead.
133 134 135 |
# File 'lib/h3/unidirectional_edges.rb', line 133 def h3_indexes_from_unidirectional_edge(edge) origin_and_destination_from_unidirectional_edge(edge) end |
#h3_indexes_neighbors?(origin, destination) ⇒ Boolean
Please use #neighbors? instead.
25 26 27 |
# File 'lib/h3/unidirectional_edges.rb', line 25 def h3_indexes_neighbors?(origin, destination) neighbors?(origin, destination) end |
#h3_unidirectional_edge(origin, destination) ⇒ Object
Please use #unidirectional_edge instead.
74 75 76 |
# File 'lib/h3/unidirectional_edges.rb', line 74 def h3_unidirectional_edge(origin, destination) unidirectional_edge(origin, destination) end |
#h3_unidirectional_edge_boundary(edge) ⇒ Object
Please use #unidirectional_edge_boundary instead.
193 194 195 |
# File 'lib/h3/unidirectional_edges.rb', line 193 def h3_unidirectional_edge_boundary(edge) unidirectional_edge_boundary(edge) end |
#h3_unidirectional_edge_valid?(h3_index) ⇒ Boolean
Please use #unidirectional_edge_valid? instead.
50 51 52 |
# File 'lib/h3/unidirectional_edges.rb', line 50 def h3_unidirectional_edge_valid?(h3_index) unidirectional_edge_valid?(h3_index) end |
#h3_unidirectional_edges_from_hexagon(origin) ⇒ Object
Please use #unidirectional_edges_from_hexagon instead.
162 163 164 |
# File 'lib/h3/unidirectional_edges.rb', line 162 def h3_unidirectional_edges_from_hexagon(origin) unidirectional_edges_from_hexagon(origin) end |
#origin_and_destination_from_unidirectional_edge(edge) ⇒ Array<Integer>
Derive origin and destination H3 indexes from edge.
Returned in the form
[origin, destination]
125 126 127 128 129 130 |
# File 'lib/h3/unidirectional_edges.rb', line 125 def origin_and_destination_from_unidirectional_edge(edge) max_hexagons = 2 out = H3Indexes.of_size(max_hexagons) Bindings::Private.h3_indexes_from_unidirectional_edge(edge, out) out.read end |
#origin_from_unidirectional_edge(edge) ⇒ Integer
Derive origin H3 index from edge.
107 108 109 110 |
# File 'lib/h3/unidirectional_edges.rb', line 107 attach_function :origin_from_unidirectional_edge, :getOriginH3IndexFromUnidirectionalEdge, %i[h3_index], :h3_index |
#unidirectional_edge(origin, destination) ⇒ Integer
Derives the H3 index of the edge from the given H3 indexes.
68 69 70 71 |
# File 'lib/h3/unidirectional_edges.rb', line 68 attach_function :unidirectional_edge, :getH3UnidirectionalEdge, %i[h3_index h3_index], :h3_index |
#unidirectional_edge_boundary(edge) ⇒ Array<Array<Float>>
Derive coordinates for edge boundary.
184 185 186 187 188 189 190 |
# File 'lib/h3/unidirectional_edges.rb', line 184 def unidirectional_edge_boundary(edge) geo_boundary = GeoBoundary.new Bindings::Private.h3_unidirectional_edge_boundary(edge, geo_boundary) geo_boundary[:verts].take(geo_boundary[:num_verts]).map do |d| [rads_to_degs(d[:lat]), rads_to_degs(d[:lon])] end end |
#unidirectional_edges_from_hexagon(origin) ⇒ Array<Integer>
Derive unidirectional edges for a H3 index.
154 155 156 157 158 159 |
# File 'lib/h3/unidirectional_edges.rb', line 154 def unidirectional_edges_from_hexagon(origin) max_edges = 6 out = H3Indexes.of_size(max_edges) Bindings::Private.h3_unidirectional_edges_from_hexagon(origin, out) out.read end |