Engines with variable distances between pistons at top dead-centre positions and cylinder heads