vislite 0.8.0 → 0.8.1-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 (79) hide show
  1. package/CHANGELOG +212 -209
  2. package/README.md +136 -144
  3. package/lib/Buffer/index.umd.js +36 -36
  4. package/lib/Buffer/index.umd.min.js +2 -2
  5. package/lib/Canvas/index.umd.js +691 -691
  6. package/lib/Canvas/index.umd.min.js +2 -2
  7. package/lib/Cardinal/index.umd.js +91 -91
  8. package/lib/Cardinal/index.umd.min.js +2 -2
  9. package/lib/Eoap/index.umd.js +34 -34
  10. package/lib/Eoap/index.umd.min.js +2 -2
  11. package/lib/Geometry/index.umd.js +286 -286
  12. package/lib/Geometry/index.umd.min.js +2 -2
  13. package/lib/Hermite/index.umd.js +36 -36
  14. package/lib/Hermite/index.umd.min.js +2 -2
  15. package/lib/Matrix4/index.umd.js +125 -125
  16. package/lib/Matrix4/index.umd.min.js +2 -2
  17. package/lib/Mercator/index.umd.js +20 -20
  18. package/lib/Mercator/index.umd.min.js +2 -2
  19. package/lib/OralCanvas/index.es.js +634 -634
  20. package/lib/OralCanvas/index.es.min.js +2 -2
  21. package/lib/OralWebGL/index.es.js +552 -552
  22. package/lib/OralWebGL/index.es.min.js +2 -2
  23. package/lib/SVG/index.umd.js +471 -471
  24. package/lib/SVG/index.umd.min.js +2 -2
  25. package/lib/Shader/index.umd.js +61 -61
  26. package/lib/Shader/index.umd.min.js +2 -2
  27. package/lib/Texture/index.umd.js +54 -54
  28. package/lib/Texture/index.umd.min.js +2 -2
  29. package/lib/TreeLayout/index.umd.js +368 -368
  30. package/lib/TreeLayout/index.umd.min.js +2 -2
  31. package/lib/WebGL/index.umd.js +599 -599
  32. package/lib/WebGL/index.umd.min.js +2 -2
  33. package/lib/animation/index.umd.js +73 -73
  34. package/lib/animation/index.umd.min.js +2 -2
  35. package/lib/formatColor/index.umd.js +40 -40
  36. package/lib/formatColor/index.umd.min.js +2 -2
  37. package/lib/getLoopColors/index.umd.js +36 -36
  38. package/lib/getLoopColors/index.umd.min.js +2 -2
  39. package/lib/getWebGLContext/index.umd.js +63 -63
  40. package/lib/getWebGLContext/index.umd.min.js +2 -2
  41. package/lib/index.umd.js +2955 -2955
  42. package/lib/index.umd.min.js +2 -2
  43. package/lib/move/index.umd.js +8 -8
  44. package/lib/move/index.umd.min.js +2 -2
  45. package/lib/resizeObserver/index.umd.js +30 -30
  46. package/lib/resizeObserver/index.umd.min.js +2 -2
  47. package/lib/rotate/index.umd.js +8 -8
  48. package/lib/rotate/index.umd.min.js +2 -2
  49. package/lib/ruler/index.umd.js +138 -138
  50. package/lib/ruler/index.umd.min.js +2 -2
  51. package/lib/scale/index.umd.js +7 -7
  52. package/lib/scale/index.umd.min.js +2 -2
  53. package/lib/throttle/index.umd.js +49 -49
  54. package/lib/throttle/index.umd.min.js +2 -2
  55. package/lib/viewHandler/index.umd.js +120 -120
  56. package/lib/viewHandler/index.umd.min.js +2 -2
  57. package/miniprogram/ui-canvas/drawImage.js +34 -0
  58. package/miniprogram/ui-canvas/index.js +10 -2
  59. package/package/getWebGLContext/index.ts +40 -40
  60. package/package.json +70 -70
  61. package/src/Canvas.ts +72 -72
  62. package/src/Geometry.ts +210 -210
  63. package/src/WebGL.ts +66 -66
  64. package/src/common/canvas/index.ts +183 -183
  65. package/src/common/canvas/painter.ts +446 -446
  66. package/src/common/geometry/prism-horizontal.ts +50 -50
  67. package/src/common/geometry/prism-vertical.ts +55 -55
  68. package/src/common/geometry/tool/circle.ts +17 -17
  69. package/src/common/geometry/tool/rotateLine.ts +48 -48
  70. package/src/common/geometry/tool/triangles.ts +23 -23
  71. package/src/common/webgl/getWebGLContext.ts +45 -45
  72. package/src/common/webgl/index.ts +227 -227
  73. package/types/Canvas.d.ts +318 -318
  74. package/types/Geometry.d.ts +132 -132
  75. package/types/WebGLOption.d.ts +14 -14
  76. package/types/getWebGLContext.d.ts +4 -4
  77. package/types/ui-canvas.d.ts +4 -4
  78. package/uni-app/drawImage.js +17 -17
  79. package/uni-app/ui-canvas.vue +290 -290
@@ -1,11 +1,11 @@
1
1
  /*!
2
- * VISLite JavaScript Library v0.8.0
2
+ * VISLite JavaScript Library v0.8.1-alpha.0
3
3
  * git+https://github.com/oi-contrib/VISLite.git
4
4
  *
5
5
  * Copyright zxl20070701
6
6
  * Released under the MIT license
7
7
  * https://zxl20070701.github.io/notebook/home.html
8
8
  *
9
- * Publish Date: Sat Mar 02 2024 12:41:38 GMT+0800 (中国标准时间)
9
+ * Publish Date: Tue Apr 02 2024 14:46:44 GMT+0800 (China Standard Time)
10
10
  */
11
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,r){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.prototype.drawImage=function(t,i,e,n,r,o){var s=this;return void 0===o&&(o=!1),new Promise((function(a){if(s.__region&&(s.__region.fillRect(i,e,n,r),a({})),s.__isPainter&&s.__onlyRegion)return s;if("string"!=typeof t||o)s.painter.drawImage(t,i,e,n,r),a({});else{var _=new Image;_.onload=function(){s.painter.drawImage(_,i,e,n,r),a({})},_.src=t}}))},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,n,r){void 0===n&&(n={}),void 0===r&&(r=1);var o=t.call(this,i,n,e?new _(e,{willReadFrequently:!0}):void 0,!0,r)||this;return o.name="Canvas",o.__regionList={},o.__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),o.__scaleSize=r,o.setRegion(""),o}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){var r=e.__region?e.__region.painter.getImageData(t-.5,i-.5,1,1):{data:[0,0,0,0]},o=r.data,s=function(){if(e.__region)for(var t in e.__regionList)if("rgb("+o[0]+","+o[1]+","+o[2]+")"==e.__regionList[t]){n(t);break}n("")};o?s():r.then((function(t){o=t,s()}))}))},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.getInfo=function(){return{width:this.painter.canvas.width/this.__scaleSize,height:this.painter.canvas.height/this.__scaleSize}},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){t*=this.__scaleSize,i*=this.__scaleSize;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,willReadFrequently:!1});var r,o=i.clientWidth,s=i.clientHeight,a=null,_=i;_._vislite_canvas_?(r=_._vislite_canvas_[0],a=_._vislite_canvas_[1]):(r=document.createElement("canvas"),i.appendChild(r),e.region&&(a=document.createElement("canvas")),_._vislite_canvas_=[r,a],i.setAttribute("vislite","Canvas"));for(var h=[a,r],l=0;l<h.length;l++){var p=h[l];p&&(p.style.width=o+"px",p.setAttribute("width",l*o+o+""),p.style.height=s+"px",p.setAttribute("height",l*s+s+""))}return(n=t.call(this,r,a,{willReadFrequently:e.willReadFrequently},2)||this).__canvas=r,n.painter.scale(2,2),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,12 +1,12 @@
1
1
  /*!
2
- * VISLite JavaScript Library v0.8.0
2
+ * VISLite JavaScript Library v0.8.1-alpha.0
3
3
  * git+https://github.com/oi-contrib/VISLite.git
4
4
  *
5
5
  * Copyright zxl20070701
6
6
  * Released under the MIT license
7
7
  * https://zxl20070701.github.io/notebook/home.html
8
8
  *
9
- * Publish Date: Sat Mar 02 2024 12:41:38 GMT+0800 (中国标准时间)
9
+ * Publish Date: Tue Apr 02 2024 14:46:44 GMT+0800 (China Standard Time)
10
10
  */
11
11
  (function (global, factory) {
12
12
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -14,97 +14,97 @@
14
14
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.VISLite_Cardinal = factory());
15
15
  })(this, (function () { 'use strict';
16
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;
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
51
  }());
52
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;
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
108
  }());
109
109
 
110
110
  return Cardinal;
@@ -1,11 +1,11 @@
1
1
  /*!
2
- * VISLite JavaScript Library v0.8.0
2
+ * VISLite JavaScript Library v0.8.1-alpha.0
3
3
  * git+https://github.com/oi-contrib/VISLite.git
4
4
  *
5
5
  * Copyright zxl20070701
6
6
  * Released under the MIT license
7
7
  * https://zxl20070701.github.io/notebook/home.html
8
8
  *
9
- * Publish Date: Sat Mar 02 2024 12:41:38 GMT+0800 (中国标准时间)
9
+ * Publish Date: Tue Apr 02 2024 14:46:44 GMT+0800 (China Standard Time)
10
10
  */
11
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,12 +1,12 @@
1
1
  /*!
2
- * VISLite JavaScript Library v0.8.0
2
+ * VISLite JavaScript Library v0.8.1-alpha.0
3
3
  * git+https://github.com/oi-contrib/VISLite.git
4
4
  *
5
5
  * Copyright zxl20070701
6
6
  * Released under the MIT license
7
7
  * https://zxl20070701.github.io/notebook/home.html
8
8
  *
9
- * Publish Date: Sat Mar 02 2024 12:41:38 GMT+0800 (中国标准时间)
9
+ * Publish Date: Tue Apr 02 2024 14:46:44 GMT+0800 (China Standard Time)
10
10
  */
11
11
  (function (global, factory) {
12
12
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -14,38 +14,38 @@
14
14
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.VISLite_Eoap = factory());
15
15
  })(this, (function () { 'use strict';
16
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;
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
49
  }());
50
50
 
51
51
  return Eoap;
@@ -1,11 +1,11 @@
1
1
  /*!
2
- * VISLite JavaScript Library v0.8.0
2
+ * VISLite JavaScript Library v0.8.1-alpha.0
3
3
  * git+https://github.com/oi-contrib/VISLite.git
4
4
  *
5
5
  * Copyright zxl20070701
6
6
  * Released under the MIT license
7
7
  * https://zxl20070701.github.io/notebook/home.html
8
8
  *
9
- * Publish Date: Sat Mar 02 2024 12:41:38 GMT+0800 (中国标准时间)
9
+ * Publish Date: Tue Apr 02 2024 14:46:44 GMT+0800 (China Standard Time)
10
10
  */
11
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();