|
| 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 lost in TRANSLATION!my goal in this module was to investigate the translation between picture and brainso i start to investigate in the stereoscopic depth perception. and as a result of my investigation i create a 'SIRDS' single image random dot stereogram prinziple of creating a 'SIRDS'
translation image and koch snowflake
illustration of vector scribt algorithmcombination of the results
vector script algorithmPROCEDURE SIRDS; {bildgroesse 200*200, RDSgroesse 400*280} VAR currentCell:HANDLE; _tag,_data:STRING; _flag,id:INTEGER; x,y,value,PValue:REAL; _fileName:STRING; xmax,ymax,xmaxG,ymaxG:integer; Zarray:array[0..500,0..500] of real; same:array[0..500] of integer; pix:array[0..500] of real; Buchstabe:string; GesamtAusgabe:dynArray[] of Char; GesamtAusgabeST:dynArray[] of Char; StereoAusgabe:dynArray[] of Char; offset:integer; Objekt,CopyFlocke:handle; Col,red,green,blue:longint; counter,counter1:integer; maxTiefe,Color:integer; Visible:boolean; E,D,Z,ZT,mue,S,RandomFarbe,L:real; x1,x2,y1,y2,xR,xL,xg,yg,DPI,t,flocke:integer; SnowflakeArea:array[1..4] of real; Snowflake:array[1..10] of handle; procedure Schneeflocken; VAR Ordnung:integer; hlaenge,x1,y1,pi1,winkel1:real; i,j:integer; objekt:handle; p1x,p1y,p2x,p2y,distanceY:real; maxSnowflake:integer; procedure koch (pordnung: Integer; plaenge, pwinkel: Real); begin if (pordnung = 0 ) then begin x1 := x1+plaenge*cos(pwinkel); y1 := y1-plaenge*sin(pwinkel); addpoint(Round(x1),Round(y1)); end else begin koch (pordnung-1, plaenge / 3, pwinkel); pwinkel := pwinkel + pi /3; koch (pordnung-1, plaenge / 3, pwinkel); pwinkel := pwinkel - 2 * pi / 3; koch (pordnung-1, plaenge / 3, pwinkel); pwinkel := pwinkel + pi / 3; koch (pordnung-1, plaenge / 3, pwinkel); end; end; {end of koch} begin maxSnowflake:=3; pi1:=3.145; winkel1 :=0; For i:=1 to maxSnowflake do begin hlaenge :=i*40; if (i=1) then hlaenge:=45; x1 := 0; y1 := 0; MoveTo (Round(x1), Round(y1)); beginpoly; ordnung := (3); koch (ordnung, hlaenge, winkel1); winkel1 := winkel1 - 2 * pi / 3; ordnung := (3); koch (ordnung, hlaenge, winkel1); winkel1 := winkel1 - 2 * pi / 3; ordnung := (3); koch (ordnung, hlaenge, winkel1); winkel1 := winkel1 - 2 * pi / 3; endpoly; ClosePoly; {creates and moves flakes uebereinander} Snowflake[i]:=LnewObj; Col:=224; {eisblau} ColorIndexToRGB(Col,red,green,blue); SetFillBack(Snowflake[i],red,green,blue); Col:=0; {weiss} ColorIndexToRGB(Col,red,green,blue); SetPenFore(Snowflake[i],red,green,blue); GetBBox (Snowflake[i],p1x,p1y,p2x,p2y); Hmove(Snowflake[i],-p2x+((p2x-p1x)/2),-p2y+((p2y-p1y)/2)); end; {end for} {intersects and sorts the snowflakes} DSelectAll; clipSurface(Snowflake[3],Snowflake[1]); DSelectAll; SelectObj(T=21); Objekt:= FSActLayer; Snowflake[3]:=Objekt; For i:=1 to maxSnowFlake+1 do begin SnowflakeArea[i]:=HArea(Snowflake[i]); end; SortArray(SnowflakeArea,0,0); end; {end procedure snowflake} PROCEDURE Working(x1,y1:integer;PValue:REAL); {bildeinlesen} begin Zarray[x1+100,YmaxG-y1-40]:=(PValue); Message('x1:',x1,' y1:',y1,' pvalue:',pvalue); end; PROCEDURE readData(VAR _dData,_dTag:STRING;VAR _OCFlag:INTEGER); VAR _rString:STRING; _rChar:CHAR; _f1:INTEGER; BEGIN {setzen der Variablen in den Grundzustand} _f1:=0; _OCFlag:=0; _dData:=''; {Name/Art der Wertebezeichnung aus dem XML} _rString:=''; _dTag:=''; {Wert/Daten aus dem XML} WHILE ((_f1=0) AND (NOT EOF(_fileName))) DO BEGIN Read(_rChar); IF _rChar='/' THEN BEGIN IF _OCFlag=1 THEN _OCFlag:=2; _rString:=''; END ELSE BEGIN IF _rChar='<' THEN BEGIN _OCFLag:=1; _dData:=_rString; _rString:=''; END ELSE BEGIN IF _rChar='>' THEN BEGIN _dTag:=_rString; _f1:=1; END ELSE BEGIN _rString:=Concat(_rString,_rChar); END; END; END; END; IF EOF(_fileName) THEN _dTag:='xx'; END; BEGIN {hauptprogramm} (*{$debug}*) xmaxG:=400-1; ymaxG:=280-1; {parser} GetFile(_fileName); Open(_fileName); WHILE _tag<>'xx' DO BEGIN readData(_data,_tag,_flag); IF (_flag=2) THEN BEGIN IF _tag='CELL' THEN BEGIN Working(x1,y1,Value); END; IF _tag='ID' THEN BEGIN id := Str2Num(_data); END; IF _tag='VALUE' THEN BEGIN value := Str2Num(_data); END; IF _tag='X' THEN BEGIN x1:=Str2Num(_data); END; IF _tag='Y' THEN BEGIN y1:=Str2Num(_data); END; END; IF(_flag=1) THEN BEGIN END; END; Close(_fileName); {erzeuge Stereogramm} penpat(0); DPI:=72; E:=Round(2.5*DPI); {Augenabstand} mue:=0.33333; {idealer abstand von near zur far plane} For y1:=0 to YmaxG do begin for x1:=0 to XmaxG do begin same[x1]:=x1; end; For x1:=0 to XmaxG do begin Z:=Zarray[x1,y1]; {tiefenpunkt aus bildinfos} S:=Round(E*(1-(mue*Z))/(2-(mue*Z))); {Punktabstand Bildebene} xL:=Round(x1-(s/2)); {linker punkt} xR:=XL+S; {rechter punkt} if ((xL>0) and (xR<XmaxG)) then begin t:=1; REPEAT Zt:=Z+(2*(2-mue*Z)*t/(mue*E)); if ((Zarray[x1-t,y1]<Zt) and (Zarray[x1+t,y1]<Zt)) then begin Visible:=TRUE; end else begin Visible:=FALSE; end; t:=t+1; UNTIL ((Visible=True) and (zt<1) or ((x1-t)<1) or ((x1+t)>(xmaxG-1))); if (Visible=TRUE) then begin l:=same[xl]; while ((l<> xL) and (l<>xR)) do begin if (l<xr) then begin xl:=l; l:=same[xL]; end else begin same[xL]:=xr; xl:=xR; l:=same[xL]; xR:=l; end; end; same[xl]:=xR; end; {end if} end; {end if} end; {end for x1} For x1:=xMaxG downto 0 do begin If (same[x1]=x1) then begin pix[x1]:=trunc((random*3)+1); end else begin pix[x1]:=pix[same[x1]]; end; Color:=trunc(Pix[x1]); Case Color of 1:col:=0; {weiss} 2:col:=50; {mittelgrau} 3:col:=255; {dunkelgrau} end; {end of Case} ColorIndexToRGB(Col,red,green,blue); rect(x1*5,y1*5,x1*5+5,y1*5+5); Objekt:=LnewObj; SetFillBack(Objekt,red,green,blue); end; counter1:=0; end; {end for y1} {schneeflocken settings} PenPat(1); Schneeflocken; For Counter:=1 to 8 do begin Flocke:=trunc((random*3)+1); z:=(1/Flocke); y1:=round((random*(YmaxG-20))+1); repeat x1:=round((random*(XmaxG-20))+1); S:=round(E*((1-(mue*z))/(2-(mue*z)))); {Punktabstand Bildebene} xR:=Round((x1)-(s/2)); {rechter punkt} XL:=Round((x1)+(s/2)); {linker punkt} until ((xR>0) and (xL<XmaxG)); CopyFlocke:=HDuplicate(Snowflake[Flocke],xR*5+10,y1*5); CopyFlocke:=HDuplicate(Snowflake[Flocke],xL*5+10,y1*5); end; dselectAll; END; RUN(SIRDS); FINAL images-- NDSFrankThessling - 20 Dec 2005
|
This website has been archived and is no longer maintained.