chiark / gitweb /
commitid: provide 2d demo
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 5 Feb 2016 17:58:19 +0000 (17:58 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 5 Feb 2016 17:58:19 +0000 (17:58 +0000)
commitid-2d-test.scad [new file with mode: 0644]
commitid.scad.pl

diff --git a/commitid-2d-test.scad b/commitid-2d-test.scad
new file mode 100644 (file)
index 0000000..a15de77
--- /dev/null
@@ -0,0 +1,3 @@
+// -*- C -*-
+include <commitid.scad>
+Commitid_2DDemo();
index 33ab57d8cc8db00592a43970cb8cc3a77c3bebe3..3e813b2d3cdbb4f549e09e207ba31c615524bb59 100755 (executable)
@@ -127,6 +127,16 @@ sub chrmodname ($) {
     return "Commitid__chr_$chrx";
 }
 
+our $gtm_demo_i = -1;
+our $gtm_demo_j;
+our @gtm_demo_o;
+
+sub gentextmodule_demo_next_batch(){
+    $gtm_demo_i++;
+    $gtm_demo_j = 0;
+}
+gentextmodule_demo_next_batch();
+
 sub gentextmodule ($@) {
     my ($form, @lines) = @_;
     my $modb = "Commitid_$form";
@@ -152,8 +162,14 @@ sub gentextmodule ($@) {
     p " d=Commitid_depth();\n";
     p " translate([0,0,-d]) linear_extrude(height=d*2) ${modb}_2D();\n";
     p "}\n";
+
     p sprintf "function %s_sz() = Commitid__scale() * 0.1 * [ %d, %d ];\n",
        $modb, 2 * ($cols * 4 - 1), 2 * (@lines * 6 - 1);
+
+    push @gtm_demo_o,
+       " translate([$gtm_demo_i * st[0], $gtm_demo_j * st[1]])".
+       " ${modb}_2D();\n";
+    $gtm_demo_j++;
 }
 
 our @demo;
@@ -311,6 +327,8 @@ sub do_git () {
     }
 
     foreach my $sz (3..10) {
+       gentextmodule_demo_next_batch();
+
        gentextmodule_plusq("Small$sz", rjustt($sz, $git_count.$git_dirty))
            if defined $git_count;
 
@@ -352,6 +370,11 @@ gentextmodule('FontDemo', @demo);
 
 do_git();
 
+p "module Commitid_2DDemo(){\n";
+p " st = Commitid__scale() * [ 10, 5 ];\n";
+p $_ foreach @gtm_demo_o;
+p "}\n";
+
 flush STDOUT or die $!;
 close STDOUT or die $!;