// UdK Computational design // Marius Watz 2003 // http://www.evolutionzone.com/udk/ // // UDK04_01_weeds // // A simulation of weeds moving in the wind. // Uses the Vec2D library and demonstrates how to dynamically change // a force, in this case wind. // // Note that the use of Vec2D objects to represent the wind is actually // redundant since we don't use the y values... Weed weeds[]; int num; int reduceWindCnt; float maxWindChange,maxWind; Vec2D wind,windD,userWind,userWindD; Vec2D mouseStart; void setup() { size(400,400); background(255,255,255); num=75; weeds=new Weed[num]; for(int i=0; i0) { userWind.add(userWindD); reduceWindCnt--; } windD.add(random(-0.5,0.5),0); if(windD.x<-maxWindChange) windD.x=-maxWindChange; else if(windD.x>maxWindChange) windD.x=maxWindChange; if(wind.x>maxWind) windD.x-=0.1; else if(wind.x<-maxWind) windD.x+=0.1; wind.x+=windD.x; for(int i=0; iwidth) x=width; h=random(175,250); bend=random(-20,20); bendMod=1+random(-0.5,2.5); vnum=20; v=new Vec2D[vnum]; for(int i=0; i