Lego train tracks geometry
The width of sleepers is 8 studs. There are 4 studs between the tracks.
Straight track is 16 studs long.
Curved track is a 22.5° arc with radius of 40 studs (R40). So 4 curved tracks make a 90° arc.
This translated to a track of about 15.7 studs long at the center. (Inner rail 14.7 studs, outer rail 16.7 studs)
Flex track is 4 studs long, can be bend between straight and R40 curve, and everything in between. This corresponds to a maximal angle of 5.73°. So 4 flexible tracks is slightly longer than a regular 22.5° curved track.
A straight track on a switch is 32 studs in length (double straight track). The turn track consists of two arcs both with 40 stud radius (R40), the first 36.87° outward, and the second 14.37° inward.
You may recognise the angle of 36.87° angle from a Pythagorean triangle with sides of 3, 4 and 5. As you can see in the picture, this ensures that the turn track will perfectly align with the main track if followed by a regular curved track. The result is two parallel tracks 16 stud apart (8 studs between the sleepers).