String rand_seed = "SEED"; String d = rand_seed.replaceAll("[^0-9]", "").replaceAll("^0+(?!$)", ""); int ri = Integer.parseInt(d.substring( d.length() -9)); float P = (1 + sqrt(5)) / 2; float[][] sv = { {-1,P, 0}, { 1,P, 0}, {-1, -P, 0}, { 1, -P, 0}, {0, -1, P}, {0,1, P}, {0, -1, -P}, {0,1, -P}, { P, 0, -1}, { P, 0,1}, {-P, 0, -1}, {-P, 0,1} }; int[][] sf = { {0, 11, 5}, {0, 5, 1}, {0, 1, 7}, {0, 7, 10}, {0, 10, 11}, {1, 5, 9}, {5, 11, 4}, {11, 10, 2}, {10, 7, 6}, {7, 1, 8}, {3, 9, 4}, {3, 4, 2}, {3, 2, 6}, {3, 6, 8}, {3, 8, 9}, {4, 9, 5}, {2, 4, 11}, {6, 2, 10}, {8, 6, 7}, {9, 8, 1} }; ArrayList vs = new ArrayList(); ArrayList fs = new ArrayList(); float fv = 0.05; float nc = 0.1; float rl = 0.01; int ms = 130; int fr = 400; int ft = fr; int fp = 120; int fc = 200; public float[] nv(float[] v) { float l2 = sqrt(sq(v[0])+sq(v[1])+sq(v[2])); float[] r = {v[0]*rad/l2,v[1]*rad/l2,v[2]*rad/l2}; return r; } HashMap mp = new HashMap(); public int mt(int p1, int p2) { int si = min(p1, p2); int gi = max(p1, p2); String key = Integer.toString(si)+"-"+Integer.toString(gi); if (mp.containsKey(key)) { return mp.get(key);} float[] v1 = vs.get(p1); float[] v2 = vs.get(p2); float[] md = { (v1[0]+v2[0])/2, (v1[1]+v2[1])/2, (v1[2]+v2[2])/2 }; vs.add( nv(md) ); int ix = vs.size() - 1; mp.put(key, ix); return ix; } public ArrayList de(ArrayList fs) { ArrayList fsd = new ArrayList(); for (int i = 0; i < fs.size(); i++) { int[] tri = fs.get(i); int v1 = mt(tri[0], tri[1]); int v2 = mt(tri[1], tri[2]); int v3 = mt(tri[2], tri[0]); fsd.add(new int[] {tri[0], v1, v3}); fsd.add(new int[]{tri[1], v2, v1}); fsd.add(new int[]{tri[2], v3, v2}); fsd.add(new int[]{v1, v2, v3}); } return fsd; } int[] cs = new int[12]; ArrayList vd = new ArrayList(); int lix = 0; int np; ArrayList og_vs = new ArrayList(); float rad; float rix; float ps; float[] ot; float sg; float lln; void setup(){ randomSeed(ri); noiseSeed(ri); size(1000, 1000, P3D); smooth(); frameRate(30); int sb = Math.round( random(3) )+3; lln = rad; rix = random(1000, 10000); ps = 10; ot = new float[] {random(-rl, rl), random(-rl, rl) }; if (random(1)<0.2){ sg = random(0.42, 0.50); rad = random(20)+ 75; } else { sg = random(0.54, 0.62); rad = random(20)+ 55; } for (int i = 0; i < sf.length; i++) { fs.add(sf[i]); } for (int i = 0; i < 12; i++) { cs[i] = Math.round(random(255)); } for (int i = 0; i lln) { lln = ln; lix = r_ind; } float nois = 1-( nc*(1-pw) ) + (nc*noise(og_vs.get(r_ind)[0]+random(ps), og_vs.get(r_ind)[1]+random(ps), og_vs.get(r_ind)[2]+random(ps) )); if (ln>ms && nois>1.0){ continue; } vs.set(r_ind, new float[] {vs.get(r_ind)[0]*nois, vs.get(r_ind)[1]*nois, vs.get(r_ind)[2]*nois} ); } } else if (frameCount>=ft && frameCount < (ft+fp)) { } else if ( frameCount >= (ft+fp) && frameCount <= (ft+fp+fc) ) { if (frameCount == ft+fp){ for (int i = 0; i < vs.size(); i++) { float[] v1 = vs.get(i); float[] v2 = og_vs.get(i); vd.add( new float[] {(v1[0]-v2[0])/fc, (v1[1]-v2[1])/fc, (v1[2]-v2[2])/fc} ); } } else { for (int i = 0; i < vs.size(); i++) { float[] v1 = vs.get(i); float[] v2 = vd.get(i); vs.set(i, new float[] { v1[0]-v2[0],v1[1]-v2[1],v1[2]-v2[2] } ); } } } else{ ft = fr+frameCount; vd = new ArrayList(); lln = rad; lix = 0; } }