/// <summary>
        /// Create a Sierpiński triangle-based pyramid
        /// </summary>
        /// <param name="numSubdivisions">Subdivisions in the Sierpiński triangle on each side</param>
        public Sierpinski(int numSubdivisions = 1)
        {
            int NumTris = (int)Math.Pow(4, numSubdivisions + 1);

            VertCount      = NumTris;
            ColorDataCount = NumTris;
            IndiceCount    = 3 * NumTris;

            Tetra twhole = new Tetra(new Vector3(0.0f, 0.0f, 1.0f),         // Apex center
                                     new Vector3(0.943f, 0.0f, -0.333f),    // Base center top
                                     new Vector3(-0.471f, 0.816f, -0.333f), // Base left bottom
                                     new Vector3(-0.471f, -0.816f, -0.333f));

            List <Tetra> allTets = twhole.Divide(numSubdivisions);

            int offset = 0;

            foreach (Tetra t in allTets)
            {
                verts.AddRange(t.GetVerts());
                indices.AddRange(t.GetIndices(offset * 4));
                colors.AddRange(t.GetColorData());
                offset++;
            }
        }
        public List <Tetra> Divide(int n = 0)
        {
            if (n == 0)
            {
                return(new List <Tetra>(new Tetra[] { this }));
            }
            else
            {
                Vector3 halfa = (PointApex + PointA) / 2.0f;
                Vector3 halfb = (PointApex + PointB) / 2.0f;
                Vector3 halfc = (PointApex + PointC) / 2.0f;

                // Calculate points half way between base points
                Vector3 halfab = (PointA + PointB) / 2.0f;
                Vector3 halfbc = (PointB + PointC) / 2.0f;
                Vector3 halfac = (PointA + PointC) / 2.0f;

                Tetra t1 = new Tetra(PointApex, halfa, halfb, halfc);
                Tetra t2 = new Tetra(halfa, PointA, halfab, halfac);
                Tetra t3 = new Tetra(halfb, halfab, PointB, halfbc);
                Tetra t4 = new Tetra(halfc, halfac, halfbc, PointC);

                List <Tetra> output = new List <Tetra>();

                output.AddRange(t1.Divide(n - 1));
                output.AddRange(t2.Divide(n - 1));
                output.AddRange(t3.Divide(n - 1));
                output.AddRange(t4.Divide(n - 1));

                return(output);
            }
        }
        public List<Tetra> Divide(int n = 0)
        {
            if (n == 0)
            {
                return new List<Tetra>(new Tetra[] { this });
            }
            else
            {

                Vector3 halfa = (PointApex + PointA) / 2.0f;
                Vector3 halfb = (PointApex + PointB) / 2.0f;
                Vector3 halfc = (PointApex + PointC) / 2.0f;

                // Calculate points half way between base points
                Vector3 halfab = (PointA + PointB) / 2.0f;
                Vector3 halfbc = (PointB + PointC) / 2.0f;
                Vector3 halfac = (PointA + PointC) / 2.0f;

                Tetra t1 = new Tetra(PointApex, halfa, halfb, halfc);
                Tetra t2 = new Tetra(halfa, PointA, halfab, halfac);
                Tetra t3 = new Tetra(halfb, halfab, PointB, halfbc);
                Tetra t4 = new Tetra(halfc, halfac, halfbc, PointC);

                List<Tetra> output = new List<Tetra>();

                output.AddRange(t1.Divide(n - 1));
                output.AddRange(t2.Divide(n - 1));
                output.AddRange(t3.Divide(n - 1));
                output.AddRange(t4.Divide(n - 1));

                return output;

            }
        }
        /// <summary>
        /// Create a Sierpiński triangle-based pyramid
        /// </summary>
        /// <param name="numSubdivisions">Subdivisions in the Sierpiński triangle on each side</param>
        public Sierpinski(int numSubdivisions = 1)
        {
            int NumTris = (int)Math.Pow(4, numSubdivisions + 1);

            VertCount = NumTris;
            ColorDataCount = NumTris;
            IndiceCount = 3 * NumTris;

            Tetra twhole = new Tetra(new Vector3(0.0f, 0.0f, 1.0f),  // Apex center
                            new Vector3(0.943f, 0.0f, -0.333f),  // Base center top
                            new Vector3(-0.471f, 0.816f, -0.333f),  // Base left bottom
                            new Vector3(-0.471f, -0.816f, -0.333f));

            List<Tetra> allTets = twhole.Divide(numSubdivisions);

            int offset = 0;
            foreach (Tetra t in allTets)
            {
                verts.AddRange(t.GetVerts());
                indices.AddRange(t.GetIndices(offset * 4));
                colors.AddRange(t.GetColorData());
                offset++;
            }
        }