1 /*! 2 * 3 * RaphaëlSM : Raphaël extension for civil engineering mechanics drawings 4 * version 0.5.2 (2011-10-15) 5 * 6 * Copyright (C) 2011 Jan Stransky 7 * 8 * Czech Technical University, Faculty of Civil Engineering, 9 * Department of Structural Mechanics, 166 29 Prague, Czech Republic 10 * 11 * 12 * This program is free software: you can redistribute it and/or modify 13 * it under the terms of the GNU General Public License as published by 14 * the Free Software Foundation, either version 3 of the License, or 15 * (at your option) any later version. 16 * 17 * This program is distributed in the hope that it will be useful, 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 * GNU General Public License for more details. 21 * 22 * You should have received a copy of the GNU General Public License 23 * along with this program. If not, see <http://www.gnu.org/licenses/>. 24 */ 25 26 /** 27 * @fileOverview <a href="http://raphaeljs.com/">Raphaël</a> (svg javascript library) extension by functions and "classes" for structural mechanics drawings (supports, deflections etc.). Requires <a href="http://raphaeljs.com/">raphael.js</a> and <a href="http://mech.fsv.cvut.cz/~stransky/software/raphaeltools/">raphaeltools.js</a> loaded before loading this file. For more information see <a href="http://mech.fsv.cvut.cz/~stransky/software/raphaelsm/">project homepage</a>. 28 <br /><br/>RaphaëlSM is a free software distributed under <a href='http://www.gnu.org/licenses/gpl.html'>GNU GPL license</a>. 29 * @author <a href="http://mech.fsv.cvut.cz/~stransky">Jan Stránský</a> 30 * @version Version 0.5.2 (2011-10-15) 31 */ 32 33 34 35 36 /** Abstract class for simple geometrical objects 37 * @class Abstract class for geometrical object 38 * @property {Raphael} rapheal raphael instance connected to the object 39 * @property {float} x x coordinate of the object 40 * @property {float} z z coordinate of the object 41 * @property {float} size size of the object 42 * @property {float} angle angle of the object 43 * @property {Array} pathList svg array (list) of the object 44 * @property {Raphael.el} obj actual raphael object 45 * @property {float} sin sin of this.angle 46 * @property {float} cos cos of this.angle*/ 47 GeomObj = function() { 48 49 /** Constructor 50 * @param {Raphael} raphael raphael instance 51 * @param {Object} parameters, see below 52 * @param {float} params.x x coordinate [pixel] 53 * @param {float} params.z z coordinate [pixel] 54 * @param {float} params.size size [pixel] 55 * @param {float} params.angle rotation angle from initial position*/ 56 this.constructorGeomObj = function(raphael,params) { 57 this.raphael = raphael 58 var params = params==undefined? {} : params; 59 this.x = params.x==undefined? 0. : params.x; 60 this.z = params.z==undefined? 0. : params.z; 61 this.size = params.size==undefined? 1. : params.size; 62 this.angle = params.angle==undefined? 0. : params.angle; 63 this.pathList = null; 64 this.obj = null; 65 this.sin = 0.; 66 this.cos = 0.; 67 68 this.setSinCos(); 69 this.setPathList(); 70 this.makeObj(this.raphael); 71 this.copies = []; 72 this.copiesShifts = []; 73 } 74 75 /** Compute sin and cos from stored angle*/ 76 this.setSinCos = function() { 77 this.sin = Math.sin(-this.angle*Math.PI/180); 78 this.cos = Math.cos(-this.angle*Math.PI/180); 79 } 80 /** Set new this.pathList of receiver (each derived class must define its own setPathList method)*/ 81 this.setPathList = function() {} 82 // Create a raphael object and assign it to this.obj 83 this.makeObj = function() { this.obj = this.raphael.path(this.pathList); } 84 // Set this.pathList to this.obj raphael object 85 this.attrObjPath = function() { this.obj.attr({"path":this.pathList}); } 86 /** Sets new x position of receiver (this.x = x) 87 * @param {float} x new x coordinate [pixel]*/ 88 this.setX = function(x) { this.x = x; this.up(); } 89 /** Sets new z position of receiver (this.z = z) 90 * @param {float} z new z coordinate [pixel]*/ 91 this.setZ = function(z) { this.z = z; this.up(); } 92 /** Sets new x and z position of receiver (this.x = x; this.z = z) 93 * @param {float} x new x coordinate [pixel] 94 * @param {float} z new z coordinate [pixel]*/ 95 this.setXZ = function(x,z) { this.x = x; this.z = z; this.up(); } 96 /** Translate receiver in x direction (this.x += x) 97 * @param {float} dx distance to be translated [pixel]*/ 98 this.translateX = function(dx) { this.x += dx; this.up(); } 99 /** Translate receiver in x direction (this.z += dz) 100 * @param {float} dz distance to be translated [pixel]*/ 101 this.translateZ = function(dz) { this.z += dz; this.up(); } 102 /** Translate receiver in x and z direction (this.x += dx; this.z += dz) 103 * @param {float} dx distance to be translated in x direction [pixel] 104 * @param {float} dz distance to be translated in z direction [pixel]*/ 105 this.translate = function(dx,dz) { this.x += dx; this.z += dz; this.up(); } 106 /** Rotate receiver by given angle (this.angle += phi) 107 * @param {float} phi angle of rotation*/ 108 this.rotate = function(phi) { this.angle += phi; this.setSinCos(); this.up(); } 109 /** Set angle of receiver (this.angle = phi) 110 * @param {float} phi angle of rotation*/ 111 this.setAngle = function(phi) { this.angle = phi; this.setSinCos(); this.up(); } 112 /** Copy receiver 113 * @param {[TODO]} shifts TODO*/ 114 this.copy = function(shifts) { for (var i=0; i<shifts.length; i++) { this.copiesShifts.push(shifts[i]); this.copies.push(this.makeCopy()); this.up();} } 115 /** Make a copy of itself (each derived class to be copied have to define its own makeCopy method)*/ 116 this.makeCopy = function() {} 117 118 /** Update receiver (set this.pathList for given internal variables - x,z,angle... - as well as its copies)*/ 119 this.up = function() { 120 this.setPathList(); this.attrObjPath(); 121 for (var c=0; c<this.copies.length; c++) { this.copies[c].setXZ(this.x+this.copiesShifts[c][0],this.z+this.copiesShifts[c][1]); } 122 } 123 } 124 125 /** Arrow 126 * @class represents arrow 127 * @borrows GeomObj#setX as this.setX 128 * @borrows GeomObj#setZ as this.setZ 129 * @borrows GeomObj#setXZ as this.setXZ 130 * @borrows GeomObj#translateX as this.translateX 131 * @borrows GeomObj#translateZ as this.translateZ 132 * @borrows GeomObj#translate as this.translate 133 * @borrows GeomObj#rotate as this.rotate 134 * @borrows GeomObj#setAngle this.setAngle 135 * @borrows GeomObj#up as this.up 136 * @borrows GeomObj#rapheal as this.raphael 137 * @borrows GeomObj#x as this.x 138 * @borrows GeomObj#z as this.z 139 * @borrows GeomObj#size as this.size 140 * @borrows GeomObj#angle as this.angle 141 * @borrows GeomObj#pathList as this.pathList 142 * @borrows GeomObj#obj as this.obj 143 * @borrows GeomObj#sin as this.sin 144 * @borrows GeomObj#cos as this.cos 145 * @param {Raphael} raphael raphael instance 146 * @param {Object} params parameters, see below 147 * @param {float} [params.x=0.] x coordinate of arrow tip [pixel] 148 * @param {float} [params.z=0.] z coordinate of arrow tip [pixel] 149 * @param {float} [params.size=100.] length of the whole arrow (its size) [pixel] 150 * @param {float} [params.angle=0.] the arrow will be rotated by this angle [deg] 151 * @param {float} [params.headLen=size/4.] length of the arrow head [pixel] 152 * @param {float} [params.headWidth=size/16.] width of the arrow head [pixel] 153 * @property {float} headLen length of arrow head [pixel] 154 * @property {float} headWidth width of arrow head [pixel]*/ 155 Arrow = function(raphael,params) { 156 var params = params==undefined? {} : params; 157 this.inheritFrom = GeomObj; this.inheritFrom(); 158 159 /** Constructor, see {@link Arrow} for parameters description*/ 160 this.constructorArrow = function(raphael,params) { 161 this.constructorGeomObj(raphael,params); 162 if (params.size==undefined) { this.size = 50.; } 163 this.headLen = params.headLen==undefined? this.size/4. : params.headLen; 164 this.headWidth = params.headWidth==undefined? this.size/16.: params.headWidth; 165 this.up(); 166 } 167 168 /** Sets svg path of receiver*/ 169 this.setPathList = function() { 170 this.pathList = [ 171 ["M",this.x,this.z], 172 ["L",this.x+this.cos*this.size,this.z+this.sin*this.size], 173 ["M",this.x+this.cos*this.headLen-this.sin*this.headWidth,this.z+this.sin*this.headLen+this.cos*this.headWidth], 174 ["L",this.x,this.z], 175 ["L",this.x+this.cos*this.headLen+this.sin*this.headWidth,this.z+this.sin*this.headLen-this.cos*this.headWidth]]; 176 } 177 /** Resize receiver in both direction 178 * @param {float} newSize new size of receiver*/ 179 this.resize = function(newSize) { 180 if (Math.abs(newSize)>=1) { this.headLen *= newSize/this.size; this.headWidth *= newSize/this.size; this.size=newSize; this.up(); } 181 } 182 /** Returns copy of receiver 183 * @returns {Arrow} copy of receiver*/ 184 this.makeCopy = function() { 185 var ret = new Arrow(this.raphael,{x:this.x,z:this.z,size:this.size,angle:this.angle,headLen:this.headLen,headWidth:this.headWidth}); 186 ret.obj.remove(); 187 ret.obj = this.obj.clone(); 188 return ret; 189 } 190 191 this.constructorArrow(raphael,params); 192 }; 193 /** Creates new Arrow object, for parameters meaning see {@link Arrow} 194 * @returns {Arrow} new Arrow object*/ 195 Arrow.create = function(raphael,params) { 196 return new Arrow(raphael,params); 197 } 198 199 200 /** Pin support 201 * @class represents pin support 202 * @borrows GeomObj#setX as this.setX 203 * @borrows GeomObj#setZ as this.setZ 204 * @borrows GeomObj#setXZ as this.setXZ 205 * @borrows GeomObj#translateX as this.translateX 206 * @borrows GeomObj#translateZ as this.translateZ 207 * @borrows GeomObj#translate as this.translate 208 * @borrows GeomObj#rotate as this.rotate 209 * @borrows GeomObj#setAngle this.setAngle 210 * @borrows GeomObj#up as this.up 211 * @borrows GeomObj#rapheal as this.raphael 212 * @borrows GeomObj#x as this.x 213 * @borrows GeomObj#z as this.z 214 * @borrows GeomObj#size as this.size 215 * @borrows GeomObj#angle as this.angle 216 * @borrows GeomObj#pathList as this.pathList 217 * @borrows GeomObj#obj as this.obj 218 * @borrows GeomObj#sin as this.sin 219 * @borrows GeomObj#cos as this.cos 220 * @param {Raphael} raphael raphael instance 221 * @param {Object} params parameters, see below 222 * @param {float} [params.x=0.] x coordinate of supprt tip [pixel] 223 * @param {float} [params.z=0.] z coordinate of supprt tip [pixel] 224 * @param {float} [params.size=20.] height of the support [pixel] 225 * @param {float} [params.angle=0.] the support will be rotated by angle [deg] 226 * @param {bool|int} [params.sliding=true] if the support is sliding or not 227 * @param {float} [params.gap=5.] gap between triangle and line (sliding symbol) [pixel] 228 * @param {float} [params.ratio=0.7] width/height of the triangle [-] 229 * @property {bool} sliding true for sliding pins and false for fixed pins 230 * @property {float} ratio width/height of the pin 231 * @property {bool} sliding true for sliding pins and false for fixed pins*/ 232 PinSupport = function(raphael,params) { 233 var params = params==undefined? {} : params; 234 this.inheritFrom = GeomObj; this.inheritFrom(); 235 236 /** Constructor, see {@link PinSupport} for parameters description*/ 237 this.constructorPinSupport = function(raphael,params) { 238 this.constructorGeomObj(raphael,params); 239 if (params.size==undefined) { this.size = 20.; } 240 this.sliding = params.sliding==undefined? false : params.sliding 241 this.ratio = params.ratio==undefined? .7 : params.ratio; 242 this.gap = params.gap==undefined? 5. : params.gap; 243 this.up(); 244 } 245 246 /** Sets svg path of receiver*/ 247 this.setPathList = function() { 248 if (this.sliding) { 249 this.pathList = [ 250 ["M",this.x,this.z], 251 ["L", this.x - this.cos*this.ratio*this.size - this.sin*this.size, this.z - this.sin*this.ratio*this.size + this.cos*this.size], 252 ["L", this.x + this.cos*this.ratio*this.size - this.sin*this.size, this.z + this.sin*this.ratio*this.size + this.cos*this.size], 253 ["Z"], 254 ["M", this.x - this.cos*this.ratio*this.size - this.sin*(this.size+this.gap),this.z - this.sin*this.ratio*this.size + this.cos*(this.size+this.gap)], 255 ["L", this.x + this.cos*this.ratio*this.size - this.sin*(this.size+this.gap),this.z + this.sin*this.ratio*this.size + this.cos*(this.size+this.gap)]]; 256 } 257 else { 258 this.pathList = [ 259 ["M",this.x,this.z], 260 ["L", this.x - this.cos*this.ratio*this.size - this.sin*this.size, this.z - this.sin*this.ratio*this.size + this.cos*this.size], 261 ["L", this.x + this.cos*this.ratio*this.size - this.sin*this.size, this.z + this.sin*this.ratio*this.size + this.cos*this.size], 262 ["Z"]]; 263 } 264 } 265 /** Returns copy of receiver 266 * @returns {PinSupport} copy of receiver*/ 267 this.makeCopy = function() { 268 var ret = new PinSupport(this.raphael,{x:this.x,z:this.z,size:this.size,angle:this.angle,sliding:this.sliding,gap:this.gap,ratio:this.ratio}); 269 ret.obj.remove(); 270 ret.obj = this.obj.clone(); 271 return ret; 272 } 273 274 this.constructorPinSupport(raphael,params); 275 } 276 277 /** Creates new PinSupport object, for parameters meaning see {@link PinSupport} 278 * @returns {PinSupport} new PinSupport object*/ 279 PinSupport.create = function(raphael,params) { 280 return new PinSupport(raphael,params); 281 } 282 283 284 285 /** Fixed support 286 * @class represents fixed support 287 * @borrows GeomObj#setX as this.setX 288 * @borrows GeomObj#setZ as this.setZ 289 * @borrows GeomObj#setXZ as this.setXZ 290 * @borrows GeomObj#translateX as this.translateX 291 * @borrows GeomObj#translateZ as this.translateZ 292 * @borrows GeomObj#translate as this.translate 293 * @borrows GeomObj#rotate as this.rotate 294 * @borrows GeomObj#setAngle this.setAngle 295 * @borrows GeomObj#up as this.up 296 * @borrows GeomObj#rapheal as this.raphael 297 * @borrows GeomObj#x as this.x 298 * @borrows GeomObj#z as this.z 299 * @borrows GeomObj#size as this.size 300 * @borrows GeomObj#angle as this.angle 301 * @borrows GeomObj#pathList as this.pathList 302 * @borrows GeomObj#obj as this.obj 303 * @borrows GeomObj#sin as this.sin 304 * @borrows GeomObj#cos as this.cos 305 * @param {Raphael} raphael raphael instance 306 * @param {Object} params parameters, see below 307 * @param {float} [params.x=0.] x coordinate of the support center [pixel] 308 * @param {float} [params.z=0.] z coordinate of the support center [pixel] 309 * @param {float} [params.size=30.] size (height) of the support [pixel] 310 * @param {float} [params.angle=0.] the support will be rotated by angle [deg] 311 * @param {float} [params.ratio=2.] height/width (width of the 'flags') 312 * @param {int} [params.nFlags=5] number of 'flags' 313 * @param {bool|int} [params.reversed=false] reversed direction of 'flags' 314 * @property {float} ratio ratio between length of support and 'flag' 315 * @property {int} nFlags number of flags 316 * @property {bool} reversed if flags are reversed or not*/ 317 FixedSupport = function(raphael,params) { 318 var params = params==undefined? {} : params; 319 this.inheritFrom = GeomObj; this.inheritFrom(); 320 321 /** Constructor, see {@link FixedSupport} for parameters description*/ 322 this.constructorFixedSupport = function(raphael,params) { 323 this.constructorGeomObj(raphael,params); 324 if (params.size==undefined) { this.size = 30.; } 325 this.ratio = params.ratio==undefined? .2 : params.ratio; 326 this.nFlags = params.nFlags==undefined? 5 : params.nFlags; 327 this.reversed = params.reversed==undefined? false : params.reversed; 328 this.up(); 329 } 330 331 /** Sets svg path of receiver*/ 332 this.setPathList = function() { 333 this.pathList = [ 334 ["M", this.x - this.sin*this.size*.5, this.z + this.cos*this.size*.5], 335 ["L", this.x + this.sin*this.size*.5, this.z - this.cos*this.size*.5]]; 336 if (this.reversed) { 337 for (var i=0; i<this.nFlags; i++) { 338 var pt0 = vecTrans(0,this.size*(-.5+(i+1)/this.nFlags),this.sin,this.cos); 339 var pt1 = vecTrans(-this.size*this.ratio,this.size*(-.5+i/this.nFlags),this.sin,this.cos); 340 this.pathList.push(["M",this.x+pt0[0],this.z+pt0[1]]); 341 this.pathList.push(["L",this.x+pt1[0],this.z+pt1[1]]); 342 } 343 } 344 else { 345 for (var i=0; i<this.nFlags; i++) { 346 var pt0 = vecTrans(0,this.size*(-.5+i/this.nFlags),this.sin,this.cos); 347 var pt1 = vecTrans(-this.size*this.ratio,this.size*(-.5+(i+1)/this.nFlags),this.sin,this.cos); 348 this.pathList.push(["M",this.x+pt0[0],this.z+pt0[1]]); 349 this.pathList.push(["L",this.x+pt1[0],this.z+pt1[1]]); 350 } 351 } 352 } 353 354 /** Returns copy of receiver 355 * @returns {FixedSupport} copy of receiver*/ 356 this.makeCopy = function() { 357 var ret = new FixedSupport(this.raphael,{x:this.x,z:this.z,size:this.size,angle:this.angle,ratio:this.ratio,nFlags:this.nFlags,reversed:this.reversed}); 358 ret.obj.remove(); 359 ret.obj = this.obj.clone(); 360 return ret; 361 } 362 363 this.constructorFixedSupport(raphael,params); 364 } 365 /** Creates new FixedSupport object, for parameters meaning see {@link PinSupport} 366 * @returns {FixedSupport} new FixedSupport object*/ 367 FixedSupport.create = function(raphael,params) { 368 return new FixedSupport(raphael,params); 369 } 370 371 372 373 /** Continuous load 374 * @class represents continuous load 375 * @param {Raphael} raphael raphael instance 376 * @param {Point2d} point1 1st point 377 * @param {Point2d} point2 2nd point 378 * @param {float} [valx=0.] value of load in x direction (global) 379 * @param {float} [valz=0.] value of load in z direction (global) 380 * @param {int} [nArrows=4] numer of arrows 381 * @property {Raphael} raphael raphael instance 382 * @property {Point2d} point1 1st point 383 * @property {Point2d} point2 2nd point 384 * @property {float} valx value in global x direction 385 * @property {float} valz value in global z direction 386 * @property {int} nArrows number of displayed arrows 387 * @property {Raphael.el} obj pointer to actual raphael object*/ 388 ContinuousLoad = function(raphael,point1,point2,valx,valz,nArrows) { 389 390 /** Constructor, see {@link ContinuousLoad} for parameters description*/ 391 this.constructorLine = function(raphael,point1,point2,valx,valz,nArrows) { 392 this.raphael = raphael; 393 this.point1 = point1; 394 this.point2 = point2; 395 this.valx = valx==undefined? 0. : valx; 396 this.valz = valz==undefined? 0. : valz; 397 this.nArrows = nArrows==undefined? 4 : nArrows; 398 399 this.obj = this.raphael.path(this.pathList); 400 this.up(); 401 } 402 403 /** Sets new values to receiver 404 * @param {float} [valx=0.] value in global x direction 405 * @param {float} [valz=0.] value in global z direction*/ 406 this.setVals = function(valx,valz) { 407 this.valx = valx==undefined? 0. : valx; 408 this.valz = valz==undefined? 0. : valz; 409 this.up(); 410 } 411 412 /** Sets geometry proprties of receiver according to stored attributes*/ 413 this.setGeom = function() { 414 this.x1 = this.point1.x; 415 this.z1 = this.point1.z; 416 this.x2 = this.point2.x; 417 this.z2 = this.point2.z; 418 this.dx = this.x2-this.x1; 419 this.dz = this.z2-this.z1; 420 this.len = Math.sqrt(this.dx*this.dx+this.dz*this.dz); 421 this.cos = this.dx/this.len; 422 this.sin = this.dz/this.len; 423 this.lenVals = Math.sqrt(this.valx*this.valx+this.valz*this.valz); 424 this.cosVal = this.valx/this.lenVals; 425 this.sinVal = this.valz/this.lenVals; 426 } 427 428 /** Sets svg path of receiver*/ 429 this.setPathList = function() { 430 this.pathList = [["M",this.x1,this.z1],["L",this.x2,this.z2], 431 ["L",this.x2-this.valx,this.z2-this.valz],["L",this.x1-this.valx,this.z1-this.valz],["Z"]]; 432 var segLen = this.len/(this.nArrows+1); 433 for (var i=1; i<=this.nArrows; i++) { 434 this.pathList.push(["M",this.x1-this.valx+i*segLen*this.cos,this.z1-this.valz+i*segLen*this.sin]); 435 this.pathList.push(["L",this.x1+i*segLen*this.cos,this.z1+i*segLen*this.sin]); 436 this.pathList.push(["M", 437 this.x1+i*segLen*this.cos-this.cosVal*this.lenVals/4+this.sinVal*this.lenVals/16, 438 this.z1+i*segLen*this.sin-this.sinVal*this.lenVals/4-this.cosVal*this.lenVals/16]); 439 this.pathList.push(["L",this.x1+i*segLen*this.cos,this.z1+i*segLen*this.sin]); 440 this.pathList.push(["L", 441 this.x1+i*segLen*this.cos-this.cosVal*this.lenVals/4-this.sinVal*this.lenVals/16, 442 this.z1+i*segLen*this.sin-this.sinVal*this.lenVals/4+this.cosVal*this.lenVals/16]); 443 } 444 } 445 // Set this.pathList to this.obj raphael object 446 this.attrObjPath = function() { this.obj.attr({"path":this.pathList}); } 447 448 /** Update receiver (set this.pathList for given internal variables)*/ 449 this.up = function() { this.setGeom(); this.setPathList(); this.attrObjPath(); } 450 451 this.constructorLine(raphael,point1,point2,valx,valz,nArrows); 452 } 453 /** Creates new ContinuousLoad object, for parameters meaning see {@link ContinuousLoad} 454 * @returns {ContinuousLoad} new ContinuousLoad object*/ 455 ContinuousLoad.create = function(raphael,point1,point2,valx,valz,nArrows) { 456 return new ContinuousLoad(raphael,point1,point2,valx,valz,nArrows); 457 } 458 459 460 461 462 /** Abstract class for curves (applied as internal forces, deflection etc.) 463 * @class represents generic curve object drawn over a line (e.g. beam) 464 * @param {Raphael} raphael raphael instance 465 * @param {Point2d} point1 first point of curve 466 * @param {Point2d} point2 second point of curve 467 * @param {Object} params parameters, see below 468 * @param {float} [params.scale=1.] scale scale between passed value and drawn value in pixels 469 * @param {bool} [params.closedBegin=true] if point1 is connected with appropriate value of curve 470 * @param {bool} [params.closedEnd=true] if point2 is connected with appropriate value of curve 471 * @param {bool} [params.closedBase=true] if point1 and point2 are connected within the curve definition 472 * @property {Raphael} raphael raphael instance 473 * @property {Point2d} point1 1st point 474 * @property {Point2d} point2 2nd point 475 * @property {float} scale scale scale between passed value and drawn value in pixels 476 * @property {bool} closedBegin if point1 is connected with appropriate value of curve 477 * @property {bool} closedEnd if point2 is connected with appropriate value of curve 478 * @property {bool} closedBase if point1 and point2 are connected within the curve definition 479 * @property {Raphael.el} actual raphael object 480 */ 481 CurveObj = function() { 482 483 /** Constructor, see {@link LinearCurve} for parameters description*/ 484 this.constructorCurveObj = function(raphael,point1,point2,params) { 485 var params = params==undefined? {} : params; 486 this.raphael = raphael; 487 this.point1 = point1; 488 this.point2 = point2; 489 this.scale = params.scale==undefined? 1. : params.scale; 490 this.closedBegin = params.closedBegin==undefined? true : params.closedBegin; 491 this.closedEnd = params.closedEnd==undefined? true : params.closedEnd; 492 this.closedBase = params.closedBase==undefined? true : params.closedBase; 493 494 this.setGeom() 495 this.consts(); 496 this.setPathList(); 497 this.makeObj(); 498 } 499 500 /** Sets function constants*/ 501 this.consts = function() {} 502 503 /** Sets svg path list*/ 504 this.setPathList = function() {} 505 506 /** Sets geometric parameters according to stored attributes*/ 507 this.setGeom = function() { 508 this.x1 = this.point1.x; 509 this.z1 = this.point1.z; 510 this.x2 = this.point2.x; 511 this.z2 = this.point2.z; 512 this.dx = this.x2-this.x1; 513 this.dz = this.z2-this.z1; 514 this.len = Math.sqrt(this.dx*this.dx+this.dz*this.dz); 515 this.segLen = this.len/(this.nSeg) || 1. 516 this.cos = this.dx/this.len; 517 this.sin = this.dz/this.len; 518 } 519 520 this.makeObj = function() { this.obj = this.raphael.path(this.pathList); } 521 this.attrObjPath = function() { this.obj.attr({"path":this.pathList}); } 522 523 /** Update*/ 524 this.up= function() { this.setGeom(); this.consts(); this.setPathList(); this.attrObjPath(); } 525 526 this.closedPartsHandle = function(val1) { 527 if (this.closedEnd) { this.pathList.push(["L",this.x2,this.z2]); } 528 else { this.pathList.push(["M",this.x2,this.z2]); } 529 if (this.closedBase) { this.pathList.push(["L",this.x1,this.z1]); } 530 else { this.pathList.push(["M",this.x1,this.z1]); } 531 if (this.closedBegin) { this.pathList.push(["L",this.x1-this.scale*this.sin*val1,this.z1+this.scale*this.cos*val1]); } 532 } 533 } 534 535 536 537 538 /** Linear curve (e.g. shear force line) 539 * @class represents linear curve 540 * @param {Raphael} raphael raphael instance 541 * @param {Point2d} point1 1st point 542 * @param {Point2d} point2 2nd point 543 * @param {Object} params parameters, see below 544 * @param {float} [param.val1=0.] value in 1st point 545 * @param {float} [param.val2=0.] value in 2nd point 546 * @param {float} [param.scale=1.] scale factor 547 * @param {bool} [param.closedBegin=true] the line conecting 1st point with 1st nodal value 548 * @param {bool} [param.closedEnd=true] the line conecting 2nd point with 2nd nodal value 549 * @param {bool} [param.closedBase=true] the line conecting 1st and 2nd point 550 * @property {Raphael} raphael raphael instance 551 * @property {Point2d} point1 1st point 552 * @property {Point2d} point2 2nd point 553 * @property {float} scale scale scale between passed value and drawn value in pixels 554 * @property {bool} closedBegin if point1 is connected with appropriate value of curve 555 * @property {bool} closedEnd if point2 is connected with appropriate value of curve 556 * @property {bool} closedBase if point1 and point2 are connected within the curve definition 557 * @property {Raphael.el} obj pointer to actual raphael object 558 * @borrows CurveObj#setPathList as this.setPathList 559 * @borrows CurveObj#consts as this.consts 560 * @borrows CurveObj#up as this.up 561 * @property {float} val1 value in 1st point 562 * @property {float} val2 value in 2nd point*/ 563 LinearCurve = function(raphael,point1,point2,params) { 564 var params = params==undefined? {} : params; 565 this.inheritFrom = CurveObj; this.inheritFrom(); 566 567 /** Constructor, see {@link LinearCurve} for parameters description*/ 568 this.constructorLinearCurve = function(raphael,point1,point2,params) { 569 this.constructorCurveObj(raphael,point1,point2,params); 570 this.val1 = params.val1==undefined? 0. : params.val1; 571 this.val2 = params.val2==undefined? 0. : params.val2; 572 this.up(); 573 } 574 575 this.setPathList = function() { 576 this.pathList = [["M",this.x1-this.scale*this.sin*this.val1,this.z1+this.scale*this.cos*this.val1]]; 577 this.pathList.push(["L",this.x2-this.scale*this.sin*this.val2,this.z2+this.scale*this.cos*this.val2]); 578 this.closedPartsHandle(this.val1); 579 } 580 581 /** Sets values of receiver 582 * @param {float} val1 value in 1st point 583 * @param {float} val2 value in 2nd point*/ 584 this.setVals = function(val1,val2) { 585 this.val1 = val1; 586 this.val2 = val2; 587 this.up(); 588 } 589 590 this.constructorLinearCurve(raphael,point1,point2,params); 591 } 592 /** Creates new LinearCurve object, for parameters meaning see {@link LinearCurve} 593 * @returns {LinearCurve} new LinearCurve object*/ 594 LinearCurve.create = function(raphael,point1,point2,params) { 595 return new LinearCurve(raphael,point1,point2,params); 596 } 597 598 599 /** Parabolic curve (e.g. bending moment line) 600 * @class represents parabolic curve 601 * @param {Raphael} raphael raphael instance 602 * @param {Point2d} point1 1st point 603 * @param {Point2d} point2 2nd point 604 * @param {Object} params parameters, see below 605 * @param {float} [params.val1=0.] value in 1st point 606 * @param {float} [params.valMid=0.] value in the middle of 1st and 2nd point 607 * @param {float} [params.val2=0.] value in 2nd point 608 * @param {float} [params.sclale=1.] scale factor 609 * @param {bool} [params.closedBegin=true] the line conecting 1st point with 1st nodal value 610 * @param {bool} [params.closedEnd=true] the line conecting 2nd point with 2nd nodal value 611 * @param {bool} [params.closedBase=true] the line conecting 1st and 2nd point 612 * @param {int} [params.nSeg=5] number of interpolating points 613 * @property {Raphael} raphael raphael instance 614 * @property {Point2d} point1 1st point 615 * @property {Point2d} point2 2nd point 616 * @property {float} scale scale scale between passed value and drawn value in pixels 617 * @property {bool} closedBegin if point1 is connected with appropriate value of curve 618 * @property {bool} closedEnd if point2 is connected with appropriate value of curve 619 * @property {bool} closedBase if point1 and point2 are connected within the curve definition 620 * @property {Raphael.el} obj pointer to actual raphael object 621 * @borrows CurveObj#setPathList as this.setPathList 622 * @borrows CurveObj#consts as this.consts 623 * @borrows CurveObj#up as this.up 624 * @property {float} val1 value in 1st point 625 * @property {float} val2 value in 2nd point 626 * @property {float} valMid value in the middle*/ 627 ParabolicCurve = function(raphael,point1,point2,params) { 628 var params = params==undefined? {} : params; 629 this.inheritFrom = CurveObj; this.inheritFrom(); 630 this.constructorParabolicCurve = function(raphael,point1,point2,params) { 631 this.constructorCurveObj(raphael,point1,point2,params); 632 this.val1 = params.val1==undefined? 0. : params.val1; 633 this.valMid = params.valMid==undefined? 0. : params.valMid; 634 this.val2 = params.val2==undefined? 0. : params.val2; 635 this.nSeg = params.nSeg==undefined? 5 : params.nSeg; 636 this.up(); 637 } 638 639 this.consts = function() { 640 this.c0 = this.val1; 641 this.c1 = (-3*this.val1 - this.val2 + 4*this.valMid)/this.len; 642 this.c2 = (2*this.val1 + 2*this.val2 - 4*this.valMid)/this.len/this.len; 643 } 644 this.v = function(s) { return this.c0 + this.c1*s + this.c2*s*s; } 645 this.dv = function(s) { return this.c1 + 2*this.c2*s; } 646 this.setPathList = function() { 647 this.pathList = [["M",this.x1-this.scale*this.sin*this.v(0),this.z1+this.scale*this.cos*this.v(0)]]; 648 var t = .3; 649 for (var i=0; i<this.nSeg; i++) { 650 var v1 = this.v(i*this.segLen); 651 var v2 = this.v((i+1)*this.segLen); 652 var dv1 = this.dv(i*this.segLen); 653 var dv2 = this.dv((i+1)*this.segLen); 654 var vec1 = vecTrans((i+t)*this.segLen,this.scale*(v1+dv1*t*this.segLen),this.sin,this.cos); 655 var vec2 = vecTrans((i+1-t)*this.segLen,this.scale*(v2-dv2*t*this.segLen),this.sin,this.cos); 656 var vec3 = vecTrans((i+1)*this.segLen,this.scale*v2,this.sin,this.cos); 657 var ll = ["C",this.x1+vec1[0],this.z1+vec1[1],this.x1+vec2[0],this.z1+vec2[1],this.x1+vec3[0],this.z1+vec3[1]]; 658 this.pathList.push(ll); 659 } 660 this.closedPartsHandle(this.v(0)); 661 } 662 663 /** Sets values of receiver 664 * @param {float} val1 value in 1st point 665 * @param {float} val2 value in 2nd point 666 * @param {float} valMid value in the middle*/ 667 this.setVals = function(val1,val2,valMid) { 668 this.val1 = val1; 669 this.val2 = val2; 670 this.valMid = valMid; 671 this.up(); 672 } 673 674 this.constructorParabolicCurve(raphael,point1,point2,params); 675 } 676 /** Creates new ParabolicCurve object, for parameters meaning see {@link ParabolicCurve} 677 * @returns {ParabolicCurve} new ParabolicCurve object*/ 678 ParabolicCurve.create = function(raphael,point1,point2,params) { 679 return new ParabolicCurve(raphael,point1,point2,params); 680 } 681 682 683 684 /** Generic class for 3rd and 4th order curves (used for deflection) 685 * @class represents generic class for deflection curve 686 * @param {Raphael} raphael raphael instance 687 * @param {Point2d} point1 1st point 688 * @param {Point2d} point2 2nd point 689 * @param {Object} params parameters, see below 690 * @param {float} [params.u1=0.] local x deflection in the 1st point 691 * @param {float} [params.w1=0.] local z deflection in the 1st point 692 * @param {float} [params.phi1=0.] rotation of the 1st point 693 * @param {float} [params.u2=0.] local x deflection in the 2nd point 694 * @param {float} [params.w2=0.] local z deflection in the 2nd point 695 * @param {float} [params.phi2=0.] rotation of the 2nd point 696 * @param {float} [params.wMid=0.] local z deflection from continuous load in the middle of the beam 697 * @param {float} [params.realLen=1.] real length (in units of u and w) of beam 698 * @param {float} [params.scale=1.] scale parameter for the deflection line 699 * @param {bool} [params.closedBegin=true] the line conecting 1st point with 1st nodal value 700 * @param {bool} [params.closedEnd=true] the line conecting 2nd point with 2nd nodal value 701 * @param {bool} [params.closedBase=true] the line conecting 1st and 2nd point 702 * @param {int} [params.nSeg=5] number of interpolation points 703 * @property {Raphael} raphael raphael instance 704 * @property {Point2d} point1 1st point 705 * @property {Point2d} point2 2nd point 706 * @property {float} scale scale scale between passed value and drawn value in pixels 707 * @property {bool} closedBegin if point1 is connected with appropriate value of curve 708 * @property {bool} closedEnd if point2 is connected with appropriate value of curve 709 * @property {bool} closedBase if point1 and point2 are connected within the curve definition 710 * @property {Raphael.el} obj pointer to actual raphael object 711 * @borrows CurveObj#setPathList as this.setPathList 712 * @borrows CurveObj#consts as this.consts 713 * @borrows CurveObj#up as this.up 714 * @property {float} u1 local x displacement of 1st point 715 * @property {float} w1 local z displacement of 1st point 716 * @property {float} phi1 rotation of 1st point 717 * @property {float} u2 local x displacement of 2nd point 718 * @property {float} w2 local z displacement of 2nd point 719 * @property {float} phi2 rotation of 2nd point 720 * @property {float} wMid local z deflection from continuous load in the middle of the beam 721 * @property {float} realLen real length (in units of u and w) of beam 722 * @property {float} scale parameter for the deflection line 723 * @property {int} nSeg number of interpolation points 724 */ 725 DeflCurve = function(raphael,point1,point2,params) { 726 var params = params==undefined? {} : params; 727 this.inheritFrom = CurveObj; this.inheritFrom(); 728 this.constructorDeflCurve = function(raphael,point1,point2,params) { 729 this.constructorCurveObj(raphael,point1,point2,params); 730 this.u1 = params.u1==undefined? 0. : params.u1; 731 this.w1 = params.w1==undefined? 0. : params.w1; 732 this.phi1 = params.phi1==undefined? 0. : params.phi1; 733 this.u2 = params.u2==undefined? 0. : params.u2; 734 this.w2 = params.w2==undefined? 0. : params.w2; 735 this.phi2 = params.phi2==undefined? 0. : params.phi2; 736 this.wMid = params.wMid==undefined? 0. : params.wMid; 737 this.realLen = params.realLen==undefined? 1. : params.realLen; 738 this.nSeg = params.nSeg==undefined? 5 : params.nSeg; 739 this.scale = params.scale==undefined? 1. : params.scale; 740 741 this.setGeom() 742 this.lenScale = this.realLen/this.len; 743 this.consts(); 744 this.setPathList(); 745 this.makeObj(); 746 this.up(); 747 } 748 749 this.consts = function() { 750 this.c0 = this.w1; 751 this.c1 = -this.phi1*this.lenScale; 752 this.c2 = (2*this.phi1+this.phi2)*this.lenScale/this.len + 3/this.len/this.len*(this.w2-this.w1) + 16/this.len/this.len*this.wMid; 753 this.c3 = 2/this.len/this.len/this.len*(this.w1-this.w2) - 1/this.len/this.len*this.lenScale*(this.phi1+this.phi2) - 32/this.len/this.len/this.len*this.wMid; 754 this.c4 = 16/this.len/this.len/this.len/this.len*this.wMid; 755 } 756 this.w = function(s) { return this.c0 + this.c1*s + this.c2*s*s + this.c3*s*s*s + this.c4*s*s*s*s; } 757 this.dw = function(s) { return this.c1 + 2*this.c2*s + 3*this.c3*s*s + 4*this.c4*s*s*s; } 758 this.setPathList = function() { 759 this.pathList = [["M",this.x1+this.scale*(this.u1*this.cos-this.sin*this.w(0)),this.z1+this.scale*(this.u1*this.sin+this.cos*this.w(0))]]; 760 var t = .3; 761 for (var i=0; i<this.nSeg; i++) { 762 var w1 = this.w(i*this.segLen); 763 var w2 = this.w((i+1)*this.segLen); 764 var dw1 = this.dw(i*this.segLen); 765 var dw2 = this.dw((i+1)*this.segLen); 766 var vec1 = vecTrans(this.scale*this.u1+(i+t)*(this.segLen+this.scale*(this.u2-this.u1)/this.nSeg),this.scale*(w1+dw1*t*this.segLen),this.sin,this.cos); 767 var vec2 = vecTrans(this.scale*this.u1+(i+1-t)*(this.segLen+this.scale*(this.u2-this.u1)/this.nSeg),this.scale*(w2-dw2*t*this.segLen),this.sin,this.cos); 768 var vec3 = vecTrans(this.scale*this.u1+(i+1)*(this.segLen+this.scale*(this.u2-this.u1)/this.nSeg),this.scale*w2,this.sin,this.cos); 769 var ll = ["C",this.x1+vec1[0],this.z1+vec1[1],this.x1+vec2[0],this.z1+vec2[1],this.x1+vec3[0],this.z1+vec3[1]]; 770 this.pathList.push(ll); 771 } 772 this.closedPartsHandle(this.w(0)); 773 } 774 775 /** Sets new values of all stored displacements and rotations 776 * @param {float} u1 local x deflection in the 1st point 777 * @param {float} w1 local z deflection in the 1st point 778 * @param {float} phi1 rotation of the 1st point 779 * @param {float} u2 local x deflection in the 2nd point 780 * @param {float} w2 local z deflection in the 2nd point 781 * @param {float} phi2 rotation of the 2nd point 782 * @param {float} wMid local z deflection from continuous load in the middle of the beam*/ 783 this.setDsplFull = function(u1,w1,phi1,u2,w2,phi2,wMid) { 784 this.u1 = u1; 785 this.w1 = w1; 786 this.phi1 = phi1; 787 this.u2 = u2; 788 this.w2 = w2; 789 this.phi2 = phi2; 790 this.wMid = wMid || 0.; 791 this.up(); 792 } 793 } 794 795 /* *********************************************************** 796 * 797 * specific higher order curves 798 * 799 ************************************************************/ 800 801 /** Cubic deflection (all 6 dofs can be set) 802 * @class represents cubic deflection, all 6 dofs can be set 803 * @param {Raphael} raphael raphael instance 804 * @param {Point2d} point1 1st point 805 * @param {Point2d} point2 2nd point 806 * @param {float} [u1=0.] local x deflection in the 1st point 807 * @param {float} [w1=0.] local z deflection in the 1st point 808 * @param {float} [phi1=0.] rotation of the 1st point 809 * @param {float} [u2=0.] local x deflection in the 2nd point 810 * @param {float} [w2=0.] local z deflection in the 2nd point 811 * @param {float} [phi2=0.] rotation of the 2nd point 812 * @param {float} [realLen=1.] real length (in units of u and w) of beam 813 * @param {float} [scale=1.] scale parameter for the deflection line 814 * @param {bool} [closedBegin=true] the line conecting 1st point with 1st nodal value 815 * @param {bool} [closedEnd=true] the line conecting 2nd point with 2nd nodal value 816 * @param {bool} [closedBase=true] the line conecting 1st and 2nd point 817 * @param {int} [nSeg=5] number of interpolation points 818 * @borrows CurveObj#setPathList as this.setPathList 819 * @borrows CurveObj#consts as this.consts 820 * @borrows CurveObj#up as this.up 821 * @property {float} u1 local x displacement of 1st point 822 * @property {float} w1 local z displacement of 1st point 823 * @property {float} phi1 rotation of 1st point 824 * @property {float} u2 local x displacement of 2nd point 825 * @property {float} w2 local z displacement of 2nd point 826 * @property {float} phi2 rotation of 2nd point 827 * @property {float} realLen real length (in units of u and w) of beam 828 * @property {int} nSeg number of interpolation points 829 */ 830 DeflCubic = function(raphael,point1,point2,params) { 831 var params = params==undefined? {} : params; 832 params.wMid = 0.; 833 this.inheritFrom = DeflCurve; this.inheritFrom(); 834 this.constructorDeflCurve(raphael,point1,point2,params); 835 /** Sets new values of all stored displacements and rotations 836 * @param {float} u1 local x deflection in the 1st point 837 * @param {float} w1 local z deflection in the 1st point 838 * @param {float} phi1 rotation of the 1st point 839 * @param {float} u2 local x deflection in the 2nd point 840 * @param {float} w2 local z deflection in the 2nd point 841 * @param {float} phi2 rotation of the 2nd point*/ 842 this.setDspl = function(u1,w1,phi1,u2,w2,phi2) { this.setDsplFull(u1,w1,phi1,u2,w2,phi2,0); } 843 } 844 /** Creates new DeflCubic object, for parameters meaning see {@link DeflCubic} 845 * @returns {DeflCubic} new DeflCubic object*/ 846 DeflCubic.create = function(raphael,point1,point2,params) { 847 return new DeflCubic(raphael,point1,point2,params); 848 } 849 850 /** 4th order deflection 851 * @class represents cubic deflection, all 6 dofs can be set 852 * @param {Raphael} raphael raphael instance 853 * @param {Point2d} point1 1st point 854 * @param {Point2d} point2 2nd point 855 * @param {Object} params parameters, see below 856 * @param {float} [params.u1=0.] local x deflection in the 1st point 857 * @param {float} [params.w1=0.] local z deflection in the 1st point 858 * @param {float} [params.phi1=0.] rotation of the 1st point 859 * @param {float} [params.u2=0.] local x deflection in the 2nd point 860 * @param {float} [params.w2=0.] local z deflection in the 2nd point 861 * @param {float} [params.phi2=0.] rotation of the 2nd point 862 * @param {float} [params.wMid=0.] local z deflection from continuous load in the middle of the beam 863 * @param {float} [params.realLen=1.] real length (in units of u and w) of beam 864 * @param {float} [params.scale=1.] scale parameter for the deflection line 865 * @param {bool} [params.closedBegin=true] the line conecting 1st point with 1st nodal value 866 * @param {bool} [params.closedEnd=true] the line conecting 2nd point with 2nd nodal value 867 * @param {bool} [params.closedBase=true] the line conecting 1st and 2nd point 868 * @param {int} [params.nSeg=5] number of interpolation points 869 * @borrows CurveObj#setPathList as this.setPathList 870 * @borrows CurveObj#consts as this.consts 871 * @borrows CurveObj#up as this.up 872 * @property {float} u1 local x displacement of 1st point 873 * @property {float} w1 local z displacement of 1st point 874 * @property {float} phi1 rotation of 1st point 875 * @property {float} u2 local x displacement of 2nd point 876 * @property {float} w2 local z displacement of 2nd point 877 * @property {float} phi2 rotation of 2nd point 878 * @property {float} realLen real length (in units of u and w) of beam 879 * @property {float} wMid local z deflection from continuous load in the middle of the beam 880 * @property {int} nSeg number of interpolation points 881 */ 882 Defl4thOrder = function(raphael,point1,point2,params) { 883 var params = params==undefined? {} : params; 884 this.inheritFrom = DeflCurve; this.inheritFrom(); 885 this.constructorDeflCurve(raphael,point1,point2,params); 886 /** Sets new values of all stored displacements and rotations + wMid 887 * @param {float} u1 local x deflection in the 1st point 888 * @param {float} w1 local z deflection in the 1st point 889 * @param {float} phi1 rotation of the 1st point 890 * @param {float} u2 local x deflection in the 2nd point 891 * @param {float} w2 local z deflection in the 2nd point 892 * @param {float} phi2 rotation of the 2nd point 893 * @param {float} wMid local z deflection from continuous load in the middle of the beam*/ 894 this.setDspl = function(u1,w1,phi1,u2,w2,phi2,wMid) { this.setDsplFull(u1,w1,phi1,u2,w2,phi2,wMid); } 895 } 896 /** Creates new Defl4thOrder object, for parameters meaning see {@link Defl4thOrder} 897 * @returns {Defl4thOrder} new Defl4thOrder object*/ 898 Defl4thOrder.create = function(raphael,point1,point2,params) { 899 return new Defl4thOrder(raphael,point1,point2,params); 900 } 901 902 903 904 /** Cubic deflection (no axial displacement) 905 * @class represents cubic deflection (no axial displacement) 906 * @param {Raphael} raphael raphael instance 907 * @param {Point2d} point1 1st point 908 * @param {Point2d} point2 2nd point 909 * @param {Object} params parameters, see below 910 * @param {float} [params.w1=0.] local z deflection in the 1st point 911 * @param {float} [params.phi1=0.] rotation of the 1st point 912 * @param {float} [params.w2=0.] local z deflection in the 2nd point 913 * @param {float} [params.phi2=0.] rotation of the 2nd point 914 * @param {float} [params.realLen=1.] real length (in units of u and w) of beam 915 * @param {float} [params.scale=1.] scale parameter for the deflection line 916 * @param {bool} [params.closedBegin=true] the line conecting 1st point with 1st nodal value 917 * @param {bool} [params.closedEnd=true] the line conecting 2nd point with 2nd nodal value 918 * @param {bool} [params.closedBase=true] the line conecting 1st and 2nd point 919 * @param {int} [params.nSeg=5] number of interpolation points 920 * @borrows CurveObj#setPathList as this.setPathList 921 * @borrows CurveObj#consts as this.consts 922 * @borrows CurveObj#up as this.up 923 * @property {float} w1 local z displacement of 1st point 924 * @property {float} phi1 rotation of 1st point 925 * @property {float} w2 local z displacement of 2nd point 926 * @property {float} phi2 rotation of 2nd point 927 * @property {float} realLen real length (in units of u and w) of beam 928 * @property {int} nSeg number of interpolation points 929 */ 930 DeflCubicNoU = function(raphael,point1,point2,params) { 931 var params = params==undefined? {} : params; 932 params.wMid = 0.; 933 params.u1 = 0.; 934 params.u2 = 0.; 935 this.inheritFrom = DeflCurve; this.inheritFrom(); 936 this.constructorDeflCurve(raphael,point1,point2,params); 937 /** Sets new values of w and phi in both points 938 * @param {float} w1 local z deflection in the 1st point 939 * @param {float} phi1 rotation of the 1st point 940 * @param {float} w2 local z deflection in the 2nd point 941 * @param {float} phi2 rotation of the 2nd point*/ 942 this.setDspl = function(w1,phi1,w2,phi2) { this.setDsplFull(0,w1,phi1,0,w2,phi2,0); } 943 } 944 945 /** Creates new DeflCubicNoU object, for parameters meaning see {@link DeflCubicNoU} 946 * @returns {DeflCubicNoU} new DeflCubicNoU object*/ 947 DeflCubicNoU.create = function(raphael,point1,point2,params) { 948 return new DeflCubicNoU(raphael,point1,point2,params); 949 } 950 951 952 953 954 955 /** 4th order deflection (no axial displacement) 956 * @class represents 4th order deflection (no axial displacement) 957 * @param {Raphael} raphael raphael instance 958 * @param {Point2d} point1 1st point 959 * @param {Point2d} point2 2nd point 960 * @param {Object} params parameters, see below 961 * @param {float} [params.w1=0.] local z deflection in the 1st point 962 * @param {float} [params.phi1=0.] rotation of the 1st point 963 * @param {float} [params.w2=0.] local z deflection in the 2nd point 964 * @param {float} [params.phi2=0.] rotation of the 2nd point 965 * @param {float} [params.wMid=0.] local z deflection from continuous load in the middle of the beam 966 * @param {float} [params.realLen=1.] real length (in units of u and w) of beam 967 * @param {float} [params.scale=1.] scale parameter for the deflection line 968 * @param {bool} [params.closedBegin=true] the line conecting 1st point with 1st nodal value 969 * @param {bool} [params.closedEnd=true] the line conecting 2nd point with 2nd nodal value 970 * @param {bool} [params.closedBase=true] the line conecting 1st and 2nd point 971 * @param {int} [params.nSeg=5] number of interpolation points 972 * @borrows CurveObj#setPathList as this.setPathList 973 * @borrows CurveObj#consts as this.consts 974 * @borrows CurveObj#up as this.up 975 * @property {float} w1 local z displacement of 1st point 976 * @property {float} phi1 rotation of 1st point 977 * @property {float} w2 local z displacement of 2nd point 978 * @property {float} phi2 rotation of 2nd point 979 * @property {float} realLen real length (in units of u and w) of beam 980 * @property {float} wMid local z deflection from continuous load in the middle of the beam 981 * @property {int} nSeg number of interpolation points 982 */ 983 Defl4thOrderNoU = function(raphael,point1,point2,params) { 984 var params = params==undefined? {} : params; 985 params.u1 = 0.; 986 params.u2 = 0.; 987 this.inheritFrom = DeflCurve; this.inheritFrom(); 988 this.constructorDeflCurve(raphael,point1,point2,params); 989 /** Sets new values of w and phi in both points + wMid 990 * @param {float} w1 local z deflection in the 1st point 991 * @param {float} phi1 rotation of the 1st point 992 * @param {float} w2 local z deflection in the 2nd point 993 * @param {float} phi2 rotation of the 2nd point 994 * @param {float} wMid local z deflection from continuous load in the middle of the beam*/ 995 this.setDspl = function(w1,phi1,w2,phi2,wMid) { this.setDsplFull(0,w1,phi1,0,w2,phi2,wMid); } 996 } 997 /** Creates new Defl4thOrderNoU object, for parameters meaning see {@link Defl4thOrderNoU} 998 * @returns {Defl4thOrderNoU} new Defl4thOrderNoU object*/ 999 Defl4thOrderNoU.create = function(raphael,point1,point2,params) { 1000 return new Defl4thOrderNoU(raphael,point1,point2,params); 1001 } 1002