| 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
| |
PROCEDURE EndlessBox;
Type X=structure
x:Array [1..100] of real;
end;
y=structure
y:Array [1..100] of x;
end;
xyz=structure
z:Array [1..100] of y;
end;
VAR
WertBox: XYZ;
x1,y1,z1:longint;
maxX,maxY,maxZ:longint;
PointWert,Zaehler,SubSolid,faktor,versatz,waves:integer;
Wert:real;
AnzCon,AnzConSeite,ConSeite,Force,thickness:integer;
MObjekt,MObjekt1,BoneStaerke:handle;
BoneString:handle;
BoneStringA,Box1,Rechteck:handle;
Procedure CreateBone(ConSeite:integer;a,b,c:real);
var yP,xP,zP:longint;
begin
xp:=trunc(x1);
yp:=trunc(y1);
zp:=trunc(z1);
case ConSeite of
1:begin
BoneString:=CreateNurbsCurve(xp*faktor+Versatz,yp*faktor+Versatz,zp*faktor+Versatz, true, 2);
For zp:=2 to (maxZ-1) do begin
If zp<maxZ then begin
repeat
yp:=trunc(b-2+(random*2)+1);
until ((yp>1) and (yp<maxy));
repeat
xp:=trunc(c-2+(random*2)+1);
until ((xp>1) and (xp<maxx));
AddVertex3D(BoneString,xp*faktor+Versatz,yp*faktor+Versatz,zp*faktor+Versatz);
WertBox.z[zp].y[yp].x[xp]:=0;
end; {end if}
end; {end for}
AddVertex3d(BoneString,x1*faktor+Versatz,y1*faktor+Versatz,maxZ*faktor+Versatz);
BoneString :=LnewObj;
arc(-2,-2,2,2,0,360);
BoneStaerke:=lNewObj;
MObjekt:=CreateExtrudeAlongPath(BoneString,BoneStaerke);
SubSolid:=SubtractSolid(Box1,MObjekt1,Box1);
end;
2:begin
BoneString :=CreateNurbsCurve(xp*faktor+Versatz,yp*faktor+Versatz,zp*faktor+Versatz, true, 2);
For yp:=2 to (maxY-1) do begin
If yp<maxY then begin
repeat
zp:=trunc(a-2+(random*2)+1);
until ((zp>1) and (zp<maxz));
repeat
xp:=trunc(c-2+(random*2)+1);
until ((xp>1) and (xp<maxx));
AddVertex3D(BoneString,xp*faktor+Versatz,yp*faktor+Versatz,zp*faktor+Versatz);
WertBox.z[zp].y[yp].x[xp]:=0;
end; {end if}
end; {end for}
AddVertex3D(BoneString ,x1*faktor+Versatz,maxy*faktor+Versatz,z1*faktor+Versatz);
BoneString :=LNewObj;
arc(-2,-2,2,2,0,360);
BoneStaerke:=lNewObj;
MObjekt:=CreateExtrudeAlongPath(BoneString,BoneStaerke);
end;
3:begin
BoneString :=CreateNurbsCurve(xp*faktor+Versatz,yp*faktor+Versatz,zp*faktor+Versatz, true, 2);
For xp:=2 to (maxX-1) do begin
If yp<maxY then begin
repeat
zp:=trunc(a-2+(random*2)+1);
until ((zp>1) and (zp<maxz));
repeat
yp:=trunc(b-2+(random*2)+1);
until ((yp>1) and (yp<maxy));
AddVertex3D(BoneString ,xp*faktor+Versatz,yp*faktor+Versatz,zp*faktor+Versatz);
WertBox.z[zp].y[yp].x[xp]:=0;
end; {end if}
end; {end for}
AddVertex3D(BoneString ,maxx*faktor+Versatz,y1*faktor+Versatz,z1*faktor+Versatz);
BoneString :=LNewObj;
arc(-2,-2,2,2,0,360);
BoneStaerke:=lNewObj;
MObjekt:=CreateExtrudeAlongPath(BoneString ,BoneStaerke);
SubSolid:=SubtractSolid(MObjekt1,Box1,Box1);
end;
end; {end of case}
end;
BEGIN {hauptprogramm}
maxZ:=6;
maxY:=6;
maxX:=6;
Zaehler:=0;
faktor:=6;
{fuelle inbox}
For z1:=1 to maxZ do begin
For y1:=1 to maxY do begin
for x1:=1 to maxY do begin
Wert:=trunc(random*4);
WertBox.z[z1].y[y1].x[x1]:=0;
end; {x1}
end; {y1}
end; {z1}
{definiere connectoren}
while (Zaehler<2) do begin {begrenze Einstreuung diagonale Achse}
repeat
x1:=(trunc(random*((maxX-1)/2)))+1;
y1:=(trunc(random*((maxY-1)/2)))+1;
until ((x1>1) and (y1>1));
z1:=1;
Wert:=WertBox.z[z1].y[y1].x[x1];
if (Wert<>1) then begin
if (y1<=x1) then begin
WertBox.z[z1].y[y1].x[x1]:=1;
WertBox.z[z1].y[x1].x[y1]:=1; {diagonale Spiegelung}
Zaehler:=Zaehler+1;
end; {end if}
end; {end if}
end; {end of while}
{spiegele Connectoren}
For y1:=1 to ((maxY-1)/2) do begin
For x1:=1 to ((maxx-1)/2) do begin
If WertBox.z[1].y[y1].x[x1]=1 then begin
{plane1}
WertBox.z[1].y[y1].x[x1]:=1;
WertBox.z[1].y[y1].x[(maxX)-(x1-1)]:=1;
WertBox.z[1].y[maxY-(y1-1)].x[maxX-(x1-1)]:=1;
WertBox.z[1].y[maxY-(y1-1)].x[x1]:=1;
{plane2}
WertBox.z[y1].y[maxY].x[x1]:=1;
WertBox.z[y1].y[maxY].x[maxX-(x1-1)]:=1;
WertBox.z[maxY-(y1-1)].y[maxY].x[maxX-(x1-1)]:=1;
WertBox.z[maxY-(y1-1)].y[maxY].x[x1]:=1;
{plane3}
WertBox.z[maxZ].y[y1].x[x1]:=1;
WertBox.z[maxZ].y[y1].x[maxX-(x1-1)]:=1;
WertBox.z[maxZ].y[maxY-(y1-1)].x[maxX-(x1-1)]:=1;
WertBox.z[maxZ].y[maxY-(y1-1)].x[x1]:=1;
{plane4}
WertBox.z[y1].y[1].x[x1]:=1;
WertBox.z[y1].y[1].x[maxX-(x1-1)]:=1;
WertBox.z[maxY-(y1-1)].y[1].x[maxX-(x1-1)]:=1;
WertBox.z[maxY-(y1-1)].y[1].x[x1]:=1;
{plane5}
WertBox.z[x1].y[y1].x[1]:=1;
WertBox.z[x1].y[maxY-(y1-1)].x[1]:=1;
WertBox.z[maxX-(x1-1)].y[y1].x[1]:=1;
WertBox.z[maxX-(x1-1)].y[maxY-(y1-1)].x[1]:=1;
{plane6}
WertBox.z[x1].y[y1].x[maxX]:=1;
WertBox.z[x1].y[maxY-(y1-1)].x[maxX]:=1;
WertBox.z[maxX-(x1-1)].y[y1].x[maxX]:=1;
WertBox.z[maxX-(x1-1)].y[maxY-(y1-1)].x[maxX]:=1;
end; {endif}
end; {end forx}
end; {end forY}
{Anzahl der Endless Boxes}
For Waves:=1 to 1 do begin
Versatz:=Versatz+(Waves*50);
{zaehle connectoren und nummeriere }
AnzCon:=0;
For z1:=1 to maxZ do begin
For y1:=1 to maxY do begin
for x1:=1 to maxX do begin
If (WertBox.z[z1].y[y1].x[x1]=1) then
begin
AnzCon:=AnzCon+1;
WertBox.z[z1].y[y1].x[x1]:=1;
end; {end if}
end; {x1}
end; {y1}
end; {z1}
{plane 1 to 3}
ConSeite:=1;
z1:=1;
For y1:=1 to maxY do begin
For x1:=1 to maxX do begin
If (WertBox.z[z1].y[y1].x[x1]=1) then
begin
CreateBone(ConSeite,z1,y1,x1);
end; {end if}
end; {x1}
end; {y1}
{plane 2 to 4}
ConSeite:=2;
y1:=1;
For z1:=1 to maxZ do begin
For x1:=1 to maxX do begin
If (WertBox.z[z1].y[y1].x[x1]=1) then
begin
CreateBone(ConSeite,z1,y1,x1);
end; {end if}
end; {x1}
end; {z1}
{plane 5 to 6}
ConSeite:=3;
x1:=1;
For z1:=1 to maxZ do begin
For y1:=1 to maxY do begin
If (WertBox.z[z1].y[y1].x[x1]=1) then
begin
CreateBone(ConSeite,z1,y1,x1);
end; {end if}
end; {x1}
end; {z1}
{zeichne connectoren}
For z1:=1 to maxZ do begin
For y1:=1 to maxY do begin
for x1:=1 to maxX do begin
if (WertBox.z[z1].y[y1].x[x1]=1) then
begin
rect(-3,-3,3,3);
Rechteck:=LnewObj;
MObjekt1:=HExtrude(Rechteck,-3,3);
IF x1=maxx then begin
Move3dObj(MObjekt1,x1*faktor+Versatz+4.5,y1*faktor+Versatz,z1*faktor+Versatz);
MObjekt:=CreateSphere(x1*faktor+Versatz+1.5,y1*faktor+Versatz,z1*faktor+Versatz,3);
SubSolid:=SubtractSolid(MObjekt,MObjekt1,Box1);
end;
IF x1=1 then begin
Move3dObj(MObjekt1,x1*faktor+Versatz-4.5,y1*faktor+Versatz,z1*faktor+Versatz);
MObjekt:=CreateSphere(x1*faktor+Versatz-1.5,y1*faktor+Versatz,z1*faktor+Versatz,3);
SubSolid:=SubtractSolid(MObjekt,MObjekt1,Box1);
end;
IF y1=maxy then begin
Move3dObj(MObjekt1,x1*faktor+Versatz,y1*faktor+Versatz+4.5,z1*faktor+Versatz);
MObjekt:=CreateSphere(x1*faktor+Versatz,y1*faktor+Versatz+1.5,z1*faktor+Versatz,3);
SubSolid:=SubtractSolid(MObjekt,MObjekt1,Box1);
end;
IF y1=1 then begin
Move3dObj(MObjekt1,x1*faktor+Versatz,y1*faktor+Versatz-4.5,z1*faktor+Versatz);
MObjekt:=CreateSphere(x1*faktor+Versatz,y1*faktor+Versatz-1.5,z1*faktor+Versatz,3);
SubSolid:=SubtractSolid(MObjekt,MObjekt1,Box1);
end;
IF z1=maxz then begin
Move3dObj(MObjekt1,x1*faktor+Versatz,y1*faktor+Versatz,z1*faktor+Versatz+4.5);
MObjekt:=CreateSphere(x1*faktor+Versatz,y1*faktor+Versatz,z1*faktor+Versatz+1.5,3);
SubSolid:=SubtractSolid(MObjekt,MObjekt1,Box1);
end;
IF z1=1 then begin
Move3dObj(MObjekt1,x1*faktor+Versatz,y1*faktor+Versatz,z1*faktor+Versatz-4.5);
MObjekt:=CreateSphere(x1*faktor+Versatz,y1*faktor+Versatz,z1*faktor+Versatz-1.5,3);
SubSolid:=SubtractSolid(MObjekt,MObjekt1,Box1);
end;
end; {endif}
end; {x1}
end; {y1}
end; {z1}
END; {end of Waves}
END; {end of 3dArray}
run(EndlessBox);
Revision r1.7 - 10 May 2006 - 22:50 - NDSFrankThessling Parents: WebHome > NDSFrankThessling
|
Copyright © 1999-2003 by the contributing authors.
All material on this collaboration platform is the property of the contributing authors.
|
|
|