We have discussed the serbinski triangle. In this section, we will extend the two-dimensional triangle to three-dimensional triangle and change it into a triangle. A positive still keeps being split. Each positive still can be split into four small ones. it is a lot of trouble to transform from two-dimensional to three-dimensional. The three-dimensional serbinski still looks more like a grave than the serbinski triangle.
Core code:
static void SierpinskiTetrahedron(const Vector3* pSrc, Vector3* pDest){ Vector3 v01 = (pSrc[0] + pSrc[1])*0.5f; Vector3 v02 = (pSrc[0] + pSrc[2])*0.5f; Vector3 v03 = (pSrc[0] + pSrc[3])*0.5f; Vector3 v12 = (pSrc[1] + pSrc[2])*0.5f; Vector3 v13 = (pSrc[1] + pSrc[3])*0.5f; Vector3 v23 = (pSrc[2] + pSrc[3])*0.5f; pDest[0] = pSrc[0]; pDest[1] = v01; pDest[2] = v02; pDest[3] = v03; pDest[4] = pSrc[1]; pDest[5] = v01; pDest[6] = v12; pDest[7] = v13; pDest[8] = pSrc[2]; pDest[9] = v02; pDest[10] = v12; pDest[11] = v23; pDest[12] = pSrc[3]; pDest[13] = v03; pDest[14] = v13; pDest[15] = v23;}
Software: http://files.cnblogs.com/WhyEngine/Fractal.7z
Fractal: serbinski (Sierpinski)