| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- fileName="one_case_data-3d.txt";
- generateNewCase=1;
- graphSize=[800,800]; fontSize=4; meshSize=48;
- 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')];
- rangeZ=[min(dat.C(3,1:(dat.n))-dat.R'),max(dat.C(3,1:(dat.n))+dat.R')];
- itemColorMap=[0, 0, 0; 2/3,0, 0; 0,2/3,0; 0,0,2/3;..
- 0,2/3,2/3; 2/3,0,2/3;2/3,2/3,0;..
- 11/51,0,11/51;1,1,1];
- function canvas(n)
- grw=graphWindows(n); clf(grw);
- grw.color_map=itemColorMap;
- grw.children.isoview="on";
- endfunction
- function centres()
- obj=scatter3d(dat.C(1,1:dat.n),dat.C(2,1:dat.n),dat.C(3,1:dat.n),..
- 64,itemColorMap(2:(dat.n+1),1:3),"fill",".");
- endfunction
- function [x,y,z]=tchSph(t,p)
- x=sin(t).*cos(p)*currR+currC(1)*ones(p);
- y=sin(t).*sin(p)*currR+currC(2)*ones(p);
- z=cos(t).*currR+currC(3)*ones(p);
- endfunction
- function circles()
- for i=1:1:dat.n
- currC=dat.C(1:dat.d,i); currR=dat.R(i);
- t=linspace(-%pi,%pi,meshSize); p=linspace(-%pi,%pi,meshSize);
- [xf,yf,zf]=eval3dp(tchSph,t,p);
- obj=plot3d(xf,yf,zf,..
- ebox=[rangeX(1),rangeX(2),rangeY(1),rangeY(2),..
- rangeZ(1),rangeZ(2)],flag=[0,3,4]);
- obj.foreground=i+1;
- end
- endfunction
- function startPoint(n)
- obj=scatter3d([rts(n).s(1).P(1),rts(n).s(1).P(1)],..
- [rts(n).s(1).P(2),rts(n).s(1).P(2)],..
- [rts(n).s(1).P(3),rts(n).s(1).P(3)],..
- 48,[itemColorMap(1,1:3);itemColorMap(1,1:3)],"fill","x");
- obj.thickness=2;
- obj=scatter3d([rts(n).s(1).P(1),rts(n).s(1).P(1)],..
- [rts(n).s(1).P(2),rts(n).s(1).P(2)],..
- [rts(n).s(1).P(3),rts(n).s(1).P(3)],..
- 128,[itemColorMap(1,1:3);itemColorMap(1,1:3)],"o");
- obj.thickness=2;
- 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);sZs(j)=rts(n).s(j).P(3);
- end
- param3d(sXs,sYs,sZs); obj=get("hdl"); obj.thickness=2; obj.foreground=1;
- endfunction
- function endPoint(n)
- obj=scatter3d(..
- [rts(n).s(length(rts(n).s)).P(1),rts(n).s(length(rts(n).s)).P(1)],..
- [rts(n).s(length(rts(n).s)).P(2),rts(n).s(length(rts(n).s)).P(2)],..
- [rts(n).s(length(rts(n).s)).P(3),rts(n).s(length(rts(n).s)).P(3)],..
- 512,[itemColorMap(1,1:3);itemColorMap(1,1:3)],"o"); obj.thickness=2;
- endfunction
- function bestGuessPoint()
- obj=scatter3d([bestGuess.P(1),bestGuess.P(1)],..
- [bestGuess.P(2),bestGuess.P(2)],..
- [bestGuess.P(3),bestGuess.P(3)],256,..
- [itemColorMap(8,1:3);itemColorMap(8,1:3)],"+");
- obj.thickness=2;
- endfunction
- function realPointPoint()
- obj=scatter3d([dat.realPoint(1),dat.realPoint(1)],..
- [dat.realPoint(2),dat.realPoint(2)],..
- [dat.realPoint(3),dat.realPoint(3)],256,..
- [itemColorMap(8,1:3);itemColorMap(8,1:3)],"*");
- obj.thickness=2;
- endfunction
- if exists("graphWindows")==0
- for i=1:1:dat.runs
- graphWindows(i)=scf(); gw=graphWindows(i);
- gw.figure_size=graphSize; gw.color_map=itemColorMap;
- end
- else
- if length(graphWindows)<>dat.runs
- clear graphWindows;
- for i=1:1:dat.runs
- graphWindows(i)=scf(); gw=graphWindows(i);
- gw.figure_size=graphSize; gw.color_map=itemColorMap;
- 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();
- ax0=graphWindows(i).children; ax0.filled="off";
- ax0.font_style=0; ax0.font_size=fontSize-2;
- ax0.title.font_style=0; ax0.title.font_size=fontSize;
- ax0.x_label.font_style=0; ax0.x_label.font_size=fontSize;
- ax0.y_label.font_style=0; ax0.y_label.font_size=fontSize;
- ax0.z_label.font_style=0; ax0.z_label.font_size=fontSize;
- ax0.isoview="on";
- ax0.cube_scaling="off";
- 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"]));
- end
|