HyperFun Polygon Convertor

This is a Windows tool for 2D polygon drawing and conversion to HyperFun.

There are two programs:

1) polygon.exe is a simple Windows editor for a 2D polygon:

One can avoid using polygon.exe and input the text file for 2D polygon manually. For example, for a triangle:

3
0. 0.
0.5 1.
0. 1.

2) Polygon_Frep console program translates ASCII file with polygon data into HF file.

DOS command:

>Polygon_Frep p.txt p.hf

p.txt is an input file with vertex coordinates (counter-clockwise) (see the sample p1.txt)
p.hf is an output file (see the sample p1.hf).
Note that x[3] is used in the HF model, so formally it is an infinite cylinder in 3D defined as

f(x,y,z) >= 0, where f(x,y,0) >= 0 is a 2D polygon.

The maximal bounding box is x:[0,760], y:[0,470]

Viewing the generated HF object in the HyperFun for Windows program.

To render this object make the following steps: 1) Assign in HFW:

x[1] -> x
x[2] -> y
x[3] -> 0
f -> 0

2) In Redering-Polygonization-Axes/Box visibility, make

Long step 100
short step 0 

3) Render frame

Note it is up side down, because of the drawing the letter in screen coordinates.

To flip the polygon up side down and to fit it to any given rectangle: 1) add the following lines at the top:

-- box to fit the letter in
xmin = 2; xmax = 4; ymin = 2; ymax = 4;
xt = 760*(x[1]-xmin)/(xmax-xmin);
yt = 470*(1-(x[2]-ymin)/(ymax-ymin));

2) change in the text below these symbols:

x[1] to xt
x[2] to yt

Send questions and inquiries to

ekart at nm.ru pasko at acm.org