/* (non-Javadoc)
         * @see net.sourceforge.arbaro.tree.TreeGenerator#makeTree(net.sourceforge.arbaro.export.Progress)
         */
        public override CS_Tree makeTree(Object progress)
        {
            CS_TreeImpl tree = new CS_TreeImpl(seed, csparams);

            tree.make(progress);

            return(tree);
        }
Example #2
0
        /**
         * Creates a new stem
         *
         * @param tr the tree object
         * @param params the general tree parameters
         * @param lparams the parameters for the stem level
         * @param parnt the parent stem, from wich the stems grows out
         * @param stlev the stem level
         * @param trf the base transformation of the stem
         * @param offs the offset of ste stem within the parent stem (0..1)
         */
        public CS_StemImpl(CS_TreeImpl tr, CS_StemImpl growsOutOf, int stlev,
                           DX_Transformation trf, float offs) /* offs=0 */
        {
            tree      = tr;
            stemlevel = stlev;
            transf    = trf;
            offset    = offs;

            if (growsOutOf != null)
            {
                if (growsOutOf.stemlevel < stemlevel)
                {
                    parent = growsOutOf;
                }
                else
                {
                    clonedFrom = growsOutOf;
                    parent     = growsOutOf.parent;
                }
            }

            par  = tree.csparams;
            lpar = par.getLevelParams(stemlevel);

            // initialize lists
            segments = new List <CS_SegmentImpl>(lpar.nCurveRes);

            if (lpar.nSegSplits > 0 || par._0BaseSplits > 0)
            {
                clones = new List <CS_StemImpl>();        // lpar.nSegSplits*lpar.nCurveRes+1);
            }

            if (stemlevel < par.Levels - 1)
            {
                CS_LevelParams lpar_1 = par.getLevelParams(lpar.level + 1);
                substems = new List <CS_StemImpl>(lpar_1.nBranches);
            }

            if (stemlevel == par.Levels - 1 && par.Leaves != 0)
            {
                leaves = new List <CS_LeafImpl>(Math.Abs(par.Leaves));
            }

            // inialize other variables
            leavesPerSegment = 0;
            splitCorrection  = 0;

            index = 0;         // substem number

            cloneIndex = new List <int>();
            pruneTest  = false;        // flag used for pruning

            //...
            maxPoint = new Vector3(-float.MaxValue, -float.MaxValue, -float.MaxValue);
            minPoint = new Vector3(float.MaxValue, float.MaxValue, float.MaxValue);
        }
Example #3
0
        /* offs=0 */
        /**
         * Creates a new stem
         *
         * @param tr the tree object
         * @param params the general tree parameters
         * @param lparams the parameters for the stem level
         * @param parnt the parent stem, from wich the stems grows out
         * @param stlev the stem level
         * @param trf the base transformation of the stem
         * @param offs the offset of ste stem within the parent stem (0..1)
         */
        public CS_StemImpl(CS_TreeImpl tr, CS_StemImpl growsOutOf, int stlev,
                DX_Transformation trf, float offs)
        {
            tree = tr;
                    stemlevel = stlev;
                    transf = trf;
                    offset = offs;

                    if (growsOutOf != null)
                    {
                        if (growsOutOf.stemlevel < stemlevel)
                            parent = growsOutOf;
                        else
                        {
                            clonedFrom = growsOutOf;
                            parent = growsOutOf.parent;
                        }
                    }

                    par = tree.csparams;
                    lpar = par.getLevelParams(stemlevel);

                    // initialize lists
                    segments = new List<CS_SegmentImpl>(lpar.nCurveRes);

                    if (lpar.nSegSplits > 0 || par._0BaseSplits > 0)
                    {
                        clones = new List<CS_StemImpl>(); // lpar.nSegSplits*lpar.nCurveRes+1);
                    }

                    if (stemlevel < par.Levels - 1)
                    {
                        CS_LevelParams lpar_1 = par.getLevelParams(lpar.level + 1);
                        substems = new List<CS_StemImpl>(lpar_1.nBranches);
                    }

                    if (stemlevel == par.Levels - 1 && par.Leaves != 0)
                    {
                        leaves = new List<CS_LeafImpl>(Math.Abs(par.Leaves));
                    }

                    // inialize other variables
                    leavesPerSegment = 0;
                    splitCorrection = 0;

                    index = 0; // substem number

                    cloneIndex = new List<int>();
                    pruneTest = false; // flag used for pruning

                    //...
                    maxPoint = new Vector3(-float.MaxValue, -float.MaxValue, -float.MaxValue);
                    minPoint = new Vector3(float.MaxValue, float.MaxValue, float.MaxValue);
        }
Example #4
0
 /**
  * Creates a new tree object copying the parameters
  * from an other tree
  *
  * @param other the other tree, from wich parameters are taken
  */
 public CS_TreeImpl(CS_TreeImpl other)
 {
     csparams = new CS_Params(other.csparams);
     trunks = new List<CS_StemImpl>();
 }
        /* (non-Javadoc)
         * @see net.sourceforge.arbaro.tree.TreeGenerator#makeTree(net.sourceforge.arbaro.export.Progress)
         */
        public override CS_Tree makeTree(Object progress)
        {
            CS_TreeImpl tree = new CS_TreeImpl(seed, csparams);
            tree.make(progress);

            return tree;
        }
Example #6
0
 /**
  * Creates a new tree object copying the parameters
  * from an other tree
  *
  * @param other the other tree, from wich parameters are taken
  */
 public CS_TreeImpl(CS_TreeImpl other)
 {
     csparams = new CS_Params(other.csparams);
     trunks   = new List <CS_StemImpl>();
 }