|
| 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 BACK... __________________________________________________________________________________________________________________________ THE IDEA WITH A REKURSION TREE TO CREATE A MAIN STRUCTURE __________________________________________________________________________________________________________________________ ...AND THE TRIALS TO SCRIPT IT... __________________________________________________________________________________________________________________________ ...BUT THE PROBLEM IS TO DEFINE THE EXACT DIRECTION OF THE GROWING AND ALSO TO GET SOME HANDLES TO THE CONNECTORS AND ENDPOINTS FOR FURTHER DEVELOPMENTS. __________________________________________________________________________________________________________________________ PROCEDURE Rekursion; VAR length:REAL; winkel01,winkel02: REAL; x,y:REAL; startX1,startY1:REAL; Level:INTEGER; h,myLine:HANDLE; m,i:INTEGER; startx,starty,endx,endy:REAL; n:LONGINT; Procedure branch(startX1,startY1,Length, winkel01,winkel02:REAL;Level:INTEGER); BEGIN;anglevar; IF Level<7 THEN BEGIN moveto(startX1,startY1); lineto(length,#winkel01); PenLoc(x,y); startX1:=x; startY1:=y; branch(startX1,startY1,Length*0.5*(1+random),winkel01*0.5*(1+random)-winkel02*0.5*(1+random),winkel02*0.5*(1+random),Level+1); branch(startX1,startY1,Length*0.5*(1+random),winkel01*0.5*(1+random)+winkel02*0.5*(1+random),winkel02*0.5*(1+random),Level+1); END; noAnglevar; END; (* HALBIEREN *) Procedure myDivide01(x1,y1,x2,y2:REAL); VAR c,newX, newY : REAL; BEGIN newX := (x2 + x1)/2; newY := (y2 + y1)/2; c:=Abs(Distance(x1,y1,x2,y2)); IF c>20 THEN BEGIN myDivide01(x1,y1,newX,newY); myDivide01(newX,newY,x2,y2); END; IF c < 20 THEN BEGIN MoveTo(x1,y1); LineTo(x2,y2); END; END; (* HAUPTSCRIPT *) BEGIN (* AUFRUF REKURSION *) length:=50; Level:=1; winkel01:=90; winkel02:=30; branch(startX1,startY1,Length,winkel01,winkel02, Level); (* AUFRUF HALBIEREN *) h:= LNewObj; h:=GetLayer(h); n:=NumObj(h); FOR m:= 1 To n DO BEGIN myLine:=FObject; GetSegPt1(myLine,startx,starty); GetSegPt2(myLine,endx,endy); myDivide01(startx,starty,endx,endy); DelObject(myLine); myLine:=NextObj(myLine); END; END; RUN (Rekursion); -- NDSMatthiasZaeh - 08 Dec 2005
|
This website has been archived and is no longer maintained.