Skip to content

Commit

Permalink
different colors for squares in matrix, #8
Browse files Browse the repository at this point in the history
  • Loading branch information
arturhoo committed Apr 23, 2012
1 parent 6a0d851 commit 7b33af7
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions prot2/Matriz.pde
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ class Matriz {
}

// Preenche fantasmas
if(maioresValoresLocaisY[i] == 0.0) maioresValoresLocaisY[i] = 2.0;
if(maioresValoresLocaisX[i] == 0.0) maioresValoresLocaisX[i] = 2.0;
if(maioresValoresLocaisY[i] == 0.0) maioresValoresLocaisY[i] = 1.5;
if(maioresValoresLocaisX[i] == 0.0) maioresValoresLocaisX[i] = 1.5;

// Contando os inválidos
if(this.quadrados[numChave-1][i] == null) countNulls++;
Expand Down Expand Up @@ -161,16 +161,14 @@ class Matriz {
comp += maioresValoresLocaisY[i];
altura += maioresValoresLocaisX[numChave-i-1];
}
constanteY = novoH/altura;
constanteX = novoW/comp;
constanteY = (true) ? novoH/altura : h/altura;
constanteX = (true) ? novoW/comp : w/altura;

for(int i=numChave-1; i>=countNulls; i--) {
float acumulaX = 0;
for(int k=countNulls; k<i; k++) acumulaX += maioresValoresLocaisX[k];
acumulaX *= constanteY;
float acumulaY = 0;
// stroke(255);
// line(x, novoY+acumulaX, x+w, novoY+acumulaX);
for(int j=0; j<numChave-countNulls; j++) {
if(!exibe00 && i==numChave-1 && j==0){
} else {
Expand All @@ -179,13 +177,12 @@ class Matriz {
numElementosAtual = numElementosAtual*2;
if(this.exibeLog) numElementosAtual = log(numElementosAtual);
if(numElementosAtual != 0.0) {
fill(cPallete[4], 170);
noStroke();
rectMode(CORNER);
rect( x+acumulaY+((acumulaY+maioresValoresLocaisY[j]*constanteX)-(acumulaY+numElementosAtual*constanteX)),
novoY+acumulaX,
numElementosAtual*constanteX,
numElementosAtual*constanteY);
SquareMap sm = new SquareMap(x+acumulaY+((acumulaY+maioresValoresLocaisY[j]*constanteX)-(acumulaY+numElementosAtual*constanteX)),
novoY+acumulaX,
numElementosAtual*constanteX,
numElementosAtual*constanteY,
i, j);
sm.draw();
}
}
}
Expand Down

0 comments on commit 7b33af7

Please sign in to comment.