animation/guides/guides.pde

131 lines
3.6 KiB
Plaintext

import processing.svg.*;
int n = 0;
String NAME = "guide_frame";
float IN = 25.4;
float MM = 96 / IN;
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
float pad = 10.0; //mm
float calcH = (totalW - (pad * 2.0)) / RATIO;
float calcTop = (totalH - calcH) / 2.0;
float markLeft = (pad / 2.0) * MM;
float markTop = (calcTop - (pad / 2.0)) * MM;
float markRight = (totalW - (pad / 2.0)) * MM;
float markBottom = (totalH - (calcTop - (pad / 2.0))) * MM;
float frameLeft = pad * MM;
float frameTop = calcTop * MM;
float frameRight = (totalW - pad) * MM;
float frameBottom = (totalH - calcTop) * MM;
void settings () {
size(W, H, SVG, NAME + ".svg");
}
void setup () {
noFill();
stroke(0);
noLoop();
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);
line(x, y - len, x, y + len);
}
void marks () {
mark(markLeft, markTop);
mark(markRight, markTop);
mark(markLeft, markBottom);
mark(markRight, markBottom);
}
void frame () {
line(frameLeft, frameTop, frameRight, frameTop);
line(frameRight, frameTop, frameRight, frameBottom);
line(frameRight, frameBottom, frameLeft, frameBottom);
line(frameLeft, frameBottom, frameLeft, frameTop);
}
//bolex viewfinder frame, 90% of full
void bolex () {
float fiveX = (frameRight - frameLeft) / 20.0;
float fiveY = (frameBottom - frameTop) / 20.0;
float bolexLeft = frameLeft + fiveX;
float bolexRight = frameRight - fiveX;
float bolexTop = frameTop + fiveY;
float bolexBottom = frameBottom - fiveY;
line(bolexLeft, bolexTop, bolexRight, bolexTop);
line(bolexRight, bolexTop, bolexRight, bolexBottom);
line(bolexRight, bolexBottom, bolexLeft, bolexBottom);
line(bolexLeft, bolexBottom, bolexLeft, bolexTop);
}
void draw () {
//marks();
//bolex();
frame();
//1234
//drawNumber(4, frameLeft + ((frameRight - frameLeft) / 2.0), 1.0 * MM);
//bisect
/*
line(0,H/2,W,H/2);
line(W/2,0,W/2,H);
*/
}