Fractal: serbinski (Sierpinski)

Source: Internet
Author: User

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)

Related Keywords:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.