3 # Open the custom output from the custom_output.cc program
4 open A
,"packing.custom1" or die "Can't open file \"packing.custom1\"\n";
6 # Open the POV-Ray file
7 open B
,">custom_output_p.pov" or die "Can't open output file\n";
9 # Loop over all lines in the packing.custom1 file
12 # Use a regular expression to get the particle position and the number
13 # of faces of the Voronoi cell. These will be stored in the variables
15 m/pos=\((.*)\).*faces=(\d*)/;
17 # Print a sphere to the POV-Ray file, giving it a different texture
18 # depending on the number of faces of the Voronoi cell
19 print B
"sphere{<$1>,0.5 texture{t$2}}\n";