aboutsummaryrefslogtreecommitdiff
path: root/scripts/update-geometry
blob: 82f961ba6daa1debc5af8af6b381e96781c930ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/perl -w

use strict;

open(FH, $ARGV[0]);

my $done = 0;
my $cx = 0.0;
my $cy = 0.0;
my $pan = 10000000;
my $min_x;
my $min_y;

while ( my $line = <FH> ) {

	chomp $line;

	if ( $line =~ /^([0-9]+)\/min_x\ =\ ([0-9,\.\-e]+)$/ ) {

		$pan = $1;
		$min_x = $2;
		printf("%i/min_fs = %i\n", $pan, $min_x);

	} elsif ( $line =~ /^([0-9]+)\/min_y\ =\ ([0-9,\.\-e]+)$/ ) {

		if ( $1 != $pan ) {
			printf(STDERR "Error!\n");
			exit(1);
		}
		$min_y = $2;
		printf("%i/min_ss = %i\n", $pan, $min_y);

	} elsif ( $line =~ /^([0-9]+)\/max_x\ =\ ([0-9,\.\-e]+)$/ ) {

		if ( $1 != $pan ) {
			printf(STDERR "Error!\n");
			exit(1);
		}
		printf("%i/max_fs = %i\n", $pan, $2);

	} elsif ( $line =~ /^([0-9]+)\/max_y\ =\ ([0-9,\.\-e]+)$/ ) {

		if ( $1 != $pan ) {
			printf(STDERR "Error!\n");
			exit(1);
		}
		printf("%i/max_ss = %i\n", $pan, $2);

	} elsif ( $line =~ /^([0-9]+)\/cx\ =\ ([0-9,\.\-e]+)$/ ) {

		$cx = $2;
		if ( $1 != $pan ) {
			printf(STDERR "Error!\n");
			exit(1);
		}

	} elsif ( $line =~ /^([0-9]+)\/cy\ =\ ([0-9,\.\-e]+)$/ ) {

		$cy = $2;
		if ( $1 != $pan ) {
			printf(STDERR "Error!\n");
			exit(1);
		}

		printf("%i/corner_x = %5.2f\n", $pan, $min_x - $cx);
		printf("%i/corner_y = %5.2f\n", $pan, $min_y - $cy);
		printf("%i/fs = x\n", $pan);
		printf("%i/ss = y\n", $pan);

	} else {
		printf("%s\n", $line);
	}

}

exit($done);