PermuteCuboid() private static method

private static PermuteCuboid ( Vector3 dirs, int offset, float x, float y, float z ) : int
dirs Vector3
offset int
x float
y float
z float
return int
Example #1
0
        public static void InitializeDirections()
        {
            float num = (1f + Mathf.Sqrt(5f)) / 2f;

            TreeAO.directions     = new Vector3[60];
            TreeAO.directions[0]  = new Vector3(0f, 1f, 3f * num);
            TreeAO.directions[1]  = new Vector3(0f, 1f, -3f * num);
            TreeAO.directions[2]  = new Vector3(0f, -1f, 3f * num);
            TreeAO.directions[3]  = new Vector3(0f, -1f, -3f * num);
            TreeAO.directions[4]  = new Vector3(1f, 3f * num, 0f);
            TreeAO.directions[5]  = new Vector3(1f, -3f * num, 0f);
            TreeAO.directions[6]  = new Vector3(-1f, 3f * num, 0f);
            TreeAO.directions[7]  = new Vector3(-1f, -3f * num, 0f);
            TreeAO.directions[8]  = new Vector3(3f * num, 0f, 1f);
            TreeAO.directions[9]  = new Vector3(3f * num, 0f, -1f);
            TreeAO.directions[10] = new Vector3(-3f * num, 0f, 1f);
            TreeAO.directions[11] = new Vector3(-3f * num, 0f, -1f);
            int offset = 12;

            offset = TreeAO.PermuteCuboid(TreeAO.directions, offset, 2f, 1f + 2f * num, num);
            offset = TreeAO.PermuteCuboid(TreeAO.directions, offset, 1f + 2f * num, num, 2f);
            offset = TreeAO.PermuteCuboid(TreeAO.directions, offset, num, 2f, 1f + 2f * num);
            offset = TreeAO.PermuteCuboid(TreeAO.directions, offset, 1f, 2f + num, 2f * num);
            offset = TreeAO.PermuteCuboid(TreeAO.directions, offset, 2f + num, 2f * num, 1f);
            offset = TreeAO.PermuteCuboid(TreeAO.directions, offset, 2f * num, 1f, 2f + num);
            for (int i = 0; i < TreeAO.directions.Length; i++)
            {
                TreeAO.directions[i] = TreeAO.directions[i].normalized;
            }
        }
Example #2
0
        public static void InitializeDirections()
        {
            float num = (float)((1.0 + (double)Mathf.Sqrt(5f)) / 2.0);

            TreeAO.directions     = new Vector3[60];
            TreeAO.directions[0]  = new Vector3(0.0f, 1f, 3f * num);
            TreeAO.directions[1]  = new Vector3(0.0f, 1f, -3f * num);
            TreeAO.directions[2]  = new Vector3(0.0f, -1f, 3f * num);
            TreeAO.directions[3]  = new Vector3(0.0f, -1f, -3f * num);
            TreeAO.directions[4]  = new Vector3(1f, 3f * num, 0.0f);
            TreeAO.directions[5]  = new Vector3(1f, -3f * num, 0.0f);
            TreeAO.directions[6]  = new Vector3(-1f, 3f * num, 0.0f);
            TreeAO.directions[7]  = new Vector3(-1f, -3f * num, 0.0f);
            TreeAO.directions[8]  = new Vector3(3f * num, 0.0f, 1f);
            TreeAO.directions[9]  = new Vector3(3f * num, 0.0f, -1f);
            TreeAO.directions[10] = new Vector3(-3f * num, 0.0f, 1f);
            TreeAO.directions[11] = new Vector3(-3f * num, 0.0f, -1f);
            int offset1 = 12;
            int offset2 = TreeAO.PermuteCuboid(TreeAO.directions, offset1, 2f, (float)(1.0 + 2.0 * (double)num), num);
            int offset3 = TreeAO.PermuteCuboid(TreeAO.directions, offset2, (float)(1.0 + 2.0 * (double)num), num, 2f);
            int offset4 = TreeAO.PermuteCuboid(TreeAO.directions, offset3, num, 2f, (float)(1.0 + 2.0 * (double)num));
            int offset5 = TreeAO.PermuteCuboid(TreeAO.directions, offset4, 1f, 2f + num, 2f * num);
            int offset6 = TreeAO.PermuteCuboid(TreeAO.directions, offset5, 2f + num, 2f * num, 1f);

            TreeAO.PermuteCuboid(TreeAO.directions, offset6, 2f * num, 1f, 2f + num);
            for (int index = 0; index < TreeAO.directions.Length; ++index)
            {
                TreeAO.directions[index] = TreeAO.directions[index].normalized;
            }
        }