|
| 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 DRAGONFLYWING __________________________________________________________________________________________________________________________ THE FINAL RESULT IS BASED ON A DEFINED SHAPE, WHICH IS DIVIDED IN POLYGONES WITH FOUR VERTEXES. ALL THE STARTING POINTS OF THE POLYS ARE AT THE SAME PLACE. IF THE VERTEXES ARE AN ODDLY NUMBER THERE WILL BE ONE EXTRA VERTEX ADDED. AFTER THAT THE POLYGONES ARE DIVIDED AGAIN AND AGAIN IN TWO PARTS ASLONG AS A CERTAIN DIMENSION IS REACHED. __________________________________________________________________________________________________________________________ PROCEDURE HalfCell; VAR j,s,k,m,n,i:INTEGER; h,myPoly,lastPoly,firstObject:HANDLE; neuPx,neuPy,px,py:REAL; c:REAL; a1,a2,a3,a4,a5:POINT; ps:INTEGER; rest:REAL; pn:POINT; myArray:DYNARRAY[] OF POINT; NumPoly:INTEGER; {teile polygone bis auf min.-wert} Procedure myDivide01(p1,p2,p3,p4:POINT;ps:INTEGER); VAR p5,p6:POINT; BEGIN PenSize(ps); p5.x := (p2.x - p1.x)/9*4+p1.x; p5.y := (p2.y - p1.y)/9*4+p1.y; p6.x:= (p4.x - p3.x)/9*4+p3.x; p6.y:= (p4.y - p3.y)/9*4+p3.y; MoveTo(p5.x,p5.y); LineTo(p6.x,p6.y); c:=Abs(Distance(p5.x,p5.y,p6.x,p6.y)); IF c>15 THEN BEGIN myDivide01(p5,p6,p4,p1,ps/6*5); myDivide01(p5,p6,p3,p2,ps/6*5); END; END; {anzahl punkte im gezeichneten polygon, HAUPTSCRIPT} BEGIN myPoly:=FObject; ps:=50; PenSize(ps); ALLOCATE myArray[1..GetVertNum(myPoly)]; FOR m:=1 TO GetVertNum(myPoly) DO BEGIN GetPolyPt (myPoly, m, px, py); myArray[m].x:=px; myArray[m].y:=py; END; s:= GetVertNum(myPoly); ClosePoly; BeginPoly; FOR m:=1 TO s DO BEGIN Addpoint(myArray[m].x,myArray[m].y); END; EndPoly; rest:=s MOD 2; {ungeradeZahl} IF rest=1 THEN BEGIN neuPx:=(myArray[3].x+myArray[2].x)/2+5; neuPy:=(myArray[3].y+myArray[2].y)/2+5; InsertVertex(myPoly,neuPx,neuPy,3,17,0); s:=s+1; END; DelObject(myPoly); {teile Polygon} BEGIN s:= s/2-1; {anzahl polys} k:=0; FOR j:= 1 TO s DO BEGIN ClosePoly; BeginPoly; Addpoint(myArray[1].x,myArray[1].y); Addpoint(myArray[2+k].x,myArray[2+k].y); Addpoint(myArray[3+k].x,myArray[3+k].y); Addpoint(myArray[4+k].x,myArray[4+k].y); EndPoly; a1.x:=myArray[1].x; a1.y:=myArray[1].y; a2.x:=myArray[2+k].x; a2.y:=myArray[2+k].y; a3.x:=myArray[3+k].x; a3.y:=myArray[3+k].y; a4.x:=myArray[4+k].x; a4.y:=myArray[4+k].y; k:=k+2; myDivide01(a1,a2,a3,a4,ps); END; DelObject(myPoly); lastPoly:= FObject; DelObject(lastPoly); END; END; RUN (HalfCell); DOWNLOAD: YourOwnWing.zip: -- NDSMatthiasZaeh - 08 Dec 2005
|
This website has been archived and is no longer maintained.