From 3736060ffd1362c9698e2d3ddecbdefa606bcdca Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 1 Mar 2019 00:51:48 +0000 Subject: [PATCH] wip --- generate-board | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/generate-board b/generate-board index 64500d0..fd87a7f 100755 --- a/generate-board +++ b/generate-board @@ -25,6 +25,8 @@ our %vxname2pos; # $vxname2pos{VXNAME} = Math::GSL::Vector sub TAU { M_PI * 2.0; } sub MM2PT { 72.0 / 25.4; } +our $mid; + # ----- region names from plag, incl. reverse mapping ----- our %prs2region; @@ -214,6 +216,7 @@ sub transform_coordinates () { gsl_vector_add($$pr->raw, $translate->raw) and confess; gsl_vector_scale($$pr->raw, $scale) and confess; }); + $mid = $lims[1] - $lims[0]; } sub adjust_nz() { @@ -225,21 +228,21 @@ sub adjust_nz() { foreach my $v (@$poly) { $v->{NZ_Occurs} = $occurs{$v->{VxName}}; } - my $ei; my $occurs_m = sub { - my ($delta) = @_; - $poly->[($ei+$delta+@$poly) % @$poly]{NZ_Occurs} > 1 + my ($ei) = @_; + $poly->[($ei+@$poly) % @$poly]{NZ_Occurs} > 1 }; - for $ei (0..$#$poly) { - next if $occurs_m->(0); - next unless $occurs_m->(-1); - next unless $occurs_m->(+1); + for my $ei (0..$#$poly) { + next if $occurs_m->($ei); + next unless $occurs_m->($ei-1); + next unless $occurs_m->($ei+1); # adjust coord outwards } - for $ei (0..$#$poly) { - next unless $occurs_m->(-1); - next unless $occurs_m->(0); - my $pos = \ $poly->{$ei}{Pos}; + for my $ei (0..$#$poly) { + next unless $occurs_m->($ei-1); + next unless $occurs_m->($ei); + my $pos = \ $poly->[$ei]{Pos}; + $$pos = $$pos*2 - $mid - Math::GSL::Vector->new([-1400,0]); } } @@ -277,6 +280,7 @@ prep_region_rmap(); read_faces(); calculate_centres(); transform_coordinates(); +adjust_nz(); o("%!\n"); o(" 0.52 dup scale\n"); # xxx bodge -- 2.30.2