vislite 0.5.0 → 0.5.2-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/.editorconfig +18 -18
  2. package/AUTHORS.txt +6 -6
  3. package/CHANGELOG +5 -0
  4. package/LICENSE +20 -20
  5. package/README.md +69 -69
  6. package/miniprogram/ui-canvas/index.js +107 -107
  7. package/miniprogram/ui-canvas/index.json +4 -4
  8. package/miniprogram/ui-canvas/index.wxml +4 -4
  9. package/miniprogram/ui-canvas/index.wxss +5 -5
  10. package/package/Buffer/index.ts +2 -2
  11. package/package/Canvas/index.ts +2 -2
  12. package/package/Cardinal/index.ts +2 -2
  13. package/package/Eoap/index.ts +2 -2
  14. package/package/Hermite/index.ts +2 -2
  15. package/package/Matrix4/index.ts +2 -2
  16. package/package/Mercator/index.ts +2 -2
  17. package/package/OralCanvas/index.ts +2 -2
  18. package/package/OralWebGL/index.ts +2 -2
  19. package/package/SVG/index.ts +2 -2
  20. package/package/Shader/index.ts +39 -39
  21. package/package/Texture/index.ts +2 -2
  22. package/package/TreeLayout/index.ts +2 -2
  23. package/package/WebGL/index.ts +2 -2
  24. package/package/animation/index.ts +2 -2
  25. package/package/formatColor/index.ts +2 -2
  26. package/package/getLoopColors/index.ts +2 -2
  27. package/package/getWebGLContext/index.ts +39 -39
  28. package/package/resizeObserver/index.ts +2 -2
  29. package/package/rotate/index.ts +2 -2
  30. package/package/ruler/index.ts +2 -2
  31. package/package/throttle/index.ts +2 -2
  32. package/package/viewHandler/index.ts +2 -2
  33. package/package.json +1 -1
  34. package/src/Canvas.ts +67 -67
  35. package/src/Matrix4/move.ts +12 -12
  36. package/src/Matrix4/rotate.ts +15 -15
  37. package/src/Matrix4/scale.ts +11 -11
  38. package/src/Matrix4/transform.ts +64 -64
  39. package/src/SVG.ts +24 -24
  40. package/src/WebGL.ts +66 -66
  41. package/src/animation.ts +98 -98
  42. package/src/common/assemble.ts +22 -22
  43. package/src/common/canvas/arc.ts +50 -50
  44. package/src/common/canvas/config.ts +158 -158
  45. package/src/common/canvas/gradient.ts +29 -29
  46. package/src/common/canvas/index.ts +168 -168
  47. package/src/common/canvas/painter.ts +426 -426
  48. package/src/common/canvas/texts.ts +18 -18
  49. package/src/common/mergeOption.ts +6 -6
  50. package/src/common/setStyle.ts +5 -5
  51. package/src/common/svg/config.ts +174 -174
  52. package/src/common/svg/tool.ts +44 -44
  53. package/src/common/tree/index.ts +25 -25
  54. package/src/common/tree/toInnerTree.ts +56 -56
  55. package/src/common/tree/toPlainTree.ts +131 -131
  56. package/src/common/webgl/buffer.ts +79 -79
  57. package/src/common/webgl/doDraw.ts +108 -108
  58. package/src/common/webgl/getColorFactory.ts +26 -26
  59. package/src/common/webgl/getShader.ts +48 -48
  60. package/src/common/webgl/getTexture.ts +11 -11
  61. package/src/common/webgl/getWebGLContext.ts +27 -27
  62. package/src/common/webgl/index.ts +223 -223
  63. package/src/common/webgl/shader.ts +75 -75
  64. package/src/common/webgl/texture.ts +96 -96
  65. package/src/formatColor.ts +44 -44
  66. package/src/getLoopColors.ts +42 -42
  67. package/src/interpolation/Cardinal.ts +110 -110
  68. package/src/interpolation/Hermite.ts +65 -65
  69. package/src/resizeObserver.ts +36 -36
  70. package/src/ruler.ts +188 -188
  71. package/src/shader/fsColor.c +7 -7
  72. package/src/shader/fsColors.c +7 -7
  73. package/src/shader/fsCube.c +8 -8
  74. package/src/shader/fsImage.c +8 -8
  75. package/src/shader/vsColor.c +17 -17
  76. package/src/shader/vsColors.c +13 -13
  77. package/src/shader/vsCube.c +13 -13
  78. package/src/shader/vsImage.c +13 -13
  79. package/src/throttle.ts +51 -51
  80. package/src/viewHandler.ts +158 -158
  81. package/types/Buffer.d.ts +23 -23
  82. package/types/Canvas.d.ts +300 -300
  83. package/types/CanvasOption.d.ts +7 -7
  84. package/types/Cardinal.d.ts +13 -13
  85. package/types/Gradient.d.ts +14 -14
  86. package/types/Hermite.d.ts +18 -18
  87. package/types/Object3D.d.ts +114 -114
  88. package/types/SVGConfig.d.ts +76 -76
  89. package/types/Scene3D.d.ts +6 -6
  90. package/types/Shader.d.ts +21 -21
  91. package/types/Texture.d.ts +16 -16
  92. package/types/Tree.d.ts +69 -69
  93. package/types/TreeConfig.d.ts +24 -24
  94. package/types/TreeOption.d.ts +48 -48
  95. package/types/WebGL.d.ts +38 -38
  96. package/types/WebGLOption.d.ts +7 -7
  97. package/types/animation.d.ts +6 -6
  98. package/types/formatColor.d.ts +2 -2
  99. package/types/getLoopColors.d.ts +2 -2
  100. package/types/getWebGLContext.d.ts +2 -2
  101. package/types/painterConfig.d.ts +2 -2
  102. package/types/resizeObserver.d.ts +2 -2
  103. package/types/ruler.d.ts +7 -7
  104. package/types/throttle.d.ts +4 -4
  105. package/types/throttleOption.d.ts +21 -21
  106. package/types/viewHandler.d.ts +13 -13
  107. package/uni-app/ui-canvas.vue +226 -222
  108. package/lib/Buffer/index.umd.js +0 -55
  109. package/lib/Buffer/index.umd.min.js +0 -11
  110. package/lib/Canvas/index.umd.js +0 -721
  111. package/lib/Canvas/index.umd.min.js +0 -11
  112. package/lib/Cardinal/index.umd.js +0 -112
  113. package/lib/Cardinal/index.umd.min.js +0 -11
  114. package/lib/Eoap/index.umd.js +0 -53
  115. package/lib/Eoap/index.umd.min.js +0 -11
  116. package/lib/Geometry/index.umd.js +0 -205
  117. package/lib/Geometry/index.umd.min.js +0 -11
  118. package/lib/Hermite/index.umd.js +0 -55
  119. package/lib/Hermite/index.umd.min.js +0 -11
  120. package/lib/Matrix4/index.umd.js +0 -146
  121. package/lib/Matrix4/index.umd.min.js +0 -11
  122. package/lib/Mercator/index.umd.js +0 -39
  123. package/lib/Mercator/index.umd.min.js +0 -11
  124. package/lib/OralCanvas/index.es.js +0 -657
  125. package/lib/OralCanvas/index.es.min.js +0 -11
  126. package/lib/OralWebGL/index.es.js +0 -611
  127. package/lib/OralWebGL/index.es.min.js +0 -11
  128. package/lib/SVG/index.umd.js +0 -475
  129. package/lib/SVG/index.umd.min.js +0 -11
  130. package/lib/Shader/index.umd.js +0 -134
  131. package/lib/Shader/index.umd.min.js +0 -11
  132. package/lib/Texture/index.umd.js +0 -72
  133. package/lib/Texture/index.umd.min.js +0 -11
  134. package/lib/TreeLayout/index.umd.js +0 -430
  135. package/lib/TreeLayout/index.umd.min.js +0 -11
  136. package/lib/WebGL/index.umd.js +0 -684
  137. package/lib/WebGL/index.umd.min.js +0 -11
  138. package/lib/animation/index.umd.js +0 -91
  139. package/lib/animation/index.umd.min.js +0 -11
  140. package/lib/formatColor/index.umd.js +0 -59
  141. package/lib/formatColor/index.umd.min.js +0 -11
  142. package/lib/getLoopColors/index.umd.js +0 -55
  143. package/lib/getLoopColors/index.umd.min.js +0 -11
  144. package/lib/getWebGLContext/index.umd.js +0 -65
  145. package/lib/getWebGLContext/index.umd.min.js +0 -11
  146. package/lib/index.umd.js +0 -2834
  147. package/lib/index.umd.min.js +0 -11
  148. package/lib/resizeObserver/index.umd.js +0 -48
  149. package/lib/resizeObserver/index.umd.min.js +0 -11
  150. package/lib/rotate/index.umd.js +0 -27
  151. package/lib/rotate/index.umd.min.js +0 -11
  152. package/lib/ruler/index.umd.js +0 -145
  153. package/lib/ruler/index.umd.min.js +0 -11
  154. package/lib/throttle/index.umd.js +0 -70
  155. package/lib/throttle/index.umd.min.js +0 -11
  156. package/lib/viewHandler/index.umd.js +0 -139
  157. package/lib/viewHandler/index.umd.min.js +0 -11
@@ -1,11 +0,0 @@
1
- /*!
2
- * VISLite JavaScript Library v0.5.0
3
- * git+https://github.com/oi-contrib/VISLite.git
4
- *
5
- * Copyright zxl20070701
6
- * Released under the MIT license
7
- * https://zxl20070701.github.io/notebook/home.html
8
- *
9
- * Publish Date: Sat Sep 30 2023 19:14:04 GMT+0800 (中国标准时间)
10
- */
11
- var t,i;t=this,i=function(){"use strict";var t=function(i,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e])},t(i,e)};function i(i,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=i}t(i,e),i.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}"function"==typeof SuppressedError&&SuppressedError;var e=function(t,i,e,n,r){var o=Math.cos(e),s=Math.sin(e);return[+((n-t)*o-(r-i)*s+t).toFixed(7),+((n-t)*s+(r-i)*o+i).toFixed(7)]},n=function(t,i,e,n,r){return t.beginPath(),t.translate(e,n),t.rotate(r),t.font=i.fontStyle+" "+i.fontWeight+" "+i.fontSize+"px "+i.fontFamily,t},r=function(t,i,n,r,o,s,a,_){if(o>s){var h=o;o=s,s=h}return a%=2*Math.PI,_>=1.999999*Math.PI||_<=1.999999*-Math.PI?_=2*Math.PI:_%=2*Math.PI,function(t,i,n,r,o,s,a){i<0&&(t+=i,i*=-1);var _,h=[];_=e(0,0,t,o,0),h[0]=_[0],h[1]=_[1],_=e(0,0,i,_[0],_[1]),h[2]=_[0],h[3]=_[1],_=e(0,0,t,s,0),h[4]=_[0],h[5]=_[1],_=e(0,0,i,_[0],_[1]),h[6]=_[0],h[7]=_[1],a(t,t+i,h[0]+n,h[1]+r,h[4]+n,h[5]+r,h[2]+n,h[3]+r,h[6]+n,h[7]+r,.5*(s-o))}(a,_,n,r,o,s,(function(e,a,_,h,l,p,u,f,c,g,y){y<0&&(y=-y),t.beginPath(),t.moveTo(_,h),t.arc(n,r,o,e,a,!1),"round"==i.arcEndCap?t.arc(.5*(u+c),.5*(f+g),y,a-Math.PI,a,!0):"-round"==i.arcEndCap?t.arc(.5*(u+c),.5*(f+g),y,a-Math.PI,a,!1):t.lineTo(c,g),t.arc(n,r,s,a,e,!0),"round"==i.arcStartCap?t.arc(.5*(_+l),.5*(h+p),y,e,e-Math.PI,!0):"-round"==i.arcStartCap?t.arc(.5*(_+l),.5*(h+p),y,e,e-Math.PI,!1):t.lineTo(_,h)})),"butt"==i.arcStartCap&&t.closePath(),t},o=function(t,i,e,n){return t.beginPath(),t.moveTo(i+n,e),t.arc(i,e,n,0,2*Math.PI),t},s=function(t,i,e,n,r){return t.beginPath(),t.rect(i,e,n,r),t};function a(t,i,e,n,r){for(var o=0,s="",a=0;a<i.length;a++)t.measureText(s+i[a]).width>e||/\n$/.test(s)?(r(s,((o+=1)-.5)*n),s=i[a]):a==i.length-1?(o+=1,r(s+i[a],(o-.5)*n)):s+=i[a];return o*n}var _=function(){function t(t,i,e,n){void 0===i&&(i={}),void 0===n&&(n=!1),this.__region=null,this.__onlyRegion=!1,this.__specialConfig={fontSize:16,fontFamily:"sans-serif",fontWeight:400,fontStyle:"normal",arcStartCap:"butt",arcEndCap:"butt"},this.__initConfig={fillStyle:"black",strokeStyle:"black",lineWidth:1,textAlign:"left",textBaseline:"middle",lineDash:[],shadowBlur:0,shadowColor:"black"},this.painter=t.getContext("2d",i),this.__region=e,this.__isPainter=n,this.painter.textBaseline="middle",this.painter.textAlign="left"}return t.prototype.useConfig=function(t,i){if(this.__region&&["fillStyle","strokeStyle","shadowBlur","shadowColor"].indexOf(t)<0&&this.__region.useConfig(t,i),this.__isPainter&&this.__onlyRegion)return this;if("lineDash"==t)this.painter.setLineDash&&this.painter.setLineDash(i);else if(t in this.__specialConfig)"fontSize"==t&&(i=Math.round(i)),this.__specialConfig[t]=i;else{if(!(t in this.__initConfig))throw new Error("Illegal configuration item of painter : "+t+" !");this.painter[t]=i}return this},t.prototype.fillText=function(t,i,e,r){return void 0===r&&(r=0),this.__region&&this.__region.fillText(t,i,e,r),this.__isPainter&&this.__onlyRegion||(this.painter.save(),n(this.painter,this.__specialConfig,i,e,r).fillText(t,0,0),this.painter.restore()),this},t.prototype.strokeText=function(t,i,e,r){return void 0===r&&(r=0),this.__region&&this.__region.strokeText(t,i,e,r),this.__isPainter&&this.__onlyRegion||(this.painter.save(),n(this.painter,this.__specialConfig,i,e,r).strokeText(t,0,0),this.painter.restore()),this},t.prototype.fullText=function(t,i,e,r){return void 0===r&&(r=0),this.__region&&this.__region.fullText(t,i,e,r),this.__isPainter&&this.__onlyRegion||(this.painter.save(),n(this.painter,this.__specialConfig,i,e,r),this.painter.fillText(t,0,0),this.painter.strokeText(t,0,0),this.painter.restore()),this},t.prototype.fillTexts=function(t,i,e,r,o,s){var _=this;void 0===o&&(o=1.2),void 0===s&&(s=0);var h=0;if(this.__region&&(h=this.__region.fillTexts(t,i,e,r,o)),this.__isPainter&&this.__onlyRegion)return h;this.painter.save(),n(this.painter,this.__specialConfig,i,e,s);var l=a(this.painter,t,r,this.__specialConfig.fontSize*o,(function(t,i){_.painter.fillText(t,0,i)}));return this.painter.restore(),l},t.prototype.strokeTexts=function(t,i,e,r,o,s){var _=this;void 0===o&&(o=1.2),void 0===s&&(s=0);var h=0;if(this.__region&&(h=this.__region.fillTexts(t,i,e,r,o)),this.__isPainter&&this.__onlyRegion)return h;this.painter.save(),n(this.painter,this.__specialConfig,i,e,s);var l=a(this.painter,t,r,this.__specialConfig.fontSize*o,(function(t,i){_.painter.strokeText(t,0,i)}));return this.painter.restore(),l},t.prototype.fullTexts=function(t,i,e,r,o,s){var _=this;void 0===o&&(o=1.2),void 0===s&&(s=0);var h=0;if(this.__region&&(h=this.__region.fillTexts(t,i,e,r,o)),this.__isPainter&&this.__onlyRegion)return h;this.painter.save(),n(this.painter,this.__specialConfig,i,e,s);var l=a(this.painter,t,r,this.__specialConfig.fontSize*o,(function(t,i){_.painter.fillText(t,0,i),_.painter.strokeText(t,0,i)}));return this.painter.restore(),l},t.prototype.beginPath=function(){return this.__region&&this.__region.beginPath(),this.__isPainter&&this.__onlyRegion||this.painter.beginPath(),this},t.prototype.closePath=function(){return this.__region&&this.__region.closePath(),this.__isPainter&&this.__onlyRegion||this.painter.closePath(),this},t.prototype.moveTo=function(t,i){return this.__region&&this.__region.moveTo(t,i),this.__isPainter&&this.__onlyRegion||this.painter.moveTo(Math.round(t)+.5,Math.round(i)+.5),this},t.prototype.lineTo=function(t,i){return this.__region&&this.__region.lineTo(t,i),this.__isPainter&&this.__onlyRegion||this.painter.lineTo(Math.round(t)+.5,Math.round(i)+.5),this},t.prototype.arc=function(t,i,e,n,r){return this.__region&&this.__region.arc(t,i,e,n,r),this.__isPainter&&this.__onlyRegion||this.painter.arc(t,i,e,n,n+r,r<0),this},t.prototype.fill=function(){return this.__region&&this.__region.fill(),this.__isPainter&&this.__onlyRegion||this.painter.fill(),this},t.prototype.stroke=function(){return this.__region&&this.__region.stroke(),this.__isPainter&&this.__onlyRegion||this.painter.stroke(),this},t.prototype.full=function(){return this.__region&&this.__region.full(),this.__isPainter&&this.__onlyRegion||(this.painter.fill(),this.painter.stroke()),this},t.prototype.save=function(){return this.__region&&this.__region.save(),this.__isPainter&&this.__onlyRegion||this.painter.save(),this},t.prototype.restore=function(){return this.__region&&this.__region.restore(),this.__isPainter&&this.__onlyRegion||this.painter.restore(),this},t.prototype.clip=function(){return this.__region&&this.__region.clip(),this.__isPainter&&this.__onlyRegion||this.painter.clip(),this},t.prototype.quadraticCurveTo=function(t,i,e,n){return this.__region&&this.__region.quadraticCurveTo(t,i,e,n),this.__isPainter&&this.__onlyRegion||this.painter.quadraticCurveTo(t,i,e,n),this},t.prototype.bezierCurveTo=function(t,i,e,n,r,o){return this.__region&&this.__region.bezierCurveTo(t,i,e,n,r,o),this.__isPainter&&this.__onlyRegion||this.painter.bezierCurveTo(t,i,e,n,r,o),this},t.prototype.clearRect=function(t,i,e,n){return this.__region&&this.__region.clearRect(t,i,e,n),this.__isPainter&&this.__onlyRegion||this.painter.clearRect(t,i,e,n),this},t.prototype.fillArc=function(t,i,e,n,o,s){return this.__region&&this.__region.fillArc(t,i,e,n,o,s),this.__isPainter&&this.__onlyRegion||r(this.painter,this.__specialConfig,t,i,e,n,o,s).fill(),this},t.prototype.strokeArc=function(t,i,e,n,o,s){return this.__region&&this.__region.strokeArc(t,i,e,n,o,s),this.__isPainter&&this.__onlyRegion||r(this.painter,this.__specialConfig,t,i,e,n,o,s).stroke(),this},t.prototype.fullArc=function(t,i,e,n,o,s){return this.__region&&this.__region.fullArc(t,i,e,n,o,s),this.__isPainter&&this.__onlyRegion||(r(this.painter,this.__specialConfig,t,i,e,n,o,s),this.painter.fill(),this.painter.stroke()),this},t.prototype.fillCircle=function(t,i,e){return this.__region&&this.__region.fillCircle(t,i,e),this.__isPainter&&this.__onlyRegion||o(this.painter,t,i,e).fill(),this},t.prototype.strokeCircle=function(t,i,e){return this.__region&&this.__region.strokeCircle(t,i,e),this.__isPainter&&this.__onlyRegion||o(this.painter,t,i,e).stroke(),this},t.prototype.fullCircle=function(t,i,e){return this.__region&&this.__region.fullCircle(t,i,e),this.__isPainter&&this.__onlyRegion||(o(this.painter,t,i,e),this.painter.fill(),this.painter.stroke()),this},t.prototype.fillRect=function(t,i,e,n){return this.__region&&this.__region.fillRect(t,i,e,n),this.__isPainter&&this.__onlyRegion||s(this.painter,t,i,e,n).fill(),this},t.prototype.strokeRect=function(t,i,e,n){return this.__region&&this.__region.strokeRect(t,i,e,n),this.__isPainter&&this.__onlyRegion||s(this.painter,t,i,e,n).stroke(),this},t.prototype.fullRect=function(t,i,e,n){return this.__region&&this.__region.fullRect(t,i,e,n),this.__isPainter&&this.__onlyRegion||(s(this.painter,t,i,e,n),this.painter.fill(),this.painter.stroke()),this},t.prototype.draw=function(){},t}(),h={"font-size":"fontSize","font-family":"fontFamily","font-weight":"fontWeight","font-style":"fontStyle","arc-start-cap":"arcStartCap","arc-end-cap":"arcEndCap"},l=function(t){function e(i,e){var n=t.call(this,i,{},e?new _(e,{willReadFrequently:!0}):null,!0)||this;return n.name="Canvas",n.__regionList={},n.__regionAssemble=function(t,i,e,n){for(var r=[],o=0;o<n;o++)r[o]=t;return function(){for(var o=0;o<n;o++){if(r[o]+e<i){r[o]=+(r[o]+e).toFixed(7);break}o<n-1&&(r[o]=t)}return r}}(0,255,10,3),n.setRegion(""),n}return i(e,t),e.prototype.config=function(t){for(var i in t){var e=h[i]||i;this.useConfig(e,t[i])}return this},e.prototype.onlyRegion=function(t){return this.__onlyRegion=t,this},e.prototype.setRegion=function(t){if(this.__region)if(t){if(null==this.__regionList[t]){var i=this.__regionAssemble();this.__regionList[t]="rgb("+i[0]+","+i[1]+","+i[2]+")"}this.__region.useConfig("fillStyle",this.__regionList[t])&&this.__region.useConfig("strokeStyle",this.__regionList[t])}else this.__region.useConfig("fillStyle","#000000")&&this.__region.useConfig("strokeStyle","#000000");return this},e.prototype.getRegion=function(t,i){var e=this;return new Promise((function(n,r){var o=e.__region?e.__region.painter.getImageData(t-.5,i-.5,1,1):{data:[0,0,0,0]},s=o.data,a=function(){if(e.__region)for(var t in e.__regionList)if("rgb("+s[0]+","+s[1]+","+s[2]+")"==e.__regionList[t]){n(t);break}n("")};s?a():o.then((function(t){s=t,a()}))}))},e.prototype.textWidth=function(t){this.painter.save(),n(this.painter,this.__specialConfig,0,0,0);var i=this.painter.measureText(t+"").width;return this.painter.restore(),i},e.prototype.getContext=function(t){return void 0===t&&(t=!1),t?this.__region?this.__region.painter:null:this.painter},e.prototype.createLinearGradient=function(t,i,e,n){return function(t,i,e,n,r){var o=t.createLinearGradient(i,e,n,r),s={value:function(){return o},setColor:function(t,i){return o.addColorStop(t,i),s}};return s}(this.painter,t,i,e,n)},e.prototype.createRadialGradient=function(t,i,e){return function(t,i,e,n){var r=t.createRadialGradient(i,e,0,i,e,n),o={value:function(){return r},setColor:function(t,i){return r.addColorStop(t,i),o}};return o}(this.painter,t,i,e)},e.prototype.getColor=function(t,i){var e=this.painter.getImageData(t-.5,i-.5,1,1).data;return"rgba("+e[0]+","+e[1]+","+e[2]+","+e[3]+")"},e}(_);return function(t){function e(i,e){void 0===e&&(e={});var n=this;if(!i)throw new Error("VISLite Canvas:The mount point requires an HTMLElement type but encountered null.");e=function(t,i){for(var e in t)i[e]=t[e];return i}(e,{region:!0});var r,o,s=i.clientWidth,a=i.clientHeight,_=i;_._vislite_canvas_?(r=_._vislite_canvas_[0],o=_._vislite_canvas_[1]):(r=document.createElement("canvas"),i.appendChild(r),e.region&&(o=document.createElement("canvas")),_._vislite_canvas_=[r,o],i.setAttribute("vislite","Canvas"));for(var h=0,l=[r,o];h<l.length;h++){var p=l[h];p&&(p.style.width=s+"px",p.setAttribute("width",s+""),p.style.height=a+"px",p.setAttribute("height",a+""))}return(n=t.call(this,r,o)||this).__canvas=r,n}return i(e,t),e.prototype.toDataURL=function(){var t=this;return new Promise((function(i){i(t.__canvas.toDataURL())}))},e}(l)},"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(t="undefined"!=typeof globalThis?globalThis:t||self).VISLite_Canvas=i();
@@ -1,112 +0,0 @@
1
- /*!
2
- * VISLite JavaScript Library v0.5.0
3
- * git+https://github.com/oi-contrib/VISLite.git
4
- *
5
- * Copyright zxl20070701
6
- * Released under the MIT license
7
- * https://zxl20070701.github.io/notebook/home.html
8
- *
9
- * Publish Date: Sat Sep 30 2023 19:14:04 GMT+0800 (中国标准时间)
10
- */
11
- (function (global, factory) {
12
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
13
- typeof define === 'function' && define.amd ? define(factory) :
14
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.VISLite_Cardinal = factory());
15
- })(this, (function () { 'use strict';
16
-
17
- var Hermite = (function () {
18
- function Hermite(u) {
19
- if (u === void 0) { u = 0.5; }
20
- this.name = 'Hermite';
21
- this.__u = u;
22
- }
23
- Hermite.prototype.setP = function (x1, y1, x2, y2, s1, s2) {
24
- if (x1 < x2) {
25
- this.__a = x1;
26
- this.__b = x2;
27
- var p3 = this.__u * s1, p4 = this.__u * s2;
28
- y1 /= (x2 - x1);
29
- y2 /= (x2 - x1);
30
- this.__MR = [
31
- 2 * y1 - 2 * y2 + p3 + p4,
32
- 3 * y2 - 3 * y1 - 2 * p3 - p4,
33
- p3,
34
- y1
35
- ];
36
- }
37
- else
38
- throw new Error('The point x-position should be increamented!');
39
- return this;
40
- };
41
- Hermite.prototype.use = function (x) {
42
- if (this.__MR) {
43
- var sx = (x - this.__a) / (this.__b - this.__a), sx2 = sx * sx, sx3 = sx * sx2;
44
- var sResult = sx3 * this.__MR[0] + sx2 * this.__MR[1] + sx * this.__MR[2] + this.__MR[3];
45
- return sResult * (this.__b - this.__a);
46
- }
47
- else
48
- throw new Error('You shoud first set the position!');
49
- };
50
- return Hermite;
51
- }());
52
-
53
- var Cardinal = (function () {
54
- function Cardinal(t) {
55
- if (t === void 0) { t = 0; }
56
- this.name = 'Cardinal';
57
- this.__t = t;
58
- }
59
- Cardinal.prototype.setP = function (points) {
60
- this.__HS = {
61
- "x": [],
62
- "h": []
63
- };
64
- var flag, slope = (points[1][1] - points[0][1]) / (points[1][0] - points[0][0]), temp;
65
- this.__HS.x[0] = points[0][0];
66
- for (flag = 1; flag < points.length; flag++) {
67
- if (points[flag][0] <= points[flag - 1][0])
68
- throw new Error('The point position should be increamented!');
69
- this.__HS.x[flag] = points[flag][0];
70
- if (flag < points.length - 1) {
71
- if ((points[flag + 1][1] > points[flag][1] && points[flag - 1][1] > points[flag][1]) ||
72
- (points[flag + 1][1] < points[flag][1] && points[flag - 1][1] < points[flag][1]) ||
73
- points[flag + 1][1] == points[flag][1] ||
74
- points[flag - 1][1] == points[flag][1]) {
75
- temp = 0;
76
- }
77
- else {
78
- temp = (points[flag + 1][1] - points[flag - 1][1]) / (points[flag + 1][0] - points[flag - 1][0]);
79
- }
80
- }
81
- else {
82
- temp = (points[flag][1] - points[flag - 1][1]) / (points[flag][0] - points[flag - 1][0]);
83
- }
84
- this.__HS.h[flag - 1] = new Hermite((1 - this.__t) * 0.5).setP(points[flag - 1][0], points[flag - 1][1], points[flag][0], points[flag][1], slope, temp);
85
- slope = temp;
86
- }
87
- return this;
88
- };
89
- Cardinal.prototype.use = function (x) {
90
- if (this.__HS) {
91
- this.__i = -1;
92
- while (this.__i + 1 < this.__HS.x.length && (x > this.__HS.x[this.__i + 1] || (this.__i == -1 && x >= this.__HS.x[this.__i + 1]))) {
93
- this.__i += 1;
94
- }
95
- if (this.__i < 0) {
96
- return this.__HS.h[0].use(this.__HS.x[0]);
97
- }
98
- else if (this.__i >= this.__HS.h.length) {
99
- return this.__HS.h[this.__HS.h.length - 1].use(this.__HS.x[this.__HS.x.length - 1]);
100
- }
101
- return this.__HS.h[this.__i].use(x);
102
- }
103
- else {
104
- throw new Error('You shoud first set the position!');
105
- }
106
- };
107
- return Cardinal;
108
- }());
109
-
110
- return Cardinal;
111
-
112
- }));
@@ -1,11 +0,0 @@
1
- /*!
2
- * VISLite JavaScript Library v0.5.0
3
- * git+https://github.com/oi-contrib/VISLite.git
4
- *
5
- * Copyright zxl20070701
6
- * Released under the MIT license
7
- * https://zxl20070701.github.io/notebook/home.html
8
- *
9
- * Publish Date: Sat Sep 30 2023 19:14:04 GMT+0800 (中国标准时间)
10
- */
11
- var t,i;t=this,i=function(){"use strict";var t=function(){function t(t){void 0===t&&(t=.5),this.name="Hermite",this.__u=t}return t.prototype.setP=function(t,i,_,h,s,e){if(!(t<_))throw new Error("The point x-position should be increamented!");this.__a=t,this.__b=_;var n=this.__u*s,o=this.__u*e;return i/=_-t,h/=_-t,this.__MR=[2*i-2*h+n+o,3*h-3*i-2*n-o,n,i],this},t.prototype.use=function(t){if(this.__MR){var i=(t-this.__a)/(this.__b-this.__a),_=i*i;return(i*_*this.__MR[0]+_*this.__MR[1]+i*this.__MR[2]+this.__MR[3])*(this.__b-this.__a)}throw new Error("You shoud first set the position!")},t}();return function(){function i(t){void 0===t&&(t=0),this.name="Cardinal",this.__t=t}return i.prototype.setP=function(i){this.__HS={x:[],h:[]};var _,h,s=(i[1][1]-i[0][1])/(i[1][0]-i[0][0]);for(this.__HS.x[0]=i[0][0],_=1;_<i.length;_++){if(i[_][0]<=i[_-1][0])throw new Error("The point position should be increamented!");this.__HS.x[_]=i[_][0],h=_<i.length-1?i[_+1][1]>i[_][1]&&i[_-1][1]>i[_][1]||i[_+1][1]<i[_][1]&&i[_-1][1]<i[_][1]||i[_+1][1]==i[_][1]||i[_-1][1]==i[_][1]?0:(i[_+1][1]-i[_-1][1])/(i[_+1][0]-i[_-1][0]):(i[_][1]-i[_-1][1])/(i[_][0]-i[_-1][0]),this.__HS.h[_-1]=new t(.5*(1-this.__t)).setP(i[_-1][0],i[_-1][1],i[_][0],i[_][1],s,h),s=h}return this},i.prototype.use=function(t){if(this.__HS){for(this.__i=-1;this.__i+1<this.__HS.x.length&&(t>this.__HS.x[this.__i+1]||-1==this.__i&&t>=this.__HS.x[this.__i+1]);)this.__i+=1;return this.__i<0?this.__HS.h[0].use(this.__HS.x[0]):this.__i>=this.__HS.h.length?this.__HS.h[this.__HS.h.length-1].use(this.__HS.x[this.__HS.x.length-1]):this.__HS.h[this.__i].use(t)}throw new Error("You shoud first set the position!")},i}()},"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(t="undefined"!=typeof globalThis?globalThis:t||self).VISLite_Cardinal=i();
@@ -1,53 +0,0 @@
1
- /*!
2
- * VISLite JavaScript Library v0.5.0
3
- * git+https://github.com/oi-contrib/VISLite.git
4
- *
5
- * Copyright zxl20070701
6
- * Released under the MIT license
7
- * https://zxl20070701.github.io/notebook/home.html
8
- *
9
- * Publish Date: Sat Sep 30 2023 19:14:04 GMT+0800 (中国标准时间)
10
- */
11
- (function (global, factory) {
12
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
13
- typeof define === 'function' && define.amd ? define(factory) :
14
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.VISLite_Eoap = factory());
15
- })(this, (function () { 'use strict';
16
-
17
- var rotateX = function (deg, x, y, z) {
18
- var cos = Math.cos(deg), sin = Math.sin(deg);
19
- return [x, y * cos - z * sin, y * sin + z * cos];
20
- };
21
- var rotateY = function (deg, x, y, z) {
22
- var cos = Math.cos(deg), sin = Math.sin(deg);
23
- return [z * sin + x * cos, y, z * cos - x * sin];
24
- };
25
- var rotateZ = function (deg, x, y, z) {
26
- var cos = Math.cos(deg), sin = Math.sin(deg);
27
- return [x * cos - y * sin, x * sin + y * cos, z];
28
- };
29
- var Eoap = (function () {
30
- function Eoap(scale, center) {
31
- if (scale === void 0) { scale = 7; }
32
- if (center === void 0) { center = [107, 36]; }
33
- this.name = 'Eoap';
34
- this.__scale = scale;
35
- this.__center = center;
36
- }
37
- Eoap.prototype.use = function (λ, φ) {
38
- var p = rotateY((360 - φ) / 180 * Math.PI, 100 * this.__scale, 0, 0);
39
- p = rotateZ(λ / 180 * Math.PI, p[0], p[1], p[2]);
40
- p = rotateZ((90 - this.__center[0]) / 180 * Math.PI, p[0], p[1], p[2]);
41
- p = rotateX((90 - this.__center[1]) / 180 * Math.PI, p[0], p[1], p[2]);
42
- return [
43
- -p[0],
44
- p[1],
45
- p[2]
46
- ];
47
- };
48
- return Eoap;
49
- }());
50
-
51
- return Eoap;
52
-
53
- }));
@@ -1,11 +0,0 @@
1
- /*!
2
- * VISLite JavaScript Library v0.5.0
3
- * git+https://github.com/oi-contrib/VISLite.git
4
- *
5
- * Copyright zxl20070701
6
- * Released under the MIT license
7
- * https://zxl20070701.github.io/notebook/home.html
8
- *
9
- * Publish Date: Sat Sep 30 2023 19:14:04 GMT+0800 (中国标准时间)
10
- */
11
- var t,e;t=this,e=function(){"use strict";var t=function(t,e,n,i){var o=Math.cos(t),a=Math.sin(t);return[e*o-n*a,e*a+n*o,i]};return function(){function e(t,e){void 0===t&&(t=7),void 0===e&&(e=[107,36]),this.name="Eoap",this.__scale=t,this.__center=e}return e.prototype.use=function(e,n){var i,o,a,s,r,h,u=(i=(360-n)/180*Math.PI,o=100*this.__scale,a=0,s=0,r=Math.cos(i),h=Math.sin(i),[s*h+o*r,a,s*r-o*h]);return u=t(e/180*Math.PI,u[0],u[1],u[2]),u=t((90-this.__center[0])/180*Math.PI,u[0],u[1],u[2]),u=function(t,e,n,i){var o=Math.cos(t),a=Math.sin(t);return[e,n*o-i*a,n*a+i*o]}((90-this.__center[1])/180*Math.PI,u[0],u[1],u[2]),[-u[0],u[1],u[2]]},e}()},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).VISLite_Eoap=e();
@@ -1,205 +0,0 @@
1
- /*!
2
- * VISLite JavaScript Library v0.5.0
3
- * git+https://github.com/oi-contrib/VISLite.git
4
- *
5
- * Copyright zxl20070701
6
- * Released under the MIT license
7
- * https://zxl20070701.github.io/notebook/home.html
8
- *
9
- * Publish Date: Sat Sep 30 2023 19:14:04 GMT+0800 (中国标准时间)
10
- */
11
- (function (global, factory) {
12
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
13
- typeof define === 'function' && define.amd ? define(factory) :
14
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.VISLite_Geometry = factory());
15
- })(this, (function () { 'use strict';
16
-
17
- var splitNum = function (precision, radius) {
18
- var num = Math.ceil(Math.PI * 2 /
19
- Math.asin(precision / radius) * 2);
20
- return (isNaN(num) || num < 12) ? 12 : num;
21
- };
22
-
23
- function rotate (cx, cy, deg, x, y) {
24
- var cos = Math.cos(deg), sin = Math.sin(deg);
25
- return [
26
- (x - cx) * cos - (y - cy) * sin + cx,
27
- (x - cx) * sin + (y - cy) * cos + cy
28
- ];
29
- }
30
-
31
- function prismHorizontal (normal, x, y, z, radius, num, d) {
32
- var beginX, beginZ;
33
- if (num == 4) {
34
- var temp = radius / 1.414;
35
- beginX = x + temp;
36
- beginZ = z + temp;
37
- }
38
- else {
39
- beginX = x + radius;
40
- beginZ = z;
41
- }
42
- var point = [beginX, beginZ], points = [], deg = Math.PI * 2 / num;
43
- for (var i = 0; i < num; i++) {
44
- points.push(x, y, z);
45
- if (normal)
46
- points.push(0, d, 0);
47
- points.push(point[0], y, point[1]);
48
- if (normal)
49
- points.push(0, d, 0);
50
- point = rotate(x, z, deg * (i + 1), beginX, beginZ);
51
- points.push(point[0], y, point[1]);
52
- if (normal)
53
- points.push(0, d, 0);
54
- }
55
- return points;
56
- }
57
-
58
- /******************************************************************************
59
- Copyright (c) Microsoft Corporation.
60
-
61
- Permission to use, copy, modify, and/or distribute this software for any
62
- purpose with or without fee is hereby granted.
63
-
64
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
65
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
66
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
67
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
68
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
69
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
70
- PERFORMANCE OF THIS SOFTWARE.
71
- ***************************************************************************** */
72
- /* global Reflect, Promise, SuppressedError, Symbol */
73
-
74
-
75
- function __spreadArray(to, from, pack) {
76
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
77
- if (ar || !(i in from)) {
78
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
79
- ar[i] = from[i];
80
- }
81
- }
82
- return to.concat(ar || Array.prototype.slice.call(from));
83
- }
84
-
85
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
86
- var e = new Error(message);
87
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
88
- };
89
-
90
- function prismVertical (normal, x, y, z, radius, height, num) {
91
- var points = [];
92
- var beginPosition;
93
- if (num == 4) {
94
- beginPosition = rotate(x, z, Math.PI * 0.25, x - radius, z);
95
- }
96
- else {
97
- beginPosition = [x + radius, z];
98
- }
99
- var deg = Math.PI * 2 / num, degHalf = Math.PI * 2 / (num * 2);
100
- var endPosition, normalPosition = [];
101
- for (var i = 0; i < num; i++) {
102
- endPosition = rotate.apply(void 0, __spreadArray([x, z, deg], beginPosition, false));
103
- if (normal) {
104
- var halfPosition = rotate.apply(void 0, __spreadArray([x, z, degHalf], beginPosition, false));
105
- normalPosition = [halfPosition[0], 0, halfPosition[1]];
106
- }
107
- points.push.apply(points, __spreadArray([beginPosition[0], y, beginPosition[1]], normalPosition, false));
108
- points.push.apply(points, __spreadArray([beginPosition[0], y + height, beginPosition[1]], normalPosition, false));
109
- points.push.apply(points, __spreadArray([endPosition[0], y + height, endPosition[1]], normalPosition, false));
110
- points.push.apply(points, __spreadArray([beginPosition[0], y, beginPosition[1]], normalPosition, false));
111
- points.push.apply(points, __spreadArray([endPosition[0], y, endPosition[1]], normalPosition, false));
112
- points.push.apply(points, __spreadArray([endPosition[0], y + height, endPosition[1]], normalPosition, false));
113
- beginPosition = endPosition;
114
- }
115
- return points;
116
- }
117
-
118
- function sphereFragment (normal, cx, cy, cz, radius, num, index) {
119
- var points = [cx, cy + radius, cz], deg = Math.PI * 2 / num, point;
120
- if (normal)
121
- points.push(0, radius, 0);
122
- var copy2 = function () {
123
- points.push.apply(points, points.slice(points.length - (normal ? 12 : 6)));
124
- };
125
- for (var i = 1; i < num * 0.5; i++) {
126
- point = rotate(cx, cy, deg * i, cx, cy + radius);
127
- if (i > 1)
128
- copy2();
129
- var point1 = rotate(cx, cz, deg * index, point[0], cz);
130
- points.push(point1[0], point[1], point1[1]);
131
- if (normal)
132
- points.push(point1[0] - cx, point[1] - cy, point1[1] - cz);
133
- if (i > 1)
134
- copy2();
135
- var point2 = rotate(cx, cz, deg * (index + 1), point[0], cz);
136
- points.push(point2[0], point[1], point2[1]);
137
- if (normal)
138
- points.push(point2[0] - cx, point2[1] - cy, point2[1] - cz);
139
- }
140
- copy2();
141
- points.push(cx, cy - radius, cz);
142
- if (normal)
143
- points.push(0, -radius, 0);
144
- return points;
145
- }
146
-
147
- function mergeOption (option, defaultOption) {
148
- for (var key in option) {
149
- defaultOption[key] = option[key];
150
- }
151
- return defaultOption;
152
- }
153
-
154
- var Geometry = (function () {
155
- function Geometry(option) {
156
- if (option === void 0) { option = {}; }
157
- this.name = 'Geometry';
158
- this.__option = mergeOption(option, {
159
- precision: 0.1,
160
- normal: false,
161
- });
162
- }
163
- Geometry.prototype.config = function (option) {
164
- for (var key in option) {
165
- this.__option[key] = option[key];
166
- }
167
- return this;
168
- };
169
- Geometry.prototype.cylinder = function (x, y, z, radius, height) {
170
- var num = splitNum(this.__option.precision, radius);
171
- return this.prism(x, y, z, radius, height, num);
172
- };
173
- Geometry.prototype.prism = function (x, y, z, radius, height, num) {
174
- var _a, _b, _c;
175
- var result = [{
176
- points: [],
177
- length: 0,
178
- method: "TRIANGLES"
179
- }];
180
- (_a = result[0].points).push.apply(_a, prismHorizontal(this.__option.normal, x, y, z, radius, num, height > 0 ? -1 : 1));
181
- (_b = result[0].points).push.apply(_b, prismHorizontal(this.__option.normal, x, y + height, z, radius, num, height > 0 ? 1 : -1));
182
- (_c = result[0].points).push.apply(_c, prismVertical(this.__option.normal, x, y, z, radius, height, num));
183
- result[0].length = 12 * num;
184
- return result;
185
- };
186
- Geometry.prototype.sphere = function (cx, cy, cz, radius) {
187
- var _a;
188
- var num = splitNum(this.__option.precision, radius);
189
- var result = [{
190
- points: [],
191
- length: 0,
192
- method: "TRIANGLES"
193
- }];
194
- for (var i = 0; i < num; i++) {
195
- (_a = result[0].points).push.apply(_a, sphereFragment(this.__option.normal, cx, cy, cz, radius, num, i));
196
- }
197
- result[0].length = result[0].points.length / (this.__option.normal ? 6 : 3);
198
- return result;
199
- };
200
- return Geometry;
201
- }());
202
-
203
- return Geometry;
204
-
205
- }));
@@ -1,11 +0,0 @@
1
- /*!
2
- * VISLite JavaScript Library v0.5.0
3
- * git+https://github.com/oi-contrib/VISLite.git
4
- *
5
- * Copyright zxl20070701
6
- * Released under the MIT license
7
- * https://zxl20070701.github.io/notebook/home.html
8
- *
9
- * Publish Date: Sat Sep 30 2023 19:14:04 GMT+0800 (中国标准时间)
10
- */
11
- var t,n;t=this,n=function(){"use strict";var t=function(t,n){var p=Math.ceil(2*Math.PI/Math.asin(t/n)*2);return isNaN(p)||p<12?12:p};function n(t,n,p,o,r){var i=Math.cos(p),e=Math.sin(p);return[(o-t)*i-(r-n)*e+t,(o-t)*e+(r-n)*i+n]}function p(t,p,o,r,i,e,s){var u,a;if(4==e){var h=i/1.414;u=p+h,a=r+h}else u=p+i,a=r;for(var l=[u,a],f=[],c=2*Math.PI/e,y=0;y<e;y++)f.push(p,o,r),t&&f.push(0,s,0),f.push(l[0],o,l[1]),t&&f.push(0,s,0),l=n(p,r,c*(y+1),u,a),f.push(l[0],o,l[1]),t&&f.push(0,s,0);return f}function o(t,n,p){if(p||2===arguments.length)for(var o,r=0,i=n.length;r<i;r++)!o&&r in n||(o||(o=Array.prototype.slice.call(n,0,r)),o[r]=n[r]);return t.concat(o||Array.prototype.slice.call(n))}function r(t,p,o,r,i,e,s){var u,a=[p,o+i,r],h=2*Math.PI/e;t&&a.push(0,i,0);for(var l=function(){a.push.apply(a,a.slice(a.length-(t?12:6)))},f=1;f<.5*e;f++){u=n(p,o,h*f,p,o+i),f>1&&l();var c=n(p,r,h*s,u[0],r);a.push(c[0],u[1],c[1]),t&&a.push(c[0]-p,u[1]-o,c[1]-r),f>1&&l();var y=n(p,r,h*(s+1),u[0],r);a.push(y[0],u[1],y[1]),t&&a.push(y[0]-p,y[1]-o,y[1]-r)}return l(),a.push(p,o-i,r),t&&a.push(0,-i,0),a}return"function"==typeof SuppressedError&&SuppressedError,function(){function i(t){void 0===t&&(t={}),this.name="Geometry",this.__option=function(t,n){for(var p in t)n[p]=t[p];return n}(t,{precision:.1,normal:!1})}return i.prototype.config=function(t){for(var n in t)this.__option[n]=t[n];return this},i.prototype.cylinder=function(n,p,o,r,i){var e=t(this.__option.precision,r);return this.prism(n,p,o,r,i,e)},i.prototype.prism=function(t,r,i,e,s,u){var a,h,l,f=[{points:[],length:0,method:"TRIANGLES"}];return(a=f[0].points).push.apply(a,p(this.__option.normal,t,r,i,e,u,s>0?-1:1)),(h=f[0].points).push.apply(h,p(this.__option.normal,t,r+s,i,e,u,s>0?1:-1)),(l=f[0].points).push.apply(l,function(t,p,r,i,e,s,u){var a,h=[];a=4==u?n(p,i,.25*Math.PI,p-e,i):[p+e,i];for(var l,f=2*Math.PI/u,c=2*Math.PI/(2*u),y=[],v=0;v<u;v++){if(l=n.apply(void 0,o([p,i,f],a,!1)),t){var _=n.apply(void 0,o([p,i,c],a,!1));y=[_[0],0,_[1]]}h.push.apply(h,o([a[0],r,a[1]],y,!1)),h.push.apply(h,o([a[0],r+s,a[1]],y,!1)),h.push.apply(h,o([l[0],r+s,l[1]],y,!1)),h.push.apply(h,o([a[0],r,a[1]],y,!1)),h.push.apply(h,o([l[0],r,l[1]],y,!1)),h.push.apply(h,o([l[0],r+s,l[1]],y,!1)),a=l}return h}(this.__option.normal,t,r,i,e,s,u)),f[0].length=12*u,f},i.prototype.sphere=function(n,p,o,i){for(var e,s=t(this.__option.precision,i),u=[{points:[],length:0,method:"TRIANGLES"}],a=0;a<s;a++)(e=u[0].points).push.apply(e,r(this.__option.normal,n,p,o,i,s,a));return u[0].length=u[0].points.length/(this.__option.normal?6:3),u},i}()},"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t="undefined"!=typeof globalThis?globalThis:t||self).VISLite_Geometry=n();
@@ -1,55 +0,0 @@
1
- /*!
2
- * VISLite JavaScript Library v0.5.0
3
- * git+https://github.com/oi-contrib/VISLite.git
4
- *
5
- * Copyright zxl20070701
6
- * Released under the MIT license
7
- * https://zxl20070701.github.io/notebook/home.html
8
- *
9
- * Publish Date: Sat Sep 30 2023 19:14:04 GMT+0800 (中国标准时间)
10
- */
11
- (function (global, factory) {
12
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
13
- typeof define === 'function' && define.amd ? define(factory) :
14
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.VISLite_Hermite = factory());
15
- })(this, (function () { 'use strict';
16
-
17
- var Hermite = (function () {
18
- function Hermite(u) {
19
- if (u === void 0) { u = 0.5; }
20
- this.name = 'Hermite';
21
- this.__u = u;
22
- }
23
- Hermite.prototype.setP = function (x1, y1, x2, y2, s1, s2) {
24
- if (x1 < x2) {
25
- this.__a = x1;
26
- this.__b = x2;
27
- var p3 = this.__u * s1, p4 = this.__u * s2;
28
- y1 /= (x2 - x1);
29
- y2 /= (x2 - x1);
30
- this.__MR = [
31
- 2 * y1 - 2 * y2 + p3 + p4,
32
- 3 * y2 - 3 * y1 - 2 * p3 - p4,
33
- p3,
34
- y1
35
- ];
36
- }
37
- else
38
- throw new Error('The point x-position should be increamented!');
39
- return this;
40
- };
41
- Hermite.prototype.use = function (x) {
42
- if (this.__MR) {
43
- var sx = (x - this.__a) / (this.__b - this.__a), sx2 = sx * sx, sx3 = sx * sx2;
44
- var sResult = sx3 * this.__MR[0] + sx2 * this.__MR[1] + sx * this.__MR[2] + this.__MR[3];
45
- return sResult * (this.__b - this.__a);
46
- }
47
- else
48
- throw new Error('You shoud first set the position!');
49
- };
50
- return Hermite;
51
- }());
52
-
53
- return Hermite;
54
-
55
- }));
@@ -1,11 +0,0 @@
1
- /*!
2
- * VISLite JavaScript Library v0.5.0
3
- * git+https://github.com/oi-contrib/VISLite.git
4
- *
5
- * Copyright zxl20070701
6
- * Released under the MIT license
7
- * https://zxl20070701.github.io/notebook/home.html
8
- *
9
- * Publish Date: Sat Sep 30 2023 19:14:04 GMT+0800 (中国标准时间)
10
- */
11
- var t,i;t=this,i=function(){"use strict";return function(){function t(t){void 0===t&&(t=.5),this.name="Hermite",this.__u=t}return t.prototype.setP=function(t,i,e,o,s,_){if(!(t<e))throw new Error("The point x-position should be increamented!");this.__a=t,this.__b=e;var n=this.__u*s,r=this.__u*_;return i/=e-t,o/=e-t,this.__MR=[2*i-2*o+n+r,3*o-3*i-2*n-r,n,i],this},t.prototype.use=function(t){if(this.__MR){var i=(t-this.__a)/(this.__b-this.__a),e=i*i;return(i*e*this.__MR[0]+e*this.__MR[1]+i*this.__MR[2]+this.__MR[3])*(this.__b-this.__a)}throw new Error("You shoud first set the position!")},t}()},"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(t="undefined"!=typeof globalThis?globalThis:t||self).VISLite_Hermite=i();
@@ -1,146 +0,0 @@
1
- /*!
2
- * VISLite JavaScript Library v0.5.0
3
- * git+https://github.com/oi-contrib/VISLite.git
4
- *
5
- * Copyright zxl20070701
6
- * Released under the MIT license
7
- * https://zxl20070701.github.io/notebook/home.html
8
- *
9
- * Publish Date: Sat Sep 30 2023 19:14:04 GMT+0800 (中国标准时间)
10
- */
11
- (function (global, factory) {
12
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
13
- typeof define === 'function' && define.amd ? define(factory) :
14
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.VISLite_Matrix4 = factory());
15
- })(this, (function () { 'use strict';
16
-
17
- function _move (d, a, b, c) {
18
- if (c === void 0) { c = 0; }
19
- var sqrt = Math.sqrt(a * a + b * b + c * c);
20
- return [
21
- 1, 0, 0, 0,
22
- 0, 1, 0, 0,
23
- 0, 0, 1, 0,
24
- a * d / sqrt, b * d / sqrt, c * d / sqrt, 1
25
- ];
26
- }
27
-
28
- function _rotate (deg) {
29
- var sin = Math.sin(deg), cos = Math.cos(deg);
30
- return [
31
- cos, sin, 0, 0,
32
- -sin, cos, 0, 0,
33
- 0, 0, 1, 0,
34
- 0, 0, 0, 1
35
- ];
36
- }
37
-
38
- function _scale (xTimes, yTimes, zTimes, cx, cy, cz) {
39
- if (cx === void 0) { cx = 0; }
40
- if (cy === void 0) { cy = 0; }
41
- if (cz === void 0) { cz = 0; }
42
- return [
43
- xTimes, 0, 0, 0,
44
- 0, yTimes, 0, 0,
45
- 0, 0, zTimes, 0,
46
- cx - cx * xTimes, cy - cy * yTimes, cz - cz * zTimes, 1
47
- ];
48
- }
49
-
50
- function _transform (a1, b1, c1, a2, b2, c2) {
51
- if (typeof a1 === 'number' && typeof b1 === 'number') {
52
- if (typeof c1 !== 'number') {
53
- c1 = 0;
54
- a2 = a1;
55
- b2 = b1;
56
- c2 = 1;
57
- }
58
- else if (typeof a2 !== 'number' || typeof b2 !== 'number' || typeof c2 !== 'number') {
59
- a2 = a1;
60
- b2 = b1;
61
- c2 = c1;
62
- a1 = 0;
63
- b1 = 0;
64
- c1 = 0;
65
- }
66
- if (a1 == a2 && b1 == b2 && c1 == c2)
67
- throw new Error('It\'s not a legitimate ray!');
68
- var sqrt1 = Math.sqrt((a2 - a1) * (a2 - a1) + (b2 - b1) * (b2 - b1)), cos1 = sqrt1 != 0 ? (b2 - b1) / sqrt1 : 1, sin1 = sqrt1 != 0 ? (a2 - a1) / sqrt1 : 0, b = (a2 - a1) * sin1 + (b2 - b1) * cos1, c = c2 - c1, sqrt2 = Math.sqrt(b * b + c * c), cos2 = sqrt2 != 0 ? c / sqrt2 : 1, sin2 = sqrt2 != 0 ? b / sqrt2 : 0;
69
- return [
70
- [
71
- cos1, cos2 * sin1, sin1 * sin2, 0,
72
- -sin1, cos1 * cos2, cos1 * sin2, 0,
73
- 0, -sin2, cos2, 0,
74
- b1 * sin1 - a1 * cos1, c1 * sin2 - a1 * sin1 * cos2 - b1 * cos1 * cos2, -a1 * sin1 * sin2 - b1 * cos1 * sin2 - c1 * cos2, 1
75
- ],
76
- [
77
- cos1, -sin1, 0, 0,
78
- cos2 * sin1, cos2 * cos1, -sin2, 0,
79
- sin1 * sin2, cos1 * sin2, cos2, 0,
80
- a1, b1, c1, 1
81
- ]
82
- ];
83
- }
84
- else {
85
- throw new Error('a1 and b1 is required!');
86
- }
87
- }
88
-
89
- var _multiply = function (matrix4, param) {
90
- var newParam = [];
91
- for (var i = 0; i < 4; i++)
92
- for (var j = 0; j < param.length / 4; j++)
93
- newParam[j * 4 + i] =
94
- matrix4[i] * param[j * 4] +
95
- matrix4[i + 4] * param[j * 4 + 1] +
96
- matrix4[i + 8] * param[j * 4 + 2] +
97
- matrix4[i + 12] * param[j * 4 + 3];
98
- return newParam;
99
- };
100
- var Matrix4 = (function () {
101
- function Matrix4(initMatrix4) {
102
- if (initMatrix4 === void 0) { initMatrix4 = [
103
- 1, 0, 0, 0,
104
- 0, 1, 0, 0,
105
- 0, 0, 1, 0,
106
- 0, 0, 0, 1
107
- ]; }
108
- this.name = 'Matrix4';
109
- this.__matrix4 = initMatrix4;
110
- }
111
- Matrix4.prototype.move = function (dis, a, b, c) {
112
- if (c === void 0) { c = 0; }
113
- this.__matrix4 = _multiply(_move(dis, a, b, c), this.__matrix4);
114
- return this;
115
- };
116
- Matrix4.prototype.rotate = function (deg, a1, b1, c1, a2, b2, c2) {
117
- var matrix4s = _transform(a1, b1, c1, a2, b2, c2);
118
- this.__matrix4 = _multiply(_multiply(_multiply(matrix4s[1], _rotate(deg)), matrix4s[0]), this.__matrix4);
119
- return this;
120
- };
121
- Matrix4.prototype.scale = function (xTimes, yTimes, zTimes, cx, cy, cz) {
122
- if (cx === void 0) { cx = 0; }
123
- if (cy === void 0) { cy = 0; }
124
- if (cz === void 0) { cz = 0; }
125
- this.__matrix4 = _multiply(_scale(xTimes, yTimes, zTimes, cx, cy, cz), this.__matrix4);
126
- return this;
127
- };
128
- Matrix4.prototype.multiply = function (newMatrix4, flag) {
129
- if (flag === void 0) { flag = false; }
130
- this.__matrix4 = flag ? _multiply(this.__matrix4, newMatrix4) : _multiply(newMatrix4, this.__matrix4);
131
- return this;
132
- };
133
- Matrix4.prototype.use = function (x, y, z, w) {
134
- if (z === void 0) { z = 0; }
135
- if (w === void 0) { w = 1; }
136
- return _multiply(this.__matrix4, [x, y, z, w]);
137
- };
138
- Matrix4.prototype.value = function () {
139
- return this.__matrix4;
140
- };
141
- return Matrix4;
142
- }());
143
-
144
- return Matrix4;
145
-
146
- }));