Can an arbitrary 3-d shape be fitted inside a cube so it touches all the sides?

In 2-d space, it is possible to take any shape and fit it inside a square such that it touches all the sides of the square. In other words, its projection on the x-axis is the same as its projection on the y-axis. To see this, we can consider a function which is the ratio of its projection on the x-axis to its projection on the y-axis. As we rotate by $$\frac{\pi}{2}$$, this ratio will go from one side of $$1$$ to the other. Because it is a continuous function, it must cross $$1$$.

I was wondering about extending this result to 3-d space. I have a general 3-d object and would like to rotate it such that its projection along all three axes becomes the same. Can we prove this is always possible or otherwise? And if it isn't possible in general, any non-trivial special cases where it will be?

Say it isn't possible in general to fit an arbitrary object in 3-d space inside a cube such that all the faces of the cube are touched by the object. Or, the projection of the object along $$x$$, $$y$$ and $$z$$ axes are the same. The next obvious question becomes, how close can you get. And what is a good algorithm (given the object) to get you as close as you can get.

The proof for the 2-d case in the question suggests an algorithm for rotating a general 2-d shape such that it fits in a square (touching all sides). Keep rotating the shape by small amounts until you find the projection along the x and y axes are the same.

This algorithm can be extended to 3-d space. First, rotate the object by small amounts in the x-y plane until its projections along the x and y axes are the same (within some $$\epsilon$$). Now its projections along x and y are the same, but that along z will be different from those two. So, do the same thing, but this time rotating along the y-z plane. After this stage, the projections along the y and z axes will be the same but the x-axis will be different from both of them. So, try to "fix" that again by rotating along the x-y plane once more. And keep repeating this over many iterations. Soon, all three projections should start to look the same.

I've coded this up in Python in the Github gist below (it'll currently work for simplices). So far tried it for a plane square in 3-d space and random tetrahedra. The algorithm seems to work well for both of those.

It would be nice to have a proof that this algorithm will always get the projections along the x, y and z axes arbitrarily close to each other with enough iterations.

https://gist.github.com/ryu577/5ebd7108a9c322304f5aed19d9a7b2c9

• If it's always possible to get arbitrarily close, then it's always possible to do it exactly. And I'm quite sure that it is always possible to get arbitrarily close, but I can't think of a proof. Mar 18, 2023 at 13:25
• Not necessarily. For example drawing with compass and ruler one can get arbitrarily close to squaring the circle but not exactly. Another example is approximating pi or e with rational numbers. Mar 18, 2023 at 13:39
• In this case though I agree. Getting arbitrarily close should mean it can be done exactly. Mar 18, 2023 at 13:45
• Think I have a proof that it can be done exactly, and the proof provides a constructive framework for finding it. Mar 23, 2023 at 15:35

Proof of the conjecture

Short sketch of proof. For every choice of an axis of rotation, one can spin the body around that chosen axis. As the OP noted, one can make the two perpendicular dimensions in this plane match. Unfortunately, the thickness of the body in the third direction, measured along the chosen axis, might be too large or too small. In fact we know the third dimension can be made too large/too small if we point the axis in the direction of (A) absolutely largest/ (B) absolute smallest possible thickness of the body. If we gradually move the axis of rotation from A to B there must be an intermediate Goldilocks choice $$C$$ that is just right.

Details of proof.

For every unit vector $$\vec n$$ on the unit sphere $$S$$, denote the thickness of the body in that direction by $$h(\vec n)$$. (The thickness is the length of the segment obtained by projecting the body orthogonally onto the line whose direction is $$\vec n$$.) This is a non-negative continuous function of $$\vec n \in S$$. Note that $$h(-\vec n)=h(\vec n)$$.

The continuous function $$h(\vec n)$$ attains its absolute max at least once at some direction; call one such choice $$A\in S$$. Likewise its absolute minimum is attained somewhere; call one such choice $$B\in S$$. Construct a continuous path on the sphere from $$A$$ to $$B$$. Let $$C$$ be any intermediate point on that path.

Regarding $$C$$ as the vertical axis pointing upward out of our field of view, the directions perpendicular to $$C$$ sweep out a circle of directions in the plane parametrized by an angle $$\theta$$. We want to show that there is a solution of $$f_1(\theta)=h(\theta)= f_2(\theta)=h(\theta+\pi/2)$$. (This provides a pair of perpendicular directions of equal width in the plane).

Technical point: in order to single out an attribute of the solutions that can be shown to be continuous as we vary $$C$$, some extra care is needed. The problem is that the domain point $$\theta$$ might not be unique or might not depend continuously on $$C$$. In contrast, the maximal range value we construct below will depend continuously on $$C$$.

Define $$f_3(\theta)=min(f_1(\theta), f_2(\theta))$$

The two planar regions defined in polar coordinates as $$r\leq f_1(\theta)$$ and $$r\leq f_2(\theta)$$ respectively are two congruent regions that are rotated by a right angle. Each of these congruent regions is defined as an intersection of half-planes, hence the region a convex region in the plane. The intersection of these two convex congruent regions is another convex region whose polar equation is $$r= f_3(\theta)$$. (see picture below). The largest value of $$f_3(\theta)$$ will be denoted by $$r_{max}(C)$$. It is the largest possible value of $$r$$ for which $$r= h(\theta)= h(\theta+\pi/2)$$. Continuity of $$r_{max}(C)$$ follows from the joint continuity of the expression $$f_3$$ as a function of $$\theta$$ and $$C$$ on the compact configuration space $$(\theta, C)$$.)

Note that by the choice of $$A$$ as the absolutely largest value of $$h(\vec n)$$ on the entire sphere, it follows that $$r_{max}(A) \leq h(A)$$.

At the end of the path, by construction of $$B$$ as a point where $$h(\vec n)$$ is absolutely smallest, we must have $$r_{max}(B)\geq h(B)$$. By the intermediate value theorem, there is a point $$C$$ where $$r_{max}(C)= h(C)$$. At this point $$C$$ we have the equality of the thickness function $$h$$ in three perpendicular directions. QED.

P.S. For a nontrivial class of extreme examples for which equal widths do occur in every direction, you can explore the topic of surfaces of constant width The obvious example is a sphere. Remarkably, however, there exist many non-spherical convex smooth surfaces with this property: the projected width of the object on each line of projection is constant in every direction chosen for the line.

This is an outline of how aspherical constant-width surfaces are constructed. Starting with a desired function $$h(\vec n)$$ one parametrizes the desired surface as $$\vec p= h(\vec n) \vec n + \vec t(\vec n)$$ where the correction term $$\vec t$$ is perpendicular to $$\vec n$$. It turns out that the correct choice for the correction is $$\vec t=\nabla_S h$$ where $$\nabla_S h$$ denote the spherical gradient of $$h$$, (the gradient of the function $$h$$ treated as a function on the unit sphere. To create a constant width surface that is a perturbation of the round sphere, of radius $$R$$, set $$h= R+ \epsilon(\vec n)$$ where the perturbation is a small odd function of $$\vec n$$.

Then the total width in direction $$\vec n$$ is $$h(\vec n) + h(-\vec n)=2R$$. The messy details are checking that the perturbation $$\epsilon$$ is small enough to preserve convexity of the surface. That boils down to looking at the second derivatives of $$\epsilon$$ on the sphere.

• My understanding of the question is that it asks if for all 3D shapes S, there exists a rotation of S whose height, width, and depth are all the same number. This answer doesn't seem to answer the question, because it instead shows that there exist 3D shapes S (other than the sphere) such that for all rotations of S, the height, width, and depth are all the same number. (That's a very interesting fact, though!) Mar 17, 2023 at 17:35
• @TannerSwett - Note that the OP also asked at the end for non-trivial examples of classes of solids that do meet the condition. Both answers are addressing this subquestion, so they count as "partial answers". Mar 17, 2023 at 18:05
• @MathWonk - thanks for the proof. I'll review it over the weekend. However, your previous answer had another class of non-trivial shapes similar to a sphere. Why remove that one? Can you please add that back as another answer? Mar 24, 2023 at 4:05
• @Rohit That info about constant-width surfaces is still available at the end, as a postscript. Mar 24, 2023 at 13:25
• Thanks. I didn't understand how you're defining the two regions in polar coordinates. Can you please elaborate? Mar 25, 2023 at 23:42

Yes, I am quite sure any 3D shape can be rotated so that it just touches all six sides of a cube aligned with the axes.

Here is most of a proof:

Let $$S$$ be any 3D shape (that is, any bounded subset of $$\mathbb{R}^3$$).

Given any 3D shape $$T$$, define its $$x$$-extent, $$E_x(T)$$, as the difference between the least upper bound and the greatest lower bound of all $$x$$-coordinates of points in $$T$$. Define the $$y$$-extent and $$z$$-extent analogously.

Our goal is to prove that there exists some rotation $$R$$ such that $$E_x(RS) = E_y(RS) = E_z(RS)$$.

Define the function $$f : \mathrm{SO}(3) \to \mathbb{R}^3$$ which takes any rotation $$R$$ and returns the tuple $$(E_x(RS), E_y(RS), E_z(RS))$$.

Define the path $$p$$ in $$\mathrm{SO}(3)$$ as the path which consists of making a sequence of smooth 90-degree rotations about the following axes: $$(1,0,0)$$, $$(0,1,0)$$, $$(0,0,1)$$, $$(-1,0,0)$$, $$(0,-1,0)$$, $$(0,0,1)$$. After these rotations have been made, the result is the identity rotation, so the path $$p$$ is in fact a loop. Furthermore, $$p$$ is contractible to a point. (I'm not sure exactly how to prove that, but I'm sure that it's true.)

The image $$f(p)$$ visits the following points in the following order:

• $$(E_x(S), E_y(S), E_z(S))$$
• $$(E_x(S), E_z(S), E_y(S))$$
• $$(E_y(S), E_z(S), E_x(S))$$
• $$(E_z(S), E_y(S), E_x(S))$$
• $$(E_z(S), E_x(S), E_y(S))$$
• $$(E_y(S), E_x(S), E_z(S))$$
• $$(E_x(S), E_y(S), E_z(S))$$

Here is the hole in my proof. (No pun intended!) Intuitively, it seems like the path $$f(p)$$ will always walk around the line of points of the form $$(t, t, t)$$ exactly once. I'm not 100% sure that that's correct, though. For now, I will simply assume that this is true.

Since the path $$p$$ (in $$\mathrm{SO}(3)$$) is contractible to a point, there exists a disc $$D$$ in $$\mathrm{SO}(3)$$ whose boundary is $$p$$. The image $$f(D)$$, therefore, is a disc in $$\mathbb{R}^3$$, which (if my assumption above is correct) must contain some point of the form $$(t, t, t)$$. The preimage of that point is a rotation $$R$$ such that

$$E_x(RS) = E_y(RS) = E_z(RS) = t.$$

A particular case from constant width 2D oval shapes is the Watts drill which is a modification of an equilateral triangle. I had got made one Watts drill long back, drilled square holes, though the square corners were a bit rounded.

The above can be generalized along same lines to make a convex surface of constant width in 3d as well. There would be second order discontinuity in surface curvature. Start with a regular tetrahedron and make parts of solid spherical triangles based tetrahedra tangential along common great circles.It can be modeled using CAS 3d with a common dihedral between common planes demarcating regions.

The most elementary possible shape that comes in mind is the regular tetrahedron that can be inscribed in a cube in such a way that its orthogonal projections on the different faces of this cube are these faces themselves.

See Geogebra animation here.

• What does "integrality of the faces" mean? Mar 17, 2023 at 6:46
• My understanding of the question is that it asks if for all 3D shapes S, there exists a rotation of S whose height, width, and depth are all the same number. This answer doesn't seem to answer the question, because it instead gives a non-trivial example of a 3D shape S whose projections into the xy-plane, xx-plane, and yz-plane are all identical (up to translation). Mar 17, 2023 at 17:34