Generate more and better guides

This commit is contained in:
Matt McWilliams 2021-07-30 01:19:32 -04:00
parent 5ba652fc16
commit d3a6a88109
1 changed files with 42 additions and 46 deletions

View File

@ -1,8 +1,18 @@
import processing.svg.*;
int n = 0;
int t = 0; //max=4
String NAME = "guide_frame";
String[] types = {
"all",
"marks",
"frame",
"bolex",
"field"
};
String TYPE = types[t];
String NAME = "guide" + "_" + TYPE;
float IN = 25.4;
float MM = 96 / IN;
@ -12,11 +22,12 @@ float RATIO = 4.0 / 3.0;
//9x12" sheet!!!!!
//Vertical measurements diff for 8 1/2"
int W = round( ((107 * 2) / IN) * 96);
int H = round( ((99 * 2) / IN) * 96);
float totalW = 107.0; //mm
float totalH = 99.0; //mm
int W = round( ((totalW * 2) / IN) * 96);
int H = round( ((totalH * 2) / IN) * 96);
float pad = 10.0; //mm
float calcH = (totalW - (pad * 2.0)) / RATIO;
float calcTop = (totalH - calcH) / 2.0;
@ -43,43 +54,6 @@ void setup () {
println(calcH);
}
void drawNumber (int num, float x, float y) {
float w = 3.0 * MM;
float h = 4.0 * MM;
float[] two1 = {x, y + (h / 4.0)};
float[] two2 = {x + (w / 2.0), y};
float[] two3 = {x + w, y + (h / 4.0)};
float[] two4 = {x + (w / 2.0), y + (h * 0.75)};
float[] three1 = {x, y + (h * 0.1)};
float[] three2 = {x + (w / 2.0), y};
float[] three3 = {x + w, y + (h / 4.0)};
float[] three4 = {x, y + (h * 0.4)};
float[] three5 = {x + w, y + (h * 0.7)};
float[] three6 = {x, y + (h * 0.9)};
if ( num == 1 ) {
line(x + (w/2), y, x + (w/2), y + h);
} else if (num == 2) {
curve(x - (w / 2.0), y + (h * 0.75), two1[0], two1[1], two2[0], two2[1], x + w, y + (h * 0.25));
curve(x, y, two2[0], two2[1], two3[0], two3[1], x + (w * 1.5), y + h);
curve(two2[0], two2[1], two3[0], two3[1], two4[0], two4[1], x, y + h);
line(two4[0], two4[1], x, y + h);
line(x, y + h, x + w, y + h);
} else if (num == 3) {
curve(x - (w / 2.0), y + (h / 2.0), three1[0], three1[1], three2[0], three2[1], x + w, y);
curve(x, y, three2[0], three2[1], three3[0], three3[1], x + (w * 1.5), y + h);
curve(x + w, y - h, three3[0], three3[1], three4[0], three4[1], x - w, y + (h / 2.0));
curve(x - w, y + (h / 2.0), three4[0], three4[1], three5[0], three5[1], x + (w * 1.25), y + (h * 2.0));
curve(x + (w / 2.0), y, three5[0], three5[1], three6[0], three6[1], x - w, y + (h / 2.0));
} else if (num == 4) {
line(x + (w * 0.1), y, x, y + (h / 2.0));
line(x, y + (h / 2.0), x + w, y + (h / 2.0));
line(x + (w * 0.9), y, x + (w * 0.9), y + h);
}
}
void mark (float x, float y) {
float len = (pad / 4.0) * MM;
line(x - len, y, x + len, y);
@ -115,12 +89,34 @@ void bolex () {
line(bolexLeft, bolexBottom, bolexLeft, bolexTop);
}
void field () {
float centerX = frameLeft + ((frameRight - frameLeft) / 2.0);
float centerY = frameTop + ((frameBottom - frameTop) / 2.0);
float stepX = (frameRight - frameLeft) / 20.0;
float stepY = (frameBottom - frameTop) / 20.0;
line(centerX, frameTop, centerX, frameBottom);
line(frameLeft, centerY, frameRight, centerY);
for (int i = 1; i < 10; i++) {
line(centerX - stepX, centerY + (i * stepY), centerX + stepX, centerY + (i * stepY));
line(centerX - stepX, centerY - (i * stepY), centerX + stepX, centerY - (i * stepY));
line(centerX + (i * stepX), centerY - stepY, centerX + (i * stepX), centerY + stepY);
line(centerX - (i * stepX), centerY - stepY, centerX - (i * stepX), centerY + stepY);
}
}
void draw () {
//marks();
//bolex();
if (TYPE == "marks" || TYPE == "all") {
marks();
}
if (TYPE == "frame" || TYPE == "all") {
frame();
//1234
//drawNumber(4, frameLeft + ((frameRight - frameLeft) / 2.0), 1.0 * MM);
}
if (TYPE == "bolex" || TYPE == "all") {
bolex();
}
if (TYPE == "field" || TYPE == "all") {
field();
}
//bisect
/*