// Netzplan tracks: each skill line is a list of grid
// waypoints. Between two waypoints the track runs straight,
// then turns 45° into the next one, like a metro map.
for _, ln := range netLines {
route := netRoutes[ln.key]
var path strings.Builder
for i, pt := range route {
px, py := x(pt[0]), y(pt[1])
if i == 0 {
fmt.Fprintf(&path, "M%.1f %.1f", px, py)
continue
}
lx, ly := x(route[i-1][0]), y(route[i-1][1])
dx, dy := px-lx, py-ly
dd := math.Min(math.Abs(dx), math.Abs(dy))
// straight run, then the diagonal
fmt.Fprintf(&path, " L%.1f %.1f L%.1f %.1f",
px-math.Copysign(dd, dx), ly, px, py)
}
fmt.Fprintf(&b, '<path d="%s" class="nz-track" stroke="%s"/>',
path.String(), ln.color)
}
1Die Gleise im Netzplan: Wegpunkte auf einem Raster, gerade Strecke plus 45°-Diagonale, als SVG-Pfad auf dem Server gerechnet.