Generalized cylinders in semi-Riemannian and spin geometry