The Computer Graphics Matrix and a Cube
Use a cube instead of the Utah Teapot in my previous post. I was pleasantly suprised by the final screen shot.
Three faces of our cube are colored with red, green and blue. The opposite faces have the complentary colors, cyan, magenta and yellow. Initially, only the yellow face is visible.
Cube = grafix('6','rgb'); % Platonic solid with 6 faces.
Rz = R_z(45); apply(Cube,Rz)
Rx = R_x(60); M = Rx*Rz; apply(Cube,M)
M = Rz*Rx; apply(Cube,M)
Ry = R_y(-120); apply(Cube,Ry)
Tx = T_x(2.5); apply(Cube,Tx)
Sxyz = S_xyz(0.75); apply(Cube,Sxyz)
M = Sxyz*Tx*Ry*Rz*Rx; apply(Cube,M)
M = Rx*Rz*Ry*Tx*Sxyz; apply(Cube,M)
Finally, a scrambled order. The cube is clipped by the plot box and we see though the interior to the opposite faces. All six colors are visible.
M = Rz*Ry*Sxyz*Tx*Rx; apply(Cube,M)
Which do you prefer, the teapot or this cube? Leave a comment.
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.