chiark / gitweb /
plag
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 8 Feb 2019 22:00:24 +0000 (22:00 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 8 Feb 2019 22:00:24 +0000 (22:00 +0000)
.gitignore
Makefile
parse-input-graph

index 38ca98a729341169dbbe17ff4e38b8bd913ae5f8..c59e76f51ac0b51b53dae7ce9cbf5ce76d40c63f 100644 (file)
@@ -1,2 +1,3 @@
 map.dot
 map.ps
+map.plag
index 02c9db1ceac52714af4833dd37cbfc27a6e060c7..8a51fff3b081b5a4bf6432ddf94e51afd3a8adb2 100644 (file)
--- 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
index 4265c017a1b315619fb15e79a91e8f623a91286f..1edbf410d7f1c79a0c29871ff2a9b14beb686724 100755 (executable)
@@ -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");