ADCS.helpers.animations.godot.assets.cubemap module¶
Equirectangular maps -> cube maps, with the face convention of OpenGL/Vulkan
cube textures, so a shader samples the result with the raw body-fixed
direction (ITRS for Earth): texture(cube, n_itrs).
Face order and orientation (s, t in [-1, 1] at texel centres, s
along image columns left to right, t along rows top to bottom):
face |
direction (x, y, z) |
|---|---|
+X |
( 1, -t, -s) |
-X |
(-1, -t, s) |
+Y |
( s, 1, t) |
-Y |
( s, -1, -t) |
+Z |
( s, -t, 1) |
-Z |
(-s, -t, -1) |
Equirectangular sources span longitude -180..180 (left to right) and latitude 90..-90 (top to bottom), pixel centres at half-pixel offsets; latitude is the geocentric angle on the sphere.
- ADCS.helpers.animations.godot.assets.cubemap.directions_to_face(d, size)[source]¶
Inverse mapping: which face and texel a direction falls in.
- Returns:
(face_index, row, col)integer arrays (nearest texel).- Parameters:
d (ndarray)
size (int)
- Return type:
Tuple[ndarray, ndarray, ndarray]
- ADCS.helpers.animations.godot.assets.cubemap.equirect_to_cube(size, texel_fn, block_rows=256)[source]¶
Build cube faces block by block (bounded memory for large faces).
- Parameters:
size (int) – Face edge in texels.
texel_fn (Callable[[ndarray], ndarray]) – Maps directions
(rows, size, 3)to texel values(rows, size[, C]).block_rows (int) – Rows computed per block.
- Returns:
Iterator of
(face_name, face_array).- Return type:
Iterator[Tuple[str, ndarray]]
- ADCS.helpers.animations.godot.assets.cubemap.face_directions(face, size, row0=0, row1=None)[source]¶
Unit directions of texel centres for rows
row0:row1of a face, shape(rows, size, 3).- Parameters:
face (str)
size (int)
row0 (int)
row1 (int | None)
- Return type:
ndarray
- ADCS.helpers.animations.godot.assets.cubemap.lonlat(d)[source]¶
Longitude and latitude [rad] of unit directions.
- Parameters:
d (ndarray)
- Return type:
Tuple[ndarray, ndarray]
- ADCS.helpers.animations.godot.assets.cubemap.sample_equirect(img, lon, lat, nearest=False)[source]¶
Sample an equirectangular image (H, W[, C]) at longitudes/latitudes [rad].
Bilinear by default (wrapping in longitude, clamped at the poles), or nearest-neighbour for categorical data such as masks. Returns float32.
- Parameters:
img (ndarray)
lon (ndarray)
lat (ndarray)
nearest (bool)
- Return type:
ndarray