Open Pomax opened 3 months ago
Partly done. Arc: in 3d:
function setup() {
setSize(600, 400);
setBorder(1, `black`);
setProjector(HOMOGENEOUS).setInfinity(Infinity);
rotateProjector(0.1, -0.2, -0.8);
play();
}
function draw() {
setCursor(`none`);
clear(`white`);
center();
noFill();
setStroke(`black`);
rotateProjector(0.1, -0.2, frame/100);
const d = 100;
line(-d,0,0, d,0,0);
line(0,-d,0, 0,d,0);
line(0,0,-d, 0,0,d);
point(0,0,0)
point(d,0,0)
point(0,d,0)
point(0,0,d)
const a = [50, 20, 0];
const b = [20, 80, 50];
const pts = [a];
for (let t=0; t<=TAU; t+=0.01) {
pts.push(lerp3d(t, a, b));
}
poly(pts);
setStroke(`lightgrey`);
poly(pts.map(p => [p[0],p[1],0]));
poly(pts.map(p => [p[0],0,p[2]]));
poly(pts.map(p => [0,p[1],p[2]]));
}
function pointerMove() {
redraw();
}
function lerp3d(t, a, b) {
return [
cos(t) * a[0] + sin(t) * b[0],
cos(t) * a[1] + sin(t) * b[1],
cos(t) * a[2] + sin(t) * b[2],
]
}