// a Plant is a collection of Attributes and other elements to define // the overall character of each plant is defined here // class Plant { Attributes Stem, Branch, Leaf, Flower, Petal; ArrayList branchList = new ArrayList (); // array to store branches // ArrayList flowerList = new ArrayList (); /// ADD OTHER ELEMENTS for entire plant: alpha, leafAngle, lo, hi, radius, alphs /// values the same for all plants // float radius = int (random (6, 10));//random (20);3 float _alpha =190;//320;//180, 220;// 320 /////////////////////////// float unfurlSpeed = 0.06; float decayRate = 0.3;//0.5;//0.3; // amount alpha is decayed.. float refurlRate = 0.02; float blurRate = 0.05; /// add a aliveTime // time before starts to decay float aliveTime = random (1, 2000);//int (random (200, 201)); // println (aliveTime); float aliveRate = 0.1; //rate at which alive time is decremented ///////////////////////// boolean decay = true; boolean flowerBlur = false; boolean leafBlur = false; boolean drawLines = false; boolean drawCentre = false; float blurAmount = 4;//15; // distance (pixels) between line and blur line float blurAlphaFraction = 0.2; // percentage of alpha (0.2 = 20% etc) int blurNum = 1; ////////////////////////// //////////////////////// int minAngle = 90; // min angle for 'spin' int maxAngle = 90; /////////////////////////////////// int bCount; int fCount; ///////////////////////////////////// boolean leafFollowParentColor = false; // do leaves follow branch colour ? boolean flowerFollowParentColor = true; // do all petals follow flower colour ?? //////////////////////////////////////////////////////////////////////////////////// float leafGrowth = 0.9; // fraction amount by which leaves grow (0.5 = less 50% , 1.0 = no change, 1.5 = increase 50%). float leafStart = 2.0f; // starting percentage size of leaf (1.0 = 100%, 2.0 = 200%) float flowerGrowth = 0.8;// how much subsequent flowers are alterd by float flowerStart = 1.0f; // starting (percentage) size of flower (2 = 200%) int[] flowerDev = {-4, 8};//{ -4, 15};// min and max amounts the flower (as a whole) can deviate (where 0 is normal: 'fully open' ////////////////////////////////////////////////////////////////// Vector3D stemLoc = new Vector3D (); //////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////// Plant (Attributes s, Attributes b, Attributes l, Attributes f, Attributes p, Vector3D sl) { Stem = s; Branch = b; Leaf = l; Flower = f; Petal = p; stemLoc.setXY (sl.x, sl.y); //////////// add blur to SOME elements of the plant (petal and leaf ?) lines ////////// //p.blur = flowerBlur; //l.blur = leafBlur; //////////// //addBranchToList (b); getData(); } /////////////////////////////////////////// /// add a branch, and give it a number (arrayPosition) void addBranchToList (Attributes b_) { bCount ++; b_.arrayPosition = bCount; branchList.add (b_); } //////////////////////////////////// void addFlowerToList (Attributes f_) { fCount ++; f_.arrayPosition = fCount; flowerList.add (f_); } /////////////////////////////////////////// void getData ( ) { if (printdata) { dataOutput.println ("Plant Attributes"); dataOutput.println ("radius: " + radius); dataOutput.println ("_alpha: " + _alpha); dataOutput.println (); dataOutput.println ("decay: " + decay); dataOutput.println ("decayRate: " + decayRate); dataOutput.println ("unfurlSpeed: " + unfurlSpeed); dataOutput.println ("refurlRate: " + refurlRate); dataOutput.println (); dataOutput.println ("flowerBlur: " + flowerBlur); dataOutput.println ("leafBlur: " + leafBlur); dataOutput.println ("blurRate: " + blurRate); dataOutput.println ("blurAmount: " + blurAmount); dataOutput.println ("blurAlphaFraction: " + blurAlphaFraction); dataOutput.println (); dataOutput.println ("drawLines: " + drawLines); dataOutput.println (); dataOutput.println ("leafFollowParentColor: " + leafFollowParentColor); dataOutput.println ("flowerFollowParentColor: " + flowerFollowParentColor); dataOutput.println (); dataOutput.println ("leafGrowth: " + leafGrowth); dataOutput.println ("leafStart: " + leafStart); dataOutput.println ("flowerGrowth: " + flowerGrowth); dataOutput.println ("flowerStart: " + flowerStart); dataOutput.println ("flowerDeviation (min/max): " + flowerDev[0] + " : " + flowerDev[1]); dataOutput.println (); dataOutput.flush(); // Writes the remaining data to the file } } }