diff --git a/docs/script/main.min.js b/docs/script/main.min.js index 4fbc0a5..a5edf97 100644 --- a/docs/script/main.min.js +++ b/docs/script/main.min.js @@ -1 +1 @@ -!function(){"use strict";var e={638:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.getQueryStringValue=t.downloadTextFile=t.declarePolyfills=void 0,t.downloadTextFile=function(e,t){var n="text/plain",r=new Blob([e],{type:n});if(void 0!==window.navigator&&void 0!==window.navigator.msSaveBlob)window.navigator.msSaveBlob(r,t);else{var a=URL.createObjectURL(r),o=document.createElement("a");o.download=t,o.href=a,o.dataset.downloadurl="".concat(n,":").concat(o.download,":").concat(o.href),o.style.display="none",document.body.appendChild(o),o.click(),document.body.removeChild(o),setTimeout((function(){URL.revokeObjectURL(a)}),5e3)}},t.getQueryStringValue=function(e){var t=window.location.href,n=t.indexOf("?");if(n>=0){var r=t.substring(n+1);if(r.length>0)for(var a=0,o=r.split("&");a=0}})),"function"!=typeof String.prototype.repeat&&(console.log("Declaring String.repeat polyfill..."),Object.defineProperty(String.prototype,"repeat",{value:function(e){if(e<0||e===1/0)throw new RangeError;for(var t="",n=0;n=1){(0,o.applyCanvasCompositing)(this.context,t,n,r),this.context.lineWidth=a*this.cssPixel;for(var i=0,s=e;i0){this.context.fillStyle=t,this.context.strokeStyle="none";for(var r=0,a=e;r0,this.writer.addLine(''),this.writer.startBlock('')),this.hasBlur&&(this.writer.startBlock(""),this.writer.startBlock('')),this.writer.addLine('')),this.writer.endBlock(""),this.writer.endBlock(""),this.writer.startBlock(''))),this.writer.addLine(''))},t.prototype.finalize=function(){this.hasBlur&&this.writer.endBlock(""),this.writer.endBlock("")},t.prototype.drawLines=function(e,t,n,r,a){if(e.length>=1){var i=void 0;if((0,o.useAdvancedCompositing)()){this.writer.startBlock(""),this.writer.startBlock('"),this.writer.endBlock("");var s=Math.ceil(255*n),h=(0,o.computeRawColor)(t);i="rgb(".concat(h.r*s,", ").concat(h.g*s,", ").concat(h.b*s,")")}else s=(0,o.useAdvancedCompositing)()?255:0,h=(0,o.computeRawColor)(t),i="rgba(".concat(h.r*s,", ").concat(h.g*s,", ").concat(h.b*s,", ").concat(n,")");this.writer.startBlock(''));for(var c=0,d=e;c'))}this.writer.endBlock("")}},t.prototype.drawPoints=function(e,t,n){if(e.length>0){this.writer.startBlock(''));for(var r=0,a=e;r'))}this.writer.endBlock("")}},t.prototype.export=function(){var e=Date.now(),t=this.writer.result;return console.log("Concatenation took ".concat(Date.now()-e," ms.")),t},Object.defineProperty(t.prototype,"size",{get:function(){return{width:1e3,height:1e3}},enumerable:!1,configurable:!0}),t}(i.PlotterBase);t.PlotterSVG=c},775:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.XMLWriter=void 0;var n=function(){function e(){this.indentationLevel=0,this.lines=[]}return Object.defineProperty(e.prototype,"result",{get:function(){return this.lines.join("\n")},enumerable:!1,configurable:!0}),e.prototype.startBlock=function(e){this.addLine(e),this.indentationLevel++},e.prototype.endBlock=function(e){this.indentationLevel--,this.addLine(e)},e.prototype.addLine=function(e){this.lines.push(this.prefix+e)},Object.defineProperty(e.prototype,"prefix",{get:function(){return"\t".repeat(this.indentationLevel)},enumerable:!1,configurable:!0}),e}();t.XMLWriter=n},794:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.ThreadComputer=void 0;var r=n(627),a=n(755),o=n(246),i=n(443),s=n(170),h=-9007199254740991,c=2*Math.PI;function d(e,t,n){return en?n:e}function l(e,t,n){return e*(1-n)+t*n}function u(e){return 0===e.length?null:e[Math.floor(Math.random()*e.length)]}var p=function(){function e(e){this.hiddenCanvasData=null,this.sourceImage=e,this.hiddenCanvas=document.createElement("canvas"),this.hiddenCanvasContext=this.hiddenCanvas.getContext("2d"),this.reset(.0625,1)}return e.prototype.drawThread=function(e,t){var n=this,a=this.computeTransformation(e.size),i=a.scaling*this.hiddenCanvasScale*this.lineThickness,s=r.Parameters.invertColors?o.ECompositingOperation.LIGHTEN:o.ECompositingOperation.DARKEN;this.thread.iterateOnThreads(t,(function(t,r){for(var o=[],h=0,c=t;ha)return this.thread.lowerNbSegments(a),this.resetHiddenCanvas(),this.thread.iterateOnThreads(0,(function(e,n){(0,o.applyCanvasCompositing)(t.hiddenCanvasContext,n,t.lineOpacityInternal,o.ECompositingOperation.LIGHTEN);for(var r=0;r+1t?(t=s,e=[{peg1:o,peg2:i}]):s===t&&e.push({peg1:o,peg2:i})}}return u(e)},e.prototype.computeBestNextPeg=function(e,t){for(var n=[],r=h,a=0,o=this.pegs;ar?(r=s,n=[i]):s===r&&n.push(i)}}return u(n)},e.prototype.uploadCanvasDataToCPU=function(){if(null===this.hiddenCanvasData){var e=this.hiddenCanvas.width,t=this.hiddenCanvas.height;this.hiddenCanvasData=this.hiddenCanvasContext.getImageData(0,0,e,t)}},e.prototype.computeSegmentPotential=function(e,t){this.uploadCanvasDataToCPU();for(var n,r,a,o,i=0,s=(r=t,a=(n=e).x-r.x,o=n.y-r.y,Math.sqrt(a*a+o*o)),h=Math.ceil(s),c=0;c1?{width:t,height:Math.round(t/h)}:{width:Math.round(t*h),height:t};var n=r.Parameters.shape,a=r.Parameters.pegsCount,o=[];if(n===r.EShape.RECTANGLE){this.arePegsTooClose=function(e,t){return e.x===t.x||e.y===t.y};var i=e.width,s=e.height,h=s/i,d=Math.round(.5*a/(1+h)),l=Math.round(.5*(a-2*d));o.push({x:0,y:0});for(var u=1;u=1;u--)o.push({x:i*(u/d),y:s});for(o.push({x:0,y:s}),p=l-1;p>=1;p--)o.push({x:0,y:s*(p/l)})}else{this.arePegsTooClose=function(e,t){var n=Math.abs(e.angle-t.angle);return Math.min(n,c-n)<=c/16};for(var g=.5*e.width,f=.5*e.height,v=Math.PI*(3*(g+f)-Math.sqrt((3*g+f)*(g+3*f)))/a,m=0;o.lengththis.threadComputer.nbSegments&&(this.nbSegmentsDrawn=0),0===this.nbSegmentsDrawn){var e={backgroundColor:r.Parameters.invertColors?"black":"white",blur:r.Parameters.blur};this.plotter.resize(),this.plotter.initialize(e),r.Parameters.displayPegs&&this.threadComputer.drawPegs(this.plotter),this.threadComputer.drawThread(this.plotter,0),this.plotter.finalize()}else this.threadComputer.drawThread(this.plotter,this.nbSegmentsDrawn);this.nbSegmentsDrawn=this.threadComputer.nbSegments}},e}();t.ThreadPlotter=a},323:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.ThreadBase=void 0;var n=function(){function e(){this.sampleCanvas=null}return e.lowerNbSegmentsForThread=function(e,t){e.length=t>0?Math.min(e.length,t+1):0},e.computeNbSegments=function(e){return e.length>1?e.length-1:0},e.iterateOnThread=function(t,n,r,a){r0&&this.threadPegsRed.length0&&this.threadPegsGreen.lengthi&&o>s?a.red++:i>o&&i>s?a.green++:a.blue++}return a},t}(i.ThreadBase);t.ThreadRedBlueGreen=s},755:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Transformation=void 0;var n=function(){function e(e,t){var n=e.width/t.width,r=e.height/t.height;this.scaling=Math.min(n,r),this.origin={x:.5*(e.width-this.scaling*t.width),y:.5*(e.height-this.scaling*t.height)}}return e.prototype.transform=function(e){return{x:this.origin.x+e.x*this.scaling,y:this.origin.y+e.y*this.scaling}},e}();t.Transformation=n}},t={};!function n(r){var a=t[r];if(void 0!==a)return a.exports;var o=t[r]={exports:{}};return e[r].call(o.exports,o,o.exports,n),o.exports}(50)}(); \ No newline at end of file +!function(){"use strict";var e={638:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.getQueryStringValue=t.downloadTextFile=t.declarePolyfills=void 0,t.downloadTextFile=function(e,t){var n="text/plain",r=new Blob([e],{type:n});if(void 0!==window.navigator&&void 0!==window.navigator.msSaveBlob)window.navigator.msSaveBlob(r,t);else{var a=URL.createObjectURL(r),o=document.createElement("a");o.download=t,o.href=a,o.dataset.downloadurl="".concat(n,":").concat(o.download,":").concat(o.href),o.style.display="none",document.body.appendChild(o),o.click(),document.body.removeChild(o),setTimeout((function(){URL.revokeObjectURL(a)}),5e3)}},t.getQueryStringValue=function(e){var t=window.location.href,n=t.indexOf("?");if(n>=0){var r=t.substring(n+1);if(r.length>0)for(var a=0,o=r.split("&");a=0}})),"function"!=typeof String.prototype.repeat&&(console.log("Declaring String.repeat polyfill..."),Object.defineProperty(String.prototype,"repeat",{value:function(e){if(e<0||e===1/0)throw new RangeError;for(var t="",n=0;n=1){(0,o.applyCanvasCompositing)(this.context,t,n,r),this.context.lineWidth=a*this.cssPixel;for(var i=0,s=e;i0){this.context.fillStyle=t,this.context.strokeStyle="none";for(var r=0,a=e;r0,this.writer.addLine(''),this.writer.startBlock('')),this.hasBlur&&(this.writer.startBlock(""),this.writer.startBlock('')),this.writer.addLine('')),this.writer.endBlock(""),this.writer.endBlock(""),this.writer.startBlock(''))),this.writer.addLine(''))},t.prototype.finalize=function(){this.hasBlur&&this.writer.endBlock(""),this.writer.endBlock("")},t.prototype.drawLines=function(e,t,n,r,a){if(e.length>=1){var i=void 0;if((0,o.useAdvancedCompositing)()){this.writer.startBlock(""),this.writer.startBlock('"),this.writer.endBlock("");var s=Math.ceil(255*n),h=(0,o.computeRawColor)(t);i="rgb(".concat(h.r*s,", ").concat(h.g*s,", ").concat(h.b*s,")")}else s=(0,o.useAdvancedCompositing)()?255:0,h=(0,o.computeRawColor)(t),i="rgba(".concat(h.r*s,", ").concat(h.g*s,", ").concat(h.b*s,", ").concat(n,")");this.writer.startBlock(''));for(var c=0,d=e;c'))}this.writer.endBlock("")}},t.prototype.drawPoints=function(e,t,n){if(e.length>0){this.writer.startBlock(''));for(var r=0,a=e;r'))}this.writer.endBlock("")}},t.prototype.export=function(){var e=Date.now(),t=this.writer.result;return console.log("Concatenation took ".concat(Date.now()-e," ms.")),t},Object.defineProperty(t.prototype,"size",{get:function(){return{width:1e3,height:1e3}},enumerable:!1,configurable:!0}),t}(i.PlotterBase);t.PlotterSVG=c},775:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.XMLWriter=void 0;var n=function(){function e(){this.indentationLevel=0,this.lines=[]}return Object.defineProperty(e.prototype,"result",{get:function(){return this.lines.join("\n")},enumerable:!1,configurable:!0}),e.prototype.startBlock=function(e){this.addLine(e),this.indentationLevel++},e.prototype.endBlock=function(e){this.indentationLevel--,this.addLine(e)},e.prototype.addLine=function(e){this.lines.push(this.prefix+e)},Object.defineProperty(e.prototype,"prefix",{get:function(){return"\t".repeat(this.indentationLevel)},enumerable:!1,configurable:!0}),e}();t.XMLWriter=n},794:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.ThreadComputer=void 0;var r=n(627),a=n(755),o=n(246),i=n(443),s=n(170),h=-9007199254740991,c=2*Math.PI;function d(e,t,n){return en?n:e}function l(e,t,n){return e*(1-n)+t*n}function u(e){return 0===e.length?null:e[Math.floor(Math.random()*e.length)]}var p=function(){function e(e){this.hiddenCanvasData=null,this.sourceImage=e,this.hiddenCanvas=document.createElement("canvas"),this.hiddenCanvasContext=this.hiddenCanvas.getContext("2d"),this.reset(.0625,1)}return e.prototype.drawThread=function(e,t){var n=this,a=this.computeTransformation(e.size),i=a.scaling*this.hiddenCanvasScale*this.lineThickness,s=r.Parameters.invertColors?o.ECompositingOperation.LIGHTEN:o.ECompositingOperation.DARKEN;this.thread.iterateOnThreads(t,(function(t,r){for(var o=[],h=0,c=t;ha)return this.thread.lowerNbSegments(a),this.resetHiddenCanvas(),this.thread.iterateOnThreads(0,(function(e,n){(0,o.applyCanvasCompositing)(t.hiddenCanvasContext,n,t.lineOpacityInternal,o.ECompositingOperation.LIGHTEN);for(var r=0;r+1t?(t=s,e=[{peg1:o,peg2:i}]):s===t&&e.push({peg1:o,peg2:i})}}return u(e)},e.prototype.computeBestNextPeg=function(e,t){for(var n=[],r=h,a=0,o=this.pegs;ar?(r=s,n=[i]):s===r&&n.push(i)}}return u(n)},e.prototype.uploadCanvasDataToCPU=function(){if(null===this.hiddenCanvasData){var e=this.hiddenCanvas.width,t=this.hiddenCanvas.height;this.hiddenCanvasData=this.hiddenCanvasContext.getImageData(0,0,e,t)}},e.prototype.computeSegmentPotential=function(e,t){this.uploadCanvasDataToCPU();for(var n,r,a,o,i=0,s=(r=t,a=(n=e).x-r.x,o=n.y-r.y,Math.sqrt(a*a+o*o)),h=Math.ceil(s),c=0;c1?{width:t,height:Math.round(t/h)}:{width:Math.round(t*h),height:t};var n=r.Parameters.shape,a=r.Parameters.pegsCount,o=[];if(n===r.EShape.RECTANGLE){this.arePegsTooClose=function(e,t){return e.x===t.x||e.y===t.y};var i=e.width,s=e.height,h=s/i,d=Math.round(.5*a/(1+h)),l=Math.round(.5*(a-2*d));o.push({x:0,y:0});for(var u=1;u=1;u--)o.push({x:i*(u/d),y:s});for(o.push({x:0,y:s}),p=l-1;p>=1;p--)o.push({x:0,y:s*(p/l)})}else if(n===r.EShape.ELLIPSIS){this.arePegsTooClose=function(e,t){var n=Math.abs(e.angle-t.angle);return Math.min(n,2*Math.PI-n)<=2*Math.PI/16};for(var g=.5*e.width,f=.5*e.height,v=Math.PI*(3*(g+f)-Math.sqrt((3*g+f)*(g+3*f)))/a,m=0;o.lengththis.threadComputer.nbSegments&&(this.nbSegmentsDrawn=0),0===this.nbSegmentsDrawn){var e={backgroundColor:r.Parameters.invertColors?"black":"white",blur:r.Parameters.blur};this.plotter.resize(),this.plotter.initialize(e),r.Parameters.displayPegs&&this.threadComputer.drawPegs(this.plotter),this.threadComputer.drawThread(this.plotter,0),this.plotter.finalize()}else this.threadComputer.drawThread(this.plotter,this.nbSegmentsDrawn);this.nbSegmentsDrawn=this.threadComputer.nbSegments}},e}();t.ThreadPlotter=a},323:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.ThreadBase=void 0;var n=function(){function e(){this.sampleCanvas=null}return e.lowerNbSegmentsForThread=function(e,t){e.length=t>0?Math.min(e.length,t+1):0},e.computeNbSegments=function(e){return e.length>1?e.length-1:0},e.iterateOnThread=function(t,n,r,a){r0&&this.threadPegsRed.length0&&this.threadPegsGreen.lengthi&&o>s?a.red++:i>o&&i>s?a.green++:a.blue++}return a},t}(i.ThreadBase);t.ThreadRedBlueGreen=s},755:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Transformation=void 0;var n=function(){function e(e,t){var n=e.width/t.width,r=e.height/t.height;this.scaling=Math.min(n,r),this.origin={x:.5*(e.width-this.scaling*t.width),y:.5*(e.height-this.scaling*t.height)}}return e.prototype.transform=function(e){return{x:this.origin.x+e.x*this.scaling,y:this.origin.y+e.y*this.scaling}},e}();t.Transformation=n}},t={};!function n(r){var a=t[r];if(void 0!==a)return a.exports;var o=t[r]={exports:{}};return e[r].call(o.exports,o,o.exports,n),o.exports}(50)}();