Revealing the Tesseract: Creating a 4D Cube | Processing 4.3
Have you ever imagined a world beyond the three dimensions we know? With Processing 4.3, we can make that imagination a reality. In this tutorial, you will learn how to create a 4D cube, a geometric object that is difficult to imagine but very interesting to explore.
the code is below:
import peasy.*;
int DIM = 32;
PeasyCam cam;
void setup() {
cam = new PeasyCam(this, 500);
size(1280, 720, P3D);
windowMove(300, 100);
}
void draw() {
background(0);
for (int i = 0; i < DIM; i++){
for (int j = 0; j < DIM; j++){
for (int k = 0; k < DIM; k++){
float x = map(i, 0, DIM, -100, 100);
float y = map(j, 0, DIM, -100, 100);
float z = map(k, 0, DIM, -100, 100);
stroke(255);
point(x,y,z);
}
}
}
}
Join the conversation