xxxxxxxxxx
//import processing.pdf.*;
int cpt1 = 0; int cpt2 = 0; int cpt3 = 0;
float side ; //int prof = 100;
int nbcube = 7;
int pas = 1; int cpt = 10;
PFont myFont;
void setup() {
size(500,500,P3D); // noLoop();
myFont = createFont("Arial", 10);
background(255);
//beginRaw(PDF, "cube 50.pdf");
}
void draw() {
background(255);
textFont(myFont,20);
nbcube = int(mouseY/50) ;
text("cube de "+nbcube+" ", 30, 30 , 0);
text(" mouseY Move : cube number ", 30, 45 , -30);
text(" mouseX Move : rotate " , 30, 65 , -30);
// fill(0); textFont(myFont,20);
//text("cube de "+nbcube+" ", 50, 50 , 0);
translate(width/3, height/2, -50);
//rotateX((height/width)* mouseY );
rotateY(((PI/2)/width)* (mouseX) );
float cote = height/2.5 ;
side = cote/nbcube;
for(int j = 1 ; j <= nbcube ; j = j+ pas) {
for(int k = 1 ; k <= nbcube ; k = k+ pas) {
for(int m = 1 ; m <= nbcube ; m = m+ pas){
cpt3 = cpt3 + 1 ;
for(int i = 1; i<= nbcube ; i = i + 1) {
if( cpt3 == i*i*i ) { //When cpt3 equals one of the first nbcube integers
textFont(myFont,22);
fill(255, 0, 0 );
text(cpt3, (-cote/2)+ (j*side)+2, -(cote/2)+ (k*side), m*(side));
}
else {
textFont(myFont,12); fill( 0, 0, 255, 50 ); stroke( 0, 0, 255, 50 ); //alpha
}
}
text(cpt3, (-cote/2)+ (j*side)+2, -(cote/2)+ (k*side), m*(side));
}}}
cpt3 = 0 ;
// endRaw();
}