Пример #1
0
        int _branchId; // Used to uniquely identify a token

        public LSystem()
        {
            _interpretor = new DrawerInterpretor();
            _systemData  = null;
            _root        = new List <Token>();
            _branchId    = 0;
        }
Пример #2
0
    void Start()
    {
        _systemDatas = new List <TestData>();

        {
            Oisif.LSystemData systemData = new Oisif.LSystemData("FX", new Oisif.SimpleValue(40.0f), 1.1f);
            systemData.AddRule(new Oisif.SimpleRule('X', ">[-FX]+FX"));
            _systemDatas.Add(new TestData(systemData, "A simple tree"));
        }

        {
            Oisif.LSystemData systemData = new Oisif.LSystemData("F", new Oisif.SimpleValue(22.5f), 2.3f);
            systemData.AddRule(new Oisif.SimpleRule('F', "GG+[+F-F-F]-[-F+F+F]"));
            _systemDatas.Add(new TestData(systemData, "A more complexe tree"));
        }

        {
            Oisif.LSystemData systemData = new Oisif.LSystemData("Y", new Oisif.SimpleValue(40.0f), 1.1f);
            List <Oisif.StochasticRule.RuleParam> ruleParams = new List <Oisif.StochasticRule.RuleParam>();
            ruleParams.Add(new Oisif.StochasticRule.RuleParam(0.5f, ">G[+F][-F]"));
            ruleParams.Add(new Oisif.StochasticRule.RuleParam(0.15f, ">G[+F]"));
            ruleParams.Add(new Oisif.StochasticRule.RuleParam(0.15f, ">G[-F]"));
            ruleParams.Add(new Oisif.StochasticRule.RuleParam(0.2f, "GC"));
            systemData.AddRule(new Oisif.StochasticRule('F', ruleParams));
            systemData.AddRule(new Oisif.SimpleRule('Y', ">G[+F][-F]"));
            _systemDatas.Add(new TestData(systemData, "A simple random tree"));
        }

        {
            Oisif.LSystemData systemData = new Oisif.LSystemData("Y", new Oisif.RangeValue(35.0f, 45.0f), 1.1f);
            List <Oisif.StochasticRule.RuleParam> ruleParams = new List <Oisif.StochasticRule.RuleParam>();
            ruleParams.Add(new Oisif.StochasticRule.RuleParam(0.6f, ">G[+F][F][-F]"));
            ruleParams.Add(new Oisif.StochasticRule.RuleParam(0.05f, ">G[+F]"));
            ruleParams.Add(new Oisif.StochasticRule.RuleParam(0.05f, ">G[-F]"));
            ruleParams.Add(new Oisif.StochasticRule.RuleParam(0.3f, "GC"));
            systemData.AddRule(new Oisif.StochasticRule('F', ruleParams));
            systemData.AddRule(new Oisif.SimpleRule('Y', ">G[+F][Y][-F]"));
            _systemDatas.Add(new TestData(systemData, "A more complexe random tree"));
        }

        _system      = new Oisif.LSystem();
        _system.Data = _systemDatas[_currentIndex].Data;
        _interpretor = new Oisif.DrawerInterpretor();
    }
Пример #3
0
 public TestData(Oisif.LSystemData data, string text)
 {
     Data = data;
     Text = text;
 }