TITLE: Orthogonal Projection Area of a 3-d Cube
QUESTION [8 upvotes]: If you're given a 3-d cube centered at the origin, i.e. the center of the cube is at $(0,0,0)$. If you rotate the cube in $x$, $y$, and $z$ direction, then how can you find the area of its orthogonal projection. For example, if you don't rotate the cube at all, then the area is just $1$. However, say you rotate the cube $45^\circ$ along the line $x=y=0$, then the area comes out to $\sqrt{2}\cdot 1 = \sqrt{2}$. Is there a general formula for this where you're given some rotation and you have to find the orthogonal projected area? What about the other way, i.e. if you're given the area, can you find the coordinates of the cube (more interested in this case)?
I think this may be related to my question: Width of a tilted cube
But, instead of width, I'm working with area.

REPLY [3 votes]: It happens that the area of the projection of a unit cube into a plane is numerically equal to the length of the projection on the orthogonal line. 
Reference: https://londmathsoc.onlinelibrary.wiley.com/doi/abs/10.1112/blms/16.3.278
This fact can simplify the problem since we know that the minimum shadow is given by the height of the cube, which is 1. And the maximum is given by the length of its diagonal which is $\sqrt 3$. If we start with an horizontal cube with the diagonal on the $xz$-plane we can rotate in the $xz$ plane so that the height of the cube is equal to the z coordinate of the rotated diagonal and can hence be easily computed.
To be more precise, suppose the cube has the edges parallel to the coordinate axes. First we rotate it in the $xy$-plane so that the diagonal goes into the plane $y=0$. To achieve this we need to apply this rotation matrix:
$$
R = \begin{pmatrix}
 \sqrt 2 /2 & \sqrt 2/2 & 0 \\
-\sqrt 2 /2 & \sqrt 2/2 & 0 \\
0 & 0 & 1
\end{pmatrix}.
$$
Then we apply the rotation of an angle $\theta$ around the $y$ axis:
$$
 T_\theta = \begin{pmatrix}
\cos \theta & 0 & -\sin\theta \\
0 & 1 & 0 \\
\sin \theta & 0 & \cos \theta
\end{pmatrix}.
$$
The area of the projection should be equal to the $z$ coordinate of the rotated diagonal. So it should be:
$$
  (0,0,1)\cdot T_\theta \cdot R \cdot \begin{pmatrix}1\\1\\1\end{pmatrix}
$$
while the coordinates of the center of the faces (as requested in the codejam problem) can be easily computed by appling $T_\theta R$ to the original coordinates which are (for a unit cube centered in the origin):
$$
 T_\theta R \begin{pmatrix}1/2 \\ 0 \\ 0\end{pmatrix} \qquad
 T_\theta R \begin{pmatrix}0 \\ 1/2 \\ 0\end{pmatrix} \qquad
 T_\theta R \begin{pmatrix}0 \\ 0 \\ 1/2 \end{pmatrix}.
$$