Пример #1
0
        public void Generate_Cayley(int n, Vector3 startPoint, Vector3 vector)
        {
            if (n == 0)
            {
                return;
            }
            var endPoint = startPoint + vector;
            var line     = new Line(startPoint, endPoint);

            lines.Add(line);
            var points = SubDividLine.Generate(line, n, line.Length * .2f);

            pointList.Add(points);

            var cnt = Random.Range(2, 4);

            var v      = RandomRotate(vector);
            var q      = Quaternion.Euler(0, 180f / cnt, 0);
            var minLen = .5f;
            var maxLen = .8f;

            for (int i = 0; i < cnt; i++)
            {
                Generate_Cayley(n - 1, endPoint, v * Random.Range(minLen, maxLen));
                v = q * v;
            }
        }
Пример #2
0
        public void Test_SubDivid()
        {
            pointList.Clear();
            var points = SubDividLine.Generate(new Line(Vector3.zero, Vector3.up), 5, Random.Range(Amplify / 2, Amplify));

            pointList.Add(points);
        }