 # HyperFun in the Fab Lab: Relief carving   We use the HyperFun Polygon Convertor: a 2D polygon drawing tool (polygon.exe) and a convertor from a polygon to HyperFun (Polygon_FRep.exe) for modeling a relief for carving. Then, we carve the generated relief on a block and on a spoon.

1. Draw a symbol or a letter as a 2D polygon using polygon.exe
Draw the polygon clockwise (see the “HF” letter HF_let.jpg as an example). It is better to use the whole available space, the letter can be scaled later.
2. Save the polygon data (HF_let.txt).
3. From the command prompt window, run the command:
`Polygon_FRep HF_let.txt HF_let.hf`

The HyperFun file HF_let.hf is generated. Note that x is used in this model, so formally it is an infinite cylinder in 3D. The maximal bounding box for drawn polygons is x:[0,760], y:[0,470].

4. (optional) To check the generated HF_let.hf model, the HFW program can be used as follows:
```Assign
x -> 0
f -> 0```

In Redering-Polygonization-Axes/Box visibility, make:

```Long step 100
short step 0
Render frame: [[http://www.hyperfun.org/HFab/FabLabHF/HF_let_HFW.jpg|HF_let_HFW.jpg]]```

Note, it is up side down, because of the drawing the letter in screen coordinates. The letter can be vertically flipped later.

5. To flip the letter and to scale it to any given rectangle, add the following lines at the top:
```-- box to fit the letter in
xmin = 2; xmax = 4; ymin = 2; ymax = 4;
xt = 760*(x-xmin)/(xmax-xmin);
yt = 470*(1-(x-ymin)/(ymax-ymin));
```

and change in the text below these symbols
x to xt
x to yt \\See HF_let_up.hf as an example and its image HF_let_up.jpg.

6. Making a relief solid.
Add at the end of the letter model the following lines:
```zmax = 1.1;
slope = 0.2;
letnorm = zmax * (2/(1+exp(-slope*letfit))-1);
height = letnorm-x;
bound = x-0.1;
letrel = height & bound;```

See HF_let_relief.hf model and its image HF_let_relief.jpg, where
zmax is height of the relief;
slope controls smoothness of the relief;
height defines a solid as f(x,y)-z >= 0
bound is a boundary solid for the relief.

7. “Carving” the relief on a block.
Make a block object and apply union of it with the relief solid. See the HF_let_box.hf model and its image HF_let_box.jpg
8. Carving on the spoon.
1. Change the box for scaling the letter:
```-- box to fit the letter in
xmin = 1.7;
xmax = 4.7;
ymin = 1.4;
ymax = 4.4;```
2. Change the bound solid for the relief:
```center = [3, 3, 3];
bound = hfSphere(x, center, 2.9);```
3. Change the block model to a spoon3.hf model. See the initial spoon image spoon3.jpg
See the relief carving on the spoon model HF_spoon3.hf, and the images HF_spoon3_zoom.jpg and HF_spoon3.jpg.
To make the STL file for fabrication, use the following command:
`hfp HF_spoon3.hf -b 0,0,0,20,8,8 -g 131 -stl hf_spoon.stl ` 