Physicists Code: ```cs float[] vertices = new float[3 * n]; for (uint i = 0

Physicists Code:
            float[] vertices = new float[3 * n];

            for (uint i = 0; i < n; i++)
            {
                float idx = (float)i + 0.5f;

                float ϕ = MathFs.Acos(1.0f - 2.0f * idx / (float)n);
                float ϑ = MathFs.PI * (1.0f + MathFs.Sqrt(5.0f)) * idx;

                vertices[3 * i + 0] = MathFs.Cos(ϑ) * MathFs.Sin(ϕ);
                vertices[3 * i + 1] = MathFs.Sin(ϑ) * MathFs.Sin(ϕ) + 1.0f; // Put 0 | 0 | 0 at the bottom instead of the centre
                vertices[3 * i + 2] = MathFs.Cos(ϕ);
            }

            return vertices;
Was this page helpful?