import java.util.ArrayList; // Declare a "Bling" object ArrayList blings; float rotation; boolean showVectors = false; int numBlings = 0; void setup() { size(800,600, P3D);//download & change P3D to OPENGL for better performance framerate(30); //smooth(); lights(); // Create the thing object blings = new ArrayList(); for(int i = 0; i < numBlings; i++) { blings.add(new Bling(new Vector3D(25f * i,20f * i, 15f*i),new Vector3D(1.5f,2f,1f), new Vector3D(0f,0f,0f),(Math.random() < 0.5f)?0:1)); } } void draw() { lights(); background(100); pushMatrix(); translate(width/2,height/2,0); //rotateX(rotation*2.5f); rotateY(rotation); //rotateZ(rotation*0.5f); stroke(70); noFill(); fill(200,200,200,50); //box(316); sphereDetail(30); sphere(316); sphereDetail(6); for(int i = 0; i < blings.size(); i++) { Bling bi = (Bling)blings.get(i); bi.acc = new Vector3D(0,0,0); for(int j = 0; j < blings.size(); j++) { if(i != j) { Bling bj = (Bling)blings.get(j); float dist = Vector3D.distance(bi.loc,bj.loc); dist *= dist; if(bi.type != bj.type) { bi.acc.add(Vector3D.div(Vector3D.mult(Vector3D.sub(bj.loc,bi.loc),100f),dist)); } else { bi.acc.sub(Vector3D.div(Vector3D.mult(Vector3D.sub(bj.loc,bi.loc),100f),dist)); } bi.acc.limit(10f); } } } // Run the "Bling" object for(int i=0;i