Task
Draw a rotating cube.

It should be oriented with one vertex pointing straight up, and its opposite vertex on the main diagonal (the one farthest away) straight down. It can be solid or wire-frame, and you can use ASCII art if your language doesn't have graphical capabilities. Perspective is optional.




Related tasks
 Draw a cuboid
 write language name in 3D ASCII


%!PS-Adobe-3.0
%%BoundingBox: 0 0 400 400
 
/ed { exch def } def
/roty { dup sin /s ed cos /c ed [[c 0 s neg] [0 1 0] [s 0 c]] } def
/rotz { dup sin /s ed cos /c ed [[c s neg 0] [s c 0] [0 0 1]] } def
/dot { /a ed /b ed
	a 0 get b 0 get mul
	a 1 get b 1 get mul
	a 2 get b 2 get mul
	add add } def
 
/mmul {	/v ed [exch {v dot} forall] } def
/transall { /m ed [exch {m exch mmul}forall] } def
 
/vt
	[[1  1  1] [-1  1  1]
	 [1 -1  1] [-1 -1  1]
	 [1  1 -1] [-1  1 -1]
	 [1 -1 -1] [-1 -1 -1]]
	-45 roty transall
	2 sqrt 1 atan rotz transall
def
 
/xy { exch get {} forall pop } def
/page {
	/a ed /v vt a roty transall def
	0 setlinewidth 100 100 scale 2 2 translate
	/edge { v xy moveto v xy lineto stroke } def
 
	0 1 2 3 4 5 6 7 0 2 1 3 4 6 5 7 0 4 1 5 2 6 3 7
	1 1 12 { pop edge } for
	showpage
} def
 
0 {3.2 add dup page } loop
%%EOF