分形之闵可夫斯基(Minkowski)

      与上一篇文章分形之正方形折线相似,闵可夫斯基分形也是分形出正方体,不同之处是它分出了两个正方体。

核心代码:

static void FractalMinkowski(const Vector3& vStart, const Vector3& vEnd, Vector3* pVertices)
{
    Vector3 vSub = vEnd - vStart;
    Yreal len = D3DXVec3Length(&vSub);

pVertices[0] = vStart; pVertices[8] = vEnd; pVertices[4] = (vStart + vEnd)*0.5f; pVertices[1] = vStart + vSub*0.25f; pVertices[7] = vStart + vSub*0.75f; Vector3 v(-vSub.y*0.25f, vSub.x*0.25f, 0.0f); pVertices[2] = pVertices[1] + v; pVertices[3] = pVertices[4] + v; pVertices[5] = pVertices[4] - v; pVertices[6] = pVertices[7] - v; }

软件截图:

软件下载地址:https://files.cnblogs.com/WhyEngine/Fractal.7z

posted on 2014-10-18 07:02  叶飞影  阅读(3205)  评论(0编辑  收藏  举报