12345678910111213141516171819202122232425262728293031323334 |
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-
- package garten.model;
-
- /**
- *
- * @author Jan
- */
- import lsystem.StochasticGrammar;
-
- class Pflanze2 extends PflanzeImpl
- {
- Pflanze2(int Xstart, int Ystart, int Generation,int startLength)//startLength 10-20 (Verzweigte Pflanze)3 Generationen
- {
- super(Xstart,Ystart,Generation,startLength);
- DELTA = (float) ((Math.PI)/5);
- createLSystem();
- translateRules();
- }
-
- public void createLSystem()
- {
- grammar = new StochasticGrammar(axiom);
- grammar.addRule('F',"F[+FF][-FF]F[-F][+F]F",(float) 0.1); // add rule, and weight
- grammar.addRule('F',"F[+FF][-FF]F[+F][+F]F",(float) 0.3);
- grammar.addRule('F',"F[+F][+FF]F[+F][-F]F",(float) 0.2);
- grammar.generateGrammar(generations);
- drawLength = (float) (startLength * Math.pow(0.6, (double) generations));
- }
- }
|