As mentioned above, the levy curve is generated by dividing a line segment into two lines with the same length and vertical lines. in addition, the fragtal dragon is also to turn a line segment into two lines with an angle of 90 degrees. this section shows that a line segment is constantly divided into two equal-length and non-fixed-angle line segments to generate a graph. this is like turning a line segment into an isosceles triangle. The original line segment is the bottom side of an isosceles triangle, and the new line segment is the waist side of an isosceles triangle. change the fragment graph by setting the angle of the bottom corner.
Core code:
static void FractalAngleC(const Vector3& vStart, const Vector3& vEnd, Vector3* pVertices, Yreal angle){ Vector3 vSub = vEnd - vStart; pVertices[0] = vStart; pVertices[2] = vEnd; Yreal alfa = atan2f(vSub.y, vSub.x); alfa += angle; Yreal l = D3DXVec3Length(&vSub)*0.5f/cosf(angle); pVertices[1].x = vStart.x + cosf(alfa)*l; pVertices[1].y = vStart.y + sinf(alfa)*l; pVertices[1].z = 0.0f;}
Software: http://files.cnblogs.com/WhyEngine/Fractal.7z
Fractal-C-line