diff options
Diffstat (limited to 'js/Misc/BOUNCE.js')
-rw-r--r-- | js/Misc/BOUNCE.js | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/js/Misc/BOUNCE.js b/js/Misc/BOUNCE.js index 0c2fa34f..2436898c 100644 --- a/js/Misc/BOUNCE.js +++ b/js/Misc/BOUNCE.js @@ -33,9 +33,9 @@ function BOUNCE() { this.model.nzcross = new ScilabDouble([n*(n-1)/2+4*n]); this.model.blocktype = new ScilabString(["c"]); this.model.dep_ut = new ScilabDouble([false,true]); - var exprs = [[strcat(sci2exp(this.rpar1))],[strcat(sci2exp(this.rpar2))],[strcat(sci2exp(this.walls))],[strcat(sci2exp(this.x))],[strcat(sci2exp(this.xd))],[strcat(sci2exp(this.y))],[strcat(sci2exp(this.yd))]]; - var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"BOUNCE\",sz(1),sz(2));"]); - this.x = standard_define([3,2],this.model,exprs,gr_i); + this.exprs = [[strcat(sci2exp(this.rpar1))],[strcat(sci2exp(this.rpar2))],[strcat(sci2exp(this.walls))],[strcat(sci2exp(this.x))],[strcat(sci2exp(this.xd))],[strcat(sci2exp(this.y))],[strcat(sci2exp(this.yd))]]; + this.gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"BOUNCE\",sz(1),sz(2));"]); + this.x = standard_define([3,2],this.model,this.exprs,this.gr_i); return new BasicBlock(this.x); } BOUNCE.prototype.details = function BOUNCE() { @@ -65,16 +65,17 @@ function BOUNCE() { this.yd = inverse(arguments[0]["yd"]) this.g = parseFloat(arguments[0]["g"]) this.C = parseFloat(arguments[0]["C"]) + this.exprs = arguments[0]["exprs"] this.x = arg1; this.graphics = arg1.graphics; - var exprs = this.graphics.exprs; + this.exprs = this.graphics.exprs; this.model = arg1.model; - if (size(exprs,"*")<9) { - exprs[8-1] = "9.81"; - exprs[9-1] = "0"; + if (size(this.exprs,"*")<9) { + this.exprs[8-1] = "9.81"; + this.exprs[9-1] = "0"; } while (true) { - [ok,this.rpar1,this.rpar2,this.walls,this.xt,this.xd,this.y,this.yd,this.g,this.C,exprs] = scicos_getvalue(["Set Bounce Block"],["Mass","Radius","[xmin,xmax,ymin,ymax]","xpos","xdpos","ypos","ydpos","g (gravity)","C (aerodynamic coeff"],list("vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",1,"vec",1),exprs); + [ok,this.rpar1,this.rpar2,this.walls,this.xt,this.xd,this.y,this.yd,this.g,this.C,this.exprs] = scicos_getvalue(["Set Bounce Block"],["Mass","Radius","[xmin,xmax,ymin,ymax]","xpos","xdpos","ypos","ydpos","g (gravity)","C (aerodynamic coeff"],list("vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",1,"vec",1),this.exprs); if (!ok) { break; } @@ -123,7 +124,7 @@ function BOUNCE() { var state = transpose(state); this.model.state = new ScilabDouble(state.slice()); this.model.nzcross = new ScilabDouble([n*(n-1)/2+4*n]); - this.graphics.exprs = new ScilabDouble([exprs]); + this.graphics.exprs = new ScilabDouble([this.exprs]); this.x.graphics = this.graphics; this.x.model = this.model; break; |