8 my ($coords, $trans) = @_;
10 for (0 .. $#$coords) {
11 $res[$_] = $coords->[$trans->[$_]];
12 $res[$_] *= -1 if $trans->[$_+@$coords] < 0;
17 my %aligned_scanners = ('scanner 0' => [ 0, 0, 0 ]);
19 # parsing the debugging output of the first part ...
21 my ($s1, $s2, $rest) = /(.*) and (.*) aligned: (.*) beacons:/;
24 my @r = split /,/, $rest;
28 # @off = transform(\@off, \@rot);
30 # $off[$_] += $aligned_scanners{$s1}->[$_] for 0..2;
31 say "$s2 at ", join(',', @off);
32 $aligned_scanners{$s2} = [ @off ];
36 for my $s1 (keys %aligned_scanners) {
37 for my $s2 (keys %aligned_scanners) {
39 $dist += abs($aligned_scanners{$s1}->[$_] - $aligned_scanners{$s2}->[$_]) for 0 .. 2;
40 $max_dist = $dist if $dist > $max_dist;
41 say "$s1 to $s2 = $dist";