Fractal of the Sierpinski triangle

Source: Internet
Author: User

The serbinski triangle (Sierpinski triangle) is a kind of fractal. It was proposed by Polish mathematician shelbinski in 1915. It is a typical self-similar set. Some materials refer to it as sherbinski's grave.

The generation process is as follows:

    1. Take a solid triangle. (Most use equilateral triangles)
    2. Divide the line along the three sides into four small triangles.
    3. Remove the small triangle in the middle.
    4. Repeat 1 for the remaining three small triangles.

Core code:

static void SierpinskiTriangle(const Vector3& v1, const Vector3& v2, const Vector3& v3, Vector3* pVertices){    Vector3 v12 = (v1 + v2)*0.5f;    Vector3 v13 = (v1 + v3)*0.5f;    Vector3 v23 = (v2 + v3)*0.5f;    pVertices[0] = v1;    pVertices[1] = v12;    pVertices[2] = v13;    pVertices[3] = v2;    pVertices[4] = v23;    pVertices[5] = v12;    pVertices[6] = v3;    pVertices[7] = v13;    pVertices[8] = v23;}

Software: http://files.cnblogs.com/WhyEngine/Fractal.7z

 

Fractal of the Sierpinski triangle

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.