Example #1
0
    public void GenerateSection()
    {
        //Create a source line for each section.
        Vector3[] line = Patterns.Diagonal(numPointsPerLine);

        //This sets line to start at the end of the last line.
        //Vector3[] endpoints is filled with the endpoints of
        //the line generated each pass.
        if (!(endPoints == null))
        {
            for (int i = 0; i < line.Length; i++)
            {
                line[i] += endPoints[0];
            }
        }

        //branchPointBuffer is the number of points between each branch start point.
        branchPointBuffer = MakeBranchStartPoints(line); //divide line length by 2 NumBranchesPerTrunk times.

        //branchMatrix schema:    --------------------
        //rows are branches                     //
        //columns are points on the branch      //
        //--first column is the starting point--//

        //pass in an array of branch start points from the original line.
        //Get a matrix of all the branches at the positions of the original line.
        branchMatrix = MakeBranches(branchStartPoints, PointsPerBranch);

        //Each Vector3[] in List is a set of reflections for one branch on the trunk.
        branchMatrixList = GenerateBranchList(branchMatrix);


        sectionReflections = ReflectLine(line, NumLinesPerSection, numPointsPerLine);

        //Save value farthest from center.
        //There may be a case where the farthest point
        //differs from the endpoints.
        //List<Vector3> farthestPoints = new List<Vector3>();
        //farthestPoints = GetFarthestPoints(farthestPoints);

        //Save final value in each array.
        endPoints = new Vector3[NumLinesPerSection];
        endPoints = GetEndpoints(endPoints);

        MakeBoundaries(endPoints, sectionReflections);

        //GenerateBackground(endPoints);
    }