animation/guides/guides.pde

127 lines
3.0 KiB
Plaintext
Raw Normal View History

2021-07-29 15:30:45 +00:00
import processing.svg.*;
int n = 0;
2021-07-30 05:19:32 +00:00
int t = 0; //max=4
2021-07-29 15:30:45 +00:00
2021-07-30 05:19:32 +00:00
String[] types = {
"all",
"marks",
"frame",
"bolex",
"field"
};
String TYPE = types[t];
String NAME = "guide" + "_" + TYPE;
2021-07-29 15:30:45 +00:00
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
2021-07-30 05:19:32 +00:00
int W = round( ((totalW * 2) / IN) * 96);
int H = round( ((totalH * 2) / IN) * 96);
2021-07-29 15:30:45 +00:00
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);
}
2021-07-30 04:08:34 +00:00
//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;
2021-07-29 15:30:45 +00:00
2021-07-30 04:08:34 +00:00
line(bolexLeft, bolexTop, bolexRight, bolexTop);
line(bolexRight, bolexTop, bolexRight, bolexBottom);
line(bolexRight, bolexBottom, bolexLeft, bolexBottom);
line(bolexLeft, bolexBottom, bolexLeft, bolexTop);
}
2021-07-30 05:19:32 +00:00
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);
}
}
2021-07-30 04:08:34 +00:00
void draw () {
2021-07-30 05:19:32 +00:00
if (TYPE == "marks" || TYPE == "all") {
marks();
}
if (TYPE == "frame" || TYPE == "all") {
frame();
}
if (TYPE == "bolex" || TYPE == "all") {
bolex();
}
if (TYPE == "field" || TYPE == "all") {
field();
}
2021-07-29 15:30:45 +00:00
//bisect
/*
line(0,H/2,W,H/2);
line(W/2,0,W/2,H);
*/
}