首页 > 代码库 > 分形之皇冠(Crown)
分形之皇冠(Crown)
皇冠分形曲线
核心代码:
static void FractalCrown(const Vector3& vStart, const Vector3& vEnd, Vector3* pVertices){ Vector3 vSub = vEnd - vStart; Yreal len = D3DXVec3Length(&vSub); pVertices[0] = vStart; pVertices[6] = vEnd; Yreal alfa = atan2f(vSub.y, vSub.x); Yreal a0 = alfa - YD_REAL_PI/6; Yreal a1 = alfa + YD_REAL_PI/6; Yreal l = len/3/cosf(YD_REAL_PI/6); pVertices[1].x = vStart.x + cosf(a0)*l; pVertices[1].y = vStart.y + sinf(a0)*l; pVertices[1].z = 0.0f; pVertices[2].x = vStart.x + cosf(a1)*l; pVertices[2].y = vStart.y + sinf(a1)*l; pVertices[2].z = 0.0f; pVertices[4].x = vEnd.x - cosf(a0)*l; pVertices[4].y = vEnd.y - sinf(a0)*l; pVertices[4].z = 0.0f; pVertices[5].x = vEnd.x - cosf(a1)*l; pVertices[5].y = vEnd.y - sinf(a1)*l; pVertices[5].z = 0.0f; pVertices[3] = (vStart + vEnd + pVertices[1] + pVertices[5])*0.25f;}
软件截图:
软件下载地址:http://files.cnblogs.com/WhyEngine/Fractal.7z
分形之皇冠(Crown)
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。