diff --git a/Track-Element-Lengths.md b/Track-Element-Lengths.md index dbb9d7b..19f4c7c 100644 --- a/Track-Element-Lengths.md +++ b/Track-Element-Lengths.md @@ -15,16 +15,19 @@ Distance | Axis These figures coincide with a length of 8716 for the X and Y axis and a length of 6554 for the Z axis, using the Pythagorean theorem and rounding up. -If a straight track element is positioned at x = 0, it will contain subposition data starting at x = 1 and ending at x = 32. To get an accurate distance measurement, the position at x = 0 must be included. A simple heuristic assigns the starting position for track elements: -- if the track element starts orthagonal, the starting position will be <31, 16, z> -- if the track element starts diagonally, the starting position will be <16, 16, z> +Subpositions are direction-specific, this means the track element length varies depending on which direction it is rotated in the world. These variations appear to have a specific pattern: the track positions are in the range [0, 31] on both axis. For example, flat track has the following beginning and end subposition data: +Direction | Start position | End position +-|-|- +0 | { 31, 16, 0 } | { 0, 16, 0 } +1 | { 16, 0, 0 } | { 16, 31, 0 } +2 | { 0, 16, 0 } | { 31, 16, 0 } +3 | { 16, 31, 0 } | {16, 0, 0 } -The z coordinate was challenging to arrive at, since the subposition data Z did not match the TED TrackCoordinates start_z. In the end, I rounded to the nearest 8 units z. +With this information, we can infer that any 90 degree left-hand turn facing direction 0 will be longer than any 90 degree right-hand turn facing direction 0, because the end of the left-hand turn will be at the start of the tile and include 0 while the end of the right-hand turn will be at the end of the tile and exclude 32. A 180 degree turn facing direction 0 or 3 will be shorter than any 180 degree turn facing direction 1 or 2. -Only the 0 rotation subposition data was tested, but looking at the data it is obvious that there are different lengths for the different track piece rotations. - -Here is the full list of track element lengths using rotation 0, with the calculated Start Position and First Subposition Position data for reference: +There may be more variations in the four directions than merely the inclusion or exclusion of the edge of the tile, but I have not poured over enough data to determine this. +With an algorithm that accounts for some but not all of the information above, here is a list of track element length: Track Element ID | Track Element Type | Length | Start Position (calculated) | First Subposition Position -|-|-|-|- 0 | Flat| 278912 | { 32, 16, 0 } | { 31, 16, 0 }