R- функция усули (rfm)да шаклларни чизиш дастурлари


Download 119.74 Kb.
Sana12.12.2020
Hajmi119.74 Kb.
#165446
Bog'liq
Maruza №11

ФАН: Фракталлар назарияси ва фрактал графика


Ўқитувчи: техника фанлари доктори, АВТ кафедраси профессори

Шаҳзода Анарова Аманбаевна

R- функция усули (RFM)да шаклларни

чизиш дастурлари

Режа:

  • Тўғри тўртбурчакли шаклларни чизиш дастурлари;
  • Бурчаклик, тавр, қўштавр ва зетаврлар шаклларини чизиш дастурлари;
  • Варраксимон шаклларни чизиш дастурлари.

Function Krug(x,y:real):boolean;

const RR=1.0;

Begin

Krug:=false;

Krug:=(SQR(RR)-SQR(X)-SQR(Y))>=0;

End;

Function TURT(x,y:real):boolean;

var p1,p2:boolean; a,b:real;

begin

b:=1; a:=2*b; TURT:=false;

p1:=sqr(a)-sqr(x)>=0; p2:=sqr(b)-sqr(y)>=0;

TURT:=(p1 and p2);

End;

Function vosmVirez(x,y:real):boolean;

var f1,f2,f3,f4,f5,f6,f7,f8,f9:boolean; a,alfa,r1,r2:real;

begin

vosmVirez:=false;

alfa:=pi/8; r1:=1; r2:=2*r1*sin(alfa/2); a:=r1/sqrt(2);

f1:=sqr(r1)-sqr(x)-sqr(y)>=0; f2:=sqr(x-r1)+sqr(y)-sqr(r2)>=0;

f3:=sqr(x+r1)+sqr(y)-sqr(r2)>=0; f4:=sqr(x)+sqr(y-r1)-sqr(r2)>=0;

f5:=sqr(x)+sqr(y+r1)-sqr(r2)>=0; f6:=sqr(x-a)+sqr(y-a)-sqr(r2)>=0;

f7:=sqr(x+a)+sqr(y+a)-sqr(r2)>=0; f8:=sqr(x+a)+sqr(y-a)-sqr(r2)>=0;

f9:=sqr(x-a)+sqr(y+a)-sqr(r2)>=0;

vosmVirez:= f1 and (((f2 and f3) and (f4 and f5)) and ((f6 and f7) and (f8 and f9)));

End;

Function tavr(x,y:real):boolean;

const a0=0.1; b0=0.1; a1=0.4; b1=0.6; y0=0.5;

var f1,f2,f3,f4 {,w1,w2,w}:boolean;

begin

tavr:=false;

f1:=sqr(a1)-sqr(x)>=0; f2:=sqr(b0)-sqr(y-y0)>=0;

(* w1:=f1 and f2;*)

f3:=sqr(a0)-sqr(x)>=0; f4:=sqr(b1)-sqr(y)>=0;

( *w2:=f3 and f4; w:=w1 or w2 ;*)

(*w*) tavr:=(f1 and f2) or (f3 and f4);

End;

Function Qo’shtavr(x,y:real):boolean;

const a0=0.1;b0=0.1{6};a1=0.4;b1=0.6{1};y0=0.5;

var f1,f2,f3,f4,f5,f6:boolean; x0:real;

begin

Qo’shtavr:=false;

f1:=sqr(a1)-sqr(x)>=0; f2:=sqr(b0{1})-sqr(y-y0)>=0;

f3:=sqr(a0)-sqr(x)>=0; f4:=sqr(b1{a1}{0})-sqr(y)>=0;

f5:=sqr(a1)-sqr(x)>=0; f6:=sqr(b0{1})-sqr(y+y0)>=0;

Qo’shtavr:=((f1 and f2) or (f3 and f4) or (f5 and f6));

End;

Function zetavr (x,y:real):boolean;

const a0=0.1;b0=0.1;a1=0.4;b1=0.6; x1=0.1;y1=0.1;x2=0.1;y2=0.1;

var f1,f2,f3,f4,f5,f6:boolean; x0:real;

begin

zetavr:=false;

f1:=(sqr(a0)-sqr(x))>=0; f2:=(sqr(b1)-sqr(y))>=0;

(*f1:=(sqr(0.25{a1})-sqr(x+0.15{x1}))>=0;

f2:=(sqr(0.1{b1})-sqr(y-0.5{y1}))>=0;*)

f3:=(a1+x)*(a0-x)>=0; f4:=(b1-y)*(y-a1)>=0;

(* f1:=(sqr(a1)-sqr(x-x2))>=0; f2:=(sqr(b1)-sqr(y+y2))>=0;*)

f5:=(a0+x)*(a1-x)>=0; f6:=-(a1+y)*(b1+y)>=0;

zetavr:=((f1 and f2) or (f3 and f4)) or (f5 and f6);

End;

Function ugl(x,y:real):boolean;

const

a0=0.1;b0=0.5;a1=0.4;b1=0.1;y0=0.5; var f1,f2,f3,f4,f5,f6:boolean; x0:real;

begin

ugl:=false;

f1:=sqr(a0)-sqr(x)>=0; f2:=sqr(b0)-sqr(y)>=0;

f3:=(a0+(-x))*(a1-(-x))>=0; f4:=(b0+y)*(b1-y)>=0;

ugl:=(f1 or f2) and (f3 and f4);

(* f3:=b1-y>=0; f4:=b0+y>=0; f5:=a1-(-x)>=0;f6:=a0+(-x)>=0;

ugl:=(f1 or f2) and ((f3 and f4) and (f5 and f6));*)

End;

Function varo(x,y:real):boolean;

var f1,f2,f3,f4,f5,f6,f7, f8,f9,f10,w1,w2,w3,w4,w5,w:boolean; a,b,a1,b1,c,d:real;

begin

a:=1.0; b:=0.20; {max 0.9} a1:=a/10; b1:=b/10; c:=a+a1; d:=b+b1; varo:=false;

f1:=(sqr(b*c)-sqr(a1*y+b*x))>=0; f2:=(sqr(a*d)-sqr(a*y-b1*x))>=0;

f3:=-x>=0; f4:=b-y>=0; f5:=y>=0; f6:=a-x>=0;

f7:=x>=0; f8:=y+b>=0; f9:=-y>=0; f10:=x+a>=0;

 

w1:= (f1 and f2);{kvadrat} w2:= (f3 or f4);{verh treug}

w3:= (f5 or f6);{prav treug} w4:= (f7 or f8);{nign treug}

w5:= (f9 or f10);{lev treug}

  w:=(((w1 and w2) and w3) and w4) and w5;

varo:=w;

end;{varo}


y

z

b

-b

-a

a

a2

b2

c=a+a2

d=b+b2

Function vara(x,y:real):boolean;

var f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,fa,w1,w2,w3,w4,w5,w:boolean;a,b,a1,b1,c,d,r:real;

begin

a:=1.020; b:=0.2020; {max 0.9} a1:=a/10; b1:=b/10; c:=a+a1; d:=b+b1; r:=sqrt(sqr(a)+sqr(b))/10{b/10.0};

  vara:=false;

f1:=(sqr(b*c)-sqr(a1*y+b*x))>=0; f2:=(sqr(a*d)-sqr(a*y-b1*x))>=0;

  fa:=(sqr(x)+sqr(y)-sqr(r))>=0; f3:=-x>=0; f4:=b-y>=0; f5:=y>=0; f6:=a-x>=0;

f7:=x>=0; f8:=y+b>=0; f9:=-y>=0; f10:=x+a>=0;

  w1:= (f1 and f2);{kvadrat} w2:= (f3 or f4);{verh treug}

w3:= (f5 or f6);{prav treug} w4:= (f7 or f8);{nign treug}

w5:= (f9 or f10);{lev treug}  

w:=((((w1 and w2) and w3) and w4) and w5 and fa);

vara:=w; end;{vara}


z

-b

-a

Function vare(x,y:real):boolean;

var f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,fe,w1,w2,w3,w4,w5,w:boolean; a0,b0,a,b,a1,b1,c,d:real;

begin

a:=1.0; b:=1.0; {max 0.9} a0:=b/5.0; b0:=b/10.0; a1:=a/10; b1:=b/10; c:=a+a1; d:=b+b1;

vare:=false;

f1:=(sqr(b*c)-sqr(a1*y+b*x))>=0; f2:=(sqr(a*d)-sqr(a*y-b1*x))>=0;

fe:=sqr(x/a0)+sqr(y/b0)-1>=0; f3:=-x>=0; f4:=b-y>=0; f5:=y>=0;

f6:=a-x>=0; f7:=x>=0; f8:=y+b>=0; f9:=-y>=0; f10:=x+a>=0;

w1:= (f1 and f2);{kvadrat} w2:= (f3 or f4);{verh treug}

w3:= (f5 or f6);{prav treug} w4:= (f7 or f8);{nign treug}

w5:= (f9 or f10);{lev treug}

w:=((((w1 and w2) and w3) and w4) and w5 and fe);

vare:=w; end;{vare}


z

-b

-a

a

Function vart(x,y:real):boolean;

var f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,fk,fkk,w0,w1,w2,w3,w4,w5,w:boolean; a0,b0,a,b,a1,b1,c,d:real;

begin

a:=0.90; b:=0.90;{max 0.9} a0:=a/10.0; b0:=b/10.0; a1:=a/10; b1:=b/10;

c:=a+a1; d:=b+b1; vart:=false;

f1:=(sqr(b*c)-sqr(a1*y+b*x))>=0; f2:=(sqr(a*d)-sqr(a*y-b1*x))>=0;

fk:=sqr(x)-sqr(a0)>=0; fkk:=sqr(y)-sqr(b0)>=0;

f3:=-x>=0; f4:=b-y>=0; f5:=y>=0; f6:=a-x>=0;

f7:=x>=0; f8:=y+b>=0; f9:=-y>=0; f10:=x+a>=0;

w0:= (fk or fkk); {ich kv} w1:= (f1 and f2);{kvadrat}

w2:= (f3 or f4);{verh treug} w3:= (f5 or f6);{prav treug}

w4:= (f7 or f8);{nign treug} w5:= (f9 or f10);{lev treug}

w:=((((w1 and w2) and w3) and w4) and w5 and w0);

vart:=w; end;{vart}


z

-b

-a

a

function Mnogug;

var xi,yi:arr; fi:array[1..6] of boolean; i:integer;

begin

xi[1]:=1.0;xi[2]:=0.0;xi[3]:=-1.0;xi[4]:=-1.0;

xi[5]:=0.0;xi[6]:=1.0;xi[7]:=1.0;

yi[1]:=0.5;yi[2]:=1.0;yi[3]:=0.5;yi[4]:=-0.5;

yi[5]:=-1.0;yi[6]:=-0.5;yi[7]:=0.5;

for i:=1 to 6 do

fi[i]:=-x*(yi[i+1]-yi[i])+y*(xi[i+1]-xi[i])+xi[i]*yi[i+1]-xi[i+1]*yi[i]>=0;

mnogug:=(fi[1] and fi[2] and fi[3] and fi[4] and fi[5] and fi[6]);

end;

Function TAQA(x,y:real):boolean;

var p1,p2,p3:boolean;r1,r2:real;

begin

r1:=1.0;r2:=0.5;taqa:=false; p1:=sqr(r1)-sqr(x)-sqr(y)>=0;

p2:=sqr(x)+sqr(y)-sqr(r2)>=0; p3:=y>0;

taqa:=(p1 and p2) and p3;

End;

Function KOLSO(x,y:real):boolean;

var p1,p2:boolean; r1,r2:real;

begin

r1:=Radius1;r2:=Radius2;kolso:=false;

p1:=sqr(r1)-sqr(x)-sqr(y)>=0; p2:=sqr(x)+sqr(y)-sqr(r2)>=0;

kolso:=p1 and p2

End;

Function krest1(x,y:real):boolean;

var r1,r2:real;w1,w2,w3,w4,w5,w6,w7,w8,w9:boolean;

begin r1:=0.75;r2:=0.35;krest11:=false;

w1:=(sqr(r1)-sqr(x)-sqr(y))/(2*r1)>=0; w2:=(sqr(r2)-sqr(x-r1)-sqr(y))/(2*r2)<=0;

w3:=(sqr(r2)-sqr(x+r1)-sqr(y))/(2*r2)<=0; w4:=(sqr(r2)-sqr(x)-sqr(y-r1))/(2*r2)<=0;

w5:=(sqr(r2)-sqr(x)-sqr(y+r1))/(2*r2)<=0;

w6:=(sqr(r2)-sqr(x-sqrt(2)/2*r1)-sqr(y-sqrt(2)/2*r1))/(2*r2)<=0;

w7:=(sqr(r2)-sqr(x+sqrt(2)/2*r1)-sqr(y-sqrt(2)/2*r1))/(2*r2)<=0;

w8:=(sqr(r2)-sqr(x+sqrt(2)/2*r1)-sqr(y+sqrt(2)/2*r1))/(2*r2)<=0;

w9:=(sqr(r2)-sqr(x-sqrt(2)/2*r1)-sqr(y+sqrt(2)/2*r1))/(2*r2)<=0;

krest1:=w1 and ( w2 or w4 or w3 or w5) and (w6 and w7 and w8 and w9);

end;{krest}

Function shest( x,y:real):boolean;

var r1,r2:real;w1,w2,w3,w4,w5,w6,w7,w8,w9:boolean;

begin r1:=1;r2:=0.3;shest:=false;

w1:=(sqr(r1)-sqr(x)-sqr(y))/(2*r1)>=0; w2:=(sqr(r2)-sqr(x-r1)-sqr(y))/(2*r2)<=0;

w3:=(sqr(r2)-sqr(x+r1)-sqr(y))/(2*r2)<=0; w4:=(sqr(r2)-sqr(x)-sqr(y-r1))/(2*r2)<=0;

w5:=(sqr(r2)-sqr(x)-sqr(y+r1))/(2*r2)<=0;

w6:=(sqr(r2)-sqr(x-sqrt(2)/2*r1)-sqr(y-sqrt(2)/2*r1))/(2*r2)<=0;

w7:=(sqr(r2)-sqr(x+sqrt(2)/2*r1)-sqr(y-sqrt(2)/2*r1))/(2*r2)<=0;

w8:=(sqr(r2)-sqr(x+sqrt(2)/2*r1)-sqr(y+sqrt(2)/2*r1))/(2*r2)<=0;

w9:=(sqr(r2)-sqr(x-sqrt(2)/2*r1)-sqr(y+sqrt(2)/2*r1))/(2*r2)<=0;

shest:=w1 and ( w2 and w4 and w3 and w5) and (w6and w7 and w8 and w9);

end;{krest}

function fig8( x,y:real):boolean;{vosmigrannic}

var xi,yi:arr17;

f1,f2,f3,f4:boolean; i:integer; a:real;

begin

a:=1/sqrt(2);

f1:=(sqr(a)-sqr(x)){/(2*a)}>=0; f2:=(sqr(a)-sqr(y)){/(2*a)}>=0;

f3:=(1-sqr(x+y)){/(2*a)}>=0; f4:=(1-sqr(x-y)){/(2*a)}>=0;

fig8:=((f1 and f2) or (f3 and f4));

end;


Эътиборингиз учун рахмат!!!!!
Download 119.74 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling