Bugfix in search_for_outside_edge routine.
[voro++.git] / branches / dynamic / scripts / strip_degen.pl
blobc84c5565fa53f4a66be6d7cb80f697dbe3babcf4
1 #!/usr/bin/perl
2 # POV-Ray will generate an error if it encounters a "degenerate cylinder" where
3 # the two end points are equal. This code will scan the POV-Ray files created
4 # by Voro++, and strip out any of these cases.
5 #
6 # Usually, the degenerate cylinders generated by Voro++ are not actually
7 # degenerate in its internal representation (since the code is specifically
8 # structured to avoid cases like that). However, these cases are caused by the
9 # POV-Ray files which are generate only have coordinates specified to a limited
10 # number of decimal places. In a future version, it would be nice for Voro++ to
11 # automatically recognize and ignore these cases.
13 use File::Copy;
15 $a=0;
16 open A,@ARGV[0];
17 open B,">@ARGV[0].temp";
18 while (<A>) {
19 m/^cylinder{<([-\.\d]+),([-\.\d]+),([-\.\d]+)>,<\1,\2,\3>,r}/?$a++:(print B);
21 print "$a cylinders stripped\n";
22 move("@ARGV[0].temp",@ARGV[0]);