Task

Draw a   cuboid   with relative dimensions of    2 × 3 × 4. 



The cuboid can be represented graphically, or in   ASCII art,   depending on the language capabilities.

To fulfill the criteria of being a cuboid, three faces must be visible.

Either static or rotational projection is acceptable for this task.



Related tasks
 draw a sphere
 draw a rotating cube
 write language name in 3D ASCII
 draw a Deathstar


var [const] M=50.0;
fcn cuboid(w,h,z){
   w*=M; h*=M; z*=M; // relative to abs dimensions
   bitmap:=PPM(400,400);
 
   clr:=0xff0000;  // red facing rectangle
   bitmap.line(0,0, w,0, clr); bitmap.line(0,0, 0,h, clr);
   bitmap.line(0,h, w,h, clr); bitmap.line(w,0, w,h, clr);
 
   r,a:=(w+z).toFloat().toPolar(0);  // relative to the origin
   a,b:=r.toRectangular((30.0).toRad() + a).apply("toInt"); c:=a; d:=b+h;
   clr=0xff; // blue right side of cuboid
   bitmap.line(w,0, a,b, clr); bitmap.line(a,b, c,d, clr);
   bitmap.line(w,h, c,d, clr);
 
   e:=c-w;
   clr=0xfff00; // green top of cuboid
   bitmap.line(0,h, e,d, clr); bitmap.line(c,d, e,d, clr);
 
   bitmap.write(File("foo.ppm","wb"));
}(2,3,4);