1 class XYZPixel extends SCPattern
8 float xm2 = model.xMin+cubeWidth;
9 float ym2 = model.yMin+cubeWidth;
10 float zm2 = model.zMin+cubeWidth;
14 //myP = new LXPoint(20,20,20);
17 void run(double deltaMs)
19 for(LXPoint p : model.points)
21 if(p.x > xm && p.x<= xm2 && p.y > ym && p.y<= xm2 && p.z<= zm2 && p.z > zm)
23 colors[p.index] = lx.hsb(lx.getBaseHue()+100, 100, 100);
29 float minIS=min(model.xMax,model.yMax,model.zMax);
30 xm = (xm + 1 ) % minIS;
31 ym = (ym + 1 ) % minIS;
32 zm = (zm + 1 ) % minIS;
35 ym2 = ym2 + cubeWidth;
36 zm2 = zm2 + cubeWidth;
40 class MultipleCubes extends SCPattern
42 float xm = model.xMin;
43 float ym = model.yMin+10;
44 float zm = model.zMin+5;
46 float xma = model.xMin;
47 float xmb = model.xMin;
53 MultipleCubes(LX lx) {
58 void drawVirtualCube(float bottomX, float bottomY, float bottomZ, float side, int cubeColor)
60 for(LXPoint p : model.points)
62 if(p.x > bottomX && p.x<= bottomX+side && p.y > bottomY && p.y<= bottomY + side && p.z > bottomZ && p.z<= bottomZ+side)
64 colors[p.index] = cubeColor;
71 for(int i=0;i<colors.length;i++)
79 void run(double deltaMs)
83 for(int i = 0;i < model.yMax / side; i++)
85 //println(Math.abs(minIS - xm - 30*(i % 3) - xm + 30*(i % 3)));
92 if(Math.abs(minIS - xm - 30*(i % 3) - xm + 30*(i % 3)) < side * 1.5)
94 hueDo = (hueDo+1) % 255;
97 col = lx.hsb(lx.getBaseHue() + hueDo,100,100);
98 drawVirtualCube(minIS-xm- 30*(i % 3), ym+i*side, zm, side, col);
99 drawVirtualCube(xm + 30*(i % 3), ym+i*side, zm, side, col);
102 xma = (xma + 7 ) % minIS;
103 xmb = (xmb + 3) % minIS;
104 //ym = (ym + 1 ) % minIS;
105 //zm = (zm + 1 ) % minIS;
109 class TowerParams extends SCPattern
111 BasicParameter hueoff = new BasicParameter("Hueoff", 0.0);
112 BasicParameter hueSpan = new BasicParameter("HueRange", 0.0);
113 BasicParameter t1 = new BasicParameter("T1", 0.0);
114 BasicParameter t2 = new BasicParameter("T2", 0.0);
115 BasicParameter t3 = new BasicParameter("T3", 0.0);
116 BasicParameter t4 = new BasicParameter("T4", 0.0);
117 BasicParameter t5 = new BasicParameter("T5", 0.0);
118 BasicParameter t6 = new BasicParameter("T6", 0.0);
119 BasicParameter t7 = new BasicParameter("T7", 0.0);
120 BasicParameter t8 = new BasicParameter("T8", 0.0);
121 BasicParameter t9 = new BasicParameter("T9", 0.0);
122 BasicParameter t10 = new BasicParameter("T10", 0.0);
123 BasicParameter t11 = new BasicParameter("T11", 0.0);
124 BasicParameter t12 = new BasicParameter("T12", 0.0);
125 BasicParameter t13 = new BasicParameter("T13", 0.0);
126 BasicParameter t14 = new BasicParameter("T14", 0.0);
127 BasicParameter t15 = new BasicParameter("T15", 0.0);
128 BasicParameter t16 = new BasicParameter("T16", 0.0);
130 ArrayList<BasicParameter> towerParams;
136 towerParams = new ArrayList<BasicParameter>();
137 addParameter(hueoff);
138 addParameter(hueSpan);
148 towerParams.add(t10);
149 towerParams.add(t11);
150 towerParams.add(t12);
151 towerParams.add(t13);
152 towerParams.add(t14);
153 towerParams.add(t15);
154 towerParams.add(t16);
155 for(BasicParameter p : towerParams)
159 towerSize = model.towers.size();
160 colorSpan = 255 / towerSize;
163 void run(double deltaMs)
167 for(int i=0; i<towerSize ;i++)
169 t= model.towers.get(i);
170 for(LXPoint p : t.points)
172 if(p.y<towerParams.get(i).getValuef()*200)
174 colors[p.index]=lx.hsb(255 * hueoff.getValuef()+colorSpan * hueSpan.getValuef() * i, 255, 255);
181 public void clearALL()
183 for(LXPoint p : model.points)
190 class Sandbox extends SCPattern
195 int pointrange= model.points.size();
196 int striprange= model.strips.size();
197 int facerange= model.faces.size();
198 int cuberange = model.cubes.size();
199 int towerrange = model.towers.size();
204 println("points "+pointrange);
205 println("strips "+striprange);
206 println("faces "+facerange);
207 println("cubes "+cuberange);
208 println("towers "+towerrange);
211 public void run(double deltaMs) {
217 c = (c + 1) % towerrange;
218 long col = lx.hsb(Math.round(Math.random()*255),255,255) ;
225 public void doDraw(int c,long col)
227 Tower t= model.towers.get((int) c);
228 for(LXPoint p : t.points)
230 colors[p.index] = (int) col;
235 class GranimTestPattern extends GranimPattern
237 GranimTestPattern(LX lx)
240 addGraphic("myReds",new RedsGraphic(100));
241 int[] dots = {0,128,0,128,0,128,0,128,0,128,0,128};
242 addGraphic("myOtherColors",new ColorDotsGraphic(dots));
244 getGraphicByName("myOtherColors").position=100;
247 public void run(double deltaMs)
254 Graphic reds = getGraphicByName("myReds");
255 Graphic others = getGraphicByName("myOtherColors");
256 reds.position = reds.position + 1 % 19000;
257 others.position = others.position + 10 % 19000;
260 public void clearALL()
262 for(int i = 0; i < colors.length; i++)
271 class GranimTestPattern2 extends GranimPattern
273 GranimTestPattern2(LX lx)
276 /*for(int i = 0;i < 100; i++)
278 Graphic g = addGraphic("myReds_"+i,new RedsGraphic(Math.round(Math.random() * 100)));
281 Graphic g = addGraphic("myRandoms",new RandomsGranim(50));
287 public void run(double deltaMs)
291 Graphic randomsGraphic = getGraphicByName("myRandoms");
292 randomsGraphic.position = Math.round(sin(count)*1000)+5000;
295 public void clearALL()
297 for(LXPoint p : model.points)
306 class DriveableCrossSections extends CrossSections
313 DriveableCrossSections(LX lx) {
317 public void addParams()
319 mode = new BasicParameter("Mode", 0.0);
320 xd = new BasicParameter("XD", 0.0);
321 yd = new BasicParameter("YD", 0.0);
322 zd = new BasicParameter("ZD", 0.0);
331 public void onParameterChanged(LXParameter p) {
343 void copyValuesToKnobs()
345 xd.setValue(x.getValue()/200);
346 yd.setValue(y.getValue()/115);
347 zd.setValue(z.getValue()/100);
350 void copyKnobsToValues()
352 x.setValue(xd.getValue()*200);
353 y.setValue(yd.getValue()*115);
354 z.setValue(zd.getValue()*100);
357 boolean interactive()
359 return Math.round(mode.getValuef())>0.5;
362 public void updateXYZVals()
366 xv = xd.getValuef()*200;
367 yv = yd.getValuef()*115;
368 zv = zd.getValuef()*100;
370 super.updateXYZVals();