Root/bacon/case/genpiece.pl

1#!/usr/bin/perl
2
3if ($ARGV[0] eq "-r") {
4    shift @ARGV;
5    $reverse = 1;
6}
7
8$x0 = shift @ARGV;
9$y0 = shift @ARGV;
10$x1 = shift @ARGV;
11$y1 = shift @ARGV;
12
13while (<>) {
14    $z{$1} = 1 if /\s+(-?\d+(\.\d*)?)\s*$/;
15    $zmax = $1 if $1 > $zmax || !defined $zmax;
16}
17
18if ($reverse) {
19    ($x0, $y0) = ($y0, $x0);
20    ($x1, $y1) = ($y1, $x1);
21}
22
23for (keys %z) {
24    print "$x0 $y0 $_\n";
25    print "$x1 $y0 $_\n";
26    print "$x1 $y1 $_\n";
27    print "$x0 $y1 $_\n";
28    print "$x0 $y0 $_\n\n";
29}
30

Archive Download this file

Branches:
master



interactive