Draw a simple cube
HTML/CSS/JS, 739 bytes, probably non-competing
But I just wanted to show off CSS 3D transforms.
w=_=>o.style.transform=`rotateZ(${z.value}deg) rotateY(${y.value}deg) rotateX(${-x.value}deg)`
input {
width: 5em;
}
#c{width:90px;height:90px;margin:90px;position:relative;perspective:180px}#o{position:absolute;width:90px;height:90px;transform-style:preserve-3d;transform-origin:45px 45px 0px;}#o *{position:absolute;width:90px;height:90px;border:2px solid black}#f{transform:translateZ(45px)}#b{transform:rotateX(180deg)translateZ(45px)}#r{transform:rotateY(90deg)translateZ(45px)}#l{transform:rotateY(-90deg)translateZ(45px)}#u{transform:rotateX(90deg)translateZ(45px)}#d{transform:rotateX(-90deg)translateZ(45px)}
<div oninput=w()>
X:<input id="x" type="number" value="0" min="0" max="360">
Y:<input id="y" type="number" value="0" min="0" max="360">
Z:<input id="z" type="number" value="0" min="0" max="360">
</div>
<!-- Above code for ease of use of snippet. Golfed version: <div oninput=w()><input id=x><input id=y><input id=z></div> -->
<div id=c><div id=o><div id=f></div><div id=b></div><div id=r></div><div id=l></div><div id=u></div><div id=d>
Shoes (Ruby) 235 231
Everything computed from scratch.
Shoes.app{p,a,b,c=ARGV.map{|j|j.to_f/90}
k=1+i="i".to_c
p=(0..3).map{|j|y,z=(k*i**(j+a)).rect
x,z=(((-1)**j+z*i)*i**b).rect
q=(x+y*i)*i**c
[90*(k+q/(z-4)),90*(k+q/(4+z))]}
4.upto(15){|j|line *(p[j%4][0].rect+p[(j+j/4)%4][1].rect)}}
Call from commandline eg shoes cube3d.rb 0 30 0
The idea is to simultaneously generate / rotate the four vertices of a tetrahedron in 3d. Then, as these are reduced to 2d, we generate the four vertices of the inverse tetrahedron (the total 8 vertices being those of the cube.) This gives 4 pairs of vertices corresponding to the 4 body diagonals. Finally the 2d vertices are connected by lines: each vertex of the original tetrahedron must be connected to each vertex of the inverse tetrahedron forming the 12 edges and 4 body diagonals of the cube. The ordering ensures the body diagonals are not plotted.
Test cases output
Note that, to be consistent with the last two test cases, rotation about the z axis is clockwise from the POV of the viewer. This seems to be in contradiction with the spec however. Rotation direction can be reversed by modifying *i**c
-> /i**c
ungolfed
Shoes.app{
p,a,b,c=ARGV.map{|j|j.to_f/90} #Throw away first argument (script name) and translate next three to fractions of a right angle.
k=1+i="i".to_c #set up constants i=sqrt(-1) and k=1+i
p=(0..3).map{|j| #build an array p of 4 elements (each element wil be a 2-element array containing the ends of a body diagonal in complex number format)
y,z=(k*i**(j+a)).rect #generate 4 sides of square: 1+i,i-1,-1-i,-i+1, rotate about x axis by a, and store in y and z as reals
x,z=(((-1)**j+z*i)*i**b).rect #generate x axis displacements 1,-1,1,-1, rotate x and z about y axis by b, store in x and z as reals
q=(x+y*i)*i**c #rotate x and y about z axis, store result in q as complex number
[90*(k+q/(z-4)),90*(k+q/(4+z))]} #generate "far" vertex q/(4+z) and "near" vertex q/-(4-z) opposite ends of body diagonal in 2d format.
4.upto(15){|j| #iterate through 12 edges, use rect and + to convert the two complex numbers into a 4 element array for line method
line *(p[j%4][0].rect+ #cycle through 4 vertices of the "normal" tetrahedron
p[(j+j/4)%4][1].rect) #draw to three vertices of the "inverted" tetrahedron. j/4=1,2,3, never 0
} #so the three edges are drawn but the body diagonal is not.
}
Note that for historical reasons a scale factor of 90 is applied in line 9 (chosen to be the same as 90 degrees in line 2 for golfing) but in the end there was no golfing advantage in using this particular value, so it has become an arbitrary choice.