animation/guides/guides.pde

127 lines
3.0 KiB
Plaintext

import processing.svg.*;
int n = 0;
int t = 0; //max=4
String[] types = {
"all",
"marks",
"frame",
"bolex",
"field"
};
String TYPE = types[t];
String NAME = "guide" + "_" + TYPE;
float IN = 25.4;
float MM = 96 / IN;
float RATIO = 4.0 / 3.0;
//9x12" sheet!!!!!
//Vertical measurements diff for 8 1/2"
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;
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 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 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 () {
if (TYPE == "marks" || TYPE == "all") {
marks();
}
if (TYPE == "frame" || TYPE == "all") {
frame();
}
if (TYPE == "bolex" || TYPE == "all") {
bolex();
}
if (TYPE == "field" || TYPE == "all") {
field();
}
//bisect
/*
line(0,H/2,W,H/2);
line(W/2,0,W/2,H);
*/
}