ah, the code to generate the list could be:
size(300, 300);
println("PVector[] pvList1 = ");
println(" {" );
for (int i0 = 0; i0 < 3; i0++) {
for (int i1 = 0; i1 < 3; i1++) {
for (int i2 = 0; i2 < 3; i2++) {
//String a = str(i0)
// +str(i1)
// +str(i2);
println(
" new PVector ( "
+ str(i0)+", "
+str(i1)+", "
+str(i2)
+" ),");
}//for
}
}
println("};");
and the code to demonstrate the list as a graphic
float angle1;
// auto-generated list of 3D PVectors for all possible directions in 3D (right, left, up, diagonal right downwards....)
PVector[] pvList1 =
{
// new PVector ( 0, 0, 0 ),
new PVector ( 0, 0, 1 ),
new PVector ( 0, 0, -1 ),
new PVector ( 0, 1, 0 ),
new PVector ( 0, 1, 1 ),
new PVector ( 0, 1, -1 ),
new PVector ( 0, -1, 0 ),
new PVector ( 0, -1, 1 ),
new PVector ( 0, -1, -1 ),
new PVector ( 1, 0, 0 ),
new PVector ( 1, 0, 1 ),
new PVector ( 1, 0, -1 ),
new PVector ( 1, 1, 0 ),
new PVector ( 1, 1, 1 ),
new PVector ( 1, 1, -1 ),
new PVector ( 1, -1, 0 ),
new PVector ( 1, -1, 1 ),
new PVector ( 1, -1, -1 ),
new PVector ( -1, 0, 0 ),
new PVector ( -1, 0, 1 ),
new PVector ( -1, 0, -1 ),
new PVector ( -1, 1, 0 ),
new PVector ( -1, 1, 1 ),
new PVector ( -1, 1, -1 ),
new PVector ( -1, -1, 0 ),
new PVector ( -1, -1, 1 ),
new PVector ( -1, -1, -1 )
};
void setup() {
// init
size(800, 600, P3D);
} // func
void draw() {
// runs on and on
background(0);
lights();
stroke(255, 0, 0);
strokeWeight(8);
pushMatrix();
translate(width/2, height/2, 0);
rotateX(-0.2992);
rotateY(angle1);
int i=0;
for (PVector pv : pvList1) {
float amt = map(i,
0, pvList1.length,
0, 1);
stroke(lerpColor(color(255), color(255, 0, 0), amt));
line(
//0, 0, 0,
pv.x*8, pv.y*8, pv.z*8,
pv.x*88, pv.y*88, pv.z*88);
i++;
}//for
popMatrix();
//
stroke(100);
// noFill();
fill(255, 0, 0);
pushMatrix();
translate(100, 100, 0);
rotateZ(angle1);
if (!keyPressed)
angle1+=.04;
box(60);
popMatrix();
pushMatrix();
translate(400, 100, 0);
rotateX(angle1);
fill(0, 0, 255);
box(60);
popMatrix();
pushMatrix();
translate(700, 100, 0);
rotateY(angle1);
box(60);
popMatrix();
pushMatrix();
translate(700, 300, -330);
noStroke();
sphere(50);
popMatrix();
} // func
//
Thank you!
Very inspiring!