A question came up when studying the formula for calculating the total number of possible energy states of a particle within a container.
Why is the number of possible energy states independent of the shape of the container and merely dependent on the number of states in only 3 perpendicular container dimensions ($x$, $y$ and $z$), while a momentum vector can be directed at any direction within the container? Shouldn't the length of the container in that same direction as the momentum vector also determine the number of energy states in that direction?