How to rotate a cube on all $3$ axes?

130 Views Asked by At

I have a cube that I want to turn along 3 axes, ($x$, $y$, and $z$), and I don't know how to do this.

I started by rotating a square, and I used trigonometry to rotate each vertex. I got the radius and used the formula $r\cdot \operatorname{trig}(θ)$ where r is the radius and $\theta$ (theta) is the angle at which I want to rotate the square. "trig" is either sine or cosine, used with the y and x coordinates.

I can then copy this method to 2 faces of the cube and I am able to rotate the cube along an axis.

How would I rotate a cube along all 3 axes? (This is using computer algorithms, $\theta$ isn't a set angle, and the cube can lie at any $xyz$ coordinate)