//SCOPXYZ_f Scicos 3d scope visualization block //Classical interface function ver1.0 - scilab-2.7 //8 novembre 2003 - IRCOM GROUP - Author : A.Layec function [x,y,typ]=SCOPXYZ_f(job,arg1,arg2) // Copyright INRIA x=[];y=[];typ=[] select job case 'plot' then standard_draw(arg1) case 'getinputs' then [x,y,typ]=standard_inputs(o) case 'getoutputs' then x=[];y=[];typ=[]; case 'getorigin' then [x,y]=standard_origin(arg1) case 'set' then x=arg1; graphics=arg1.graphics;exprs=graphics.exprs; model=arg1.model; //state=model(2) while %t do [ok,clrs,win,wpos,wdim,.. x_dim,y_dim,z_dim,alpha,theta,eflag,buf,GRAPHlabel,exprs]=getvalue(.. 'Set Scope parameters',.. ['Color (>0) or mark (<0) '; 'Output window number'; 'Output window position'; 'Output window sizes'; 'Xmin Xmax'; 'Ymin Ymax'; 'Zmin Zmax'; 'Alpha'; 'Theta'; '[type,box]'; 'Buffer size'; 'Captions for axes'],.. list('vec',1,'vec',1,'vec',-1,'vec',-1,'vec',2,.. 'vec',2,'vec',2,'vec',1,'vec',1,'vec',2,'vec',1,'str',1),exprs) if ~ok then break,end //user cancel modification xmin=x_dim(1);xmax=x_dim(2); ymin=y_dim(1);ymax=y_dim(2); zmin=z_dim(1);zmax=z_dim(2); mess=[] if size(wpos,'*')<>0 &size(wpos,'*')<>2 then mess=[mess;'Window position must be [] or a 2 vector';' '] ok=%f end if size(wdim,'*')<>0 &size(wdim,'*')<>2 then mess=[mess;'Window dim must be [] or a 2 vector';' '] ok=%f end if win<0 then mess=[mess;'Window number can''t be negative';' '] ok=%f end if ymin>=ymax then mess=[mess;'Ymax must be greater than Ymin';' '] ok=%f end if xmin>=xmax then mess=[mess;'Xmax must be greater than Xmin';' '] ok=%f end if zmin>=zmax then mess=[mess;'Zmax must be greater than Zmin';' '] ok=%f end if buf<2 then mess=[mess;'Buffer size must be greater or equal than 2';' '] ok=%f end if eflag(1)>6 then mess=[mess;'Type must smaller or equal than 6';' '] ok=%f end if eflag(1)<0 then mess=[mess;'Type must be positive';' '] ok=%f end if eflag(2)>4 then mess=[mess;'Box must smaller or equal than 4';' '] ok=%f end if eflag(2)<0 then mess=[mess;'Box must be positive';' '] ok=%f end if length(GRAPHlabel)>40 then mess=[mess;'Graph label too long (max 40)';' '] ok=%f end if ~ok then message(['Some specified values are inconsistent:'; ' ';mess]) end if ok then if wpos==[] then wpos=[-1;-1];end if wdim==[] then wdim=[-1;-1];end rpar=[xmin;xmax;ymin;ymax;zmin;zmax;alpha;theta] if GRAPHlabel=='' then GRAPHlabel=' @ @ ';end GRAPHlabelsize=length(GRAPHlabel) GRAPHlabelCODE=str2code(GRAPHlabel) ipar=[win;clrs;buf;0;0;wpos(:);wdim(:);eflag(1);eflag(2);.. GRAPHlabelsize;GRAPHlabelCODE(:)] model.dstate=zeros(3*buf,1) model.rpar=rpar(:) model.ipar=ipar(:) graphics.exprs=exprs x.graphics=graphics;x.model=model break end end case 'define' then win=1 wdim=[300;200] wpos=[-1;-1] clrs=1 buf=2 Xaxeslabel='XAXES' Yaxeslabel='YAXES' Zaxeslabel='ZAXES' GRAPHlabel=Xaxeslabel+'@'+Yaxeslabel+'@'+Zaxeslabel GRAPHlabelsize=length(GRAPHlabel) GRAPHlabelCODE=str2code(GRAPHlabel) xmin=-15;xmax=15 ymin=-15;ymax=15 zmin=-15;zmax=15 alpha=30 theta=45 eflag=[1;4] model=scicos_model() model.sim=list('scopxyz',2) model.in=[1;1;1] model.out=[] model.evtin=1 model.evtout=[] model.dstate=zeros(3*buf,1) model.ipar=[win;clrs;buf;0;0;wpos;wdim;eflag(1);eflag(2);GRAPHlabelsize;GRAPHlabelCODE(:)] model.rpar=[xmin;xmax;ymin;ymax;zmin;zmax;alpha;theta] model.blocktype='d' model.firing=[] model.dep_ut=[%f %f] exprs=[string(clrs); string(win); sci2exp([]); sci2exp(wdim); string(xmin)+" "+string(xmax); string(ymin)+" "+string(ymax); string(zmin)+" "+string(zmax); string(alpha); string(theta); sci2exp(eflag); string(buf); GRAPHlabel]; gr_i=['txt=[''Scope'';''XYZ'']';'xstringb(orig(1),orig(2),txt,sz(1),sz(2),''fill'');'] x=standard_define([2 2],model,exprs,gr_i) end endfunction