Vache

Voici le code d'une vache en 3D (le haut est plat pour pouvoir l'imprimer) :

function main(){
    return tout().scale(4).rotateX(180);
}
 
function tout(){
    return union (pieds(),
    union (corps()),
    tete());
}
 
function pieds(){
    return union (pied(),
    pied().translate([0,2,0]));
}
 
function pied() {
   return union (cube({size: [1,1,3.3]}),
   cube({size: [1,1,3.3]}).translate([3.5,0,0]));
}
 
function corps(){
    return union (cube({size:[5.5,4,3]})).translate([-0.5,-0.5,3]);
}
 
function tete(){
    return difference (cube ({size:[2,2,2.5]}).translate ([-2,0.5,3.5]),
    visage());
}
 
function visage(){
    return union (yeux(),
    bouche());
}
 
function yeux(){
    return union (cube ({size:[0.3,0.3,0.3]}).translate([-2,1.8,5]),
    cube ({size:[0.3,0.3,0.3]}).translate([-2,1,5]));
}
 
function bouche(){
    return union (cube ({size:[0.2,0.3,0.8]}).translate([-2,1.9,3.2]),
    union (cube ({size:[0.2,0.3,0.8]}).translate([-2,0.8,3.2]),
    cube ({size:[0.2,0.8,0.3]}).translate([-2,1.1,4])));
}