Zonohedron is a simple command-line program that computes a zonohedron out of a collection of 3D vectors.

Zonnohedron is a generalization in N dimensions of Zonohedron.

Both are written in C++ and thus available for every platform, Zonohedron it's quite fast and can process zonohedra with thousands of generators in a short time.

zonohedron_1.1.tar.gz: source code and documentation

If you have Qt installed, just use the .pro included, otherwise

on Linux/Mac:

g++ zonohedron.cpp -std=c++0x -o zonohedron g++ zonnohedron.cpp -std=c++0x -o zonnohedron -I ./ g++ generator.cpp -std=c++0x -o generator

on Windows: create a new project in your favorite IDE and include zonohedron.cpp

./zonohedron input.txt output.obj

The input file is a text file with one generator 3D vector per line:

0.388473 0.199726 0.364303 0.519182 0.144312 0.216584 0.250367 0.445088 0.391104 ...

The program saves the resulting zonohedron as a mesh in OBJ format.

The programs computes also

- the volume of the zonohedra
- the solid angle at the origin
- the list of generators on the boundary of the solid angle

Assumes all vectors have positive coordinates for the last two.

OBJ is a standard format and most mesh viewer will be able to visualize it. I recommend Meshlab.

You can use the program to visualize how the gini index varies adding a new vector.

./zonohedron input.txt gini <x range> <y range> <z value> <x step> <y step>

For each (x, y, z) where x varies from 0 to x range in increments of x step, y from 0 to y range in increments of y step and z is fixed at z value the program will compute the Gini index of the input vectors plu (x, y, z) and write the results on standard output in a gnuplot-friendly format.

You can plot the result using the following gnuplot commands

~$./zonohedron input.txt gini 10 10 5 0.5 0.5 > gini.txt ~$gnuplot set style line 1 lt 4 lw .5 set pm3d at s hidden3d 1 unset surf set zrange[0: 1] set palette defined ( 0 "blue", 1 "cyan", 2 "green", 3 "yellow", 4 "red", 5 "red") splot 'gini.txt' notitle #following commands to print to pdf set output gini.pdf set term pdfcairo replot unset output

./zonnohedron input.txt <dimensions>

The input file is a text file with one generator vector per line (here and example in 4 dimensions):

0.388473 0.199726 0.364303 0.23354 0.519182 0.144312 0.216584 1.24555s 0.250367 0.445088 0.391104 2.29831 ...

Notice how there is no need to specify how many production and how many output values are per generator vector: the Gini index does not depends on those numbers

Output is simply the gini index and the angle of the diagonal to the first N-1 dimension hyperplane.

`generator.cpp`

is a tool to generate random zonohedra while controlling the angle spread and the length spread
of the vectors.

./generator number_of_generators max_angle max_length > random.txt

Code: Federico Ponchio. (ponchio@gmail.com)