From 10d86c56bf55361dac2bacad5e1cf8303047a5e3 Mon Sep 17 00:00:00 2001 From: mattmcw Date: Fri, 30 Jul 2021 00:10:50 -0400 Subject: [PATCH] Add left_right_spacing with a loop.sh script that fixes all svg files after they're generated (using scale). EYE (spacing) values from 3.0 to 8.0 were tested on plotter at 50% scale. Scans of the pages were done. --- left_right_spacing/.gitignore | 2 + left_right_spacing/left_right_spacing.pde | 51 +++++++++++++++++++++++ left_right_spacing/loop.sh | 43 +++++++++++++++++++ 3 files changed, 96 insertions(+) create mode 100644 left_right_spacing/.gitignore create mode 100644 left_right_spacing/left_right_spacing.pde create mode 100644 left_right_spacing/loop.sh diff --git a/left_right_spacing/.gitignore b/left_right_spacing/.gitignore new file mode 100644 index 0000000..664db10 --- /dev/null +++ b/left_right_spacing/.gitignore @@ -0,0 +1,2 @@ +*.png +*.svg diff --git a/left_right_spacing/left_right_spacing.pde b/left_right_spacing/left_right_spacing.pde new file mode 100644 index 0000000..4a7ccef --- /dev/null +++ b/left_right_spacing/left_right_spacing.pde @@ -0,0 +1,51 @@ +PImage img; +import processing.svg.*; + +float EYE_INC = 0.25; +float EYE_MAX = 8.0; +float EYE = 3.0; + + +void settings() { + System.setProperty("jogl.disable.openglcore", "false"); + size(900, (900 / 4) * 3, P3D); +} + +void setup() { + noFill(); + strokeWeight(2); + textMode(SHAPE); +} + +void drawBox (int x, int y, int z) { + push(); + translate(x, y, z); + rotateY(radians( 60 )); + box(45); + pop(); +} + +void draw() { + clear(); + background(#ffffff); + camera(70.0 + (EYE / 2), 35.0, 120.0, 50.0, 50.0, 35.0 / 2, + 0.0, 1.0, 0.0); + beginRaw(SVG, "left_spacing_" + str(EYE) + ".svg"); + stroke(255, 0, 0, 124); + drawBox(50, 50, 0); + endRaw(); + + camera(70.0 - (EYE / 2), 35.0, 120.0, 50.0, 50.0, 35.0 / 2, + 0.0, 1.0, 0.0); + //background(#ffffff); + beginRaw(SVG, "right_spacing_" + str(EYE) + ".svg"); + stroke(0, 0, 255, 124); + drawBox(50, 50, 0); + endRaw(); + + save("left_right_spacing_" + str(EYE) + ".png"); + if (EYE == EYE_MAX) { + exit(); + } + EYE += EYE_INC; +} diff --git a/left_right_spacing/loop.sh b/left_right_spacing/loop.sh new file mode 100644 index 0000000..654bfbe --- /dev/null +++ b/left_right_spacing/loop.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +seq 3.0 0.25 8.0 | while IFS= read i; do + echo $i + #node ../numbers/ -n "$i" -o "left_right_spacing_$i.svg" +done + + +MATCH="left_spacing_"*".svg" +for i in $MATCH; do + #echo $i + svg=`cat "${i}"` + newfile=`mktemp` + + while IFS= read -r line; do + if [[ "${line}" == " />> "${newfile}" + else + echo "${line}" >> "${newfile}" + fi + done <<< "${svg}" + + cp "${newfile}" "${i}" + rm "${newfile}" +done + +MATCH="right_spacing_"*".svg" +for i in $MATCH; do + #echo $i + svg=`cat "${i}"` + newfile=`mktemp` + + while IFS= read -r line; do + if [[ "${line}" == " />> "${newfile}" + else + echo "${line}" >> "${newfile}" + fi + done <<< "${svg}" + + cp "${newfile}" "${i}" + rm "${newfile}" +done \ No newline at end of file