h3d 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- h3d/__init__.py +58 -0
- h3d/_core.py +218 -0
- h3d/conversions.py +162 -0
- h3d/hierarchy.py +142 -0
- h3d/indexing.py +164 -0
- h3d/inspection.py +123 -0
- h3d/storage.py +46 -0
- h3d/traversal.py +64 -0
- h3d-0.1.0.dist-info/METADATA +104 -0
- h3d-0.1.0.dist-info/RECORD +14 -0
- h3d-0.1.0.dist-info/WHEEL +5 -0
- h3d-0.1.0.dist-info/licenses/LICENSE +202 -0
- h3d-0.1.0.dist-info/licenses/NOTICE +7 -0
- h3d-0.1.0.dist-info/top_level.txt +1 -0
h3d/__init__.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"""H3D — 3D Extension for Uber H3 Spatial Indexing."""
|
|
2
|
+
|
|
3
|
+
from .indexing import (
|
|
4
|
+
latlngalt_to_voxel,
|
|
5
|
+
voxel_to_latlngalt,
|
|
6
|
+
altitude_to_vertical,
|
|
7
|
+
vertical_to_altitude,
|
|
8
|
+
vertical_bounds,
|
|
9
|
+
voxel_altitude_bounds,
|
|
10
|
+
)
|
|
11
|
+
from .inspection import (
|
|
12
|
+
is_valid_voxel,
|
|
13
|
+
get_surface_resolution,
|
|
14
|
+
get_vertical_resolution,
|
|
15
|
+
voxel_to_h3,
|
|
16
|
+
voxel_to_vertical,
|
|
17
|
+
h3_to_voxel,
|
|
18
|
+
)
|
|
19
|
+
from .traversal import iter_vertical_range
|
|
20
|
+
from .hierarchy import (
|
|
21
|
+
vertical_to_parent,
|
|
22
|
+
vertical_to_children,
|
|
23
|
+
voxel_to_parent,
|
|
24
|
+
voxel_to_children,
|
|
25
|
+
)
|
|
26
|
+
from .conversions import (
|
|
27
|
+
geodetic_to_ecef,
|
|
28
|
+
ecef_to_geodetic,
|
|
29
|
+
ecef_to_voxel,
|
|
30
|
+
voxel_to_ecef,
|
|
31
|
+
)
|
|
32
|
+
from .storage import voxel_to_parts, parts_to_voxel
|
|
33
|
+
|
|
34
|
+
__all__ = [
|
|
35
|
+
"latlngalt_to_voxel",
|
|
36
|
+
"voxel_to_latlngalt",
|
|
37
|
+
"altitude_to_vertical",
|
|
38
|
+
"vertical_to_altitude",
|
|
39
|
+
"vertical_bounds",
|
|
40
|
+
"voxel_altitude_bounds",
|
|
41
|
+
"is_valid_voxel",
|
|
42
|
+
"get_surface_resolution",
|
|
43
|
+
"get_vertical_resolution",
|
|
44
|
+
"voxel_to_h3",
|
|
45
|
+
"voxel_to_vertical",
|
|
46
|
+
"h3_to_voxel",
|
|
47
|
+
"iter_vertical_range",
|
|
48
|
+
"vertical_to_parent",
|
|
49
|
+
"vertical_to_children",
|
|
50
|
+
"voxel_to_parent",
|
|
51
|
+
"voxel_to_children",
|
|
52
|
+
"geodetic_to_ecef",
|
|
53
|
+
"ecef_to_geodetic",
|
|
54
|
+
"ecef_to_voxel",
|
|
55
|
+
"voxel_to_ecef",
|
|
56
|
+
"voxel_to_parts",
|
|
57
|
+
"parts_to_voxel",
|
|
58
|
+
]
|
h3d/_core.py
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
"""Private validation, index arithmetic, and coordinate helpers for H3D."""
|
|
2
|
+
|
|
3
|
+
from collections.abc import Iterator
|
|
4
|
+
from math import copysign, cos, floor, isfinite, radians, sin, sqrt
|
|
5
|
+
from numbers import Integral, Real
|
|
6
|
+
|
|
7
|
+
from h3.api import basic_int as _h3
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Index format and resolution constants.
|
|
11
|
+
_MAX_SURFACE_RESOLUTION = 15
|
|
12
|
+
# Format v1 freezes the binary64 result of sqrt(3.0) * H3_RES0_AVG_EDGE_M.
|
|
13
|
+
H3_RES0_AVG_EDGE_M = 1_281_256.011
|
|
14
|
+
BASE_THICKNESS_M = float.fromhex("0x1.0ee60411854c7p+21")
|
|
15
|
+
_FORMAT_VERSION = 1
|
|
16
|
+
_MAX_RESOLUTION = 10
|
|
17
|
+
_BASE_COUNT = 256
|
|
18
|
+
_VERSION_SHIFT = 60
|
|
19
|
+
_RESOLUTION_SHIFT = 56
|
|
20
|
+
_BASE_SHIFT = 48
|
|
21
|
+
_LOW_RESERVED_BITS = 18
|
|
22
|
+
_DIGIT_WIDTH = 3
|
|
23
|
+
_UNUSED_DIGIT = 7
|
|
24
|
+
_WORD_BITS = 64
|
|
25
|
+
_WORD_MASK = (1 << _WORD_BITS) - 1
|
|
26
|
+
_POWERS = tuple(7**r for r in range(_MAX_RESOLUTION + 1))
|
|
27
|
+
_VOXEL_MASK = (1 << (2 * _WORD_BITS)) - 1
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
# WGS84 conversion constants.
|
|
31
|
+
_A = 6_378_137.0
|
|
32
|
+
_F = 1 / 298.257223563
|
|
33
|
+
_E2 = _F * (2 - _F)
|
|
34
|
+
_B = _A * (1 - _F)
|
|
35
|
+
_MIN_CONVERSION_HEIGHT = -2_000_000.0
|
|
36
|
+
_MAX_CONVERSION_HEIGHT = 1_000_000_000.0
|
|
37
|
+
_MAX_RESIDUAL_M = 1e-5
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
# Input validation.
|
|
41
|
+
|
|
42
|
+
def _integer(value: object, name: str, minimum: int, maximum: int) -> int:
|
|
43
|
+
if isinstance(value, bool) or not isinstance(value, Integral):
|
|
44
|
+
raise TypeError(f"{name} must be an integer")
|
|
45
|
+
if not minimum <= value <= maximum:
|
|
46
|
+
raise ValueError(f"{name} must be in [{minimum}, {maximum}]")
|
|
47
|
+
return int(value)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def _finite(value: object, name: str) -> float:
|
|
51
|
+
if isinstance(value, bool) or not isinstance(value, Real):
|
|
52
|
+
raise TypeError(f"{name} must be a real number")
|
|
53
|
+
try:
|
|
54
|
+
result = float(value)
|
|
55
|
+
except OverflowError as error:
|
|
56
|
+
raise ValueError(f"{name} must be finite in binary64") from error
|
|
57
|
+
if not isfinite(result):
|
|
58
|
+
raise ValueError(f"{name} must be finite in binary64")
|
|
59
|
+
return result
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def _canonical_latlng(lat: float, lng: float) -> tuple[float, float]:
|
|
63
|
+
lat = _finite(lat, "latitude")
|
|
64
|
+
lng = _finite(lng, "longitude")
|
|
65
|
+
if not -90.0 <= lat <= 90.0:
|
|
66
|
+
raise ValueError("latitude must be in [-90, 90] degrees")
|
|
67
|
+
if not -180.0 <= lng <= 180.0:
|
|
68
|
+
raise ValueError("longitude must be in [-180, 180] degrees")
|
|
69
|
+
if abs(lat) == 90.0:
|
|
70
|
+
return lat, 0.0
|
|
71
|
+
return lat or 0.0, -180.0 if lng == 180.0 else lng or 0.0
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
# Vertical intervals and encoding.
|
|
75
|
+
|
|
76
|
+
def _boundary(ordinal: int, subdivisions: int) -> float:
|
|
77
|
+
return BASE_THICKNESS_M * (ordinal / subdivisions - 0.5)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
_MIN_ALTITUDE_M = _boundary(0, 1)
|
|
81
|
+
_MAX_ALTITUDE_M = _boundary(_BASE_COUNT, 1)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def _bounds(resolution: int, ordinal: int) -> tuple[float, float]:
|
|
85
|
+
subdivisions = _POWERS[resolution]
|
|
86
|
+
return _boundary(ordinal, subdivisions), _boundary(ordinal + 1, subdivisions)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def _midpoint(resolution: int, ordinal: int) -> float:
|
|
90
|
+
subdivisions = _POWERS[resolution]
|
|
91
|
+
return BASE_THICKNESS_M * ((2 * ordinal + 1 - subdivisions) / (2 * subdivisions))
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def _decode_vertical(vertical: int) -> tuple[int, int]:
|
|
95
|
+
word = _integer(vertical, "vertical word", 0, _WORD_MASK)
|
|
96
|
+
if word >> _VERSION_SHIFT != _FORMAT_VERSION:
|
|
97
|
+
raise ValueError("unsupported vertical version or nonzero high reserved bit")
|
|
98
|
+
if word & ((1 << _LOW_RESERVED_BITS) - 1):
|
|
99
|
+
raise ValueError("vertical low reserved bits must be zero")
|
|
100
|
+
resolution = (word >> _RESOLUTION_SHIFT) & 15
|
|
101
|
+
if resolution > _MAX_RESOLUTION:
|
|
102
|
+
raise ValueError("unsupported vertical resolution")
|
|
103
|
+
|
|
104
|
+
ordinal = (word >> _BASE_SHIFT) & (_BASE_COUNT - 1)
|
|
105
|
+
digits = word >> _LOW_RESERVED_BITS
|
|
106
|
+
for depth in range(_MAX_RESOLUTION):
|
|
107
|
+
shift = _DIGIT_WIDTH * (_MAX_RESOLUTION - depth - 1)
|
|
108
|
+
digit = (digits >> shift) & _UNUSED_DIGIT
|
|
109
|
+
if depth < resolution:
|
|
110
|
+
if digit == _UNUSED_DIGIT:
|
|
111
|
+
raise ValueError("active vertical digits must be in [0, 6]")
|
|
112
|
+
ordinal = 7 * ordinal + digit
|
|
113
|
+
elif digit != _UNUSED_DIGIT:
|
|
114
|
+
raise ValueError("unused vertical digits must be 7")
|
|
115
|
+
return resolution, ordinal
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def _encode_vertical(resolution: int, ordinal: int) -> int:
|
|
119
|
+
unused_bits = _DIGIT_WIDTH * (_MAX_RESOLUTION - resolution)
|
|
120
|
+
digits = (1 << unused_bits) - 1
|
|
121
|
+
for shift in range(unused_bits, _DIGIT_WIDTH * _MAX_RESOLUTION, _DIGIT_WIDTH):
|
|
122
|
+
ordinal, digit = divmod(ordinal, 7)
|
|
123
|
+
digits |= digit << shift
|
|
124
|
+
return (
|
|
125
|
+
(_FORMAT_VERSION << _VERSION_SHIFT)
|
|
126
|
+
| (resolution << _RESOLUTION_SHIFT)
|
|
127
|
+
| (ordinal << _BASE_SHIFT)
|
|
128
|
+
| (digits << _LOW_RESERVED_BITS)
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def _ordinal_at(altitude: float, subdivisions: int) -> int:
|
|
133
|
+
ordinal = floor((altitude / BASE_THICKNESS_M + 0.5) * subdivisions)
|
|
134
|
+
# The initial estimate can land on either side of a rounded boundary.
|
|
135
|
+
# In particular, it can equal the count immediately below the global top.
|
|
136
|
+
while altitude < _boundary(ordinal, subdivisions):
|
|
137
|
+
ordinal -= 1
|
|
138
|
+
while altitude >= _boundary(ordinal + 1, subdivisions):
|
|
139
|
+
ordinal += 1
|
|
140
|
+
return ordinal
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
# Voxel validation and encoding.
|
|
144
|
+
|
|
145
|
+
def _valid_cell(cell: int) -> int:
|
|
146
|
+
cell = _integer(cell, "H3 cell", 0, _WORD_MASK)
|
|
147
|
+
if not _h3.is_valid_cell(cell):
|
|
148
|
+
raise ValueError("invalid H3 cell")
|
|
149
|
+
return cell
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
def _voxel_parts(voxel: object) -> tuple[int, int, int, int]:
|
|
153
|
+
voxel = _integer(voxel, "voxel", 0, _VOXEL_MASK)
|
|
154
|
+
vertical = voxel >> _WORD_BITS
|
|
155
|
+
resolution, ordinal = _decode_vertical(vertical)
|
|
156
|
+
return _valid_cell(voxel & _WORD_MASK), vertical, resolution, ordinal
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def _pack_voxel(cell: int, vertical: int) -> int:
|
|
160
|
+
return (vertical << _WORD_BITS) | cell
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
# Hierarchy.
|
|
164
|
+
|
|
165
|
+
def _parent_resolution(value: int, resolution: int) -> int:
|
|
166
|
+
return _integer(value, "parent vertical resolution", 0, resolution)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def _child_resolution(value: int, resolution: int) -> int:
|
|
170
|
+
return _integer(value, "child vertical resolution", resolution, _MAX_RESOLUTION)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
def _descendant_ordinals(
|
|
174
|
+
resolution: int, ordinal: int, child_resolution: int
|
|
175
|
+
) -> range:
|
|
176
|
+
scale = _POWERS[child_resolution - resolution]
|
|
177
|
+
return range(ordinal * scale, (ordinal + 1) * scale)
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
def _voxel_descendants(
|
|
181
|
+
cell: int, surface: int, target_surface: int, target_vertical: int, ordinals: range
|
|
182
|
+
) -> Iterator[int]:
|
|
183
|
+
if target_surface == surface:
|
|
184
|
+
cells = iter((cell,))
|
|
185
|
+
else:
|
|
186
|
+
count = _h3.cell_to_children_size(cell, target_surface)
|
|
187
|
+
cells = (_h3.child_pos_to_cell(cell, target_surface, pos) for pos in range(count))
|
|
188
|
+
for child in cells:
|
|
189
|
+
for child_ordinal in ordinals:
|
|
190
|
+
vertical = _encode_vertical(target_vertical, child_ordinal)
|
|
191
|
+
yield _pack_voxel(child, vertical)
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
# Coordinate conversions.
|
|
195
|
+
|
|
196
|
+
def _conversion_height(altitude: float) -> float:
|
|
197
|
+
if not _MIN_CONVERSION_HEIGHT <= altitude <= _MAX_CONVERSION_HEIGHT:
|
|
198
|
+
raise ValueError("altitude is outside the supported WGS84 conversion envelope")
|
|
199
|
+
return altitude
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
def _prime_vertical_radius(sin_lat: float) -> float:
|
|
203
|
+
return _A / sqrt(1.0 - _E2 * sin_lat * sin_lat)
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
def _forward(lat: float, lng: float, alt: float) -> tuple[float, float, float]:
|
|
207
|
+
if abs(lat) == 90.0:
|
|
208
|
+
return 0.0, 0.0, copysign(_B + alt, lat)
|
|
209
|
+
|
|
210
|
+
phi = radians(lat)
|
|
211
|
+
sin_lat = sin(phi)
|
|
212
|
+
radius = _prime_vertical_radius(sin_lat)
|
|
213
|
+
p = (radius + alt) * cos(phi)
|
|
214
|
+
z = (radius * (1.0 - _E2) + alt) * sin_lat
|
|
215
|
+
if lng == -180.0:
|
|
216
|
+
return -p, 0.0, z
|
|
217
|
+
lam = radians(lng)
|
|
218
|
+
return p * cos(lam), p * sin(lam), z
|
h3d/conversions.py
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"""WGS84 geodetic and Earth-centered, Earth-fixed Cartesian conversions."""
|
|
2
|
+
|
|
3
|
+
from math import atan2, copysign, cos, degrees, hypot, sin, sqrt
|
|
4
|
+
|
|
5
|
+
from ._core import (
|
|
6
|
+
_A,
|
|
7
|
+
_B,
|
|
8
|
+
_E2,
|
|
9
|
+
_MAX_CONVERSION_HEIGHT,
|
|
10
|
+
_MAX_RESIDUAL_M,
|
|
11
|
+
_MIN_CONVERSION_HEIGHT,
|
|
12
|
+
_canonical_latlng,
|
|
13
|
+
_conversion_height,
|
|
14
|
+
_finite,
|
|
15
|
+
_forward,
|
|
16
|
+
_prime_vertical_radius,
|
|
17
|
+
)
|
|
18
|
+
from .indexing import latlngalt_to_voxel as _latlngalt_to_voxel
|
|
19
|
+
from .indexing import voxel_to_latlngalt as _voxel_to_latlngalt
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def geodetic_to_ecef(lat: float, lng: float, alt: float) -> tuple[float, float, float]:
|
|
23
|
+
"""Convert WGS84 geodetic coordinates to ECEF (x, y, z) in metres.
|
|
24
|
+
|
|
25
|
+
Parameters
|
|
26
|
+
----------
|
|
27
|
+
lat : float
|
|
28
|
+
WGS84 geodetic latitude in degrees, from −90 to +90.
|
|
29
|
+
lng : float
|
|
30
|
+
WGS84 longitude in degrees, from −180 to +180.
|
|
31
|
+
alt : float
|
|
32
|
+
WGS84 ellipsoidal height in metres.
|
|
33
|
+
|
|
34
|
+
Returns
|
|
35
|
+
-------
|
|
36
|
+
tuple[float, float, float]
|
|
37
|
+
WGS84 ECEF coordinates (x, y, z).
|
|
38
|
+
|
|
39
|
+
Notes
|
|
40
|
+
-----
|
|
41
|
+
The standalone conversion accepts heights from −2,000,000 to
|
|
42
|
+
+1,000,000,000 metres. At an exact pole, x and y are zero.
|
|
43
|
+
"""
|
|
44
|
+
lat, lng = _canonical_latlng(lat, lng)
|
|
45
|
+
alt = _conversion_height(_finite(alt, "altitude"))
|
|
46
|
+
return _forward(lat, lng, alt)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def ecef_to_geodetic(x: float, y: float, z: float) -> tuple[float, float, float]:
|
|
50
|
+
"""Convert ECEF metres to WGS84 latitude, longitude and ellipsoidal height.
|
|
51
|
+
|
|
52
|
+
Parameters
|
|
53
|
+
----------
|
|
54
|
+
x, y, z : float
|
|
55
|
+
WGS84 ECEF coordinates in metres.
|
|
56
|
+
|
|
57
|
+
Returns
|
|
58
|
+
-------
|
|
59
|
+
tuple[float, float, float]
|
|
60
|
+
Latitude and longitude in degrees and recovered height in metres.
|
|
61
|
+
|
|
62
|
+
Notes
|
|
63
|
+
-----
|
|
64
|
+
Recovered heights outside the conversion envelope raise ValueError.
|
|
65
|
+
Longitude is zero on the polar axis.
|
|
66
|
+
"""
|
|
67
|
+
x = _finite(x, "x")
|
|
68
|
+
y = _finite(y, "y")
|
|
69
|
+
z = _finite(z, "z")
|
|
70
|
+
radius = hypot(x, y, z)
|
|
71
|
+
# Each supported height lies on a normal offset of the ellipsoid. Its
|
|
72
|
+
# distance from the origin lies between the polar and equatorial distances
|
|
73
|
+
# of that offset. The residual allowance here guards only this precheck.
|
|
74
|
+
if not (
|
|
75
|
+
_B + _MIN_CONVERSION_HEIGHT - _MAX_RESIDUAL_M
|
|
76
|
+
<= radius
|
|
77
|
+
<= _A + _MAX_CONVERSION_HEIGHT + _MAX_RESIDUAL_M
|
|
78
|
+
):
|
|
79
|
+
raise ValueError("ECEF point is outside the supported WGS84 conversion envelope")
|
|
80
|
+
|
|
81
|
+
p = hypot(x, y)
|
|
82
|
+
if p == 0.0:
|
|
83
|
+
return copysign(90.0, z), 0.0, _conversion_height(abs(z) - _B)
|
|
84
|
+
|
|
85
|
+
lng = degrees(atan2(y, x))
|
|
86
|
+
if z == 0.0:
|
|
87
|
+
lat, lng = _canonical_latlng(0.0, lng)
|
|
88
|
+
return lat, lng, _conversion_height(p - _A)
|
|
89
|
+
|
|
90
|
+
# Rearrange the forward equations to p*tan(phi) = z + e²*N*sin(phi).
|
|
91
|
+
# This fixed-point map is a contraction in the supported height envelope.
|
|
92
|
+
phi = atan2(z, p)
|
|
93
|
+
for _ in range(16):
|
|
94
|
+
sin_lat = sin(phi)
|
|
95
|
+
next_phi = atan2(z + _E2 * _prime_vertical_radius(sin_lat) * sin_lat, p)
|
|
96
|
+
if abs(next_phi - phi) <= 2e-16:
|
|
97
|
+
phi = next_phi
|
|
98
|
+
break
|
|
99
|
+
phi = next_phi
|
|
100
|
+
else:
|
|
101
|
+
raise ValueError("ECEF latitude calculation did not converge")
|
|
102
|
+
|
|
103
|
+
# Project onto the ellipsoid normal, avoiding division by a small cosine.
|
|
104
|
+
sin_lat = sin(phi)
|
|
105
|
+
alt = p * cos(phi) + z * sin_lat - _A * sqrt(1.0 - _E2 * sin_lat * sin_lat)
|
|
106
|
+
alt = _conversion_height(alt)
|
|
107
|
+
lat, lng = _canonical_latlng(degrees(phi), lng)
|
|
108
|
+
rx, ry, rz = _forward(lat, lng, alt)
|
|
109
|
+
if hypot(rx - x, ry - y, rz - z) > _MAX_RESIDUAL_M:
|
|
110
|
+
raise ValueError("ECEF conversion failed the Cartesian residual check")
|
|
111
|
+
return lat, lng, alt
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def ecef_to_voxel(
|
|
115
|
+
x: float, y: float, z: float, surface_resolution: int, vertical_resolution: int
|
|
116
|
+
) -> int:
|
|
117
|
+
"""Encode an ECEF point in metres using the specified voxel resolutions.
|
|
118
|
+
|
|
119
|
+
Parameters
|
|
120
|
+
----------
|
|
121
|
+
x, y, z : float
|
|
122
|
+
WGS84 ECEF coordinates in metres.
|
|
123
|
+
surface_resolution : int
|
|
124
|
+
H3 surface resolution, from 0 to 15.
|
|
125
|
+
vertical_resolution : int
|
|
126
|
+
Vertical resolution, from 0 to 10.
|
|
127
|
+
|
|
128
|
+
Returns
|
|
129
|
+
-------
|
|
130
|
+
int
|
|
131
|
+
Voxel containing the recovered geodetic point.
|
|
132
|
+
|
|
133
|
+
Notes
|
|
134
|
+
-----
|
|
135
|
+
The recovered height is indexed using the half-open domain. Cartesian
|
|
136
|
+
rounding can change the result at a voxel boundary or domain endpoint.
|
|
137
|
+
"""
|
|
138
|
+
return _latlngalt_to_voxel(*ecef_to_geodetic(x, y, z), surface_resolution, vertical_resolution)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def voxel_to_ecef(voxel: int) -> tuple[float, float, float]:
|
|
142
|
+
"""Return the voxel's representative ECEF coordinates in metres.
|
|
143
|
+
|
|
144
|
+
Parameters
|
|
145
|
+
----------
|
|
146
|
+
voxel : int
|
|
147
|
+
Canonical 128-bit voxel ID.
|
|
148
|
+
|
|
149
|
+
Returns
|
|
150
|
+
-------
|
|
151
|
+
tuple[float, float, float]
|
|
152
|
+
WGS84 ECEF coordinates of the H3 grid center at the layer midpoint.
|
|
153
|
+
"""
|
|
154
|
+
return geodetic_to_ecef(*_voxel_to_latlngalt(voxel))
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
__all__ = [
|
|
158
|
+
"geodetic_to_ecef",
|
|
159
|
+
"ecef_to_geodetic",
|
|
160
|
+
"ecef_to_voxel",
|
|
161
|
+
"voxel_to_ecef",
|
|
162
|
+
]
|
h3d/hierarchy.py
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"""Parent and child operations for vertical layers and voxels."""
|
|
2
|
+
|
|
3
|
+
from collections.abc import Iterator
|
|
4
|
+
|
|
5
|
+
from h3.api import basic_int as _h3
|
|
6
|
+
|
|
7
|
+
from ._core import (
|
|
8
|
+
_MAX_SURFACE_RESOLUTION,
|
|
9
|
+
_POWERS,
|
|
10
|
+
_child_resolution,
|
|
11
|
+
_decode_vertical,
|
|
12
|
+
_descendant_ordinals,
|
|
13
|
+
_encode_vertical,
|
|
14
|
+
_integer,
|
|
15
|
+
_pack_voxel,
|
|
16
|
+
_parent_resolution,
|
|
17
|
+
_voxel_descendants,
|
|
18
|
+
_voxel_parts,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def vertical_to_parent(vertical: int, parent_resolution: int) -> int:
|
|
23
|
+
"""Return the vertical ancestor at the requested resolution.
|
|
24
|
+
|
|
25
|
+
Parameters
|
|
26
|
+
----------
|
|
27
|
+
vertical : int
|
|
28
|
+
Canonical 64-bit vertical word.
|
|
29
|
+
parent_resolution : int
|
|
30
|
+
Target vertical resolution, at most the current resolution.
|
|
31
|
+
|
|
32
|
+
Returns
|
|
33
|
+
-------
|
|
34
|
+
int
|
|
35
|
+
Vertical word at the target resolution.
|
|
36
|
+
"""
|
|
37
|
+
resolution, ordinal = _decode_vertical(vertical)
|
|
38
|
+
target = _parent_resolution(parent_resolution, resolution)
|
|
39
|
+
return _encode_vertical(target, ordinal // _POWERS[resolution - target])
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def vertical_to_children(vertical: int, child_resolution: int) -> Iterator[int]:
|
|
43
|
+
"""Return a lazy iterator of vertical descendants in ascending altitude order.
|
|
44
|
+
|
|
45
|
+
Parameters
|
|
46
|
+
----------
|
|
47
|
+
vertical : int
|
|
48
|
+
Canonical 64-bit vertical word.
|
|
49
|
+
child_resolution : int
|
|
50
|
+
Target vertical resolution, at least the current resolution.
|
|
51
|
+
|
|
52
|
+
Returns
|
|
53
|
+
-------
|
|
54
|
+
Iterator[int]
|
|
55
|
+
Descendant vertical words.
|
|
56
|
+
|
|
57
|
+
Notes
|
|
58
|
+
-----
|
|
59
|
+
Arguments are validated when called. An equal target resolution yields
|
|
60
|
+
the original word once.
|
|
61
|
+
"""
|
|
62
|
+
resolution, ordinal = _decode_vertical(vertical)
|
|
63
|
+
target = _child_resolution(child_resolution, resolution)
|
|
64
|
+
return (
|
|
65
|
+
_encode_vertical(target, child)
|
|
66
|
+
for child in _descendant_ordinals(resolution, ordinal, target)
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def voxel_to_parent(voxel: int, surface_resolution: int, vertical_resolution: int) -> int:
|
|
71
|
+
"""Return the ancestor at the requested surface and vertical resolutions.
|
|
72
|
+
|
|
73
|
+
Parameters
|
|
74
|
+
----------
|
|
75
|
+
voxel : int
|
|
76
|
+
Canonical 128-bit voxel ID.
|
|
77
|
+
surface_resolution : int
|
|
78
|
+
Target H3 resolution, at most the current resolution.
|
|
79
|
+
vertical_resolution : int
|
|
80
|
+
Target vertical resolution, at most the current resolution.
|
|
81
|
+
|
|
82
|
+
Returns
|
|
83
|
+
-------
|
|
84
|
+
int
|
|
85
|
+
Voxel at the requested resolutions.
|
|
86
|
+
|
|
87
|
+
Notes
|
|
88
|
+
-----
|
|
89
|
+
Equal target resolutions preserve the corresponding index. Horizontal
|
|
90
|
+
ancestry follows the H3 index hierarchy.
|
|
91
|
+
"""
|
|
92
|
+
cell, _, resolution, ordinal = _voxel_parts(voxel)
|
|
93
|
+
surface = _h3.get_resolution(cell)
|
|
94
|
+
target_surface = _integer(surface_resolution, "parent surface resolution", 0, surface)
|
|
95
|
+
target_vertical = _parent_resolution(vertical_resolution, resolution)
|
|
96
|
+
if target_surface < surface:
|
|
97
|
+
cell = _h3.cell_to_parent(cell, target_surface)
|
|
98
|
+
vertical = _encode_vertical(target_vertical, ordinal // _POWERS[resolution - target_vertical])
|
|
99
|
+
return _pack_voxel(cell, vertical)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def voxel_to_children(
|
|
103
|
+
voxel: int, surface_resolution: int, vertical_resolution: int
|
|
104
|
+
) -> Iterator[int]:
|
|
105
|
+
"""Yield descendants by H3 child position, then ascending altitude.
|
|
106
|
+
|
|
107
|
+
Parameters
|
|
108
|
+
----------
|
|
109
|
+
voxel : int
|
|
110
|
+
Canonical 128-bit voxel ID.
|
|
111
|
+
surface_resolution : int
|
|
112
|
+
Target H3 resolution, at least the current resolution.
|
|
113
|
+
vertical_resolution : int
|
|
114
|
+
Target vertical resolution, at least the current resolution.
|
|
115
|
+
|
|
116
|
+
Returns
|
|
117
|
+
-------
|
|
118
|
+
Iterator[int]
|
|
119
|
+
Lazy iterator of voxel IDs.
|
|
120
|
+
|
|
121
|
+
Notes
|
|
122
|
+
-----
|
|
123
|
+
Arguments are validated when called. If both target resolutions match
|
|
124
|
+
the input, the iterator yields the original voxel once.
|
|
125
|
+
"""
|
|
126
|
+
cell, _, resolution, ordinal = _voxel_parts(voxel)
|
|
127
|
+
surface = _h3.get_resolution(cell)
|
|
128
|
+
target_surface = _integer(
|
|
129
|
+
surface_resolution, "child surface resolution", surface, _MAX_SURFACE_RESOLUTION
|
|
130
|
+
)
|
|
131
|
+
target_vertical = _child_resolution(vertical_resolution, resolution)
|
|
132
|
+
ordinals = _descendant_ordinals(resolution, ordinal, target_vertical)
|
|
133
|
+
|
|
134
|
+
return _voxel_descendants(cell, surface, target_surface, target_vertical, ordinals)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
__all__ = [
|
|
138
|
+
"vertical_to_parent",
|
|
139
|
+
"vertical_to_children",
|
|
140
|
+
"voxel_to_parent",
|
|
141
|
+
"voxel_to_children",
|
|
142
|
+
]
|
h3d/indexing.py
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"""Geodetic voxel indexing and vertical layer coordinates."""
|
|
2
|
+
|
|
3
|
+
from h3.api import basic_int as _h3
|
|
4
|
+
|
|
5
|
+
from ._core import (
|
|
6
|
+
_MAX_ALTITUDE_M,
|
|
7
|
+
_MAX_RESOLUTION,
|
|
8
|
+
_MAX_SURFACE_RESOLUTION,
|
|
9
|
+
_MIN_ALTITUDE_M,
|
|
10
|
+
_POWERS,
|
|
11
|
+
_bounds,
|
|
12
|
+
_canonical_latlng,
|
|
13
|
+
_decode_vertical,
|
|
14
|
+
_encode_vertical,
|
|
15
|
+
_finite,
|
|
16
|
+
_integer,
|
|
17
|
+
_midpoint,
|
|
18
|
+
_ordinal_at,
|
|
19
|
+
_pack_voxel,
|
|
20
|
+
_voxel_parts,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def latlngalt_to_voxel(
|
|
25
|
+
lat: float, lng: float, alt: float, surface_resolution: int, vertical_resolution: int
|
|
26
|
+
) -> int:
|
|
27
|
+
"""Encode latitude, longitude (degrees), and ellipsoidal height (metres).
|
|
28
|
+
|
|
29
|
+
Parameters
|
|
30
|
+
----------
|
|
31
|
+
lat : float
|
|
32
|
+
WGS84 geodetic latitude in degrees, from −90 to +90.
|
|
33
|
+
lng : float
|
|
34
|
+
WGS84 longitude in degrees, from −180 to +180.
|
|
35
|
+
alt : float
|
|
36
|
+
WGS84 ellipsoidal height in metres.
|
|
37
|
+
surface_resolution : int
|
|
38
|
+
H3 surface resolution, from 0 to 15.
|
|
39
|
+
vertical_resolution : int
|
|
40
|
+
Vertical resolution, from 0 to 10.
|
|
41
|
+
|
|
42
|
+
Returns
|
|
43
|
+
-------
|
|
44
|
+
int
|
|
45
|
+
Voxel containing the input position.
|
|
46
|
+
|
|
47
|
+
Notes
|
|
48
|
+
-----
|
|
49
|
+
The indexing domain includes the lower height bound and excludes the
|
|
50
|
+
upper bound. Longitude is canonicalized at the antimeridian and poles.
|
|
51
|
+
"""
|
|
52
|
+
lat, lng = _canonical_latlng(lat, lng)
|
|
53
|
+
surface = _integer(surface_resolution, "surface resolution", 0, _MAX_SURFACE_RESOLUTION)
|
|
54
|
+
vertical = altitude_to_vertical(alt, vertical_resolution)
|
|
55
|
+
return _pack_voxel(_h3.latlng_to_cell(lat, lng, surface), vertical)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def voxel_to_latlngalt(voxel: int) -> tuple[float, float, float]:
|
|
59
|
+
"""Return the H3 grid center in degrees and the vertical midpoint in metres.
|
|
60
|
+
|
|
61
|
+
Parameters
|
|
62
|
+
----------
|
|
63
|
+
voxel : int
|
|
64
|
+
Canonical 128-bit voxel ID.
|
|
65
|
+
|
|
66
|
+
Returns
|
|
67
|
+
-------
|
|
68
|
+
tuple[float, float, float]
|
|
69
|
+
Representative latitude, longitude, and ellipsoidal height.
|
|
70
|
+
|
|
71
|
+
Notes
|
|
72
|
+
-----
|
|
73
|
+
Use the original surface and vertical resolutions to re-encode the
|
|
74
|
+
representative point.
|
|
75
|
+
"""
|
|
76
|
+
cell, _, resolution, ordinal = _voxel_parts(voxel)
|
|
77
|
+
lat, lng = _canonical_latlng(*_h3.cell_to_latlng(cell))
|
|
78
|
+
return lat, lng, _midpoint(resolution, ordinal)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def altitude_to_vertical(alt: float, vertical_resolution: int) -> int:
|
|
82
|
+
"""Encode ellipsoidal height in metres as a canonical 64-bit vertical word.
|
|
83
|
+
|
|
84
|
+
Parameters
|
|
85
|
+
----------
|
|
86
|
+
alt : float
|
|
87
|
+
WGS84 ellipsoidal height in metres.
|
|
88
|
+
vertical_resolution : int
|
|
89
|
+
Vertical resolution, from 0 to 10.
|
|
90
|
+
|
|
91
|
+
Returns
|
|
92
|
+
-------
|
|
93
|
+
int
|
|
94
|
+
Vertical word for the layer containing the height.
|
|
95
|
+
|
|
96
|
+
Notes
|
|
97
|
+
-----
|
|
98
|
+
The indexing domain includes the lower height bound and excludes the
|
|
99
|
+
upper bound.
|
|
100
|
+
"""
|
|
101
|
+
resolution = _integer(vertical_resolution, "vertical resolution", 0, _MAX_RESOLUTION)
|
|
102
|
+
altitude = _finite(alt, "altitude")
|
|
103
|
+
if not _MIN_ALTITUDE_M <= altitude < _MAX_ALTITUDE_M:
|
|
104
|
+
raise ValueError("altitude is outside the H3D indexing domain")
|
|
105
|
+
return _encode_vertical(resolution, _ordinal_at(altitude, _POWERS[resolution]))
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def vertical_to_altitude(vertical: int) -> float:
|
|
109
|
+
"""Return the midpoint ellipsoidal height in metres of a vertical layer.
|
|
110
|
+
|
|
111
|
+
Parameters
|
|
112
|
+
----------
|
|
113
|
+
vertical : int
|
|
114
|
+
Canonical 64-bit vertical word.
|
|
115
|
+
|
|
116
|
+
Returns
|
|
117
|
+
-------
|
|
118
|
+
float
|
|
119
|
+
Representative height of the layer.
|
|
120
|
+
"""
|
|
121
|
+
return _midpoint(*_decode_vertical(vertical))
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def vertical_bounds(vertical: int) -> tuple[float, float]:
|
|
125
|
+
"""Return the lower-inclusive and upper-exclusive heights in metres.
|
|
126
|
+
|
|
127
|
+
Parameters
|
|
128
|
+
----------
|
|
129
|
+
vertical : int
|
|
130
|
+
Canonical 64-bit vertical word.
|
|
131
|
+
|
|
132
|
+
Returns
|
|
133
|
+
-------
|
|
134
|
+
tuple[float, float]
|
|
135
|
+
Bounds of the vertical layer.
|
|
136
|
+
"""
|
|
137
|
+
return _bounds(*_decode_vertical(vertical))
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def voxel_altitude_bounds(voxel: int) -> tuple[float, float]:
|
|
141
|
+
"""Return the voxel's lower-inclusive and upper-exclusive heights in metres.
|
|
142
|
+
|
|
143
|
+
Parameters
|
|
144
|
+
----------
|
|
145
|
+
voxel : int
|
|
146
|
+
Canonical 128-bit voxel ID.
|
|
147
|
+
|
|
148
|
+
Returns
|
|
149
|
+
-------
|
|
150
|
+
tuple[float, float]
|
|
151
|
+
Lower and upper bounds of the embedded layer.
|
|
152
|
+
"""
|
|
153
|
+
_, _, resolution, ordinal = _voxel_parts(voxel)
|
|
154
|
+
return _bounds(resolution, ordinal)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
__all__ = [
|
|
158
|
+
"latlngalt_to_voxel",
|
|
159
|
+
"voxel_to_latlngalt",
|
|
160
|
+
"altitude_to_vertical",
|
|
161
|
+
"vertical_to_altitude",
|
|
162
|
+
"vertical_bounds",
|
|
163
|
+
"voxel_altitude_bounds",
|
|
164
|
+
]
|
h3d/inspection.py
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"""Voxel validation, resolution inspection, and component access."""
|
|
2
|
+
|
|
3
|
+
from h3.api import basic_int as _h3
|
|
4
|
+
|
|
5
|
+
from ._core import _decode_vertical, _pack_voxel, _valid_cell, _voxel_parts
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def is_valid_voxel(voxel: object) -> bool:
|
|
9
|
+
"""Return whether an object is a canonical H3D voxel integer.
|
|
10
|
+
|
|
11
|
+
Parameters
|
|
12
|
+
----------
|
|
13
|
+
voxel : object
|
|
14
|
+
Value to check.
|
|
15
|
+
|
|
16
|
+
Returns
|
|
17
|
+
-------
|
|
18
|
+
bool
|
|
19
|
+
True if both words constitute a canonical voxel. Malformed inputs return False.
|
|
20
|
+
"""
|
|
21
|
+
try:
|
|
22
|
+
_voxel_parts(voxel)
|
|
23
|
+
except (TypeError, ValueError):
|
|
24
|
+
return False
|
|
25
|
+
return True
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def get_surface_resolution(voxel: int) -> int:
|
|
29
|
+
"""Return the resolution of the embedded H3 cell.
|
|
30
|
+
|
|
31
|
+
Parameters
|
|
32
|
+
----------
|
|
33
|
+
voxel : int
|
|
34
|
+
Canonical 128-bit voxel ID.
|
|
35
|
+
|
|
36
|
+
Returns
|
|
37
|
+
-------
|
|
38
|
+
int
|
|
39
|
+
H3 surface resolution from 0 to 15.
|
|
40
|
+
"""
|
|
41
|
+
cell, _, _, _ = _voxel_parts(voxel)
|
|
42
|
+
return _h3.get_resolution(cell)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def get_vertical_resolution(voxel: int) -> int:
|
|
46
|
+
"""Return the resolution of the embedded vertical layer.
|
|
47
|
+
|
|
48
|
+
Parameters
|
|
49
|
+
----------
|
|
50
|
+
voxel : int
|
|
51
|
+
Canonical 128-bit voxel ID.
|
|
52
|
+
|
|
53
|
+
Returns
|
|
54
|
+
-------
|
|
55
|
+
int
|
|
56
|
+
Vertical resolution from 0 to 10.
|
|
57
|
+
"""
|
|
58
|
+
_, _, resolution, _ = _voxel_parts(voxel)
|
|
59
|
+
return resolution
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def voxel_to_h3(voxel: int) -> int:
|
|
63
|
+
"""Return the embedded H3 cell unchanged as an integer.
|
|
64
|
+
|
|
65
|
+
Parameters
|
|
66
|
+
----------
|
|
67
|
+
voxel : int
|
|
68
|
+
Canonical 128-bit voxel ID.
|
|
69
|
+
|
|
70
|
+
Returns
|
|
71
|
+
-------
|
|
72
|
+
int
|
|
73
|
+
Original H3 cell.
|
|
74
|
+
"""
|
|
75
|
+
cell, _, _, _ = _voxel_parts(voxel)
|
|
76
|
+
return cell
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def voxel_to_vertical(voxel: int) -> int:
|
|
80
|
+
"""Return the embedded vertical word unchanged as an integer.
|
|
81
|
+
|
|
82
|
+
Parameters
|
|
83
|
+
----------
|
|
84
|
+
voxel : int
|
|
85
|
+
Canonical 128-bit voxel ID.
|
|
86
|
+
|
|
87
|
+
Returns
|
|
88
|
+
-------
|
|
89
|
+
int
|
|
90
|
+
Vertical word containing the layer and resolution.
|
|
91
|
+
"""
|
|
92
|
+
_, vertical, _, _ = _voxel_parts(voxel)
|
|
93
|
+
return vertical
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def h3_to_voxel(cell: int, vertical: int) -> int:
|
|
97
|
+
"""Combine a valid H3 cell integer with a canonical vertical word.
|
|
98
|
+
|
|
99
|
+
Parameters
|
|
100
|
+
----------
|
|
101
|
+
cell : int
|
|
102
|
+
Valid H3 cell integer.
|
|
103
|
+
vertical : int
|
|
104
|
+
Canonical 64-bit vertical word.
|
|
105
|
+
|
|
106
|
+
Returns
|
|
107
|
+
-------
|
|
108
|
+
int
|
|
109
|
+
Voxel ID containing the two words.
|
|
110
|
+
"""
|
|
111
|
+
cell = _valid_cell(cell)
|
|
112
|
+
_decode_vertical(vertical)
|
|
113
|
+
return _pack_voxel(cell, int(vertical))
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
__all__ = [
|
|
117
|
+
"is_valid_voxel",
|
|
118
|
+
"get_surface_resolution",
|
|
119
|
+
"get_vertical_resolution",
|
|
120
|
+
"voxel_to_h3",
|
|
121
|
+
"voxel_to_vertical",
|
|
122
|
+
"h3_to_voxel",
|
|
123
|
+
]
|
h3d/storage.py
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"""Split and restore voxel IDs for two-column integer storage."""
|
|
2
|
+
|
|
3
|
+
from ._core import _voxel_parts
|
|
4
|
+
from .inspection import h3_to_voxel as _h3_to_voxel
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def voxel_to_parts(voxel: int) -> tuple[int, int]:
|
|
8
|
+
"""Split a voxel into its H3 cell and vertical word for storage.
|
|
9
|
+
|
|
10
|
+
Parameters
|
|
11
|
+
----------
|
|
12
|
+
voxel : int
|
|
13
|
+
Canonical 128-bit voxel ID.
|
|
14
|
+
|
|
15
|
+
Returns
|
|
16
|
+
-------
|
|
17
|
+
tuple[int, int]
|
|
18
|
+
The original words in ``(h3_cell, vertical_word)`` order. Each is a
|
|
19
|
+
Python integer that fits in an unsigned 64-bit column.
|
|
20
|
+
"""
|
|
21
|
+
cell, vertical, _, _ = _voxel_parts(voxel)
|
|
22
|
+
return cell, vertical
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def parts_to_voxel(h3_cell: int, vertical_word: int) -> int:
|
|
26
|
+
"""Restore a voxel ID from its two unsigned 64-bit words.
|
|
27
|
+
|
|
28
|
+
Parameters
|
|
29
|
+
----------
|
|
30
|
+
h3_cell : int
|
|
31
|
+
Valid H3 cell integer stored in the low word of the voxel.
|
|
32
|
+
vertical_word : int
|
|
33
|
+
Canonical vertical word stored in the high word of the voxel.
|
|
34
|
+
|
|
35
|
+
Returns
|
|
36
|
+
-------
|
|
37
|
+
int
|
|
38
|
+
Original 128-bit voxel ID as a Python integer.
|
|
39
|
+
"""
|
|
40
|
+
return _h3_to_voxel(h3_cell, vertical_word)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
__all__ = [
|
|
44
|
+
"voxel_to_parts",
|
|
45
|
+
"parts_to_voxel",
|
|
46
|
+
]
|
h3d/traversal.py
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"""Lazy traversal of vertical layers across a height range."""
|
|
2
|
+
|
|
3
|
+
from collections.abc import Iterator
|
|
4
|
+
|
|
5
|
+
from ._core import (
|
|
6
|
+
_BASE_COUNT,
|
|
7
|
+
_MAX_ALTITUDE_M,
|
|
8
|
+
_MAX_RESOLUTION,
|
|
9
|
+
_MIN_ALTITUDE_M,
|
|
10
|
+
_POWERS,
|
|
11
|
+
_boundary,
|
|
12
|
+
_encode_vertical,
|
|
13
|
+
_finite,
|
|
14
|
+
_integer,
|
|
15
|
+
_ordinal_at,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def iter_vertical_range(
|
|
20
|
+
lower: float, upper: float, vertical_resolution: int
|
|
21
|
+
) -> Iterator[int]:
|
|
22
|
+
"""Lazily yield vertical layers intersecting the height interval [lower, upper).
|
|
23
|
+
|
|
24
|
+
Parameters
|
|
25
|
+
----------
|
|
26
|
+
lower : float
|
|
27
|
+
Inclusive lower query height in metres.
|
|
28
|
+
upper : float
|
|
29
|
+
Exclusive upper query height in metres.
|
|
30
|
+
vertical_resolution : int
|
|
31
|
+
Vertical resolution, from 0 to 10.
|
|
32
|
+
|
|
33
|
+
Returns
|
|
34
|
+
-------
|
|
35
|
+
Iterator[int]
|
|
36
|
+
Intersecting vertical words in ascending altitude order.
|
|
37
|
+
|
|
38
|
+
Notes
|
|
39
|
+
-----
|
|
40
|
+
Both query endpoints may coincide with the domain limits. Equal endpoints
|
|
41
|
+
produce an empty iterator. Reversed or out-of-domain bounds raise ValueError.
|
|
42
|
+
"""
|
|
43
|
+
resolution = _integer(vertical_resolution, "vertical resolution", 0, _MAX_RESOLUTION)
|
|
44
|
+
lower = _finite(lower, "lower altitude")
|
|
45
|
+
upper = _finite(upper, "upper altitude")
|
|
46
|
+
if not _MIN_ALTITUDE_M <= lower <= upper <= _MAX_ALTITUDE_M:
|
|
47
|
+
raise ValueError("range bounds must be ordered and within the indexing domain")
|
|
48
|
+
if lower == upper:
|
|
49
|
+
return iter(())
|
|
50
|
+
|
|
51
|
+
subdivisions = _POWERS[resolution]
|
|
52
|
+
start = _ordinal_at(lower, subdivisions)
|
|
53
|
+
if upper == _MAX_ALTITUDE_M:
|
|
54
|
+
stop = _BASE_COUNT * subdivisions
|
|
55
|
+
else:
|
|
56
|
+
stop = _ordinal_at(upper, subdivisions)
|
|
57
|
+
if upper > _boundary(stop, subdivisions):
|
|
58
|
+
stop += 1
|
|
59
|
+
return (_encode_vertical(resolution, ordinal) for ordinal in range(start, stop))
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
__all__ = [
|
|
63
|
+
"iter_vertical_range",
|
|
64
|
+
]
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: h3d
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: 3D Extension for Uber H3 Spatial Indexing
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
Project-URL: Repository, https://github.com/piglabsai/h3d
|
|
7
|
+
Project-URL: Documentation, https://github.com/piglabsai/h3d/blob/main/docs/index.md
|
|
8
|
+
Project-URL: Issues, https://github.com/piglabsai/h3d/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/piglabsai/h3d/blob/main/CHANGELOG.md
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Topic :: Scientific/Engineering :: GIS
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
License-File: NOTICE
|
|
17
|
+
Requires-Dist: h3<5,>=4.1
|
|
18
|
+
Provides-Extra: test
|
|
19
|
+
Requires-Dist: pytest>=8; extra == "test"
|
|
20
|
+
Provides-Extra: docs
|
|
21
|
+
Requires-Dist: sphinx<9,>=7.4; extra == "docs"
|
|
22
|
+
Requires-Dist: myst-parser<5,>=3; extra == "docs"
|
|
23
|
+
Requires-Dist: sphinx-book-theme<2,>=1.1; extra == "docs"
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
# H3D — 3D Extension for Uber H3 Spatial Indexing
|
|
27
|
+
|
|
28
|
+
**A voxel is a spatial region with an ID.** H3D extends an H3 cell through a
|
|
29
|
+
WGS84 ellipsoidal height interval. Use it to group positions by voxel, change
|
|
30
|
+
grid detail, or look up the original H3 footprint.
|
|
31
|
+
|
|
32
|
+
**Experimental preview.** Record the package version alongside persisted voxel
|
|
33
|
+
IDs while the API and index format are in early development.
|
|
34
|
+
|
|
35
|
+
## Install
|
|
36
|
+
|
|
37
|
+
Install with Python 3.10 or later. The H3 dependency is installed automatically.
|
|
38
|
+
|
|
39
|
+
```console
|
|
40
|
+
python -m pip install h3d
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
To install from a source checkout instead, run the following in its root.
|
|
44
|
+
|
|
45
|
+
```console
|
|
46
|
+
python -m pip install .
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## First example
|
|
50
|
+
|
|
51
|
+
Pass geodetic latitude and longitude in degrees and ellipsoidal height in metres. The representative coordinates combine the H3 grid center with the layer midpoint.
|
|
52
|
+
|
|
53
|
+
```pycon
|
|
54
|
+
>>> import h3d
|
|
55
|
+
>>> voxel = h3d.latlngalt_to_voxel(52.52, 13.405, 75.0, 9, 8)
|
|
56
|
+
>>> lower, upper = h3d.voxel_altitude_bounds(voxel)
|
|
57
|
+
>>> lower <= 75.0 < upper
|
|
58
|
+
True
|
|
59
|
+
>>> h3d.get_surface_resolution(voxel), h3d.get_vertical_resolution(voxel)
|
|
60
|
+
(9, 8)
|
|
61
|
+
>>> h3d.voxel_to_h3(voxel) == voxel & ((1 << 64) - 1)
|
|
62
|
+
True
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Conversion functions
|
|
67
|
+
|
|
68
|
+
The conversion functions accept Earth-centered, Earth-fixed (ECEF) Cartesian coordinates in metres. This example indexes an illustrative position on the ECEF equatorial X axis about 400 km above the ellipsoid.
|
|
69
|
+
|
|
70
|
+
```pycon
|
|
71
|
+
>>> satellite = h3d.ecef_to_voxel(6_778_137.0, 0.0, 0.0, 5, 4)
|
|
72
|
+
>>> lower, upper = h3d.voxel_altitude_bounds(satellite)
|
|
73
|
+
>>> lower <= 400_000.0 < upper
|
|
74
|
+
True
|
|
75
|
+
>>> x, y, z = h3d.voxel_to_ecef(satellite)
|
|
76
|
+
>>> h3d.ecef_to_voxel(x, y, z, 5, 4) == satellite
|
|
77
|
+
True
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
The satellite input must already be in WGS84 ECEF. Positions in an inertial frame require a frame transformation using the observation time before indexing.
|
|
82
|
+
|
|
83
|
+
## What to know
|
|
84
|
+
|
|
85
|
+
- Geodetic inputs use degrees and WGS84 ellipsoidal height in metres. The
|
|
86
|
+
indexing domain extends from about 1,110 km below the ellipsoid to 567,006 km
|
|
87
|
+
above it, with an exclusive upper bound.
|
|
88
|
+
- `surface_resolution` selects horizontal detail (0–15).
|
|
89
|
+
`vertical_resolution` selects layer thickness (0–10), with approximately
|
|
90
|
+
7.856 mm thickness at level 10.
|
|
91
|
+
- Voxel IDs are 128-bit Python integers. Use 32 lowercase hexadecimal digits
|
|
92
|
+
for text interchange and `voxel_to_h3()` to recover the original H3 cell.
|
|
93
|
+
|
|
94
|
+
## Documentation
|
|
95
|
+
|
|
96
|
+
- [Documentation home](https://github.com/piglabsai/h3d/blob/main/docs/index.md)
|
|
97
|
+
- [Understand the grid](https://github.com/piglabsai/h3d/blob/main/docs/concepts.md)
|
|
98
|
+
- [Usage guide](https://github.com/piglabsai/h3d/blob/main/docs/usage.md)
|
|
99
|
+
- [API quick reference](https://github.com/piglabsai/h3d/blob/main/docs/api_quick.md)
|
|
100
|
+
- [API reference](https://github.com/piglabsai/h3d/blob/main/docs/api_reference.md)
|
|
101
|
+
- [Format specification](https://github.com/piglabsai/h3d/blob/main/docs/format.md)
|
|
102
|
+
- [Contributor guide](https://github.com/piglabsai/h3d/blob/main/docs/contributing.md)
|
|
103
|
+
|
|
104
|
+
H3D is licensed under [Apache-2.0](https://github.com/piglabsai/h3d/blob/main/LICENSE).
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
h3d/__init__.py,sha256=wpcHMF17HRZdcIV1KY0VTi_2QclQ80SRbLcLl54bJJc,1305
|
|
2
|
+
h3d/_core.py,sha256=Ac_WbrXUvSyUWg2QBFALp9OHqqZMQSt_1KlDuvtd0AI,7381
|
|
3
|
+
h3d/conversions.py,sha256=T-IK2BvWhwRpLiW1bGX8LxGX0qMwH70N1Etjs11ltFo,4930
|
|
4
|
+
h3d/hierarchy.py,sha256=6Oga4dziHKtyjHqYWABdaSI2yXdJwwakuFzZfXN1nx8,4235
|
|
5
|
+
h3d/indexing.py,sha256=TcHgvpBvpwQ60FcinyUxBo2eg70bZpu5NITpBX1fLrU,4372
|
|
6
|
+
h3d/inspection.py,sha256=rffaWQyqkc_dBNAg8JEV0P81XA33mENWA1sMF1ta6Dw,2570
|
|
7
|
+
h3d/storage.py,sha256=RhK4HEenfC61uGkQZ7CZp9uyJlDA_QF4mJdDZrrIH8A,1160
|
|
8
|
+
h3d/traversal.py,sha256=1ItiKwUSBk5gb88kqY030_BV238tZHBVpLtPXvc7EA4,1819
|
|
9
|
+
h3d-0.1.0.dist-info/licenses/LICENSE,sha256=Y4M0lkp8nB4OOZrfB5IPnuBLaif7eCW92xURO9OJsbA,11338
|
|
10
|
+
h3d-0.1.0.dist-info/licenses/NOTICE,sha256=gxq6rktRT-44Dlz8vX3MvE_3m-gXDTaLWrr69sR8MBA,226
|
|
11
|
+
h3d-0.1.0.dist-info/METADATA,sha256=4byIuRs5VWBte3hsrybFZlTAFju7N9v2ODotTjfBb4s,3990
|
|
12
|
+
h3d-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
13
|
+
h3d-0.1.0.dist-info/top_level.txt,sha256=scmgP5rRDMLy05K2-RXy9LOEoZZUtmpkvHepLS7IUIM,4
|
|
14
|
+
h3d-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 Piglabs
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
h3d
|