又好久没有写项目了,初三了,可能会停更一些时间
这次再写一些opengl
的东西吧
这次是Julia
子集哦:
uses gl,glu,glut;
var
cr,cv:real;
procedure display;cdecl;
var
x,y,t:longint;
xx,yy,tt,xxx,yyy:real;
begin
glclearcolor(0,0,0,0);
glclear(gl_color_buffer_bit);
glcolor3f(1,1,1);
glbegin(gl_points);
for x:=-300 to 300 do
for y:=-300 to 300 do
begin
xx:=x/300;
yy:=y/300;
xxx:=xx;
yyy:=yy;
//writeln('xx=',xx,' yy=',yy);
for t:=1 to 10 do
begin
tt:=xx;
xx:=xx*xx-yy*yy+cr;
yy:=2*tt*yy+cv;
end;
//writeln('xx=',xx,' yy=',yy);
if xx>1 then
continue;
if xx<-1 then
continue;
if yy>1 then
continue;
if yy<-1 then
continue;
glvertex2f(xxx,yyy);
end;
glend;
glflush;
glutswapbuffers;
end;
procedure idle;cdecl;
begin
//cr:=cr+0.005;
//if cr>1 then
// halt;
glutpostredisplay;
//writeln('idled');
end;
begin
cr:=-0.4;
cv:=-0.6;
glutinit(@argc,argv);
glutinitdisplaymode(glut_double or glut_rgb);
glutinitwindowsize(600,600);
glutinitwindowposition(100,100);
glutcreatewindow('x:=x^2+c');
glutdisplayfunc(@display);
glutidlefunc(@idle);
glutmainloop;
end.
定义,对于复数x
,进行若干次(无数次),x:=x^2+c
的操作后收敛的点的集合
注意c
也是一个复数哦:cr
是实部,cv
是虚部