| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- fileName="one_case_data-2d.txt";
- generateNewCase=1;
- graphSize=[800,800]; fontSize=4;
- exec("sample_data_parser.sce");
- xlfont(strcat(["../../documentation/fonts/cm-unicode-0.7.0/",..
- "CMU_Typewriter_Text-Medium.otf"]),0);
- rangeX=[min(dat.C(1,1:(dat.n))-dat.R'),max(dat.C(1,1:(dat.n))+dat.R')];
- rangeY=[min(dat.C(2,1:(dat.n))-dat.R'),max(dat.C(2,1:(dat.n))+dat.R')];
- function c=rainbowColorMap(n)
- inc=-5/(n-1);
- cc=[1,0,1]; pp=1; cc(pp)=cc(pp)-inc;
- m=[1,0,1;1,0,0];
- for i=1:1:n
- cc(pp)=cc(pp)+inc;
- if(inc>0 & cc(pp)>1)
- diff=-(cc(pp)-1); cc(pp)=1; pp=modulo(pp,3)+1;
- cc(pp)=cc(pp)+diff; inc=-inc;
- end
- if(inc<0 & cc(pp)<0)
- diff=-cc(pp); cc(pp)=0; pp=modulo(pp,3)+1;
- cc(pp)=cc(pp)+diff; inc=-inc;
- end
- for s=1:1:3 m(i,s)=cc(s); end
- end
- m(n,1)=1; m(n,2)=0; m(n,3)=0; c=m;
- endfunction
- itemColorMap=list('#aa0000','#00aa00','#0000aa','#00aaaa','#aa00aa',..
- '#aaaa00','#664422','#aa5500','#aa5555','#550055',..
- '#ffd9d9','#e1ffe1','#def0ff','#e6ffff','#ffe6ff',..
- '#ffffd9','#f0e8e1','#ffe6cc','#ffecec');
- function z=lambdaFunc(x,y)
- pPnt=[x;y];
- sumOfDst=0;
- for i=1:1:dat.n
- sumOfDst=sumOfDst+abs(sqrt(sum((pPnt-dat.C(1:dat.d,i))^2))-dat.R(i));
- end
- z=-sumOfDst;
- endfunction
- function canvas(n)
- grw=graphWindows(n); clf(grw);
- grw.color_map=rainbowColorMap(1024);
- /* heatmap */
- Sfgrayplot(linspace(rangeX(1),rangeX(2),32),..
- linspace(rangeY(1),rangeY(2),32),lambdaFunc,colminmax=[1;1024]);
- colorbar(,,colminmax=[1;1024]); ax0=gca(); ax0.isoview='on';
- endfunction
- function centres()
- for i=1:1:dat.n
- obj=plot(dat.C(1,i),dat.C(2,i),'Color',itemColorMap(i));
- obj.mark_style=0; obj.mark_size=5; obj.line_mode="off";
- end
- endfunction
- function circles()
- for i=1:1:dat.n
- a=-%pi:0.01:%pi;
- x=dat.C(1,i)+dat.R(i)*sin(a); y=dat.C(2,i)+dat.R(i)*cos(a);
- obj=plot(x,y,'Color',itemColorMap(i)); obj.thickness=2;
- end
- endfunction
- function startPoint(n)
- obj=plot(rts(n).s(1).P(1),rts(n).s(1).P(2),'Color','#000000');
- obj.mark_style=9; obj.mark_size=10; obj.mark_background=0;
- obj=plot(rts(n).s(1).P(1),rts(n).s(1).P(2),'Color','#000000');
- obj.mark_style=2; obj.mark_size=6; obj.mark_background=0;
- endfunction
- function route(n,lastStep)
- for j=1:1:lastStep
- sXs(j)=rts(n).s(j).P(1); sYs(j)=rts(n).s(j).P(2);
- end
- plot(sXs,sYs,'Color','#000000'); obj=get("hdl");
- obj.children.mark_size=0; obj.children.thickness=1;
- obj.children.line_mode="on";
- endfunction
- function endPoint(n)
- obj=plot(rts(n).s(length(rts(n).s)).P(1),rts(n).s(length(rts(n).s)).P(2),..
- 'Color','#000000');
- obj.mark_style=9; obj.mark_size=24; obj.mark_background=0;
- endfunction
- function bestGuessPoint()
- obj=plot(bestGuess.P(1),bestGuess.P(2),'Color','#550055');
- obj.mark_style=1; obj.mark_size=16; obj.mark_background=0; obj.thickness=2;
- endfunction
- function realPointPoint()
- obj=plot(dat.realPoint(1),dat.realPoint(2),'Color','#550055');
- obj.mark_style=10; obj.mark_size=16; obj.mark_background=0; obj.thickness=2;
- endfunction
- if exists("graphWindows")==0
- for i=1:1:dat.n
- graphWindows(i)=scf();
- graphWindows(i).figure_size=graphSize;
- graphWindows(i).color_map=rainbowColorMap(1024);
- end
- else
- if length(graphWindows)<>dat.n
- clear graphWindows;
- for i=1:1:dat.n
- graphWindows(i)=scf();
- graphWindows(i).figure_size=graphSize;
- graphWindows(i).color_map=rainbowColorMap(1024);
- end
- end
- end
- for i=1:1:length(rts)
- canvas(i); centres(); circles(); startPoint(i);
- route(i,length(rts(i).s)); endPoint(i); bestGuessPoint(); realPointPoint();
- gw=gcf(); ax0=gw.children(1); ax0.filled="off";
- ax1=gw.children(2); ax1.filled="off";
- ax0.font_style=0;ax1.font_style=0;ax1.title.font_style=0;
- ax1.x_label.font_style=0;ax1.y_label.font_style=0;
- ax0.font_size=fontSize;ax1.font_size=fontSize;ax1.title.font_size=fontSize;
- ax1.x_label.font_size=fontSize;ax1.y_label.font_size=fontSize;
- xtitle([
- strcat(["Maximum of sensors uncertainty: ",string(dat.unc),";"]),
- strcat(["Number of known spheres: ",string(dat.n),";"]),
- strcat(["Start point #",string(i),..
- "; Final error: ",string(dat.error)])]);
- xs2png(graphWindows(i),strcat(["sample_start_point_",string(i),".png"]));
- //xs2svg(graphWindows(i),strcat(["sample_start_point_",string(i),".svg"]));
- //xs2eps(graphWindows(i),strcat(["sample_start_point_",string(i),".eps"]));
- end
|