//import processing.opengl.*; int lati; float dAng; float [] cosArr,sinArr; int numHex; float globalR; Hexagon [][] hexArr; float dx,dy; int rows,cols; boolean up; PImage originalImg,img; int imgCropX,imgCropY; void setup(){ size(400,400,P3D); //noStroke(); //smooth(); colorMode(HSB,1); cursor(CROSS); // lati=6; dAng=radians(360/lati); cosArr=new float [lati]; sinArr=new float [lati]; for(int i=0;iheight){ imgCropY-=1; imgCropY=constrain(imgCropY,0,originalImg.height-height); img=originalImg.get(imgCropX,imgCropY,width,height); } } else if(keyCode==40){ //DOWN if(originalImg.height>height){ imgCropY+=1; imgCropY=constrain(imgCropY,0,originalImg.height-height); img=originalImg.get(imgCropX,imgCropY,width,height); } } else if(keyCode==39){ //RIGHT if(originalImg.width>width){ imgCropX+=1; imgCropX=constrain(imgCropX,0,originalImg.width-width); img=originalImg.get(imgCropX,imgCropY,width,height); } } else if(keyCode==37){ //LEFT if(originalImg.width>width){ imgCropX-=1; imgCropX=constrain(imgCropX,0,originalImg.width-width); img=originalImg.get(imgCropX,imgCropY,width,height); } } //println(keyCode); } void generateHexagons(){ ///Generate new hexagons up=false; dy=(sqrt(3)*globalR); dx=(globalR/2)*3; cols=int(width/dx)+2; rows=int(height/dy)+3; //println(cols); hexArr=new Hexagon [cols][rows]; for(int x=0;x