コード例 #1
0
ファイル: Tree7.cs プロジェクト: miiaremahl/Lsystem
    //creates a tree by calling the general tree class
    private void createTree()
    {
        //rules for F (33.33~ change of choosing the rule)
        string[] fRules = { "F[+F]F[-F]F", "F[+F]F", "F[-F]F" };

        //rules
        rules = new Dictionary <char, string[]>
        {
            { 'F', fRules }
        };

        //start
        start = "F";

        //create tree with generic tree class
        tree.CreateTree(rules, start, iterations, length, angle, iterationMax);
    }
コード例 #2
0
ファイル: Tree8.cs プロジェクト: miiaremahl/Lsystem
    //creates a tree by calling the general tree class
    private void createTree()
    {
        //rules for V
        string[] vRules = { "[+++W][---W]YV" };

        //rules for W
        string[] wRules = { "+X[-W]Z" };

        //rules for X
        string[] xRules = { "-W[+X]Z" };

        //rules for Y
        string[] yRules = { "YZ" };

        //rules for Z
        string[] zRules = { "[-FFF][+FFF]F" };

        //rules
        rules = new Dictionary <char, string[]>
        {
            { 'V', vRules },
            { 'W', wRules },
            { 'X', xRules },
            { 'Y', yRules },
            { 'Z', zRules },
        };

        //set max iterations
        iterationMax = 11;

        //start
        start = "VZFFF";

        //create tree with generic tree class
        tree.CreateTree(rules, start, iterations, length, angle, iterationMax);
    }