首页 > 装修攻略 > 谢尔宾斯基地毯是什么 谢尔宾斯基地毯图

谢尔宾斯基地毯是什么 谢尔宾斯基地毯图

2024-05-03

导读:【谢尔宾斯基地毯是什么 谢尔宾斯基地毯图】谢尔宾斯基地毯是数学家谢尔宾斯基提出的一个分形图形. 谢尔宾斯基地毯和谢尔宾斯基三角形基本类似,不同之处在于谢尔宾斯基地毯采用的是正方形进行分形构造,而谢尔宾斯基三角形采用的等边三角形进行分形构造.谢尔 ...

谢尔宾斯基地毯是数学家谢尔宾斯基提出的一个分形图形[1]. 谢尔宾斯基地毯和谢尔宾斯基三角形基本类似, 不同之处在于谢尔宾斯基地毯采用的是正方形进行分形构造, 而谢尔宾斯基三角形采用的等边三角形进行分形构造.谢尔宾斯基地毯是由瓦茨瓦夫·谢尔宾斯基于1916年提出的一种分形,是自相似集的一种。它的豪斯多夫维是 log 8/log 3 ≈ 1.8928。门格海绵是它在三维空间中的推广。下面一起网的小编给大家介绍一下。

谢尔宾斯基地毯是什么 谢尔宾斯基地毯图

构造

谢尔宾斯基地毯的构造与谢尔宾斯基三角形相似,区别仅在于谢尔宾斯基地毯是以正方形而非等边三角形为基础的。将一个实心正方形划分为的9个小正方形,去掉中间的小正方形,再对余下的小正方形重复这一操作便能得到谢尔宾斯基地毯。如下图谢尔宾斯基地毯可以由以下计算机程序构造:

/**

Decides if a point at a specific location is filled or not.

@param x is the x coordinate of the point being checked@param y is the y coordinate of the point being checked@param width is the width of the Sierpinski Carpet being checked@param height is the height of the Sierpinski Carpet being checked@return 1 if it is to be filled or 0 if it is not*/ int isSierpinskiCarpetPixelFilled(int x,int y,int width,int height){// base case

if (x<1)

{

return 0;

}

// general case

{

/*

If the grid was split in 9 parts, what part(x2,y2) would x,y fit into?

*/

int x2 = x*3/width; // an integer from 0..2 inclusiveint y2 = y*3/height; // an integer from 0..2 inclusiveif (x2==1 && y2==1) // if in the centre squaure, it should be filled.

return 1;

/* offset x and y so it becomes bounded by 0..width/3 and 0..height/3and prepares for recursive call*/

x-=x2*width/3;

y-=y2*height/3;

}

return isSierpinskiCarpetPixelFilled(x,y,width/3,height/3);} 全国业主装修交流群:573032185

听了小编的介绍你是否有了了解呢,以上是小编提供给大家的关于谢尔宾斯基地毯的内容,希望能对大家有所帮助。如果想了解更多的信息,请多多关注一起装修网,一起装修网将给大家提供更全、更详细、更新的资讯信息。