`left = std::min(p0.x, p1.x)` would be a lot cleaner here and below.