Whenever the atomic packing factor for the hexagonal close-packed (HCP) crystal structure is discussed, such as in this wikipedia article, it is stated that the (effective) number $N$ of atoms in a unit cell (chosen as a hexagonal prism) is $6$ -- corner atoms contribute $1/6$ each, face-centred atoms contribute $1/2$ each, and middle-layer atoms contribute $1$ each. So $N = 12 \times 1/6 + 2 \times 1/2 + 3 \times 1 = 6$.
However, to me it seems that the middle-layer atoms are not fully contained in the unit cell, which would mean $N < 6$. Divide the unit cell into six triangular prisms. Then any middle-layer atom $A$ lies at the center of one of these prisms $P$. But the radius of a cylinder inscribed in $P$ is $a/2\sqrt{3} = r/\sqrt{3} < r$ (using the notation from the wikipedia page), so $A$ cannot fit inside $P$. So $A$ is not fully contained within the unit cell.
Can somebody explain why this objection is incorrect?