莱维C形曲线(Lévy C curve)是个自我相似的分形,最先由保罗·皮埃尔·莱维在1938年的论文Plane or Space Curves and Surfaces Consisting of Parts Similar to the Whole描述和观察。levy曲线分形是将一条线段不停地分形成两条长度相等且相互垂直的线段,而生成的.
levy分形的最后很像一个英文字母C,其核心分形代码如下:
static void FractalC(const Vector3& vStart, const Vector3& vEnd, Vector3* pVertices) { pVertices[0] = vStart; pVertices[3] = vEnd; pVertices[1].x = (vStart.x + vStart.y + vEnd.x - vEnd.y) / 2; pVertices[1].y = (vEnd.x + vEnd.y + vStart.y - vStart.x) / 2; pVertices[1].z = 0.0f; pVertices[2].x = pVertices[1].x; pVertices[2].y = pVertices[1].y; pVertices[2].z = 0.0f; }
下面帖上levy的各级分形图: