nice - thanks both. Here’s where I’m taking it - inspired by classic cognitive psychology - Kanisza’s triangle Kanizsa triangle - New World Encyclopedia
PGraphics canvas;
PVector[] basePts = new PVector[3];
PVector[] basePtsBlk = new PVector[3];
float angleMouseX, angleMouseY;
void setup() {
size(768, 768, P3D);
canvas = createGraphics(width, height, P3D);
for (int i = 0; i < 3; i++ ) {
float ang = TWO_PI * i / 3;
basePts[i] = new PVector(cos(ang) * 400/2, -100, sin(ang) * 400/2 );
println(basePts[i]);
}
}
void draw() {
canvas.beginDraw();
canvas.background(30);
canvas.camera(mouseX, height/2, (height/2) / tan(PI/6), width/2, height/2, 0, 0, 1, 0);
canvas.noStroke();
//canvas.ambientLight(255, 0, 0);
//canvas.directionalLight(0, 255, 0, 0, -1, 0);
//canvas.spotLight(0, 0, 255, width/2, height/2, 100, 0, 0, -1, PI/4, 2);
canvas.ortho(-width/2, width/2, -height/2, height/2);
/// white pyramid
canvas.pushMatrix();
canvas.translate(width/2, height/2, 0);
canvas.rotateX(radians(frameCount*0.99 % 360));
canvas.rotateZ(radians(frameCount/2 % 360));
canvas.fill(255);
canvas.strokeWeight(1);
canvas.stroke(0);
//sides
canvas.beginShape(TRIANGLES);
for (int i = 0; i < 3; ++i ) {
int i2 = (i+1) % 3;
canvas.vertex(basePts[i].x, basePts[i].y, basePts[i].z);
canvas.vertex(basePts[i2].x, basePts[i2].y, basePts[i2].z);
canvas.vertex(0, 180, 0 );
}
canvas.endShape();//sides
canvas.beginShape(); //base
canvas.fill(255);
for (int i = 0; i < 3; ++i ) {
canvas.vertex(basePts[i].x, basePts[i].y, basePts[i].z);
}
canvas.endShape(CLOSE);
canvas.popMatrix(); /// white pyramid end
/// pyramid 2 (blk)
canvas.pushMatrix();
canvas.translate(width/2+5, height/2-3, 0);
canvas.rotateY(radians(frameCount % 360)*-1);
canvas.rotateZ(radians(frameCount/1.8 % 360*-1));
canvas.fill(0);
canvas.strokeWeight(2);
canvas.stroke(50);
//sides
canvas.beginShape(TRIANGLES);
for (int i = 0; i < 3; ++i ) {
int i2 = (i+1) % 3;
canvas.vertex(basePts[i].x, basePts[i].y, basePts[i].z);
canvas.vertex(basePts[i2].x, basePts[i2].y, basePts[i2].z);
canvas.vertex(0, 180, 0 );
}
canvas.endShape();//sides
canvas.beginShape(); //base
canvas.fill(0);
for (int i = 0; i < 3; ++i ) {
canvas.vertex(basePts[i].x, basePts[i].y, basePts[i].z);
}
canvas.endShape(CLOSE);
canvas.popMatrix(); /// pyramid 2 (blk) end
/// pyramid 3 (blk)
canvas.pushMatrix();
canvas.translate(width/2-5, height/2+3, 0);
canvas.rotateX(radians(frameCount*0.98 % 360)*-1);
canvas.rotateZ(radians(frameCount/1.9 % 360));
canvas.fill(0);
canvas.strokeWeight(2);
canvas.stroke(50);
//sides
canvas.beginShape(TRIANGLES);
for (int i = 0; i < 3; ++i ) {
int i2 = (i+1) % 3;
canvas.vertex(basePts[i].x, basePts[i].y, basePts[i].z);
canvas.vertex(basePts[i2].x, basePts[i2].y, basePts[i2].z);
canvas.vertex(0, 180, 0 );
}
canvas.endShape();
canvas.beginShape(); //base
canvas.fill(0);
for (int i = 0; i < 3; ++i ) {
canvas.vertex(basePts[i].x, basePts[i].y, basePts[i].z);
}
canvas.endShape(CLOSE);
canvas.popMatrix(); /// pyramid 2 (blk) end
canvas.endDraw();
blendMode(BLEND);
image(canvas, 0, 0);
}