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.

This commit is contained in:
Matt McWilliams 2021-07-30 00:10:50 -04:00
parent 2015260810
commit 10d86c56bf
3 changed files with 96 additions and 0 deletions

2
left_right_spacing/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.png
*.svg

View File

@ -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;
}

View File

@ -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}" == " /><g" ]]; then
echo " /><g transform=\"scale(0.5)\"" >> "${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}" == " /><g" ]]; then
echo " /><g transform=\"scale(0.5)\"" >> "${newfile}"
else
echo "${line}" >> "${newfile}"
fi
done <<< "${svg}"
cp "${newfile}" "${i}"
rm "${newfile}"
done