|
| 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 -- NDSMonikaAnnen - 08 Dec 2005 PROCEDURE tetriswithovals; {*******************************ERSTELLE STRUCTURE************************************} TYPE MyArc = STRUCTURE pos : POINT; radius: REAL; solidHeight : REAL; END; VAR {***************************************ARRAY*****************************************} {List : ARRAY [1..Kugelzahl,posxy..radius] OF POINT;} ListofArcs: DYNARRAY[] OF MyArc; value : REAL; bol : BOOLEAN; k,i,j,m: INTEGER; x, y: INTEGER; yzwischenwert: REAL; radius: REAL; counter: INTEGER; Kugelzahl: INTEGER; x1,x2,y1,y2: REAL; h, newSolid, UserObject, RectSolid: Handle; returnInt: INTEGER; str : STRING; BEGIN DoMenuTextByName('Standard Views',1); Kugelzahl:=600; ALLOCATE ListofArcs[1..Kugelzahl]; FOR i:=1 to Kugelzahl DO BEGIN {150 = y-Achse} IF i=1 THEN BEGIN ListofArcs[1].radius:= 1; ListofArcs[1].pos.x:= 1; ListofArcs[1].pos.y := -20+ListofArcs[1].radius; END ELSE BEGIN ListofArcs[i].radius := 1+random*5; ListofArcs[i].pos.x := ListofArcs[i].radius + random*300; ListofArcs[i].solidHeight := ListofArcs[i].radius*3; END; ArcbyCenter (ListofArcs[1].pos.x, ListofArcs[1].pos.y, ListofArcs[1].radius,0, 360); DeleteObjs; END; {****************************ZEICHNE KREISE radius,x,y ist festgesetzt************************} BEGINGROUP; FOR i:= 2 to Kugelzahl DO BEGIN ListofArcs[i].pos.y:=-20+ListofArcs[i].radius; FOR k:= 1 to i-1 DO BEGIN IF (ListofArcs[k].radius + ListofArcs[i].radius) > abs (ListofArcs[i].pos.x - ListofArcs[k].pos.x) THEN BEGIN y:= sqrt((ListofArcs[i].radius + ListofArcs[k].radius)^2-(ListofArcs[i].pos.x - ListofArcs[k].pos.x)^2); yzwischenwert:=ListofArcs[k].pos.y + y; IF (yzwischenwert>ListofArcs[i].pos.y) THEN BEGIN ListofArcs[i].pos.y:=(yzwischenwert); END; END; END; Layer('Kreise'); ArcByCenter(ListofArcs[i].pos.x, ListofArcs[i].pos.y,ListofArcs[i].radius, 0, 360); {h:=CreateSphere (ListofArcs[i].pos.x, ListofArcs[i].pos.y, 0, ListofArcs[i].radius);} END; ENDGroup; {****************************ZEICHNE RECHTECK - EXTRUDIERE************************************} GetBBox (LNewObj, x1,y1,x2,y2); HUngroup(LNewObj); Layer('3D'); beginxtrd(0,0.3); Rect (x1,y1,x2,y2); (*Rect (x1-0.5,y1-0.5,x2+0.5,y2+0.5);*) endxtrd; RectSolid:= LNewObj; {****************************ERSTELLE SPHERES**********************************************} FOR i:= 1 to Kugelzahl DO BEGIN h:=CreateSphere (ListofArcs[i].pos.x, ListofArcs[i].pos.y, -2, ListofArcs[i].radius); END; DoMenuTextByName('Standard Views',1); {sets view to right isometric} {****************************SUBSTRAHIERE DIE OBJEKTE VONEINANDER**************************} FOR i:= 2 to Kugelzahl DO BEGIN IF ListofArcs[i].radius > 0 THEN BEGIN UserObject:= PickObject(ListofArcs[i].pos.x, ListofArcs[i].pos.y); END; returnInt:=SubtractSolid (RectSolid,UserObject, newSolid); RectSolid:=newSolid; END; END; RUN (tetriswithovals);
|
This website has been archived and is no longer maintained.