From a4708975d2c911b630feb5255bb98a0a7845a016 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 8 Feb 2019 22:00:24 +0000 Subject: [PATCH] plag --- .gitignore | 1 + Makefile | 6 +++--- parse-input-graph | 8 ++++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 38ca98a..c59e76f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ map.dot map.ps +map.plag diff --git a/Makefile b/Makefile index 02c9db1..8a51fff 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ o= >$@.tmp && mv -f $@.tmp $@ -map.dot: parse-input-graph input-graph +map.plag: parse-input-graph input-graph ./$^ $o -map.ps: map.dot - neato -Tps $^ $o +#map.ps: map.dot +# neato -Tps $^ $o diff --git a/parse-input-graph b/parse-input-graph index 4265c01..1edbf41 100755 --- a/parse-input-graph +++ b/parse-input-graph @@ -4,6 +4,7 @@ use strict; use Carp; use Data::Dumper; use Graph; +use List::MoreUtils qw(any); our %region; # $region{NAME}{Colour} @@ -190,8 +191,9 @@ sub dual () { my $va = "$ra # $adjia"; # $va is the vertex at the anticlockwise end # of edge no.$adjia of region $ra - next if ($rb eq 'L' or $rb eq 'NZ') and - ($ra eq 'L' or $ra eq 'NZ'); + my $ra_outside = ($ra eq 'L' or $ra eq 'NZ'); + my $rb_outside = ($rb eq 'L' or $rb eq 'NZ'); + next if $ra_outside and $rb_outside; # $rb is the region on the other side of that edge my $vb = "$rb # $adjibc"; # $vb is the vertex at the *clockwise* end @@ -221,6 +223,7 @@ sub dual () { my $vertex = { EdgeIds => $cc, Text => (join "\n", @$cc), + Outside => (any { m{^(?:L|NZ) \# \d+$} } @$cc), }; foreach my $e (@$cc) { $edgeid2vi{$e} = scalar @vertex; @@ -261,6 +264,7 @@ sub output_planar_graph () { foreach my $via (0..$#vertex) { my $vertexa = $vertex[$via]; o("$via\n"); + o(" :outside\n") if $vertexa->{Outside}; foreach my $ei (@{ $vertexa->{Edges} }) { my $vib = $ei->{VIB}; o(" $vib\n"); -- 2.30.2