ETH Zuerich - Startseite
Professur für CAAD

 


caad d-arch


Caad Teaching
 

 
Bachelor of Architecture: CAAD II ss07

 
Master of Advanced Studies
in Architecture, CAAD


 
DWF-Processing
Programmieren statt Zeichnen


 
Graustufen - Ein Atlas
Schweizer Wohngebäude als XML Daten


 
DWF- Denken in Systemen:
In Collaboration with the Technical University Vienna


 
Seminarwoche:
BlowUp


 
Archiv

 
Caad Projects
 

 
Theory
 
Design
 
Building
 
Practice

 
Related pages
 

 
Swiss Federal Institute of Technology Zurich
 
Institute of Building Technology
 
Faculty of Architecture

 
Other pages

 










hbt d-arch

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





Scripting
FloridusFlosculi

blumen_1.JPG pres1grsser.JPG
Procedure grid;

VAR
   totalx,totaly,j,i,anzahlpunkte:Integer;

Begin
   totalx:=Intdialog('Anzahl Spalten eingeben','5');   
   totaly:=Intdialog('Anzahl Reihen eingeben','7');   
   Layer('Hilfspunkte');
   For j:=1 TO totalx DO Begin
      For i:=1 TO totaly DO Begin   
         NameObject(concat(totalx,':',totaly,'P',j,'-',i));
         Locus(75*j+(40*random-20),75*i+(40*random-20));
      END;         
   END;   
END;

RUN(grid);

PROCEDURE blumen;
VAR
   move: Vector;
   Radiusspitze: DynArray[] Of Real;
   Punkteraster: DynArray[,] Of Vector;
   n,m,t,k,L,i,j,j2: Integer;
   posSelbst,posNachbar,vNachbar:Vector;
   distNachbar:REAL;
   indexNachbar:INTEGER;
   letzterRadius,ersterRadius,deltaT:INTEGER;
   deltaLaenge:REAL;
   lFaktor:REAL;
   totalx,totaly :INTEGER;

Procedure analizegrid;

VAR
   Loc1, Loc2 : INTEGER;
   str, newStrTotaly, newStrTotalx: STRING;
Begin
   Layer('Hilfspunkte');
   str := GetName(FActLayer);
   Loc1:=Pos(':',str);
   Loc2:=Pos('P',str);

   newStrTotalx:=Copy(str,1,Loc1-1);
   newStrTotaly:=Copy(str,Loc1+1,Loc2-1-Loc1);

   totalx:=Str2num(newStrTotalx);
   totaly:=Str2num(newStrTotaly);
END;



procedure radiusToNeighbour(posS:VECTOR;posN:VECTOR);

VAR vN:VECTOR;
   distN,angleN:REAL;
   indexN:INTEGER;

BEGIN
   vN:=posN-posS;
   distN:=Norm(vN);
   angleN:=Vec2Ang(vN);
   IF(angleN<0) THEN angleN:=angleN+360;
   indexN:=angleN/(360/t);
   IF (indexN=0) THEN indexN:=t;
   Message(indexN);
   RadiusSpitze[indexN]:=distN/2.0;
END;

procedure testvec(p1:Vector; Radius:DynArray[] Of Real);

VAR
   z,b,a,r0,r1:REAL;
   v,j,i: INTEGER;   
   Blattspitze:DynArray[] Of VECTOR;
   Blattschaft:DynArray[] Of VECTOR;
   Blattteil:DynArray[] Of VECTOR;
   Zufall:DynArray[] Of REAL;
   
BEGIN   
   ALLOCATE Blattspitze[0..t];
   ALLOCATE Blattschaft[0..t];
   ALLOCATE Blattteil[0..t];
   ALLOCATE Zufall[0..t];

   closepoly;
   z:=0;
   r0:=7;
   r1:=10;
   a:=360/t;

   FOR i:=   1 TO t DO BEGIN
         Blattspitze[i]:=Ang2Vec(0+i*a,radius[i]*lFaktor);
         Blattschaft[i]:=Ang2Vec(a/2+i*a,r1);   
         Blattteil[i]:=Ang2Vec(a/2+i*a,r0);
   END;
   FOR i:=1 TO t DO BEGIN
         Blattspitze[i]:=Blattspitze[i]+p1;
         Blattschaft[i]:=Blattschaft[i]+p1;
         Blattteil[i]:=Blattteil[i]+p1;
   END;


   FOR i:=1 TO t DO BEGIN
      Zufall[i]:=Random*z;      
   END;
   (***fillback(10000,30000,40000);***)
   BeginPoly;
   arcto(Blattspitze[1].x+Zufall[1],Blattspitze[1].y+Zufall[1],zufall[1]);
   ARCTO(Blattschaft[1].x+Zufall[1],Blattschaft[1].y+Zufall[1],Zufall[1]);
   
   FOR i:=1 To t DO BEGIN 
      lineto(Blattspitze[i].x+Zufall[i],Blattspitze[i].y+Zufall[i]);   
      ARCTO(Blattschaft[i].x+Zufall[i],Blattschaft[i].y+Zufall[i],Zufall[i]);
   END;
   
   Endpoly;
   BeginPoly;
   ADDPOINT(p1.x+2*Zufall[1],p1.y+2*Zufall[1]);
   ARCTO(Blattteil[t].x+1.5*Zufall[t],Blattteil[t].y-1.5*Zufall[t],10);
   ARCTO(Blattschaft[t].x+Zufall[t],Blattschaft[t].y+Zufall[t],10);
   lineto(Blattspitze[1].x+Zufall[1],Blattspitze[1].y+Zufall[1]);
   ARCTO(Blattschaft[1].x+Zufall[1],Blattschaft[1].y+Zufall[1],10);
   ARCTO(Blattteil[1].x+1.5*Zufall[1],Blattteil[1].y-1.5*Zufall[1],10);
   EndPoly;   
   
   For i:=2 TO t do Begin
      BeginPoly;   {alle anderen Blaetter}
      ADDPOINT(p1.x+2*Zufall[1],p1.y+2*Zufall[1]);
      ARCTO(Blattteil[i-1].x+1.5*Zufall[i-1],Blattteil[i-1].y-1.5*Zufall[i-1],10);
      ARCTO(Blattschaft[i-1].x+Zufall[i-1],Blattschaft[i-1].y+Zufall[i-1],10);
      lineto(Blattspitze[i].x+Zufall[i],Blattspitze[i].y+Zufall[i]);
      ARCTO(Blattschaft[i].x+Zufall[i],Blattschaft[i].y+Zufall[i],10);
      ARCTO(Blattteil[i].x+1.5*Zufall[i],Blattteil[i].y-1.5*Zufall[i],10);
      EndPoly;   
   END;
   
END;
Begin
   analizegrid;
   layer('blumen');
   Allocate Punkteraster[0..totalx,0..totaly];
   For n:=1 TO totaly DO Begin
      For m:=1 TO totalx DO Begin
         Layer('Hilfspunkte');
         GetLocPt(Getobject(concat(totalx,':',totaly,'P',m,'-',n)),Punkteraster[m,n].x,Punkteraster[m,n].y);
      END;
   END;   
   layer('blumen');
   t:=intdialog('Anzahl Blätter eingeben','20');
   lFaktor:=1.0;
   ALLOCATE Radiusspitze[0..t];
   For k:=1 To totalx Do Begin
      For L:=1 To totaly Do Begin
         move:=Punkteraster[k,L];
         
         FOR i:=1 To t DO Radiusspitze[i]:=1;
         
         posSelbst:=Punkteraster[k,L];

         IF (k<totalx) THEN radiusToNeighbour(posSelbst,Punkteraster[k+1,L]);
         IF (k>1) THEN radiusToNeighbour(posSelbst,Punkteraster[k-1,L]);
         IF (L<totaly) THEN radiusToNeighbour(posSelbst,Punkteraster[k,L+1]);
         IF (L>1) THEN radiusToNeighbour(posSelbst,Punkteraster[k,L-1]);

(***              IF ((k<totalx) AND (L<totaly)) THEN radiusToNeighbour(posSelbst,Punkteraster[k+1,L+1]);
              IF ((k<totalx) AND (L>1)) THEN radiusToNeighbour(posSelbst,Punkteraster[k+1,L-1]);
         IF ((k>1) AND (L>1)) THEN radiusToNeighbour(posSelbst,Punkteraster[k-1,L-1]);
         IF ((k>1) AND (L<totaly)) THEN radiusToNeighbour(posSelbst,Punkteraster[k-1,L+1]); 
***)              letzterRadius:=0;
         ersterRadius:=0;
         FOR i:=1 To t DO BEGIN
            IF(Radiusspitze[i]<>1)THEN BEGIN
               IF(ersterRadius=0)
               THEN ersterRadius:=i;

               IF(letzterRadius=0)
               THEN letzterRadius:=i
               ELSE BEGIN
                  deltaLaenge:=RadiusSpitze[i]-RadiusSpitze[letzterRadius];
                  deltaT:=i-letzterRadius;
                  FOR j:=1 To deltaT-1 DO BEGIN
                     RadiusSpitze[letzterRadius+j]:=RadiusSpitze[letzterRadius]+(j*(deltaLaenge/deltaT));
                  END;
               END;
               letzterRadius:=i;
            END;
         END;
         deltaLaenge:=RadiusSpitze[ersterRadius]-RadiusSpitze[letzterRadius];
         deltaT:=ersterRadius+t-letzterRadius;
         FOR j:=1 To deltaT-1 DO BEGIN
            j2:=letzterRadius+j;
            IF(j2>t) THEN j2:=j2-t;
            RadiusSpitze[j2]:=RadiusSpitze[letzterRadius]+(j*(deltaLaenge/deltaT));
         END;
         testvec(move,Radiusspitze);
      END;   
   END;
   
END;
RUN(blumen);


blumen_2.JPG
-- NDSTobiasWendt - 08 Dec 2005

Revision r1.2 - 09 Dec 2005 - 12:01 - NDSTobiasWendt
Parents: WebHome > NDSTobiasWendt > 1ModulScripting > Growing
Copyright © 1999-2003 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.

This website has been archived and is no longer maintained.