Voici le code pour faire une sorcière (assez long et compliqué) :
function main(){ return union( tout().rotateX(-90).translate([0,0,6]), socle().translate([-10,15,0]) ); } function tout(){ return pieds(). union (tronc()). union(bras()). union(nez()). union(chapeau()). subtract(yeux()). subtract(sourcils()); } var entrejambe = 5; function pieds(){ return union (cube({size:[3,6,5]}), cube({size:[3,6,5]}).translate([entrejambe,0,0])); } function tronc(){ return cube ({size:[8,6,25]}).translate([0,0,5]); } function bras(){ return cube ({size:[12,3,6.5]}).rotateX([-45]).translate([-2.5,-2,15]); } function nez(){ return cube ({size:[2,1.5,4]}).translate([3,-1.5,19]). union(cube({size:[0.7,0.7,0.7]}).translate([4,-2,19.5])); } function yeux(){ return union (cube({size:[2,1,1]}).translate([1,0,25]), cube({size:[2,1,1]}).translate([5,0,25])); } function sourcils(){ return union (cube ({size:[2,0.5,0.5]}).rotateY([20]).translate([1.3,0,27.5]), cube ({size:[2,0.5,0.5]}).rotateY([-20]).translate([4.8,0,26.9])); } function chapeau(){ return cube({size:[11,7.5,2]}).translate([-1.5,-1.5,30]). union(cube({size:[8,6,3]}).translate([0,0,32])). union(cube({size:[5,4.5,2]}).translate([1.5,1.5,35])). union(cube({size:[1,1.5,5]}).rotateY([20]).translate([3,4.5,35])); } function socle() { var trou = cube({size:[3.2,6.2,5], center:true}); return difference(cylinder({r: 7.5, h: 2.5}), union(trou.translate([-entrejambe/2,0,0]), trou.translate([entrejambe/2, 0, 0])) ); }