gShape [][] shapeArray = new gShape[gridSizeX][gridSizeY];
ArrayList<PVector> history = new ArrayList<PVector>();
for (int i = 0 ;i < gridSizeX; i++) {
for (int j = 0; j < gridSizeY; j++) {
float cX = maxrezX*i/gridSizeX;
float cY = maxrezY*j/gridSizeY;
shapeArray[i][j] = new gShape(0, 1, new PVector(cX, cY), (maxSize/100.00)*(maxrezX/gridSizeX));
if (k2 == -1) history.add(new PVector(mouseX, mouseY, 1));
if (dist(history.get(k2).x, history.get(k2).y, mouseX, mouseY) > 10) {
history.add(new PVector(mouseX, mouseY, 1));
for (int i = 0; i<gridSizeX; i++) {
for (int j = 0; j < gridSizeY; j++) {
for (int k = 0 ; k < history.size(); k++) {
float d = dist(history.get(k).x, history.get(k).y, shapeArray[i][j].c.x, shapeArray[i][j].c.y);
f += exp(-sq(d) / (2*sq(window)));
if (d < brushSize && inBrush == 0) inBrush = 1;
if (inBrush != 0) shapeArray[i][j].sz = f;
for (int k = 1; k < history.size(); k++)
if (history.get(k-1).z != 0)
line(history.get(k).x, history.get(k).y, history.get(k-1).x, history.get(k-1).y);
ellipse(mouseX, mouseY, brushSize*2, brushSize*2);
PVector c = new PVector(0,0);
gShape(float saiz, int type,PVector cent, float maxSize) {
void rec(PVector c, float sz) {
if(sz > 0.1) rect(c.x,c.y,sz,sz);
if(history.size()-1 > -1) history.get(history.size()-1).z = 0;