You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Pflanze1.java 907B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package garten.model;
  7. /**
  8. *
  9. * @author Jan
  10. */
  11. import lsystem.StochasticGrammar;
  12. class Pflanze1 extends PflanzeImpl
  13. {
  14. Pflanze1(int Xstart, int Ystart, int Generation,int startLength)//30-50, Generations 3
  15. {
  16. super(Xstart,Ystart,Generation,startLength);
  17. DELTA = (float) ((Math.PI)/10);
  18. createLSystem();
  19. translateRules();
  20. }
  21. public void createLSystem()
  22. {
  23. grammar = new StochasticGrammar(axiom);
  24. grammar.addRule('F',"F[+F]F[-F]F", (float) 0.1); // add rule, and weight
  25. grammar.addRule('F',"F[+F]F", (float) 0.45);
  26. grammar.addRule('F',"F[-F]F", (float) 0.45);
  27. grammar.generateGrammar(generations);
  28. drawLength =(float) (startLength * Math.pow(0.6, (double) generations));
  29. }
  30. }