|
| MAS ETH ARCH/CAAD - 2005/06 - STUDENT PAGES Master of Advanced Studies in Architecture, Specialization in Computer Aided Architectural Design | 065-0005/6 Supervision: Prof. Dr. Ludger Hovestadt, Philipp Schaerer Chair of CAAD, ETH Zurich This website has been archived and is no longer maintained. Mini-Assignment II: Write five small scripts. PROCEDURE kreuz; VAR h1,h2,h3:handle; i,k:integer; BEGIN FillPat(1); penfore(65535,65535,65535); Fillback(65535,0,0); rect(-1,44,44,-1); Dselectall; Fillback(65535,65535,65535); closepoly; for k:=0 TO 10 DO begin FOR i:=0 TO 10 DO begin rect(1,3,2,0); h1:=Lnewobj; Dselectall; rect(0,2,3,1); h2:=Lnewobj; Dselectall; h3 := AddSurface(h1, h2); setselect(h3); rotate(i*9+k*9); MoveObjs(i*4,k*4,FALSE,FALSE); end; end; END; Run(kreuz); PROCEDURE welle; const anzahlwellen=200; spiralwinkel=360; VAR farbe:LONGINT; x,y,winkel,radius,alpha:real; i,j:INTEGER; BEGIN alpha:=spiralwinkel/anzahlwellen; for j:=1 to anzahlwellen do begin FOR i:=j TO anzahlwellen DO BEGIN winkel:=deg2rad(i*alpha); radius:=i+j; x:=radius*sin(winkel)-2*j; y:=-radius*cos(winkel)+j; PenFore(65535-(65535/anzahlwellen)*i,65535-(65535/anzahlwellen)*i,65535-(65535/anzahlwellen)*j); if (i=j) then moveto(x,y) else lineto(x,y); end; end; END; Run(welle); PROCEDURE blume; CONST winkel=40; VAR r,g,b:LONGINT; x,y,radius,alpha,radwinkel1,radwinkel2,laenge,maxy:real; i,j,l:INTEGER; BEGIN fillback(65535,65535,65535); ColorIndexToRGB(13,r,g,b); penfore(0,0,0); for l:=1 to 100 do begin for j:=l*l to 99 do begin (*Blumen setzen*) y:=-l*l+random*l-l/2; x:=random*200; laenge:=l; radius:=l/5; OpenPoly; fillpat(0); BeginPoly; moveto(x,y); curveto((random*l-l/2)+x,-l*l); lineto((random*l-l/2)+x,-(random*l-l/2)-l*l*1.5); EndPoly; ClosePoly; fillpat(1); for i:=0 to 9 do begin (*Blumen zeichnen*) radwinkel1:=Deg2rad(i*winkel); radwinkel2:=Deg2rad(i*winkel+winkel); BeginPoly; curveto(x+laenge*sin(radwinkel1),y+laenge*cos(radwinkel1)); curveto(x+laenge*sin(radwinkel2),y+laenge*cos(radwinkel2)); lineto(x,y); EndPoly; end; Oval(x-radius,y+ radius,x+ radius,y-radius); end; end; END; Run(blume); PROCEDURE haare; const l1x= 15; l1y= 10; l2x= -5; l2y= -7; VAR r,g,b:longint; h:handle; x,y,winkel,distanz:real; i:INTEGER; BEGIN FOR i:=1 TO 2000 DO BEGIN (*linien zeichnen*) moveto(random*60-30,random*60-30); PenFore(0,0,0);line(1,0); ColorIndexToRGB(13,r,g,b); PenFore(r,g,b); line(0.5,0); group; h:=LObject; (*Distanz messen und skalieren*) hcenter(h,x,y); distanz:=sqrt(sqr(l1x-x)+sqr(l1y-y))+sqrt(sqr(l2x-x)+sqr(l2y-y)); scale(distanz/10,distanz/10); (*drehen*) hcenter(h,x,y); winkel:= ArcTan((y-l1y)/(x-l1x)); winkel:=rad2deg(winkel); hrotate(h,x,y,winkel); winkel:= ArcTan((y-l2y)/(x-l2x)); winkel:=rad2deg(winkel); hrotate(h,x,y,90+winkel); DselectAll; END; END; Run(haare); -- NDSBenjaminDillenburger - 09 Nov 2005
|
This website has been archived and is no longer maintained.