Skip to content

Commit 083d96d

Browse files
seanhandleyclaude
andcommitted
Fix H3 v4.0.0 API function bindings
- Updated edge length function names: getDirectedEdgeLength* -> edgeLength* - Updated pentagon function name: getPentagonCells -> getPentagons - Added maxGridDiskSize binding for traversal functions - Updated edge_length_km test expectation to match H3 v4.0.0 values 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent a228993 commit 083d96d

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

lib/h3/bindings/private.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def self.safe_call(out_type, method, *in_args)
3838
attach_function :hex_ranges, :gridDisksUnsafe, [H3IndexesIn, :size_t, :k_distance, H3IndexesOut], :h3_error_code
3939
attach_function :hex_ring, :gridRingUnsafe, [:h3_index, :k_distance, H3IndexesOut], :h3_error_code
4040
attach_function :h3_line, :gridPathCells, [:h3_index, :h3_index, H3IndexesOut], :h3_error_code
41+
attach_function :max_kring_size, :maxGridDiskSize, [:k_distance, :pointer], :h3_error_code
4142

4243
# Directed edge functions (formerly unidirectional_edge)
4344
attach_function :h3_indexes_from_unidirectional_edge, :directedEdgeToCells, [:h3_index, H3IndexesOut], :h3_error_code
@@ -50,7 +51,7 @@ def self.safe_call(out_type, method, *in_args)
5051
attach_function :edge_length_m, :getHexagonEdgeLengthAvgM, [Resolution, :pointer], :h3_error_code
5152
attach_function :h3_faces, :getIcosahedronFaces, %i[h3_index buffer_out], :h3_error_code
5253
attach_function :max_face_count, :maxFaceCount, %i[h3_index pointer], :h3_error_code
53-
attach_function :get_pentagon_indexes, :getPentagonCells, [:int, H3IndexesOut], :h3_error_code
54+
attach_function :get_pentagon_indexes, :getPentagons, [:int, H3IndexesOut], :h3_error_code
5455
attach_function :res_0_indexes, :getRes0Cells, [H3IndexesOut], :h3_error_code
5556

5657
# Distance functions

lib/h3/miscellaneous.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def hexagon_count(resolution)
171171
# 3.287684056071637e-05
172172
#
173173
# @return [Double] Edge length in rads
174-
attach_function :exact_edge_length_rads, :getDirectedEdgeLengthRads, %i[h3_index], :double
174+
attach_function :exact_edge_length_rads, :edgeLengthRads, %i[h3_index], :double
175175

176176
# @!method exact_edge_length_km
177177
#
@@ -182,7 +182,7 @@ def hexagon_count(resolution)
182182
# 3.287684056071637e-05
183183
#
184184
# @return [Double] Edge length in kilometres
185-
attach_function :exact_edge_length_km, :getDirectedEdgeLengthKm, %i[h3_index], :double
185+
attach_function :exact_edge_length_km, :edgeLengthKm, %i[h3_index], :double
186186

187187
# @!method exact_edge_length_m
188188
#
@@ -193,7 +193,7 @@ def hexagon_count(resolution)
193193
# 3.287684056071637e-05
194194
#
195195
# @return [Double] Edge length in metres
196-
attach_function :exact_edge_length_m, :getDirectedEdgeLengthM, %i[h3_index], :double
196+
attach_function :exact_edge_length_m, :edgeLengthM, %i[h3_index], :double
197197

198198
# Returns the radians distance between two points.
199199
#

spec/miscellaneous_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757

5858
describe ".edge_length_km" do
5959
let(:resolution) { 2 }
60-
let(:result) { 158.2446558 }
60+
let(:result) { 182.5129565 }
6161

6262
subject(:edge_length_km) { H3.edge_length_km(resolution) }
6363

0 commit comments

Comments
 (0)