I admit that I didn’t know about these transformations until today, but i now think they are really useful.

Lets start with ** minkowski(){...}**, this transformation takes two objects, and the result is to create the shape formed when you role one object around the other. This is probably best shown with an example, lets say you wanted to make a bar with rounded corners along the long side up to now we would have done this in using code similar to this :

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
$fn =30; length = 10; width = 10; depth = 10; radius = 2; for(pos = [[radius,radius,0],[radius,depth-radius,0],[width-radius,depth-radius,0],[width-radius,radius,0]]) { translate(pos){ cylinder(r=radius,h=length); } } translate([radius,0,0]){ cube([width-2*radius,depth,length]); } translate([0,radius,0]){ cube([width, depth-2*radius,length]); } |

As you can see this can be done but is a reasonably complicated object to create, the minkowski transformation enables us to create the same final object using the following code:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
$fn =30; length = 10; width = 10; depth = 10; radius = 2; minkowski(){ translate([radius,radius,0]) { cube([width-2*radius,depth-2*radius,length-1]); } cylinder(r=radius,h=1); } |

lets make note of a few things first, to get the rounded cube to end up the correct size we had to remember to reduce the original cubes dimensions by the diameter of the cylinder in x and y, and the cylinders height in z. To see why we did this lets imagine what the minkowski transformation is doing.

lets start with the base cube from before

Next we add the cylinders at each corner of the cube

Now if we were to join up these cylinders by sliding them along the edges of the cube you can see how the final minkowski shape is formed. ofcourse you dont need to use cylinders for this, we could also other shapes, like spheres if we wanted to round all the corners of the cube.

The next transformation is the ** hull(){...}** transformation. This is used if you want to have a shape that transitions from one form to another. for example you want an object that at one side has a square cross section, and have that taper down to a round point with a fixed radius, like if you were drawing up a tool that had been sharpened from a square peice of metal.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
$fn =30; length = 10; width = 10; depth = 20; taper =20; radius = 1; hull(){ translate([taper,0,0]) { cube([depth,width,length],center=true); } sphere(r=radius); } |