Voici le code [[openJSCAD]] des villageois minecraft :
function main() {
return union (
cube({size: [1,2.5,1], round: true}).translate([0.45,0]),
cube({size: [1,2.5,1], round: true}).translate([1.8,0]),
cube({size: [2.5,2,1], round: true}).translate([0.4,-1.7]),
cube({size: [1,2,1], round: true}).translate([2,-0.5,0.2]).rotateX(20),
cube({size: [1,2,1], round: true}).translate([0.2,-0.5,0.2]).rotateX(20),
cube({size: [2.8,1,1], round: true}).translate([0.2,1,0.2]).rotateX(20),
cube({size: [1,1,1], round: true}).translate([1.1,-2.4]),
cube({size: [2,2,2], round: true}).translate([0.6,-4]),
cube({size: [0.5,1.2,1], round: true}).translate([1.25,-3.3,1.4]),
cube({size: [2,1,1], round: true}).translate([0.6,2.2]),
cube({size: [1.5,0.2,0.5], round: true}).translate([0.8,-3.7,1.9]));}
Ou bien :
function main(){
return tout().rotateX(-90);
}
function tout(){
return pieds().
union (tronc()).
union(bras()).
union(nez()).
subtract(yeux()).
subtract(sourcils());
}
function pieds(){
return union (cube({size:[3,6,5]}),
cube({size:[3,6,5]}).translate([5,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]);
}
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 cube({size:[6,1,1]}).translate([1,0,26.5]);
}