123456789101112131415161718192021222324252627282930313233 |
- /*
- * 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 Pflanze1 extends PflanzeImpl
- {
- Pflanze1(int Xstart, int Ystart, int Generation,int startLength)//30-50, Generations 3
- {
- super(Xstart,Ystart,Generation,startLength);
- DELTA = (float) ((Math.PI)/10);
- createLSystem();
- translateRules();
- }
- public void createLSystem()
- {
- grammar = new StochasticGrammar(axiom);
- grammar.addRule('F',"F[+F]F[-F]F", (float) 0.1); // add rule, and weight
- grammar.addRule('F',"F[+F]F", (float) 0.45);
- grammar.addRule('F',"F[-F]F", (float) 0.45);
- grammar.generateGrammar(generations);
- drawLength =(float) (startLength * Math.pow(0.6, (double) generations));
- }
- }
|