Split triangle)

Source: Internet
Author: User

As mentioned above, the serbinski triangle keeps splitting a triangle into three similar triangles. The figure shown in this section is to constantly split two triangles with the same waist and blind angle.

Core code:

static void SplitTriangle(const Vector3& v1, const Vector3& v2, const Vector3& v3, Yreal angle, Vector3* pVertices){    Vector3 dir12 = v1 - v2;    Yreal len12 = D3DXVec3Length(&dir12);    //Vector3 dir13 = v1 - v3;    //Yreal len13 = D3DXVec3Length(&dir13);    Vector3 dir23 = v2 - v3;    Yreal len23 = D3DXVec3Length(&dir23);    dir23 /= len23;    Yreal len = len12*0.5f/cosf(angle);    pVertices[0] = v2 - dir23*len;    pVertices[1] = v1;    pVertices[2] = v2;    pVertices[3] = v3 + dir23*len;    pVertices[4] = v3;    pVertices[5] = v1;}

Software:

Since the triangle is an empty triangle, you can set its bottom angle.

When the bottom angle is 45 degrees and the right triangle is an isosceles triangle, the following grid shape is generated:

When its base angle is 30 degrees, its image will be transformed into a Koch curve. For details, see: Koch snowflake

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

split 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.