18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-03 11:15:23 +01:00
Commit Graph

3 Commits

Author SHA1 Message Date
maj00r 7ef4cf9aa1 fix(world): the remarks of Sonar on the geometry library: no shift by a level out of range, init-statements, a helper for a nested test
ancestor() returns no tile for a level out of range, and centre_direction() and corner_direction() nothing for
a tile that isn't valid, rather than shifting by a negative count or by 64 (S3949). Init-statements (S6004),
an upper-case literal suffix (S818), references in the loops of the tests (S6032), no redundant parentheses
(S1110), and the check of the neighbours of a plane tile in a helper of its own (S134). Behaviour unchanged for
valid tiles; the geometry tests pass.
2026-12-02 23:46:40 +01:00
maj00r c1e32ad2aa feat(world): the tiles of the plane body, on the face value the cube leaves free
The plane body has no cube, so its tiles take face 6 of the id: a flat square of 8192 x 1024 m with its middle
at the zero of the .scn system, split by the same quadtree in the same Hilbert order. A tile of level 13 is
exactly 1024 m, a region of the logic (level 10) 8192 m, and the edges of tiles lie every 1024 m from the zero;
the square reaches +-4194 km. The tile of a position is computed in integers (a leaf is 7.8125 mm), a tile at
the edge of the square has no neighbour beyond it, the Hilbert order stays within the plane (and no longer runs
from the last face of the cube onto it), and the frame of a plane tile has its anchor in the middle at the
height and no rotation. So the directory, the order in the files, the regions and the neighbours are the same
code for all bodies (docs/world-format-eu07.md, section 3).

The comment on the frames at the poles said the opposite of what the code does; it now says it: z points as
the north just short of the pole on the prime meridian.
2026-12-02 21:05:15 +01:00
maj00r 24e21d083d feat(world): the geometry library of the new world format: positions in micrometres, the bodies, the tiles of a cube grid and their frames
Step 1 of the plan in docs/world-format-eu07.md (#516). Nothing in the game uses it yet, so nothing it does or
shows changes.

- world_geometry::position: an absolute position as int64 micrometres, exact differences; a value of metres
  with up to six decimals comes back as the same double.
- body: the Earth (WGS84), a fictional planet (WGS84 or a sphere) and the plane, the vertical as the normal
  of the ellipsoid with no trigonometry ((0, 1, 0) on the plane), geodetic coordinates for import, a record
  of 17 bytes.
- tile_id: the cube grid with S2's layout of faces, quadratic transform and Hilbert order; face, level and
  coordinates, parents and children, the four edge neighbours across the edges of the faces, the next tile.
- tile_frame: the anchor in micrometres and the rotation of the tile's axes (x west, y up, z north), made
  once when a world is compiled and written as a record of 64 bytes, so the game never computes it.

Tests: values of metres back and forth, the verticals, geodetic coordinates to a micrometre, the records
written and read back and refused when broken, ids and their coordinates, the neighbours of every tile of
levels 0, 1 and 4 having each other back, the Hilbert order through neighbours across the faces, the frame
of a tile, and a track around the equator of 72 000 segments closing to the micrometre through 32 768
neighbouring tiles of level 13.
2026-12-02 20:42:52 +01:00