2013-03-26 79 views
1

我做学校的一个项目,需要大致重现此分(在BGI):这个分形的逻辑是什么?

enter image description here

我坚持试图找到一个中等大小的三角形放置逻辑,因为他们有被拉入for/while循环。 (我画了主要三角形和它的每一面上有一个圆圈。)

任何想法都赞赏!

+0

鉴于左侧的几个随机点,看起来依稀基于一个迭代函数系统 – 2013-03-26 07:43:27

+0

它看起来像系数稍有不妥,因为它_almost_具有D3对称性。 – 2013-03-26 07:44:37

+0

除非有人发现像这样的逆向工程分形的一般方法,恐怕这个问题是_too localised_。 – 2013-03-26 07:46:54

回答

0

绝对是IFS。 IFS分形使用递归。它就像一个树形结构,每个分支都可以有侧分支,而这些分支又可以有自己较小的侧分支。在(C类),伪它看起来是这样的:

draw_triangle(vector2d pos, float scale, int depth) 
{ 
    if (depth < MAX_DEPTH) return; 

    /* actual graphics code for the triangle goes here.. use pos and scale */ 

    /* compute center positions for circles side1_pos, side2_pos, etc... */ 

    draw_circle(side1_pos, 0.5*scale, depth+1); 
    draw_circle(side2_pos, 0.5*scale, depth+1); 
    draw_circle(side3_pos, 0.5*scale, depth+1); 
} 

draw_circle(vector2d pos, float scale, int depth) 
{ 
    if (depth < MAX_DEPTH) return; 
    /* actual graphics code for the circle goes here.. use pos and scale */ 

    /* compute center positions for triangles side1_pos, side2_pos, etc... */ 

    draw_triangle(side1_pos, 0.5*scale, depth+1); 
    draw_triangle(side2_pos, 0.5*scale, depth+1); 
    draw_triangle(side3_pos, 0.5*scale, depth+1); 
}