import processing.serial.*; Serial myPort; // Create object from Serial class class MyObject{ float dim = 30; //size of the object float x,y,z; //position coordinates float ax,ay,az; //rotational values float sx=1, sy=1, sz=1; //scaling factors boolean picked = false; //picked status color c_face = color(20); //color of face color c_edge = color(255); // color of edge // translation void move3(float xin, float yin, float zin){ x = xin; y = yin; z = zin; } // three rotations void rotate3 (float axin, float ayin, float azin){ x = axin; y = ayin; z = azin; } // scaling void scale3 (float sxin, float syin, float szin){ x = sxin; y = syin; z = szin; } // determine if an object is selected void pick (float xp, float yp){ if (dist(xp,yp,screenX(x,y,z),screenY(x,y,z))<20) picked = true; else picked = false; } // draw the object void draw3(){ stroke(c_edge); if (picked==true){ fill (255,0,0); } else fill (c_face); pushMatrix(); translate(x,y,z); rotateX(ax); rotateY(ay); rotateZ(az); scale(sx,sy,sz); box(dim); popMatrix(); } } // ******************************************************************** MyObject [] b; int zoom; void setup(){ size(600,500,P3D); b = new MyObject[20]; for (int i = 0; i