diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..d476425 Binary files /dev/null and b/.DS_Store differ diff --git a/SLO-apps/.DS_Store b/SLO-apps/.DS_Store new file mode 100644 index 0000000..bbfe97b Binary files /dev/null and b/SLO-apps/.DS_Store differ diff --git a/SLO-apps/perceptron.zip b/SLO-apps/perceptron.zip new file mode 100644 index 0000000..beced66 Binary files /dev/null and b/SLO-apps/perceptron.zip differ diff --git a/SLO-apps/perceptron/NNplusmin1.htm b/SLO-apps/perceptron/NNplusmin1.htm new file mode 100644 index 0000000..d18dcd9 --- /dev/null +++ b/SLO-apps/perceptron/NNplusmin1.htm @@ -0,0 +1,175 @@ + + + ANN plusmin 1 + + + + + + + + + + + +
+ Perceptron: plus min +
+
+
+ Geef de invoer voor de perceptron: +
+ +
+
+ +
+
+
+ + \ No newline at end of file diff --git a/SLO-apps/perceptron/TillFitSampleTrainer.htm b/SLO-apps/perceptron/TillFitSampleTrainer.htm new file mode 100644 index 0000000..5a8f7eb --- /dev/null +++ b/SLO-apps/perceptron/TillFitSampleTrainer.htm @@ -0,0 +1,607 @@ + + + + + + + + + + + + + + +
+ Perceptron: lijn +
+
+ Per punt één training:
+ + + +
+ Tot goede voorspelling:
+ -per punt:
+ +
+ -per verzameling:
+ +
+
+

+
+ + \ No newline at end of file diff --git a/SLO-apps/perceptron/jsxgraph.css b/SLO-apps/perceptron/jsxgraph.css new file mode 100644 index 0000000..2e330e8 --- /dev/null +++ b/SLO-apps/perceptron/jsxgraph.css @@ -0,0 +1,148 @@ +/* + Copyright 2008-2020 + Matthias Ehmann, + Michael Gerhaeuser, + Carsten Miller, + Bianca Valentin, + Alfred Wassermann, + Peter Wilfahrt + + This file is part of JSXGraph. + + JSXGraph is free software dual licensed under the GNU LGPL or MIT License. + + You can redistribute it and/or modify it under the terms of the + + * GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version + OR + * MIT License: https://github.com/jsxgraph/jsxgraph/blob/master/LICENSE.MIT + + JSXGraph is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License and + the MIT License along with JSXGraph. If not, see + and . + */ + +.jxgbox { + /* for IE 7 */ + position: relative; + overflow: hidden; + background-color: #ffffff; + border-style: solid; + border-width: 1px; + border-color: #356AA0; + border-radius: 10px; + -webkit-border-radius: 10px; + -ms-touch-action: none; + /* touch-action: none; */ /* Set with JavaScript */ +} + +.jxgbox svg text { + cursor: default; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.JXGtext { + font-family: Courier, monospace; + /** + * The default font family is now set in + * JXG.Options.text.cssdefaultstyle = 'font-family: Arial, Helvetica, Geneva, sans-serif;' + */ + /* + font-family: Arial, Helvetica, Geneva, sans-serif; + */ + + /* "background-color: transparent;" may produce artefacts in IE. Solution: setting a color explicitly. */ + background-color: transparent; + padding: 0; + margin: 0; +} + +.JXGinfobox { + border-style: none; + border-width: 1px; + border-color: black; +} + +/* + CSS attributes will (permantely) overwrite attributes set in JSXGraph +*/ +.JXGimage { + /* opacity: 1.0; */ +} + +.JXGimageHighlight { + /* opacity: 0.6; */ +} + +/* + CSS rules for the navigation bar +*/ + +.JXG_navigation { + position: absolute; + right: 5px; + bottom: 5px; + + z-index: 100; + + background-color: transparent; + padding: 2px; + font-size: 14px; + cursor: pointer; +} + +.JXG_navigation:hover { + +} + +.JXG_navigation_button { + color: #666666; +} + +.JXG_navigation_button:hover { + border-radius: 2px; + background-color: #c0c0c0; + background-color: rgba(184, 184, 184, 0.5); +} + +/* + CSS rules for the wrapping div in fullscreen mode +*/ + +.JXG_wrap_private:-moz-full-screen { + background-color: #cccccc; + padding: 0px; + width: 100%; + height: 100%; +} + +.JXG_wrap_private:-webkit-full-screen { + background-color: #cccccc; + padding: 0px; + width: 100%; + height: 100%; +} + +.JXG_wrap_private:fullscreen { + background-color: #cccccc; + padding: 0px; + width: 100%; + height: 100%; +} + +.JXG_wrap_private:-ms-fullscreen { + background-color: #cccccc; + padding: 0px; + width: 100%; + height: 100%; +} diff --git a/SLO-apps/perceptron/jsxgraphcore.js b/SLO-apps/perceptron/jsxgraphcore.js new file mode 100644 index 0000000..2320a91 --- /dev/null +++ b/SLO-apps/perceptron/jsxgraphcore.js @@ -0,0 +1,79 @@ +/* + JSXGraph 1.1.0 + + Copyright 2008-2020 + Matthias Ehmann, + Michael Gerhaeuser, + Carsten Miller, + Bianca Valentin, + Alfred Wassermann, + Peter Wilfahrt + + This file is part of JSXGraph. + + JSXGraph is free software dual licensed under the GNU LGPL or MIT License. + + You can redistribute it and/or modify it under the terms of the + + * GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version + OR + * MIT License: https://github.com/jsxgraph/jsxgraph/blob/master/LICENSE.MIT + + JSXGraph is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License and + the MIT License along with JSXGraph. If not, see + and . +*/ + +/** + * almond 0.2.5 Copyright (c) 2011-2012, The Dojo Foundation All Rights Reserved. + * Available via the MIT or new BSD license. + * see: https://github.com/jrburke/almond for details + */ + +/** + * UTF-8 Decoder by Bjoern Hoehrmann + * + * Copyright (c) 2008-2009 Bjoern Hoehrmann + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the Software + * without restriction, including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons + * to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or + * substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +!function(t,e){"function"==typeof define&&define.amd?define("jsxgraphcore",[],e):"object"==typeof module&&module.exports?module.exports=e():t.returnExports=e()}(this,function(){var requirejs,require,define;return function(t){function e(t,e){return v.call(t,e)}function i(t,e){var i,r,s,o,n,a,h,l,c,d,u,p,f=e&&e.split("/"),m=g.map,b=m&&m["*"]||{};if(t){for(t=t.split("/"),n=t.length-1,g.nodeIdCompat&&C.test(t[n])&&(t[n]=t[n].replace(C,"")),"."===t[0].charAt(0)&&f&&(p=f.slice(0,f.length-1),t=p.concat(t)),c=0;c0&&(t.splice(c-1,2),c-=2)}t=t.join("/")}if((f||b)&&m){for(i=t.split("/"),c=i.length;c>0;c-=1){if(r=i.slice(0,c).join("/"),f)for(d=f.length;d>0;d-=1)if((s=m[f.slice(0,d).join("/")])&&(s=s[r])){o=s,a=c;break}if(o)break;!h&&b&&b[r]&&(h=b[r],l=c)}!o&&h&&(o=h,a=l),o&&(i.splice(0,a,o),t=i.join("/"))}return t}function r(e,i){return function(){var r=y.call(arguments,0);return"string"!=typeof r[0]&&1===r.length&&r.push(null),d.apply(t,r.concat([e,i]))}}function s(t){return function(e){return i(e,t)}}function o(t){return function(e){f[t]=e}}function n(i){if(e(m,i)){var r=m[i];delete m[i],b[i]=!0,c.apply(t,r)}if(!e(f,i)&&!e(b,i))throw new Error("No "+i);return f[i]}function a(t){var e,i=t?t.indexOf("!"):-1;return i>-1&&(e=t.substring(0,i),t=t.substring(i+1,t.length)),[e,t]}function h(t){return t?a(t):[]}function l(t){return function(){return g&&g.config&&g.config[t]||{}}}var c,d,u,p,f={},m={},g={},b={},v=Object.prototype.hasOwnProperty,y=[].slice,C=/\.js$/;u=function(t,e){var r,o=a(t),h=o[0],l=e[1];return t=o[1],h&&(h=i(h,l),r=n(h)),h?t=r&&r.normalize?r.normalize(t,s(l)):i(t,l):(t=i(t,l),o=a(t),h=o[0],t=o[1],h&&(r=n(h))),{f:h?h+"!"+t:t,n:t,pr:h,p:r}},p={require:function(t){return r(t)},exports:function(t){var e=f[t];return void 0!==e?e:f[t]={}},module:function(t){return{id:t,uri:"",exports:f[t],config:l(t)}}},c=function(i,s,a,l){var c,d,g,v,y,C,_,P=[],E=typeof a;if(l=l||i,C=h(l),"undefined"===E||"function"===E){for(s=!s.length&&a.length?["require","exports","module"]:s,y=0;y")},debugInt:function(t){var e,i;for(e=0;e")},debugWST:function(e){var i=new Error;t.debugInt.apply(this,arguments),i&&i.stack&&(t.debugInt("stacktrace"),t.debugInt(i.stack.split("\n").slice(1).join("\n")))},debugLine:function(e){var i=new Error;t.debugInt.apply(this,arguments),i&&i.stack&&t.debugInt("Called from",i.stack.split("\n").slice(2,3).join("\n"))},debug:function(e){t.debugInt.apply(this,arguments)}}),t}),define("base/constants",["jxg"],function(t){"use strict";var e;return e={version:"1.1.0",licenseText:"JSXGraph v1.1.0 Copyright (C) see https://jsxgraph.org",COORDS_BY_USER:1,COORDS_BY_SCREEN:2,OBJECT_TYPE_ARC:1,OBJECT_TYPE_ARROW:2,OBJECT_TYPE_AXIS:3,OBJECT_TYPE_AXISPOINT:4,OBJECT_TYPE_TICKS:5,OBJECT_TYPE_CIRCLE:6,OBJECT_TYPE_CONIC:7,OBJECT_TYPE_CURVE:8,OBJECT_TYPE_GLIDER:9,OBJECT_TYPE_IMAGE:10,OBJECT_TYPE_LINE:11,OBJECT_TYPE_POINT:12,OBJECT_TYPE_SLIDER:13,OBJECT_TYPE_CAS:14,OBJECT_TYPE_GXTCAS:15,OBJECT_TYPE_POLYGON:16,OBJECT_TYPE_SECTOR:17,OBJECT_TYPE_TEXT:18,OBJECT_TYPE_ANGLE:19,OBJECT_TYPE_INTERSECTION:20,OBJECT_TYPE_TURTLE:21,OBJECT_TYPE_VECTOR:22,OBJECT_TYPE_OPROJECT:23,OBJECT_TYPE_GRID:24,OBJECT_TYPE_TANGENT:25,OBJECT_TYPE_HTMLSLIDER:26,OBJECT_TYPE_CHECKBOX:27,OBJECT_TYPE_INPUT:28,OBJECT_TYPE_BUTTON:29,OBJECT_TYPE_TRANSFORMATION:30,OBJECT_CLASS_POINT:1,OBJECT_CLASS_LINE:2,OBJECT_CLASS_CIRCLE:3,OBJECT_CLASS_CURVE:4,OBJECT_CLASS_AREA:5,OBJECT_CLASS_OTHER:6,OBJECT_CLASS_TEXT:7,GENTYPE_ABC:1,GENTYPE_AXIS:2,GENTYPE_MID:3,GENTYPE_REFLECTION:4,GENTYPE_MIRRORELEMENT:5,GENTYPE_TANGENT:6,GENTYPE_PARALLEL:7,GENTYPE_BISECTORLINES:8,GENTYPE_BOARDIMG:9,GENTYPE_BISECTOR:10,GENTYPE_NORMAL:11,GENTYPE_POINT:12,GENTYPE_GLIDER:13,GENTYPE_INTERSECTION:14,GENTYPE_CIRCLE:15,GENTYPE_CIRCLE2POINTS:16,GENTYPE_LINE:17,GENTYPE_TRIANGLE:18,GENTYPE_QUADRILATERAL:19,GENTYPE_TEXT:20,GENTYPE_POLYGON:21,GENTYPE_REGULARPOLYGON:22,GENTYPE_SECTOR:23,GENTYPE_ANGLE:24,GENTYPE_PLOT:25,GENTYPE_SLIDER:26,GENTYPE_TRUNCATE:27,GENTYPE_JCODE:28,GENTYPE_MOVEMENT:29,GENTYPE_COMBINED:30,GENTYPE_RULER:31,GENTYPE_SLOPETRIANGLE:32,GENTYPE_PERPSEGMENT:33,GENTYPE_LABELMOVEMENT:34,GENTYPE_VECTOR:35,GENTYPE_NONREFLEXANGLE:36,GENTYPE_REFLEXANGLE:37,GENTYPE_PATH:38,GENTYPE_DERIVATIVE:39,GENTYPE_DELETE:41,GENTYPE_COPY:42,GENTYPE_MIRROR:43,GENTYPE_ROTATE:44,GENTYPE_ABLATION:45,GENTYPE_MIGRATE:46,GENTYPE_VECTORCOPY:47,GENTYPE_POLYGONCOPY:48,GENTYPE_CTX_TYPE_G:51,GENTYPE_CTX_TYPE_P:52,GENTYPE_CTX_TRACE:53,GENTYPE_CTX_VISIBILITY:54,GENTYPE_CTX_CCVISIBILITY:55,GENTYPE_CTX_MPVISIBILITY:56,GENTYPE_CTX_WITHLABEL:57,GENTYPE_CTX_LABEL:58,GENTYPE_CTX_FIXED:59,GENTYPE_CTX_STROKEWIDTH:60,GENTYPE_CTX_LABELSIZE:61,GENTYPE_CTX_SIZE:62,GENTYPE_CTX_FACE:63,GENTYPE_CTX_STRAIGHT:64,GENTYPE_CTX_ARROW:65,GENTYPE_CTX_COLOR:66,GENTYPE_CTX_RADIUS:67,GENTYPE_CTX_COORDS:68,GENTYPE_CTX_TEXT:69,GENTYPE_CTX_ANGLERADIUS:70,GENTYPE_CTX_DOTVISIBILITY:71,GENTYPE_CTX_FILLOPACITY:72,GENTYPE_CTX_PLOT:73,GENTYPE_CTX_SCALE:74,GENTYPE_CTX_INTVAL:75,GENTYPE_CTX_POINT1:76,GENTYPE_CTX_POINT2:77,GENTYPE_CTX_LABELSTICKY:78,GENTYPE_CTX_TYPE_I:79,GENTYPE_CTX_HASINNERPOINTS:80,GENTYPE_CTX_SNAPWIDTH:81,GENTYPE_CTX_SNAPTOGRID:82},t.extend(t,e),e}),define("utils/type",["jxg","base/constants"],function(t,e){"use strict";return t.extend(t,{isId:function(t,e){return"string"==typeof e&&!!t.objects[e]},isName:function(t,e){return"string"==typeof e&&!!t.elementsByName[e]},isGroup:function(t,e){return"string"==typeof e&&!!t.groups[e]},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t||"[Object Number]"===Object.prototype.toString.call(t)},isFunction:function(t){return"function"==typeof t},isArray:function(t){return Array.isArray?Array.isArray(t):null!==t&&"object"==typeof t&&"function"==typeof t.splice&&"function"==typeof t.join},isObject:function(t){return"object"==typeof t&&!this.isArray(t)},isPoint:function(t){return null!==t&&"object"==typeof t&&t.elementClass===e.OBJECT_CLASS_POINT},isPointType:function(t,e){var i,r;return!!this.isArray(e)||(!!(this.isFunction(e)&&(i=e(),this.isArray(i)&&i.length>1))||(r=t.select(e),this.isPoint(r)))},isTransformationOrArray:function(t){if(null!==t){if(this.isArray(t)&&t.length>0)return this.isTransformationOrArray(t[0]);if("object"==typeof t)return t.type===e.OBJECT_TYPE_TRANSFORMATION}return!1},exists:function(t){return function(t){return!(void 0===t||null===t)}}(),def:function(t,e){return this.exists(t)?t:e},str2Bool:function(t){return!this.exists(t)||("boolean"==typeof t?t:!!this.isString(t)&&"true"===t.toLowerCase())},createEvalFunction:function(e,i,r){var s,o=[];for(s=0;s0&&(n=Math.min(o,c-1),h=this.copyAttributes(i,t.options,r,s[n])),this.isArray(e[o])&&e[o].length>1?d.push(t.create("point",e[o],h)):this.isFunction(e[o])?(l=e[o](),this.isArray(l)&&l.length>1&&d.push(t.create("point",[e[o]],h))):d.push(t.select(e[o])),!this.isPoint(d[o]))return!1;return d},bind:function(t,e){return function(){return t.apply(e,arguments)}},evaluate:function(t){return this.isFunction(t)?t():t},indexOf:function(t,e,i){var r,s=this.exists(i);if(Array.indexOf&&!s)return t.indexOf(e);for(r=0;r-1},coordsArrayToMatrix:function(t,e){var i,r=[],s=[];for(i=0;i.1?this.toFixed(t,2):e>=.01?this.toFixed(t,4):e>=1e-4?this.toFixed(t,6):t},keys:function(t,e){var i,r=[];for(i in t)e?t.hasOwnProperty(i)&&r.push(i):r.push(i);return r},clone:function(t){var e={};return e.prototype=t,e},cloneAndCopy:function(t,e){var i,r=function(){};r.prototype=t;for(i in e)r[i]=e[i];return r},merge:function(t,e){var i,r;for(i in e)if(e.hasOwnProperty(i))if(this.isArray(e[i]))for(t[i]||(t[i]=[]),r=0;r/g,">")},unescapeHTML:function(t){return t.replace(/<\/?[^>]+>/gi,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")},capitalize:function(t){return t.charAt(0).toUpperCase()+t.substring(1).toLowerCase()},trimNumber:function(t){return t=t.replace(/^0+/,""),t=t.replace(/0+$/,""),"."!==t[t.length-1]&&","!==t[t.length-1]||(t=t.slice(0,-1)),"."!==t[0]&&","!==t[0]||(t="0"+t),t},filterElements:function(t,e){var i,r,s,o,n,a,h,l=t.length,c=[];if("function"!=typeof e&&"object"!=typeof e)return c;for(i=0;i/g,">")),t)},evalSlider:function(t){return t&&t.type===e.OBJECT_TYPE_GLIDER&&"function"==typeof t.Value?t.Value():t}}),t}),define("utils/env",["jxg","utils/type"],function(t,e){"use strict";return t.extend(t,{touchProperty:"touches",isBrowser:"object"==typeof window&&"object"==typeof document,supportsVML:function(){return this.isBrowser&&!!document.namespaces},supportsSVG:function(){return this.isBrowser&&document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")},supportsCanvas:function(){var t,e=!1;if(this.isNode())try{t="object"==typeof module?module.require("canvas"):require("canvas"),e=!!t}catch(t){}return e||this.isBrowser&&!!document.createElement("canvas").getContext},isNode:function(){return!this.isBrowser&&("object"==typeof module&&!!module.exports||"object"==typeof global&&global.requirejsVars&&!global.requirejsVars.isBrowser)},isWebWorker:function(){return!this.isBrowser&&"object"==typeof self&&"function"==typeof self.postMessage},supportsPointerEvents:function(){return!!(this.isBrowser&&window.navigator&&(window.PointerEvent||window.navigator.pointerEnabled||window.navigator.msPointerEnabled))},isTouchDevice:function(){return this.isBrowser&&void 0!==window.ontouchstart},isAndroid:function(){return e.exists(navigator)&&navigator.userAgent.toLowerCase().indexOf("android")>-1},isWebkitAndroid:function(){return this.isAndroid()&&navigator.userAgent.indexOf(" AppleWebKit/")>-1},isApple:function(){return e.exists(navigator)&&(navigator.userAgent.indexOf("iPad")>-1||navigator.userAgent.indexOf("iPhone")>-1)},isWebkitApple:function(){return this.isApple()&&navigator.userAgent.search(/Mobile\/[0-9A-Za-z\.]*Safari/)>-1},isMetroApp:function(){return"object"==typeof window&&window.clientInformation&&window.clientInformation.appVersion&&window.clientInformation.appVersion.indexOf("MSAppHost")>-1},isMozilla:function(){return e.exists(navigator)&&navigator.userAgent.toLowerCase().indexOf("mozilla")>-1&&-1===navigator.userAgent.toLowerCase().indexOf("apple")},isFirefoxOS:function(){return e.exists(navigator)&&-1===navigator.userAgent.toLowerCase().indexOf("android")&&-1===navigator.userAgent.toLowerCase().indexOf("apple")&&navigator.userAgent.toLowerCase().indexOf("mobile")>-1&&navigator.userAgent.toLowerCase().indexOf("mozilla")>-1},ieVersion:function(){var t,e,i=3;if("object"!=typeof document)return 0;t=document.createElement("div"),e=t.getElementsByTagName("i");do{t.innerHTML="\x3c!--[if gt IE "+ ++i+"]>4?i:void 0}(),getDimensions:function(t,i){var r,s,o,n,a,h,l,c,d,u=/\d+(\.\d*)?px/;if(!this.isBrowser||null===t)return{width:500,height:500};if(i=i||document,r=i.getElementById(t),!e.exists(r))throw new Error("\nJSXGraph: HTML container element '"+t+"' not found.");return"none"!==(s=r.style.display)&&null!==s?r.clientWidth>0&&r.clientHeight>0?{width:r.clientWidth,height:r.clientHeight}:(d=window.getComputedStyle?window.getComputedStyle(r):r.style,{width:u.test(d.width)?parseFloat(d.width):0,height:u.test(d.height)?parseFloat(d.height):0}):(o=r.style,n=o.visibility,a=o.position,h=o.display,o.visibility="hidden",o.position="absolute",o.display="block",l=r.clientWidth,c=r.clientHeight,o.display=h,o.position=a,o.visibility=n,{width:l,height:c})},addEvent:function(t,i,r,s){var o=function(){return r.apply(s,arguments)};o.origin=r,s["x_internal"+i]=s["x_internal"+i]||[],s["x_internal"+i].push(o),e.exists(t)&&e.exists(t.addEventListener)&&t.addEventListener(i,o,!1),e.exists(t)&&e.exists(t.attachEvent)&&t.attachEvent("on"+i,o)},removeEvent:function(i,r,s,o){var n;if(!e.exists(o))return void t.debug("no such owner");if(!e.exists(o["x_internal"+r]))return void t.debug("no such type: "+r);if(!e.isArray(o["x_internal"+r]))return void t.debug("owner[x_internal + "+r+"] is not an array");if(-1===(n=e.indexOf(o["x_internal"+r],s,"origin")))return void t.debug("removeEvent: no such event function in internal list: "+s);try{e.exists(i)&&e.exists(i.removeEventListener)&&i.removeEventListener(r,o["x_internal"+r][n],!1),e.exists(i)&&e.exists(i.detachEvent)&&i.detachEvent("on"+r,o["x_internal"+r][n])}catch(e){t.debug("event not registered in browser: ("+r+" -- "+s+")")}o["x_internal"+r].splice(n,1)},removeAllEvents:function(e,i,r){var s,o;if(r["x_internal"+i]){for(o=r["x_internal"+i].length,s=o-1;s>=0;s--)t.removeEvent(e,i,r["x_internal"+i][s].origin,r);r["x_internal"+i].length>0&&t.debug("removeAllEvents: Not all events could be removed.")}},getPosition:function(i,r,s){var o,n,a,h=0,l=0;if(i||(i=window.event),s=s||document,a=i[t.touchProperty],e.exists(a)&&0===a.length&&(a=i.changedTouches),e.exists(r)&&e.exists(a))if(-1===r){for(n=a.length,o=0;o=9?r=e.currentStyle[i]:e.style&&(i=i.replace(/-([a-z]|[0-9])/gi,function(t,e){return e.toUpperCase()}),r=e.style[i]),r},getProp:function(t,e){var i=parseInt(this.getStyle(t,e),10);return isNaN(i)?0:i},getCSSTransform:function(t,i){var r,s,o,n,a,h,l,c,d=["transform","webkitTransform","MozTransform","msTransform","oTransform"];for(h=d.length,r=0,o="";r0){for(h=o.length,n=o.substring(a+1,h-1),c=n.split(","),s=0,l=c.length;s0){for(a=s.length,o=s.substring(n+1,a-1),l=o.split(","),r=0,h=l.length;r0&&+new Date-n<300);s.length>0?window.setTimeout(o,1):r(t)};window.setTimeout(o,1)},scaleJSXGraphDiv:function(t,e,i,r){var s,o,n=document.styleSheets.length,a=[":-webkit-full-screen",":-moz-full-screen",":fullscreen",":-ms-fullscreen"],h=a.length,l="{margin:0 auto;transform:matrix("+i+",0,0,"+i+",0,"+r+");}",c=RegExp(".*"+t+":.*full.*screen.*"+e+".*auto;.*transform:.*matrix");for(0===n&&(s=document.createElement("style"),s.appendChild(document.createTextNode("")),document.body.appendChild(s),n=document.styleSheets.length),document.styleSheets[n-1].cssRules.length>0&&c.test(document.styleSheets[n-1].cssRules[0].cssText)&&document.styleSheets[n-1].deleteRule&&document.styleSheets[n-1].deleteRule(0),o=0;o-1&&this.eventHandlers[t].splice(r,1),0===this.eventHandlers[t].length&&delete this.eventHandlers[t]):delete this.eventHandlers[t],this):this},eventify:function(t){t.eventHandlers={},t.on=this.on,t.off=this.off,t.triggerEventHandlers=this.trigger,t.trigger=this.trigger,t.suspended={}}},t.EventEmitter}),define("math/math",["jxg","utils/type"],function(t,e){"use strict";var i=function(t){var e,i;return t.memo?t.memo:(e={},i=Array.prototype.join,t.memo=function(){var r=i.call(arguments);return void 0!==e[r]?e[r]:e[r]=t.apply(this,arguments)},t.memo)};return t.Math={eps:1e-6,relDif:function(t,e){var i=Math.abs(t),r=Math.abs(e);return r=Math.max(i,r),0===r?0:Math.abs(t-e)/r},mod:function(t,e){return t-Math.floor(t/e)*e},vector:function(t,e){var i,r;for(e=e||0,i=[],r=0;r0?e[0].length:0,h=e.length,l=this.matrix(n,a);for(i=0;i0?t[0].length:0,e=this.matrix(o,s),i=0;io&&(o=Math.abs(l[e][i]),n=e);if(o<=this.eps)return[];if(n>i){for(r=0;rt||e<0)return NaN;if(e=Math.round(e),t=Math.round(t),0===e||e===t)return 1;for(i=1,r=0;r=0?.5:-.5)*Math.PI-Math.atan(t)},nthroot:function(t,e){var i=1/e;return e<=0||Math.floor(e)!==e?NaN:0===t?0:t>0?Math.exp(i*Math.log(t)):e%2==1?-Math.exp(i*Math.log(-t)):NaN},cbrt:Math.cbrt||function(t){return this.nthroot(t,3)},pow:function(t,e){return 0===t?0===e?1:0:Math.floor(e)===e?Math.pow(t,e):t>0?Math.exp(e*Math.log(t)):NaN},log10:function(t){return Math.log(t)/Math.log(10)},log2:function(t){return Math.log(t)/Math.log(2)},log:function(t,i){return void 0!==i&&e.isNumber(i)?Math.log(t)/Math.log(i):Math.log(t)},sign:Math.sign||function(t){return t=+t,0===t||isNaN(t)?t:t>0?1:-1},squampow:function(t,e){var i;if(Math.floor(e)===e){for(i=1,e<0&&(t=1/t,e*=-1);0!==e;)1&e&&(i*=t),e>>=1,t*=t;return i}return this.pow(t,e)},gcd:function(t,i){if(t=Math.abs(t),i=Math.abs(i),!e.isNumber(t)||!e.isNumber(i))return NaN;if(i>t){var r=t;t=i,i=r}for(;;){if(0===(t%=i))return i;if(0===(i%=t))return t}},lcm:function(t,i){var r;return e.isNumber(t)&&e.isNumber(i)?(r=t*i,0!==r?r/this.gcd(t,i):0):NaN},normalize:function(t){var e,i,r=2*t[3],s=t[4]/r;return t[5]=s,t[6]=-t[1]/r,t[7]=-t[2]/r,isFinite(s)?Math.abs(s)>=1?(t[0]=(t[6]*t[6]+t[7]*t[7]-s*s)/(2*s),t[1]=-t[6]/s,t[2]=-t[7]/s,t[3]=1/(2*s),t[4]=1):(i=s<=0?-1:1,t[0]=i*(t[6]*t[6]+t[7]*t[7]-s*s)*.5,t[1]=-i*t[6],t[2]=-i*t[7],t[3]=i/2,t[4]=i*s):(e=Math.sqrt(t[1]*t[1]+t[2]*t[2]),t[0]/=e,t[1]/=e,t[2]/=e,t[3]=0,t[4]=1),t},toGL:function(t){var e,i,r;if(e="function"==typeof Float32Array?new Float32Array(16):new Array(16),4!==t.length&&4!==t[0].length)return e;for(i=0;i<4;i++)for(r=0;r<4;r++)e[i+4*r]=t[i][r];return e}},t.Math}),define("base/coords",["jxg","base/constants","utils/event","utils/type","math/math"],function(t,e,i,r,s){"use strict";return t.Coords=function(t,e,s,o){this.board=s,this.usrCoords=[],this.scrCoords=[],this.emitter=!r.exists(o)||o,this.emitter&&i.eventify(this),this.setCoordinates(t,e,!0,!0)},t.extend(t.Coords.prototype,{normalizeUsrCoords:function(){Math.abs(this.usrCoords[0])>s.eps&&(this.usrCoords[1]/=this.usrCoords[0],this.usrCoords[2]/=this.usrCoords[0],this.usrCoords[0]=1)},usr2screen:function(t){var e=Math.round,i=this.board,r=this.usrCoords,s=i.origin.scrCoords;!0===t?(this.scrCoords[0]=e(r[0]),this.scrCoords[1]=e(r[0]*s[1]+r[1]*i.unitX),this.scrCoords[2]=e(r[0]*s[2]-r[2]*i.unitY)):(this.scrCoords[0]=r[0], +this.scrCoords[1]=r[0]*s[1]+r[1]*i.unitX,this.scrCoords[2]=r[0]*s[2]-r[2]*i.unitY)},screen2usr:function(){var t=this.board.origin.scrCoords,e=this.scrCoords,i=this.board;this.usrCoords[0]=1,this.usrCoords[1]=(e[1]-t[1])/i.unitX,this.usrCoords[2]=(t[2]-e[2])/i.unitY},distance:function(t,i){var r,o,n=0,a=this.usrCoords,h=this.scrCoords;if(t===e.COORDS_BY_USER){if(r=i.usrCoords,o=a[0]-r[0],(n=o*o)>s.eps*s.eps)return Number.POSITIVE_INFINITY;o=a[1]-r[1],n+=o*o,o=a[2]-r[2],n+=o*o}else r=i.scrCoords,o=h[1]-r[1],n+=o*o,o=h[2]-r[2],n+=o*o;return Math.sqrt(n)},setCoordinates:function(t,i,r,s){var o=this.usrCoords,n=this.scrCoords,a=[o[0],o[1],o[2]],h=[n[0],n[1],n[2]];return t===e.COORDS_BY_USER?(2===i.length?(o[0]=1,o[1]=i[0],o[2]=i[1]):(o[0]=i[0],o[1]=i[1],o[2]=i[2],this.normalizeUsrCoords()),this.usr2screen(r)):(2===i.length?(n[1]=i[0],n[2]=i[1]):(n[1]=i[1],n[2]=i[2]),this.screen2usr()),!this.emitter||s||h[1]===n[1]&&h[2]===n[2]||this.triggerEventHandlers(["update"],[a,h]),this},copy:function(t,e){return void 0===e&&(e=0),this[t].slice(e)},isReal:function(){return!isNaN(this.usrCoords[1]+this.usrCoords[2])&&Math.abs(this.usrCoords[0])>s.eps},__evt__update:function(t,e){},__evt:function(){}}),t.Coords}),define("utils/expect",["jxg","utils/type","base/constants","base/coords"],function(t,e,i,r){"use strict";var s={each:function(t,i,r){var s,o,n=[];if(e.exists(t.length))for(o=t.length,s=0;s0?t[0].length:0;if(c!==r.length||c!==t.length)throw new Error("JXG.Math.Numerics.Gauss: Dimensions don't match. A must be a square matrix and b must be of the same length as A.");for(a=[],h=r.slice(0,c),s=0;so;s--)if(Math.abs(a[s][o])>l)if(Math.abs(a[o][o])0?t[0].length:0,n=s-1;n>=0;n--){for(a=o-1;a>n;a--)r[n]-=t[n][a]*r[a];r[n]/=t[n][n]}return r},gaussBareiss:function(t){var e,r,s,o,n,a,h,l,c,d=i.eps;if((h=t.length)<=0)return 0;for(t[0].length=d);o++);if(o===h)return 0;for(n=e;nc&&(c=o),l+=o,o>=d){for(o=.5*Math.atan2(2*m[e][r],m[e][e]-m[r][r]),n=Math.sin(o),a=Math.cos(o),s=0;sd&&g<2e3);return[m,f]},NewtonCotes:function(t,i,r){var s,o,n,a=0,h=r&&e.isNumber(r.number_of_nodes)?r.number_of_nodes:28,l={trapez:!0,simpson:!0,milne:!0},c=r&&r.integration_type&&l.hasOwnProperty(r.integration_type)&&l[r.integration_type]?r.integration_type:"milne",d=(t[1]-t[0])/h;switch(c){case"trapez":for(a=.5*(i(t[0])+i(t[1])),s=t[0],o=0;o0)throw new Error("JSXGraph: INT_SIMPSON requires config.number_of_nodes dividable by 2.");for(n=h/2,a=i(t[0])+i(t[1]),s=t[0],o=0;o0)throw new Error("JSXGraph: Error in INT_MILNE: config.number_of_nodes must be a multiple of 4");for(n=.25*h,a=7*(i(t[0])+i(t[1])),s=t[0],o=0;o=0;--c)d*=4,u[c]=u[c+1]+(u[c+1]-u[c])/(d-1),p=u[c];if(Math.abs(p-f)18&&(m=18),p[2]=[.5773502691896257],f[2]=[1],p[4]=[.33998104358485626,.8611363115940526],f[4]=[.6521451548625461,.34785484513745385],p[6]=[.2386191860831969,.6612093864662645,.932469514203152],f[6]=[.46791393457269104,.3607615730481386,.17132449237917036],p[8]=[.1834346424956498,.525532409916329,.7966664774136267,.9602898564975363],f[8]=[.362683783378362,.31370664587788727,.22238103445337448,.10122853629037626],p[10]=[.14887433898163122,.4333953941292472,.6794095682990244,.8650633666889845,.9739065285171717],f[10]=[.29552422471475287,.26926671930999635,.21908636251598204,.1494513491505806,.06667134430868814],p[12]=[.1252334085114689,.3678314989981802,.5873179542866175,.7699026741943047,.9041172563704749,.9815606342467192],f[12]=[.24914704581340277,.2334925365383548,.20316742672306592,.16007832854334622,.10693932599531843,.04717533638651183],p[14]=[.10805494870734367,.31911236892788974,.5152486363581541,.6872929048116855,.827201315069765,.9284348836635735,.9862838086968123],f[14]=[.2152638534631578,.2051984637212956,.18553839747793782,.15720316715819355,.12151857068790319,.08015808715976021,.03511946033175186],p[16]=[.09501250983763744,.2816035507792589,.45801677765722737,.6178762444026438,.755404408355003,.8656312023878318,.9445750230732326,.9894009349916499],f[16]=[.1894506104550685,.18260341504492358,.16915651939500254,.14959598881657674,.12462897125553388,.09515851168249279,.062253523938647894,.027152459411754096],p[18]=[.0847750130417353,.2518862256915055,.41175116146284263,.5597708310739475,.6916870430603532,.8037049589725231,.8926024664975557,.9558239495713977,.9915651684209309],f[18]=[.1691423829631436,.16427648374583273,.15468467512626524,.14064291467065065,.12255520671147846,.10094204410628717,.07642573025488905,.0497145488949698,.02161601352648331],p[3]=[0,.7745966692414834],f[3]=[.8888888888888888,.5555555555555556],p[5]=[0,.5384693101056831,.906179845938664],f[5]=[.5688888888888889,.47862867049936647,.23692688505618908],p[7]=[0,.4058451513773972,.7415311855993945,.9491079123427585],f[7]=[.4179591836734694,.3818300505051189,.27970539148927664,.1294849661688697],p[9]=[0,.3242534234038089,.6133714327005904,.8360311073266358,.9681602395076261],f[9]=[.3302393550012598,.31234707704000286,.26061069640293544,.1806481606948574,.08127438836157441],p[11]=[0,.26954315595234496,.5190961292068118,.7301520055740494,.8870625997680953,.978228658146057],f[11]=[.2729250867779006,.26280454451024665,.23319376459199048,.18629021092773426,.1255803694649046,.05566856711617366],p[13]=[0,.2304583159551348,.44849275103644687,.6423493394403402,.8015780907333099,.9175983992229779,.9841830547185881],f[13]=[.2325515532308739,.22628318026289723,.2078160475368885,.17814598076194574,.13887351021978725,.09212149983772845,.04048400476531588],p[15]=[0,.20119409399743451,.3941513470775634,.5709721726085388,.7244177313601701,.8482065834104272,.937273392400706,.9879925180204854],f[15]=[.2025782419255613,.19843148532711158,.1861610000155622,.16626920581699392,.13957067792615432,.10715922046717194,.07036604748810812,.03075324199611727],p[17]=[0,.17848418149584785,.3512317634538763,.5126905370864769,.6576711592166907,.7815140038968014,.8802391537269859,.9506755217687678,.9905754753144174],f[17]=[.17944647035620653,.17656270536699264,.16800410215645004,.15404576107681028,.13513636846852548,.11188384719340397,.08503614831717918,.0554595293739872,.02414830286854793],s=t[0],o=t[1],a=m+1>>1,c=p[m],d=f[m],l=.5*(o-s),h=.5*(o+s),!0&m)for(u=d[0]*i(h),n=1;n2.0041683600089728e-294&&(s=1.1102230246251565e-14*e)>t&&(t=s),t},_gaussKronrod:function(t,e,i,r,s,o,n){var a,h,l,c,d,u,p,f,m,g=t[0],b=t[1],v=.5*(g+b),y=.5*(b-g),C=Math.abs(y),_=e(v),P=0,E=_*o[i-1],S=Math.abs(E),x=0,O=0,w=0,T=[],N=[];for(i%2==0&&(P=_*s[i/2-1]),a=Math.floor((i-1)/2),l=0;l0&&t>this.elist[this.order[a-1]];)this.order[a]=this.order[a-1],a--;for(s=oi-2&&e>=this.elist[this.order[r]];)this.order[r+1]=this.order[r],r--;this.order[r+1]=o,h=this.order[a],this.i=h,this.nrmax=a},set_initial_result:function(t,e){this.size=1,this.rlist[0]=t,this.elist[0]=e},update:function(t,e,i,r,s,o,n,a){var h=this.i,l=this.size,c=this.level[this.i]+1;a>r?(this.alist[h]=s,this.rlist[h]=n,this.elist[h]=a,this.level[h]=c,this.alist[l]=t,this.blist[l]=e,this.rlist[l]=i,this.elist[l]=r,this.level[l]=c):(this.blist[h]=e,this.rlist[h]=i,this.elist[h]=r,this.level[h]=c,this.alist[l]=s,this.blist[l]=o,this.rlist[l]=n,this.elist[l]=a,this.level[l]=c),this.size++,c>this.maximum_level&&(this.maximum_level=c),this.qpsrt()},retrieve:function(){var t=this.i;return{a:this.alist[t],b:this.blist[t],r:this.rlist[t],e:this.elist[t]}},sum_results:function(){var t,e=this.size,i=0;for(t=0;tO.limit&&t.warn("iteration limit exceeds available workspace"),N<=0&&(T<50*i.eps||T<5e-29)&&t.warn("tolerance cannot be acheived with given epsabs and epsrel"),h=M.apply(this,[r,s,A]),l=A.abserr,c=A.resabs,d=A.resasc,O.set_initial_result(h,l),u=Math.max(N,T*Math.abs(h)),p=1.1102230246251565e-14*c,l<=p&&l>u)return h,t.warn("cannot reach tolerance because of roundoff error on first attempt"),-1/0;if(l<=u&&l!==d||0===l)return h;if(1===w)return h,t.warn("a maximum of one iteration was insufficient"),-1/0;n=h,a=l,R=1;do{Y=0,D=0,j=0,I=0,X=0,G=0,S=O.retrieve(),v=S.a,y=S.b,C=S.r,_=S.e,f=v,m=.5*(v+y),g=m,b=y,Y=M.apply(this,[[f,m],s,A]),I=A.abserr,P=A.resasc,D=M.apply(this,[[g,b],s,A]),X=A.abserr,E=A.resasc,j=Y+D,G=I+X,a+=G-_,n+=j-C,P!==I&&E!==X&&(x=C-j,Math.abs(x)<=1e-5*Math.abs(j)&&G>=.99*_&&k++,R>=10&&G>_&&L++),u=Math.max(N,T*Math.abs(n)),a>u&&((k>=6||L>=20)&&(B=2),O.subinterval_too_small(f,g,b)&&(B=3)),O.update(f,m,Y,I,g,b,D,X),S=O.retrieve(),v=S.a_i,y=S.b_i,C=S.r_i,_=S.e_i,R++}while(Ru);return O.sum_results()},I:function(t,e){return this.Qag(t,e,{q:this.GaussKronrod15,limit:15,epsrel:1e-7,epsabs:1e-7})},Newton:function(t,r,s){var o,n=0,a=i.eps,h=t.apply(s,[r]);for(e.isArray(r)&&(r=r[0]);n<50&&Math.abs(h)>a;)o=this.D(t,s)(r),Math.abs(o)>a?r-=h/o:r+=.2*Math.random()-1,h=t.apply(s,[r]),n+=1;return r},root:function(t,e,i){return this.fzero(t,e,i)},generalizedNewton:function(t,e,r,s){var o,n,a,h,l,c,d,u,p,f,m,g,b,v,y=0;for(this.generalizedNewton.t1memo?(o=this.generalizedNewton.t1memo,n=this.generalizedNewton.t2memo):(o=r,n=s),u=t.X(o)-e.X(n),p=t.Y(o)-e.Y(n),f=u*u+p*p,m=this.D(t.X,t),g=this.D(e.X,e),b=this.D(t.Y,t),v=this.D(e.Y,e);f>i.eps&&y<10;)a=m(o),h=-g(n),l=b(o),c=-v(n),d=a*c-h*l,o-=(c*u-h*p)/d,n-=(a*p-l*u)/d,u=t.X(o)-e.X(n),p=t.Y(o)-e.Y(n),f=u*u+p*p,y+=1;return this.generalizedNewton.t1memo=o,this.generalizedNewton.t2memo=n,Math.abs(o)=0;r--)d[r]=(a[r]-l[r+1]*d[r+1])/n[r];for(r=o-3;r>=0;r--)d[r+1]=d[r];return d[0]=0,d[o-1]=0,d},splineEval:function(t,i,r,s){var o,n,a,h,l,c,d,u=Math.min(i.length,r.length),p=1,f=!1,m=[];for(e.isArray(t)?(p=t.length,f=!0):t=[t],o=0;oi[u-1])return NaN;for(n=1;n=0;s--)o=o.concat(["(",t[s].toPrecision(r),")"]),s>1?o=o.concat(["*",i,"",s,"<","/sup> + "]):1===s&&(o=o.concat(["*",i," + "]));return o.join("")},lagrangePolynomial:function(t){var e=[],i=function(i,r){var s,o,n,a,h=t.length,l=0,c=0;if(!r)for(s=0;s=C?t[C-1][e]():(d=Math.floor(r))===r?t[d][e]():(r-=d,u=l[e][d],void 0===u?NaN:((u[3]*r+u[2])*r+u[1])*r+u[0]))}},[n("X"),n("Y"),0,function(){return t.length-1}]},CatmullRomSpline:function(t,e){return this.CardinalSpline(t,.5,e)},regressionPolynomial:function(t,r,s){var o,n,a,h,l,c,d="";if(e.isPoint(t)&&e.isFunction(t.Value))n=function(){return t.Value()};else if(e.isFunction(t))n=t;else{if(!e.isNumber(t))throw new Error("JSXGraph: Can't create regressionPolynomial from degree of type'"+typeof t+"'.");n=function(){return t}}if(3===arguments.length&&e.isArray(r)&&e.isArray(s))l=0;else if(2===arguments.length&&e.isArray(r)&&r.length>0&&e.isPoint(r[0]))l=1;else{if(!(2===arguments.length&&e.isArray(r)&&r.length>0&&r[0].usrCoords&&r[0].scrCoords))throw new Error("JSXGraph: Can't create regressionPolynomial. Wrong parameters.");l=2}return c=function(t,c){var u,p,f,m,g,b,v,y,C,_=r.length;if(C=Math.floor(n()),!c){if(1===l)for(a=[],h=[],u=0;u<_;u++)a[u]=r[u].X(),h[u]=r[u].Y();if(2===l)for(a=[],h=[],u=0;u<_;u++)a[u]=r[u].usrCoords[1],h[u]=r[u].usrCoords[2];if(0===l)for(a=[],h=[],u=0;u<_;u++)e.isFunction(r[u])?a.push(r[u]()):a.push(r[u]),e.isFunction(s[u])?h.push(s[u]()):h.push(s[u]);for(f=[],p=0;p<_;p++)f.push([1]);for(u=1;u<=C;u++)for(p=0;p<_;p++)f[p][u]=f[p][u-1]*a[p];g=h,m=i.transpose(f),b=i.matMatMult(m,f),v=i.matVecMult(m,g),o=i.Numerics.Gauss(b,v),d=i.Numerics.generatePolynomialTerm(o,C,"x",3)}for(y=o[C],u=C-1;u>=0;u--)y=y*t+o[u];return y},c.getTerm=function(){return d},c},bezier:function(t){var e,i,r=function(r){return function(s,o){var n=3*Math.floor(s),a=s%1,h=1-a;return o||(i=3*Math.floor((t.length-1)/3),e=Math.floor(i/3)),s<0?t[0][r]():s>=e?t[i][r]():isNaN(s)?NaN:h*h*(h*t[n][r]()+3*a*t[n+1][r]())+(3*h*t[n+2][r]()+a*t[n+3][r]())*a*a}};return[r("X"),r("Y"),0,function(){return Math.floor(t.length/3)}]},bspline:function(t,e){var i,r=function(t,e){var i,r=[];for(i=0;i=r?0:l[o+1],h=e[o+s-1]-e[o],l[o]=0===h?0:(t-e[o])/h*n,0!==(h=e[o+s]-e[o+1])&&(l[o]+=(e[o+s]-t)/h*a);return l},o=function(o){return function(n,a){var h,l,c,d=[],u=t.length,p=u-1,f=e;if(p<=0)return NaN;if(p+2<=f&&(f=p+1),n<=0)return t[0][o]();if(n>=p-f+2)return t[p][o]();for(c=Math.floor(n)+f-1,i=r(p,f),d=s(n,i,f,c),h=0,l=c-f+1;l<=c;l++)l=0&&(h+=t[l][o]()*d[l]);return h}};return[o("X"),o("Y"),0,function(){return t.length-1}]},D:function(t,i){return e.exists(i)?function(e,r){var s=1e-5;return(t.apply(i,[e+s,r])-t.apply(i,[e-s,r]))/2e-5}:function(e,i){var r=1e-5;return(t(e+r,i)-t(e-r,i))/2e-5}},_riemannValue:function(t,e,i,r){var s,o,n,a;if(r<0&&("trapezoidal"!==i&&(t+=r),r*=-1,"lower"===i?i="upper":"upper"===i&&(i="lower")),a=.01*r,"right"===i)s=e(t+r);else if("middle"===i)s=e(t+.5*r);else if("left"===i||"trapezoidal"===i)s=e(t);else if("lower"===i){for(s=e(t),n=t+a;n<=t+r;n+=a)(o=e(n))s&&(s=o);o=e(t+r),o>s&&(s=o)}else s="random"===i?e(t+r*Math.random()):"simpson"===i?(e(t)+4*e(t+.5*r)+e(t+r))/6:e(t);return s},riemann:function(t,i,r,s,o){var n,a,h,l,c,d,u,p=[],f=[],m=0,g=s,b=0;if(e.isArray(t)?(c=t[0],l=t[1]):l=t,(i=Math.floor(i))<=0)return[p,f,b];for(a=(o-s)/i,n=0;n0)return e.isArray(r)?this.fminbr(t,[o,n],s):this.Newton(t,o,s);for(a=o,c=h;w=_&&Math.abs(h)>Math.abs(l)&&(y=a-n,o===a?(v=l/h,P=y*v,E=1-v):(E=h/c,v=l/c,C=l/h,P=C*(y*E*(E-v)-(n-o)*(v-1)),E=(E-1)*(v-1)*(C-1)),P>0?E=-E:P=-P,P<.75*y*E-.5*Math.abs(_*E)&&P0?_:-_),o=n,h=l,n+=S,l=t.call(s,n),(l>0&&c>0||l<0&&c<0)&&(a=o,c=h),w++}return n},fminbr:function(t,r,s){var o,n,a,h,l,c,d,u,p,f,m,g,b,v,y,C,_=.5*(3-Math.sqrt(5)),P=i.eps,E=i.eps,S=this.maxIterationsMinimize,x=0;if(!e.isArray(r)||r.length<2)throw new Error("JXG.Math.Numerics.fminbr: length of array x0 has to be at least two.");for(o=r[0],n=r[1],h=o+_*(n-o),d=t.call(s,h),a=h,l=h,c=d,u=d;x=m&&(y=(a-l)*(c-d),v=(a-h)*(c-u),b=(a-h)*v-(a-l)*y,v=2*(v-y),v>0?b=-b:v=-v,Math.abs(b)v*(o-a+2*m)&&b0?m:-m),y=a+g,C=t.call(s,y),C<=c?(y=i.eps?(f=(l*d+c*u)/p,f<0?f=0:f>1&&(f=1),l-=f*d,c-=f*u,s=l*l+c*c):(f=0,s=l*l+c*c),s>m&&(m=s,g=o)}return[Math.sqrt(m),g]},h=function(t,e,i,r,s){var o=a(t,e,i),n=o[1];if(isNaN(o[0])){h(t,e,n-1,r,s),s.push(t[n]);do{++n}while(n<=i&&isNaN(t[n].scrCoords[1]+t[n].scrCoords[2]));n<=i&&s.push(t[n]),h(t,n+1,i,r,s)}else o[0]>r?(h(t,e,n,r,s),h(t,n,i,r,s)):s.push(t[i])};for(o=t.length,r=0;rr&&isNaN(t[s].scrCoords[1]+t[s].scrCoords[2]);)s-=1;return r>s||r===o||(n[0]=t[r],h(t,r,s,e,n)),n},RamerDouglasPeuker:function(e,i){return t.deprecated("Numerics.RamerDouglasPeuker()","Numerics.RamerDouglasPeucker()"),this.RamerDouglasPeucker(e,i)},Visvalingam:function(e,i){var r,s,o,n,a,h,l,c,d,u=[],p=[],f=[];if((s=e.length)<=2)return e;for(u[0]={used:!0,lft:null,node:null},a=0,r=1;ri;)p.sort(function(t,e){return e.v-t.v}),r=p.pop().idx,u[r].used=!1,n=u[r].node.v,a=u[r].lft,h=u[r].rt,u[a].rt=h,u[h].lft=a,l=u[a].lft,null!==l&&(o=Math.abs(t.Math.Numerics.det([e[l].usrCoords,e[a].usrCoords,e[h].usrCoords])),u[a].node.v=o>=n?o:n),null!==(c=u[h].rt)&&(o=Math.abs(t.Math.Numerics.det([e[a].usrCoords,e[h].usrCoords,e[c].usrCoords])),u[h].node.v=o>=n?o:n);r=0,f=[e[r]];do{r=u[r].rt,f.push(e[r])}while(null!==u[r].rt);return f}},i.Numerics}),define("math/statistics",["jxg","math/math","utils/type"],function(t,e,i){"use strict";return e.Statistics={sum:function(t){var e,i=t.length,r=0;for(e=0;e0?this.sum(t)/t.length:0},median:function(t){var e,i;return t.length>0?(e=t.slice(0),e.sort(function(t,e){return t-e}),i=e.length,i%2==1?e[parseInt(.5*i,10)]:.5*(e[.5*i-1]+e[.5*i])):0},variance:function(t){var e,i,r,s=t.length;if(s>1){for(e=this.mean(t),i=0,r=0;r0?this.mean(this.multiply(t,e)):0},max:function(t){return Math.max.apply(this,t)},min:function(t){return Math.min.apply(this,t)},range:function(t){return[this.min(t),this.max(t)]},abs:function(t){var e,r,s;if(i.isArray(t))for(r=t.length,s=[],e=0;ee.eps&&(o[r]=(t[r].usrCoords[2]-t[i].usrCoords[2])/(t[r].usrCoords[1]-t[i].usrCoords[1]));s[i]=this.median(o),n.push(t[i].usrCoords[2]-s[i]*t[i].usrCoords[1])}return[this.median(n),this.median(s),-1]},generateGaussian:function(t,e){var i,r,s;if(this.hasSpare)return this.hasSpare=!1,this.spare*e+this.mean;do{i=2*Math.random()-1,r=2*Math.random()-1,s=i*i+r*r}while(s>=1||0===s);return s=Math.sqrt(-2*Math.log(s)/s),this.spare=r*s,this.hasSpare=!0,t+e*i*s}},e.Statistics}),define("math/geometry",["jxg","base/constants","base/coords","math/math","math/numerics","utils/type","utils/expect"],function(t,e,i,r,s,o,n){"use strict";return r.Geometry={},t.extend(r.Geometry,{angle:function(e,i,r){ +var s,o,n,a,h=[],l=[],c=[];return t.deprecated("Geometry.angle()","Geometry.rad()"),e.coords?(h[0]=e.coords.usrCoords[1],h[1]=e.coords.usrCoords[2]):(h[0]=e[0],h[1]=e[1]),i.coords?(l[0]=i.coords.usrCoords[1],l[1]=i.coords.usrCoords[2]):(l[0]=i[0],l[1]=i[1]),r.coords?(c[0]=r.coords.usrCoords[1],c[1]=r.coords.usrCoords[2]):(c[0]=r[0],c[1]=r[1]),s=h[0]-l[0],o=h[1]-l[1],n=c[0]-l[0],a=c[1]-l[1],Math.atan2(s*a-o*n,s*n+o*a)},trueAngle:function(t,e,i){return 57.29577951308232*this.rad(t,e,i)},rad:function(t,e,i){var r,s,o,n,a,h,l;return t.coords?(r=t.coords.usrCoords[1],s=t.coords.usrCoords[2]):(r=t[0],s=t[1]),e.coords?(o=e.coords.usrCoords[1],n=e.coords.usrCoords[2]):(o=e[0],n=e[1]),i.coords?(a=i.coords.usrCoords[1],h=i.coords.usrCoords[2]):(a=i[0],h=i[1]),l=Math.atan2(h-n,a-o)-Math.atan2(s-n,r-o),l<0&&(l+=6.283185307179586),l},angleBisector:function(t,r,s,n){var a,h,l,c,d,u=t.coords.usrCoords,p=r.coords.usrCoords,f=s.coords.usrCoords;return o.exists(n)||(n=t.board),0===p[0]?new i(e.COORDS_BY_USER,[1,.5*(u[1]+f[1]),.5*(u[2]+f[2])],n):(c=u[1]-p[1],d=u[2]-p[2],a=Math.atan2(d,c),c=f[1]-p[1],d=f[2]-p[2],h=Math.atan2(d,c),l=.5*(a+h),a>h&&(l+=Math.PI),c=Math.cos(l)+p[1],d=Math.sin(l)+p[2],new i(e.COORDS_BY_USER,[1,c,d],n))},reflection:function(t,r,s){var n,a,h,l,c,d,u,p=r.coords.usrCoords,f=t.point1.coords.usrCoords,m=t.point2.coords.usrCoords;return o.exists(s)||(s=r.board),c=m[1]-f[1],d=m[2]-f[2],n=p[1]-f[1],a=p[2]-f[2],u=(c*a-d*n)/(c*c+d*d),h=p[1]+2*u*d,l=p[2]-2*u*c,new i(e.COORDS_BY_USER,[h,l],s)},rotation:function(t,r,s,n){var a,h,l,c,d,u,p=r.coords.usrCoords,f=t.coords.usrCoords;return o.exists(n)||(n=r.board),a=p[1]-f[1],h=p[2]-f[2],l=Math.cos(s),c=Math.sin(s),d=a*l-h*c+f[1],u=a*c+h*l+f[2],new i(e.COORDS_BY_USER,[d,u],n)},perpendicular:function(t,s,n){var a,h,l,c,d,u=t.point1.coords.usrCoords,p=t.point2.coords.usrCoords,f=s.coords.usrCoords;return o.exists(n)||(n=s.board),s===t.point1?(a=u[1]+p[2]-u[2],h=u[2]-p[1]+u[1],d=u[0]*p[0],Math.abs(d)r.eps&&Math.abs(a-f[1])r.eps&&(Math.abs(t[0])1)i-=1;else{if(e===s-1)break;e+=1}i+=1,r=o.swap(r,i,e)}return r.slice(0,i)},calcStraight:function(t,i,s,n){var a,h,l,c,d,u,p,f,m,g;if(o.exists(n)||(n=10),u=o.evaluate(t.visProp.straightfirst),p=o.evaluate(t.visProp.straightlast),Math.abs(i.scrCoords[0])=r.eps&&i.scrCoords[1]>=0&&i.scrCoords[1]<=t.board.canvasWidth&&i.scrCoords[2]>=0&&i.scrCoords[2]<=t.board.canvasHeight,h=!p&&Math.abs(s.usrCoords[0])>=r.eps&&s.scrCoords[1]>=0&&s.scrCoords[1]<=t.board.canvasWidth&&s.scrCoords[2]>=0&&s.scrCoords[2]<=t.board.canvasHeight,l=this.meetLineBoard(f,t.board,n),c=l[0],d=l[1],!a&&!h){if(!u&&p&&!this.isSameDirection(i,s,c)&&!this.isSameDirection(i,s,d))return;if(u&&!p&&!this.isSameDirection(s,i,c)&&!this.isSameDirection(s,i,d))return}a?h||(g=this.isSameDir(i,s,c,d)?d:c):h?m=this.isSameDir(i,s,c,d)?c:d:this.isSameDir(i,s,c,d)?(m=c,g=d):(g=c,m=d),m&&i.setCoordinates(e.COORDS_BY_USER,m.usrCoords),g&&s.setCoordinates(e.COORDS_BY_USER,g.usrCoords)}},calcLineDelimitingPoints:function(t,i,s){var n,a,h,l,c,d,u,p,f,m,g=!1,b=!1;if(d=o.evaluate(t.visProp.straightfirst),u=o.evaluate(t.visProp.straightlast),Math.abs(i.scrCoords[0])=0?(l=this.projectPointToLine({coords:{usrCoords:[1,a[2],a[1]]}},t,t.board),c=this.projectPointToLine({coords:{usrCoords:[1,a[0],a[3]]}},t,t.board)):(l=this.projectPointToLine({coords:{usrCoords:[1,a[0],a[1]]}},t,t.board),c=this.projectPointToLine({coords:{usrCoords:[1,a[2],a[3]]}},t,t.board)),!g&&!b){if(!d&&!u){if(n=i.distance(e.COORDS_BY_USER,s),Math.abs(i.distance(e.COORDS_BY_USER,l)+l.distance(e.COORDS_BY_USER,s)-n)>r.eps)return;if(Math.abs(i.distance(e.COORDS_BY_USER,c)+c.distance(e.COORDS_BY_USER,s)-n)>r.eps)return}if(!d&&u&&!this.isSameDirection(i,s,l)&&!this.isSameDirection(i,s,c))return;if(d&&!u&&!this.isSameDirection(s,i,l)&&!this.isSameDirection(s,i,c))return}g?b||(m=this.isSameDir(i,s,l,c)?c:l):b?f=this.isSameDir(i,s,l,c)?l:c:this.isSameDir(i,s,l,c)?(f=l,m=c):(m=l,f=c),f&&i.setCoordinates(e.COORDS_BY_USER,f.usrCoords),m&&s.setCoordinates(e.COORDS_BY_USER,m.usrCoords)}},calcLabelQuadrant:function(t){var e;return t<0&&(t+=2*Math.PI),e=Math.floor((t+Math.PI/8)/(Math.PI/4))%8,["rt","urt","top","ulft","lft","llft","lrt"][e]},isSameDir:function(t,e,i,s){var o=e.usrCoords[1]-t.usrCoords[1],n=e.usrCoords[2]-t.usrCoords[2],a=s.usrCoords[1]-i.usrCoords[1],h=s.usrCoords[2]-i.usrCoords[2];return Math.abs(e.usrCoords[0])=0},isSameDirection:function(t,e,i){var s,o,n,a,h=!1;return s=e.usrCoords[1]-t.usrCoords[1],o=e.usrCoords[2]-t.usrCoords[2],n=i.usrCoords[1]-t.usrCoords[1],a=i.usrCoords[2]-t.usrCoords[2],Math.abs(s)=0&&n>=0?h=o>=0&&a>=0||o<=0&&a<=0:s<=0&&n<=0&&(h=o>=0&&a>=0||o<=0&&a<=0),h},intersectionFunction:function(t,r,s,n,a,h){var l=this;return r.elementClass===e.OBJECT_CLASS_CURVE&&s.elementClass===e.OBJECT_CLASS_CURVE?function(){return l.meetCurveCurve(r,s,n,a,r.board)}:r.elementClass===e.OBJECT_CLASS_CURVE&&s.elementClass===e.OBJECT_CLASS_LINE||s.elementClass===e.OBJECT_CLASS_CURVE&&r.elementClass===e.OBJECT_CLASS_LINE?function(){return l.meetCurveLine(r,s,n,r.board,h)}:r.elementClass===e.OBJECT_CLASS_LINE&&s.elementClass===e.OBJECT_CLASS_LINE?function(){var t,a,c,d,u,p;return c=d=o.evaluate(r.visProp.straightfirst),u=p=o.evaluate(r.visProp.straightlast),o.evaluate(h)||c&&u&&d&&p?l.meet(r.stdform,s.stdform,n,r.board):(t=l.meetSegmentSegment(r.point1.coords.usrCoords,r.point2.coords.usrCoords,s.point1.coords.usrCoords,s.point2.coords.usrCoords,r.board),a=!c&&t[1]<0||!u&&t[1]>1||!d&&t[2]<0||!p&&t[2]>1?[0,NaN,NaN]:t[0],new i(e.COORDS_BY_USER,a,r.board))}:function(){return l.meet(r.stdform,s.stdform,n,r.board)}},meet:function(t,e,i,s){var o=r.eps;return Math.abs(t[3])=o&&Math.abs(e[3])=o?this.meetLineCircle(t,e,i,s):this.meetCircleCircle(t,e,i,s)},meetLineBoard:function(t,s,n){var a,h,l,c,d=[];for(o.exists(n)||(n=0),d[0]=r.crossProduct(t,[n,0,1]),d[1]=r.crossProduct(t,[n,1,0]),d[2]=r.crossProduct(t,[-n-s.canvasHeight,0,1]),d[3]=r.crossProduct(t,[-n-s.canvasWidth,1,0]),l=0;l<4;l++)if(Math.abs(d[l][0])>r.eps){for(c=2;c>0;c--)d[l][c]/=d[l][0];d[l][0]=1}return Math.abs(d[1][0])s.canvasHeight?d[2]:d[3]):d[1][2]>s.canvasHeight?(a=d[2],h=d[3][2]<0?d[0]:d[3]):(a=d[1],h=d[3][2]<0?d[0]:d[3][2]>s.canvasHeight?d[2]:d[3]),a=new i(e.COORDS_BY_SCREEN,a.slice(1),s),h=new i(e.COORDS_BY_SCREEN,h.slice(1),s),[a,h]},meetLineLine:function(t,s,o,n){var a=isNaN(t[5]+s[5])?[0,0,0]:r.crossProduct(t,s);return new i(e.COORDS_BY_USER,a,n)},meetLineCircle:function(t,s,o,n){var a,h,l,c,d,u,p,f,m,g;return s[4]-r.eps*r.eps?(m=Math.sqrt(Math.abs(m)),g=[(-p+m)/(2*u),(-p-m)/(2*u)],0===o?new i(e.COORDS_BY_USER,[-g[0]*-d[1]-c*d[0],-g[0]*d[0]-c*d[1]],n):new i(e.COORDS_BY_USER,[-g[1]*-d[1]-c*d[0],-g[1]*d[0]-c*d[1]],n)):new i(e.COORDS_BY_USER,[0,0,0],n))},meetCircleCircle:function(t,s,o,n){var a;return t[4]t.maxX()||eS?0:1,new i(e.COORDS_BY_USER,[m,t.X(l),t.Y(l)],a)},meetCurveLineContinuousOld:function(o,n,a,h){var l,c,d,u,p,f,m,g,b,v,y,C,_=10*r.eps;if(t.deprecated("Geometry.meetCurveLineContinuousOld()","Geometry.meetCurveLineContinuous()"),u=function(t){var e=n.stdform[0]+n.stdform[1]*o.X(t)+n.stdform[2]*o.Y(t);return e*e},this.meetCurveLineContinuous.t1memo?(b=this.meetCurveLineContinuous.t1memo,l=s.root(u,b)):(b=o.minX(),v=o.maxX(),l=s.root(u,[b,v])),this.meetCurveLineContinuous.t1memo=l,y=o.X(l),C=o.Y(l),1===a){if(this.meetCurveLineContinuous.t2memo&&(b=this.meetCurveLineContinuous.t2memo),c=s.root(u,b),!(Math.abs(c-l)>.1&&Math.abs(y-o.X(c))>.1&&Math.abs(C-o.Y(c))>.1))for(m=20,g=(o.maxX()-o.minX())/m,f=o.minX(),d=0;d.1&&Math.abs(y-o.X(c))>.1&&Math.abs(C-o.Y(c))>.1));d++)f+=g;l=c,this.meetCurveLineContinuous.t2memo=l}return p=Math.abs(u(l))>_?NaN:1,new i(e.COORDS_BY_USER,[p,o.X(l),o.Y(l)],h)},meetCurveLineDiscrete:function(t,s,n,a,h){var l,c,d,u,p,f,m,g=s.point1.coords.usrCoords,b=s.point2.coords.usrCoords,v=0,y=t.numberPoints,C=o.evaluate(s.visProp.straightfirst),_=o.evaluate(s.visProp.straightlast);for(f=new i(e.COORDS_BY_USER,[0,NaN,NaN],a),0===g[0]?g=[1,b[1]+s.stdform[2],b[2]-s.stdform[1]]:0===b[0]&&(b=[1,g[1]+s.stdform[2],g[2]-s.stdform[1]]),u=t.points[0].usrCoords,l=1;lr.eps)for(3===t.bezierDegree?(m=this.meetBeziersegmentBeziersegment([t.points[l-1].usrCoords.slice(1),t.points[l].usrCoords.slice(1),t.points[l+1].usrCoords.slice(1),t.points[l+2].usrCoords.slice(1)],[g.slice(1),b.slice(1)],h),l+=2):m=[this.meetSegmentSegment(d,u,g,b)],c=0;c1)?f:f=new i(e.COORDS_BY_USER,p[0],a);v+=1}return f},meetCurveRedBlueSegments:function(t,e,i){var r,s,o,n,a,h,l,c,d,u=0,p=e.numberPoints,f=t.numberPoints;if(p<=1||f<=1)return[0,NaN,NaN];for(r=1;rc&&(l=this.meetSegmentSegment(o,n,a,h),l[1]>=0&&l[2]>=0&&(l[1]<1&&l[2]<1||r===f-1&&1===l[1]||s===p-1&&1===l[2]))){if(u===i)return l[0];u++}return[0,NaN,NaN]},meetSegmentSegment:function(t,e,i,s){var o,n,a,h=r.crossProduct(t,e),l=r.crossProduct(i,s),c=r.crossProduct(h,l),d=c[0];return Math.abs(d)=e[0]&&t[0]<=e[2]&&t[1]>=e[3]&&t[3]<=e[1]},_bezierListConcat:function(t,e,i,r){var s,n=o.exists(r),a=0,h=e.length,l=t.length;for(l>0&&h>0&&(1===t[l-1][1]&&0===e[0][1]||n&&1===t[l-1][2]&&0===e[0][2])&&(a=1),s=a;s=0&&c[2]>=0&&c[1]<=1&&c[2]<=1?[c]:[]):[]},_bezierLineMeetSubdivision:function(t,e,i,r){var s,o,n,a,h,l,c,d,u,p,f=[];return s=this._bezierBbox(e),o=this._bezierBbox(t),r&&!this._bezierOverlap(o,s)?[]:i<5?(n=this._bezierSplit(t),a=n[0],h=n[1],this._bezierListConcat(f,this._bezierLineMeetSubdivision(a,e,i+1),0),this._bezierListConcat(f,this._bezierLineMeetSubdivision(h,e,i+1),.5),f):(u=[1].concat(t[0]),p=[1].concat(t[3]),c=[1].concat(e[0]),d=[1].concat(e[1]),l=this.meetSegmentSegment(u,p,c,d),l[1]>=0&&l[1]<=1&&(!r||l[2]>=0&&l[2]<=1)?[l]:[])},meetBeziersegmentBeziersegment:function(t,e,i){var r,s,o;for(r=4===t.length&&4===e.length?this._bezierMeetSubdivision(t,e,0):this._bezierLineMeetSubdivision(t,e,0,i),r.sort(function(t,e){return 1e7*(t[1]-e[1])+(t[2]-e[2])}),s=[],o=0;oi))return u[i][0];return u.length>i?u[i][0]:[0,NaN,NaN]},bezierSegmentEval:function(t,e){var i,r,s,o=1-t;return r=0,s=0,i=o*o*o,r+=i*e[0][0],s+=i*e[0][1],i=3*t*o*o,r+=i*e[1][0],s+=i*e[1][1],i=3*t*t*o,r+=i*e[2][0],s+=i*e[2][1],i=t*t*t,r+=i*e[3][0],s+=i*e[3][1],[1,r,s]},bezierArc:function(t,e,i,s,o){var n,a,h,l,c,d,u,p,f,m,g,b,v,y,C,_,P,E=.5*Math.PI,S=e[1],x=e[2],O=e[0],w=[],T=[];for(c=this.distance(e,t),S/=O,x/=O,d=this.rad(t.slice(1),e.slice(1),i.slice(1)),-1===o&&(d=2*Math.PI-d),n=t,n[1]/=n[0],n[2]/=n[0],n[0]/=n[0],l=n.slice(0),s?(w=[S,S+.333*(n[1]-S),S+.666*(n[1]-S),n[1]],T=[x,x+.333*(n[2]-x),x+.666*(n[2]-x),n[2]]):(w=[n[1]],T=[n[2]]);d>r.eps;)d>E?(u=E,d-=E):(u=d,d=0),p=Math.cos(o*u),f=Math.sin(o*u),P=[[1,0,0],[S*(1-p)+x*f,p,-f],[x*(1-p)-S*f,f,p]],C=r.matVecMult(P,n),l=[C[0]/C[0],C[1]/C[0],C[2]/C[0]],m=n[1]-S,g=n[2]-x,b=l[1]-S,v=l[2]-x,_=Math.sqrt((m+b)*(m+b)+(g+v)*(g+v)),y=Math.abs(v-g)>r.eps?(m+b)*(c/_-.5)/(v-g)*8/3:(g+v)*(c/_-.5)/(m-b)*8/3,a=[1,n[1]-y*g,n[2]+y*m],h=[1,l[1]+y*v,l[2]-y*b],w=w.concat([a[1],h[1],l[1]]),T=T.concat([a[2],h[2],l[2]]),n=l.slice(0);return s&&(w=w.concat([l[1]+.333*(S-l[1]),l[1]+.666*(S-l[1]),S]),T=T.concat([l[2]+.333*(x-l[2]),l[2]+.666*(x-l[2]),x])),[w,T]},projectPointToCircle:function(t,s,n){var a,h,l,c,d,u=s.center.coords.usrCoords;return o.exists(n)||(n=t.board),o.isPoint(t)?(a=t.coords.distance(e.COORDS_BY_USER,s.center.coords),h=t.coords.usrCoords):(a=t.distance(e.COORDS_BY_USER,s.center.coords),h=t.usrCoords),Math.abs(a)1)for(g=[1,t,r],3===a.bezierDegree?u=0:y=[a.Z(0),a.X(0),a.Y(0)],d=0;d1&&d===a.numberPoints-2&&(b=C,f=this.distance(b,g),v=a.numberPoints-1),fa.maxX()?NaN:(i=t-a.X(e),s=r-a.Y(e),i*i+s*s)},x=P(n),w=50,O=(a.maxX()-a.minX())/w,E=a.minX(),d=0;dN?N:n,c=new i(e.COORDS_BY_USER,[a.X(n),a.Y(n)],h)}return[a.updateTransform(c),n]},projectCoordsToPolygon:function(e,i){var r,s,o,n,a=i.vertices.length,h=1/0;for(r=0;r>=1,0===Y&&(Y=l(),t=1&Y,Y=Y>>1|128),t}catch(t){throw t}}function u(t){var i=0,r=t;try{for(;r--;)i=i<<1|d();t&&(i=e[i]>>8-t)}catch(t){throw t}return i}function p(){R=0}function f(t){S++,A[R++]=t,T.push(String.fromCharCode(t)),32768===R&&(R=0)}function m(){this.b0=0,this.b1=0,this.jump=null,this.jumppos=-1}function g(){for(;;){if(U[J]>=w)return-1;if(O[U[J]]===J)return U[J]++;U[J]++}}function b(){var t,e=G[X];if(17===J)return-1;if(X++,J++,(t=g())>=0)e.b0=t;else if(e.b0=32768,b())return-1;if((t=g())>=0)e.b1=t,e.jump=null;else if(e.b1=32768,e.jump=G[X],e.jumppos=X,b())return-1;return J--,0}function v(t,e,i,r){var s;for(G=t,X=0,O=i,w=e,s=0;s<17;s++)U[s]=0;return J=0,b()?-1:0}function y(t){for(var e,i,r=0,s=t[r];;)if(d()){if(!(32768&s.b1))return s.b1;for(s=s.jump,e=t.length,i=0;i>1,C>23?(C=C<<1|d(),C>199?(C-=128,C=C<<1|d()):(C-=48)>143&&(C+=136)):C+=256,C<256)f(C);else{if(256===C)break;for(C-=257,S=u(r[C])+i[C],C=e[u(5)]>>3,o[C]>8?(O=u(8),O|=u(o[C]-8)<<8):O=u(o[C]),O+=s[C],C=0;CT)return p(),1;for(_=b?P[b-1]:0;C--;)P[b++]=_}else{if(C=17===C?3+u(3):11+u(7),b+C>T)return p(),1;for(;C--;)P[b++]=0}for(S=j.length,b=0;b=256){if(0===(C-=256))break;for(C-=1,S=u(r[C])+i[C],C=y(I),o[C]>8?(O=u(8),O|=u(o[C]-8)<<8):O=u(o[C]),O+=s[C];S--;)h=A[R-O&32767],f(h)}else f(C)}}while(!a);return p(),c(),0}function _(){var t,e,i,r,s,o,n,h,c=[];try{if(T=[],k=!1,c[0]=l(),c[1]=l(),120===c[0]&&218===c[1]&&(C(),M[N]=[T.join(""),"geonext.gxt"],N++),31===c[0]&&139===c[1]&&(P(),M[N]=[T.join(""),"file"],N++),80===c[0]&&75===c[1]){if(k=!0,c[2]=l(),c[3]=l(),3===c[2]&&4===c[3]){for(c[0]=l(),c[1]=l(),E=l(),E|=l()<<8,h=l(),h|=l()<<8,l(),l(),l(),l(),n=l(),n|=l()<<8,n|=l()<<16,n|=l()<<24,o=l(),o|=l()<<8,o|=l()<<16,o|=l()<<24,s=l(),s|=l()<<8,s|=l()<<16,s|=l()<<24,r=l(),r|=l()<<8,i=l(),i|=l()<<8,t=0,F=[];r--;)e=l(),"/"===e|":"===e?t=0:t127&&i<2048?(r+=String.fromCharCode(i>>6|192),r+=String.fromCharCode(63&i|128)):(r+=String.fromCharCode(i>>12|224),r+=String.fromCharCode(i>>6&63|128),r+=String.fromCharCode(63&i|128));return r},decode:function(t){var i,r,s,o=0,n=0,a=0,h=[],l=t.length,c=[];for(i=0;i>s&r,0===(a=e[256+a+s])&&(n>65535?h.push(55232+(n>>10),56320+(1023&n)):h.push(n),++o%1e4==0&&(c.push(String.fromCharCode.apply(null,h)),h=[]));return c.push(String.fromCharCode.apply(null,h)),c.join("")},asciiCharCodeAt:function(t,e){var i=t.charCodeAt(e);if(i>255)switch(i){case 8364:i=128;break;case 8218:i=130;break;case 402:i=131;break;case 8222:i=132;break;case 8230:i=133;break;case 8224:i=134;break;case 8225:i=135;break;case 710:i=136;break;case 8240:i=137;break;case 352:i=138;break;case 8249:i=139;break;case 338:i=140;break;case 381:i=142;break;case 8216:i=145;break;case 8217:i=146;break;case 8220:i=147;break;case 8221:i=148;break;case 8226:i=149;break;case 8211:i=150;break;case 8212:i=151;break;case 732:i=152;break;case 8482:i=153;break;case 353:i=154;break;case 8250:i=155;break;case 339:i=156;break;case 382:i=158;break;case 376:i=159}return i}},t.Util.UTF8}),define("utils/base64",["jxg","utils/encoding"],function(t,e){"use strict";function i(t,e){return 255&t.charCodeAt(e)}function r(t,e){return s.indexOf(t.charAt(e))}var s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";return t.Util=t.Util||{},t.Util.Base64={encode:function(t){var r,o,n,a,h,l=[];for(h=e.encode(t),n=h.length,a=n%3,r=0;r>18),s.charAt(o>>12&63),s.charAt(o>>6&63),s.charAt(63&o));switch(a){case 1:o=i(h,n-1),l.push(s.charAt(o>>2),s.charAt(o<<4&63),"=","=");break;case 2:o=i(h,n-2)<<8|i(h,n-1),l.push(s.charAt(o>>10),s.charAt(o>>4&63),s.charAt(o<<2&63),"=")}return l.join("")},decode:function(t,i){var s,o,n,a,h,l,c=[],d=[];if(s=t.replace(/[^A-Za-z0-9\+\/=]/g,""),(n=s.length)%4!=0)throw new Error("JSXGraph/utils/base64: Can't decode string (invalid input length).");for("="===s.charAt(n-1)&&(a=1,"="===s.charAt(n-2)&&(a=2),n-=4),o=0;o>16,h>>8&255,255&h),o%1e4==0&&(c.push(String.fromCharCode.apply(null,d)),d=[]);switch(a){case 1:h=r(s,n)<<12|r(s,n+1)<<6|r(s,n+2),d.push(h>>10,h>>2&255);break;case 2:h=r(s,o)<<6|r(s,o+1),d.push(h>>4)}return c.push(String.fromCharCode.apply(null,d)),l=c.join(""),i&&(l=e.decode(l)),l},decodeAsArray:function(t){var e,i=this.decode(t),r=[],s=i.length;for(e=0;e0)for(l=h[r].generatePolynomial(),n=0;n0){for(d=void 0!==_.toOrigin&&null!==_.toOrigin&&o.isInArray(n.listOfFreePoints,_.toOrigin.id)?_.toOrigin:n.listOfFreePoints[0],w=d.symbolic.x,T=d.symbolic.y,p=0;p1){for(u=void 0!==_.to10&&null!==_.to10&&_.to10.id!==_.toOrigin.id&&o.isInArray(n.listOfFreePoints,_.to10.id)?_.to10:n.listOfFreePoints[0].id===d.id?n.listOfFreePoints[1]:n.listOfFreePoints[0],N=r.rad([1,0],[0,0],[u.symbolic.x,u.symbolic.y]),v=Math.cos(-N),y=Math.sin(-N),p=0;pi.eps){for(O=u.symbolic.x,p=0;p0){for(e=0;ec==i[1]i[2]?1:0)-1,i[1]>=c)if(s[1]>c)h+=n;else{if(0===(o=this.det(i,s,t)))return 0;o>0==s[2]>i[2]&&(h+=n)}else s[1]>c&&(o=this.det(i,s,t))>0+r.eps==s[2]>i[2]&&(h+=n)}return h},Vertex:function(t,e,i,r,s){this.coords=t,this.usrCoords=this.coords.usrCoords,this.scrCoords=this.coords.scrCoords,this.intersect=!0,this.alpha=i,this.pos=e,this.path=r,this.pathname=s,this.done=!1,this.neighbour=null,this.entry_exit=!1,this.cnt=0},sortIntersections:function(t){var e,i,r,s,o=[],n=t.length;for(e=0;ee.alpha?1:-1}),t[e].length>0){for(s=t[e].length-1,r=t[e][0],r._prev=r.path[r.pos],r._prev._next=r,i=1;i<=s;i++)r=t[e][i],r._prev=t[e][i-1],r._prev._next=r;r=t[e][s],r._next=r.path[r.pos+1],r._next._prev=r,o=o.concat(t[e])}return o},findIntersections:function(t,r,o){var n,a,h,l,c,d,u,p,f,m,g,b,v=[],y=t.length-1,C=r.length-1,_=[],P=[],E=[],S=[];for(a=0;au&&(f=u,u=c,c=f),d=r[a].usrCoords[h],p=r[a+1].usrCoords[h],d>p&&(f=p,p=d,d=f),up){l=!0;break}l||(v=s.meetSegmentSegment(t[n].usrCoords,t[n+1].usrCoords,r[a].usrCoords,r[a+1].usrCoords),v[1]>=0&&v[1]<=1&&v[2]>=0&&v[2]<=1&&(m=new i(e.COORDS_BY_USER,v[0],o),g=new this.Vertex(m,n,v[1],t,"S"),b=new this.Vertex(m,a,v[2],r,"C"),g.neighbour=b,b.neighbour=g,E[n].push(g),S[a].push(b)))}for(_=this.sortIntersections(E),n=0;n<_.length;n++)_[n].cnt=n,_[n].neighbour.cnt=n;return P=this.sortIntersections(S),[_,P]},markEntryExit:function(t,e){var i,r=t[0];for(i=0===this.windingNumber(r.usrCoords,e)?"entry":"exit";!r._end;)r=r._next,o.exists(r.intersect)&&(r.entry_exit=i,i="entry"===i?"exit":"entry")},tracing:function(t,e,i){for(var r,s,n,a=0,h=0,l=[],c=[];h0&&(l.push(NaN),c.push(NaN)),n=s.cnt,r=t;do{if(l.push(s.usrCoords[1]),c.push(s.usrCoords[2]),s.done=!0,"intersection"===i&&"entry"===s.entry_exit||"union"===i&&"exit"===s.entry_exit||"difference"===i&&r===t==("exit"===s.entry_exit)){s=s._next;do{a++,l.push(s.usrCoords[1]),c.push(s.usrCoords[2]),o.exists(s.intersect)||(s=s._next)}while(!o.exists(s.intersect)&&a<4e4)}else{s=s._prev;do{a++,l.push(s.usrCoords[1]),c.push(s.usrCoords[2]),o.exists(s.intersect)||(s=s._prev)}while(!o.exists(s.intersect)&&a<4e4)}if(s.done=!0,!s.neighbour)return console.log("BREAK!!!!!!!!!!!!!!!!!",a),[[0],[0]];if(s=s.neighbour,s.done){l.push(s.usrCoords[1]),c.push(s.usrCoords[2]);break}r=s.path}while(("S"!==s.pathname||s.cnt!==n)&&a<4e4);h++}return[l,c]},isEmptyCase:function(t,e,i,r,s){var o;if("intersection"===i&&(0===t.length||0===e.length))return!0;if("union"===i&&(0===t.length||0===e.length)){if(0===t.length)for(o=0;o-1?this.monomials[i].coefficient+=e*t.coefficient:(t.coefficient*=e,this.monomials.push(t))},add:function(t){var e;if(!i.exists(t)||t.ring!==this.ring)throw new Error("JSXGraph error: In JXG.Math.Poly.polynomial.add either summand is undefined or rings don't match.");if(i.isArray(t.exponents))this.addSubMonomial(t,1);else for(e=0;e=0&&g[d]<=1;return m?[Math.ceil(255*g[0]),Math.ceil(255*g[1]),Math.ceil(255*g[2])]:g}for("string"==typeof g&&(n=g),"#"===n.charAt(0)&&(n=n.substr(1,6)),n=n.replace(/ /g,"").toLowerCase(),n=r[n]||n,d=0;d255?255:u,p=p<0||isNaN(p)?0:p>255?255:p,f=f<0||isNaN(f)?0:f>255?255:f,[u,p,f])},t.rgb2css=function(e,i,r){var s;return s=t.rgbParser(e,i,r),"rgb("+s[0]+", "+s[1]+", "+s[2]+")"},t.rgb2hex=function(e,i,r){var s,o,n;return s=t.rgbParser(e,i,r),o=s[1],n=s[2],s=s[0],s=s.toString(16),o=o.toString(16),n=n.toString(16),1===s.length&&(s="0"+s),1===o.length&&(o="0"+o),1===n.length&&(n="0"+n),"#"+s+o+n},t.hex2rgb=function(e){return t.deprecated("JXG.hex2rgb()","JXG.rgb2css()"),t.rgb2css(e)},t.hsv2rgb=function(t,e,r){var s,o,n,a,h,l,c,d,u;if(t=(t%360+360)%360,0===e){if(!(isNaN(t)||t=360?0:t,l/=60,h=Math.floor(l),a=l-h,c=r*(1-e),d=r*(1-e*a),u=r*(1-e*(1-a)),h){case 0:s=r,o=u,n=c;break;case 1:s=d,o=r,n=c;break;case 2:s=c,o=r,n=u;break;case 3:s=c,o=d,n=r;break;case 4:s=u,o=c,n=r;break;case 5:s=r,o=c,n=d}return s=Math.round(255*s).toString(16),s=2===s.length?s:1===s.length?"0"+s:"00",o=Math.round(255*o).toString(16),o=2===o.length?o:1===o.length?"0"+o:"00",n=Math.round(255*n).toString(16),n=2===n.length?n:1===n.length?"0"+n:"00",["#",s,o,n].join("")},t.rgb2hsv=function(e,i,r){var s,o,n,a,h,l,c,d,u,p,f,m,g;return s=t.rgbParser(e,i,r),o=s[1],n=s[2],s=s[0],a=s/255,h=o/255,l=n/255,m=Math.max(s,o,n),g=Math.min(s,o,n),c=m/255,d=g/255,f=c,p=0,f>0&&(p=(f-d)/f),u=1/(c-d),p>0&&(m===s?u*=h-l:u=m===o?2+(l-a)*u:4+(a-h)*u),u*=60,u<0&&(u+=360),m===g&&(u=0),[u,p,f]},t.rgb2LMS=function(e,i,r){var s,o,n,a,h,l,c,d=[[.05059983,.08585369,.0095242],[.01893033,.08925308,.01370054],[.00292202,.00975732,.07145979]];return s=t.rgbParser(e,i,r),o=s[1],n=s[2],s=s[0],s=Math.pow(s,.476190476),o=Math.pow(o,.476190476),n=Math.pow(n,.476190476),a=s*d[0][0]+o*d[0][1]+n*d[0][2],h=s*d[1][0]+o*d[1][1]+n*d[1][2],l=s*d[2][0]+o*d[2][1]+n*d[2][2],c=[a,h,l],c.l=a,c.m=h,c.s=l,c},t.LMS2rgb=function(t,e,i){var r,s,o,n,a=[[30.830854,-29.832659,1.610474],[-6.481468,17.715578,-2.532642],[-.37569,-1.199062,14.273846]],h=function(t){for(var e=127,i=64;i>0;){if(Math.pow(e,.476190476)>t)e-=i;else{if(Math.pow(e+1,.476190476)>t)return e;e+=i}i/=2}return 254===e&&13.994955247>4&15)+o.charAt(15&i),e="#"+r+r+r)},t.rgb2cb=function(e,i){var r,s,o,n,a,h,l,c,d,u,p,f,m,g="0123456789ABCDEF";if("none"===e)return e;switch(a=t.rgb2LMS(e),s=a[0],o=a[1],n=a[2],i=i.toLowerCase()){case"protanopia":l=-.06150039994295001,c=.08277001656812001,d=-.013200141220000003,u=.05858939668799999,p=-.07934519995360001,f=.013289415272000003,m=.6903216543277437,h=n/o,s=h>4&15)+g.charAt(15&r[0]),e="#"+h,h=g.charAt(r[1]>>4&15)+g.charAt(15&r[1]),e+=h,h=g.charAt(r[2]>>4&15)+g.charAt(15&r[2]),e+=h},t.autoHighlight=function(e){var i=t.rgba2rgbo(e),r=i[0],s=i[1];return"#"===e.charAt(0)?(s*=s<.3?1.8:.4,t.rgbo2rgba(r,s)):e},t}),define("options",["jxg","base/constants","math/math","utils/color","utils/type"],function(t,e,i,r,s){"use strict";return t.Options={jc:{enabled:!0,compile:!0},board:{boundingBox:[-5,5,5,-5],maxBoundingBox:[-1/0,1/0,1/0,-1/0],zoomFactor:1,zoomX:1,zoomY:1,showCopyright:!0,axis:!1,defaultAxes:{x:{name:"x",ticks:{label:{visible:"inherit",anchorX:"middle",anchorY:"top",fontSize:12,offset:[0,-3]},drawZero:!1,visible:"inherit"}},y:{name:"y",ticks:{label:{visible:"inherit",anchorX:"right",anchorY:"middle",fontSize:12,offset:[-6,0]},tickEndings:[1,0],drawZero:!1,visible:"inherit"}}},showNavigation:!0,showZoom:!0,showReload:!1,showScreenshot:!1,screenshot:{scale:1,type:"png",symbol:"⌘",css:"background-color:#eeeeee; opacity:1.0; border:2px solid black; border-radius:10px; text-align:center",cssButton:"padding: 4px 10px; border: solid #356AA0 1px; border-radius: 5px; position: absolute; right: 2ex; top: 2ex; background-color: rgba(255, 255, 255, 0.3);"},showFullscreen:!1,fullscreen:{symbol:"⛶"},showClearTraces:!1,keepAspectRatio:!1,ignoreLabels:!0,maxNameLength:1,document:!1,takeFirst:!1,takeSizeFromFile:!1,renderer:"auto",animationDelay:35,registerEvents:!0,minimizeReflow:"svg",offsetX:0,offsetY:0,zoom:{enabled:!0,factorX:1.25,factorY:1.25,wheel:!0,needShift:!0,min:1e-4,max:1e4,pinchHorizontal:!0,pinchVertical:!0,pinchSensitivity:7},pan:{needShift:!0,needTwoFingers:!1,enabled:!0},selection:{enabled:!1,name:"selectionPolygon",needShift:!1,needCtrl:!0,withLines:!1,vertices:{visible:!1},fillColor:"#ffff00",visible:!1}},navbar:{strokeColor:"#333333",fillColor:"transparent",highlightFillColor:"#aaaaaa",padding:"2px",position:"absolute",fontSize:"14px",cursor:"pointer",zIndex:"100",right:"5px",bottom:"5px"},elements:{strokeColor:"#0000ff",highlightStrokeColor:"#C3D9FF",fillColor:"red",highlightFillColor:"none",strokeOpacity:1,highlightStrokeOpacity:1,fillOpacity:1,highlightFillOpacity:1,gradient:null,gradientSecondColor:"#ffffff",gradientSecondOpacity:1,gradientStartOffset:0,gradientEndOffset:1,gradientAngle:0,gradientCX:.5,gradientCY:.5,gradientR:.5,gradientFX:.5,gradientFY:.5,gradientFR:0,transitionDuration:100,strokeWidth:2,highlightStrokeWidth:2,fixed:!1,frozen:!1,withLabel:!1,visible:!0,priv:!1,layer:0,dash:0,shadow:!1,trace:!1,traceAttributes:{},highlight:!0,needsRegularUpdate:!0,snapToGrid:!1,scalable:!0,dragToTopOfLayer:!1,draft:{draft:!1,strokeColor:"#565656",fillColor:"#565656",strokeOpacity:.8,fillOpacity:.8,strokeWidth:1},isLabel:!1},ticks:{generateLabelText:null,generateLabelValue:null,drawLabels:!1,label:{},useUnicodeMinus:!0,anchor:"left",drawZero:!1,insertTicks:!1,minTicksDistance:10,minorHeight:4,majorHeight:10,tickEndings:[1,1],minorTicks:4,scale:1,scaleSymbol:"",labels:[],maxLabelLength:5,precision:3,ticksDistance:1,face:"|",strokeOpacity:1,strokeWidth:1,strokeColor:"black",highlightStrokeColor:"#888888",fillColor:"none",highlightFillColor:"none",visible:"inherit",includeBoundaries:!1,type:"line"},hatch:{drawLabels:!1,drawZero:!0,majorHeight:20,anchor:"middle",face:"|",strokeWidth:2,strokeColor:"blue",ticksDistance:.2},precision:{touch:15,touchMax:100,mouse:4,pen:4,epsilon:1e-4,hasPoint:4},layer:{numlayers:20,text:9,point:9,glider:9,arc:8,line:7,circle:6,curve:5,turtle:5,polygon:3,sector:3,angle:3,integral:3,axis:2,ticks:2,grid:1,image:0,trace:0},angle:{withLabel:!0,radius:.5,type:"sector",orthoType:"square",orthoSensitivity:1,fillColor:"#FF7F00",highlightFillColor:"#FF7F00",strokeColor:"#FF7F00",fillOpacity:.3,highlightFillOpacity:.3,radiuspoint:{withLabel:!1,visible:!1,name:""},pointsquare:{withLabel:!1,visible:!1,name:""},dot:{visible:!1,strokeColor:"none",fillColor:"black",size:2,face:"o",withLabel:!1,name:""},label:{position:"top",offset:[0,0],strokeColor:"#0000FF"},arc:{visible:!1}},arc:{selection:"auto",hasInnerPoints:!1,label:{anchorX:"auto",anchorY:"auto"},firstArrow:!1,lastArrow:!1,fillColor:"none",highlightFillColor:"none",strokeColor:"#0000ff",highlightStrokeColor:"#C3D9FF",useDirection:!1,center:{},radiuspoint:{},anglePoint:{}},arrow:{firstArrow:!1,lastArrow:{type:1,highlightSize:6,size:6}},axis:{name:"",needsRegularUpdate:!1,strokeWidth:1,lastArrow:{type:1,highlightSize:8,size:8},strokeColor:"#666666",highlightStrokeWidth:1,highlightStrokeColor:"#888888",withTicks:!0,straightFirst:!0,straightLast:!0,margin:-4,withLabel:!1,scalable:!1,ticks:{label:{offset:[4,-9],parse:!1,needsRegularUpdate:!1,display:"internal",visible:"inherit",layer:9},visible:"inherit",needsRegularUpdate:!1,strokeWidth:1,strokeColor:"#666666",highlightStrokeColor:"#888888",drawLabels:!0,drawZero:!1,insertTicks:!0,minTicksDistance:5,minorHeight:10,majorHeight:-1,tickEndings:[0,1],minorTicks:4,ticksDistance:1,strokeOpacity:.25},point1:{needsRegularUpdate:!1,visible:!1},point2:{needsRegularUpdate:!1,visible:!1},label:{position:"lft",offset:[10,10]}},bisector:{strokeColor:"#000000",point:{visible:!1,fixed:!1,withLabel:!1,name:""}},bisectorlines:{line1:{strokeColor:"black"},line2:{strokeColor:"black"}},button:{disabled:!1,display:"html"},cardinalspline:{createPoints:!0,isArrayOfCoordinates:!1,points:{strokeOpacity:.05,fillOpacity:.05,highlightStrokeOpacity:1,highlightFillOpacity:1,withLabel:!1,name:"",fixed:!1}},chart:{chartStyle:"line",colors:["#B02B2C","#3F4C6B","#C79810","#D15600","#FFFF88","#C3D9FF","#4096EE","#008C00"],highlightcolors:null,fillcolor:null,highlightonsector:!1,highlightbysize:!1,fillOpacity:.6,withLines:!1,label:{}},checkbox:{disabled:!1,checked:!1,display:"html"},circle:{hasInnerPoints:!1,fillColor:"none",highlightFillColor:"none",strokeColor:"#0000ff",highlightStrokeColor:"#C3D9FF",center:{visible:!1,withLabel:!1,fixed:!1,name:""},label:{position:"urt"}},circumcircle:{fillColor:"none",highlightFillColor:"none",strokeColor:"#0000ff",highlightStrokeColor:"#C3D9FF",center:{visible:!1,fixed:!1,withLabel:!1,name:""}},circumcirclearc:{fillColor:"none",highlightFillColor:"none",strokeColor:"#0000ff",highlightStrokeColor:"#C3D9FF",center:{visible:!1,withLabel:!1,fixed:!1,name:""}},circumcirclesector:{useDirection:!0,fillColor:"#00FF00",highlightFillColor:"#00FF00",fillOpacity:.3,highlightFillOpacity:.3,strokeColor:"#0000ff",highlightStrokeColor:"#C3D9FF",point:{visible:!1,fixed:!1,withLabel:!1,name:""}},conic:{fillColor:"none",highlightFillColor:"none",strokeColor:"#0000ff",highlightStrokeColor:"#C3D9FF",foci:{fixed:!1,visible:!1,withLabel:!1,name:""},center:{visible:!1,withLabel:!1,name:""},point:{withLabel:!1,name:""},line:{visible:!1}},curve:{strokeWidth:1,strokeColor:"#0000ff",fillColor:"none",fixed:!0,useQDT:!1,handDrawing:!1,curveType:null,RDPsmoothing:!1,numberPointsHigh:1600,numberPointsLow:400,doAdvancedPlot:!0,recursionDepthHigh:17,recursionDepthLow:13,doAdvancedPlotOld:!1,label:{position:"lft"}},glider:{label:{}},grid:{needsRegularUpdate:!1,hasGrid:!1,gridX:1,gridY:1,strokeColor:"#C0C0C0",strokeOpacity:.5,strokeWidth:1,dash:0,snapToGrid:!1,snapSizeX:10,snapSizeY:10},group:{needsRegularUpdate:!0},htmlslider:{widthRange:100,widthOut:34,step:.01,frozen:!0,isLabel:!1,strokeColor:"black",display:"html",anchorX:"left",anchorY:"middle",withLabel:!1},image:{imageString:null,fillOpacity:1,highlightFillOpacity:.6,cssClass:"JXGimage",highlightCssClass:"JXGimageHighlight",rotate:0,snapSizeX:1,snapSizeY:1,attractors:[]},incircle:{fillColor:"none",highlightFillColor:"none",strokeColor:"#0000ff",highlightStrokeColor:"#C3D9FF",center:{visible:!1,fixed:!1,withLabel:!1,name:""}},inequality:{fillColor:"red",fillOpacity:.2,strokeColor:"none",inverse:!1},infobox:{fontSize:12,isLabel:!1,strokeColor:"#bbbbbb",display:"html",anchorX:"left",anchorY:"middle",cssClass:"JXGinfobox",rotate:0,visible:!0,parse:!1,transitionDuration:0,needsRegularUpdate:!1},integral:{axis:"x",withLabel:!0,fixed:!0,strokeWidth:0,strokeOpacity:0,fillColor:"red",fillOpacity:.4,highlightFillColor:"red",highlightFillOpacity:.2,curveLeft:{visible:!0,withLabel:!1,color:"red",fillOpacity:.8,layer:9},baseLeft:{visible:!1, +fixed:!1,withLabel:!1,name:""},curveRight:{visible:!0,withLabel:!1,color:"red",fillOpacity:.8,layer:9},baseRight:{visible:!1,fixed:!1,withLabel:!1,name:""},label:{fontSize:20}},input:{disabled:!1,maxlength:524288,display:"html"},intersection:{alwaysIntersect:!0},label:{visible:"inherit",strokeColor:"black",strokeOpacity:1,highlightStrokeOpacity:.666666,highlightStrokeColor:"black",fixed:!0,position:"urt",offset:[10,10],autoPosition:!1},legend:{style:"vertical",labels:["1","2","3","4","5","6","7","8"],colors:["#B02B2C","#3F4C6B","#C79810","#D15600","#FFFF88","#C3D9FF","#4096EE","#008C00"],rowHeight:20,strokeWidth:5},line:{firstArrow:!1,lastArrow:!1,margin:0,straightFirst:!0,straightLast:!0,fillColor:"none",highlightFillColor:"none",strokeColor:"#0000ff",highlightStrokeColor:"#888888",withTicks:!1,point1:{visible:!1,withLabel:!1,fixed:!1,name:""},point2:{visible:!1,withLabel:!1,fixed:!1,name:""},ticks:{drawLabels:!0,label:{offset:[4,-9]},drawZero:!1,insertTicks:!1,minTicksDistance:50,minorHeight:4,majorHeight:-1,minorTicks:4,defaultDistance:1,strokeOpacity:.3,visible:"inherit"},label:{position:"llft"},snapToGrid:!1,snapSizeX:1,snapSizeY:1,touchFirstPoint:!1,touchLastPoint:!1,lineCap:"butt"},locus:{translateToOrigin:!1,translateTo10:!1,stretch:!1,toOrigin:null,to10:null},mirrorelement:{fixed:!0,point:{},center:{},type:"Euclidean"},normal:{strokeColor:"#000000",point:{visible:!1,fixed:!1,withLabel:!1,name:""}},orthogonalprojection:{},parallel:{strokeColor:"#000000",point:{visible:!1,fixed:!1,withLabel:!1,name:""},label:{position:"llft"}},perpendicular:{strokeColor:"#000000",straightFirst:!0,straightLast:!0},perpendicularsegment:{strokeColor:"#000000",straightFirst:!1,straightLast:!1,point:{visible:!1,fixed:!0,withLabel:!1,name:""}},point:{withLabel:!0,label:{},style:5,face:"o",size:3,sizeUnit:"screen",fillColor:"#ff0000",highlightFillColor:"#EEEEEE",strokeWidth:2,strokeColor:"#ff0000",highlightStrokeColor:"#C3D9FF",zoom:!1,showInfobox:!0,infoboxDigits:"auto",draft:!1,attractors:[],attractorUnit:"user",attractorDistance:0,snatchDistance:0,snapToGrid:!1,snapSizeX:1,snapSizeY:1,snapToPoints:!1,ignoredSnapToPoints:[]},polygon:{hasInnerPoints:!1,fillColor:"#00FF00",highlightFillColor:"#00FF00",fillOpacity:.3,highlightFillOpacity:.3,withLines:!0,borders:{withLabel:!1,strokeWidth:1,highlightStrokeWidth:1,layer:5,label:{position:"top"},visible:"inherit"},vertices:{layer:9,withLabel:!1,name:"",strokeColor:"#ff0000",fillColor:"#ff0000",fixed:!1,visible:"inherit"},label:{offset:[0,0]}},polygonalchain:{fillColor:"none",highlightFillColor:"none"},prescribedangle:{anglePoint:{size:2,visible:!1,withLabel:!1}},reflection:{fixed:!0,center:{},type:"Euclidean"},regularpolygon:{hasInnerPoints:!1,fillColor:"#00FF00",highlightFillColor:"#00FF00",fillOpacity:.3,highlightFillOpacity:.3,withLines:!0,borders:{withLabel:!1,strokeWidth:1,highlightStrokeWidth:1,layer:5,label:{position:"top"}},vertices:{layer:9,withLabel:!0,strokeColor:"#ff0000",fillColor:"#ff0000",fixed:!1},label:{offset:[0,0]}},riemannsum:{withLabel:!1,fillOpacity:.3,fillColor:"#ffff00"},sector:{fillColor:"#00FF00",highlightFillColor:"#00FF00",fillOpacity:.3,highlightFillOpacity:.3,highlightOnSector:!1,highlightStrokeWidth:0,selection:"auto",arc:{visible:!1,fillColor:"none"},radiuspoint:{visible:!1,withLabel:!1},center:{visible:!1,withLabel:!1},anglePoint:{visible:!1,withLabel:!1},label:{offset:[0,0],anchorX:"auto",anchorY:"auto"}},segment:{label:{position:"top"}},semicircle:{center:{visible:!1,withLabel:!1,fixed:!1,name:""}},slider:{snapWidth:-1,precision:2,firstArrow:!1,lastArrow:!1,withTicks:!0,withLabel:!0,suffixLabel:null,unitLabel:null,postLabel:null,layer:9,showInfobox:!1,name:"",visible:!0,strokeColor:"#000000",highlightStrokeColor:"#888888",fillColor:"#ffffff",highlightFillColor:"none",size:6,point1:{needsRegularUpdate:!1,showInfobox:!1,withLabel:!1,visible:!1,fixed:!0,name:""},point2:{needsRegularUpdate:!1,showInfobox:!1,withLabel:!1,visible:!1,fixed:!0,name:""},baseline:{needsRegularUpdate:!1,fixed:!0,scalable:!1,name:"",strokeWidth:1,strokeColor:"#000000",highlightStrokeColor:"#888888"},ticks:{needsRegularUpdate:!1,fixed:!0,drawLabels:!1,precision:2,includeBoundaries:1,drawZero:!0,label:{offset:[-4,-14],display:"internal"},minTicksDistance:30,insertTicks:!0,minorHeight:4,majorHeight:5,minorTicks:0,defaultDistance:1,strokeOpacity:1,strokeWidth:1,tickEndings:[0,1],strokeColor:"#000000",visible:"inherit"},highline:{strokeWidth:3,fixed:!0,name:"",strokeColor:"#000000",highlightStrokeColor:"#888888"},label:{strokeColor:"#000000"},moveOnUp:!0},comb:{frequency:.2,width:.4,angle:Math.PI/3,reverse:!1,point1:{visible:!1,withLabel:!1,fixed:!1,name:""},point2:{visible:!1,withLabel:!1,fixed:!1,name:""},curve:{strokeWidth:1,strokeColor:"#000000",fillColor:"none"}},slopetriangle:{fillColor:"red",fillOpacity:.4,highlightFillColor:"red",highlightFillOpacity:.3,borders:{lastArrow:{type:1,size:6}},glider:{fixed:!0,visible:!1,withLabel:!1},baseline:{visible:!1,withLabel:!1,name:""},basepoint:{visible:!1,withLabel:!1,name:""},tangent:{visible:!1,withLabel:!1,name:""},topPoint:{visible:!1,withLabel:!1,name:""},label:{visible:!0}},stepfunction:{},tapemeasure:{strokeColor:"#000000",strokeWidth:2,highlightStrokeColor:"#000000",withTicks:!0,withLabel:!0,precision:2,point1:{visible:"inherit",strokeColor:"#000000",fillColor:"#ffffff",fillOpacity:0,highlightFillOpacity:.1,size:6,snapToPoints:!0,attractorUnit:"screen",attractorDistance:20,showInfobox:!1,withLabel:!1,name:""},point2:{visible:"inherit",strokeColor:"#000000",fillColor:"#ffffff",fillOpacity:0,highlightFillOpacity:.1,size:6,snapToPoints:!0,attractorUnit:"screen",attractorDistance:20,showInfobox:!1,withLabel:!1,name:""},ticks:{drawLabels:!1,drawZero:!0,insertTicks:!0,minorHeight:8,majorHeight:16,minorTicks:4,tickEndings:[0,1],defaultDistance:.1,strokeOpacity:1,strokeWidth:1,strokeColor:"#000000",visible:"inherit"},label:{position:"top"}},text:{fontSize:12,digits:2,parse:!0,useCaja:!1,isLabel:!1,strokeColor:"black",highlightStrokeColor:"black",highlightStrokeOpacity:.666666,cssDefaultStyle:"font-family: Arial, Helvetica, Geneva, sans-serif;",highlightCssDefaultStyle:"font-family: Arial, Helvetica, Geneva, sans-serif;",cssStyle:"",highlightCssStyle:"",useASCIIMathML:!1,useMathJax:!1,display:"html",anchor:null,anchorX:"left",anchorY:"middle",cssClass:"JXGtext",highlightCssClass:"JXGtext",dragArea:"all",withLabel:!1,rotate:0,visible:!0,snapSizeX:1,snapSizeY:1,attractors:[]},tracecurve:{strokeColor:"#000000",fillColor:"none",numberPoints:100},turtle:{strokeWidth:1,fillColor:"none",strokeColor:"#000000",arrow:{strokeWidth:2,withLabel:!1,strokeColor:"#ff0000"}},shortcuts:{color:["strokeColor","fillColor"],opacity:["strokeOpacity","fillOpacity"],highlightColor:["highlightStrokeColor","highlightFillColor"],highlightOpacity:["highlightStrokeOpacity","highlightFillOpacity"],strokeWidth:["strokeWidth","highlightStrokeWidth"]}},t.Validator=function(){var e,r=function(t){return/^[0-9]+px$/.test(t)},o=function(t){return"html"===t||"internal"===t},n=function(t){return s.isString(t)},a=function(e){return s.exists(t.normalizePointFace(e))},h=function(t){return Math.abs(t-Math.round(t))0},c=function(t){return"vml"===t||"svg"===t||"canvas"===t||"no"===t},d=function(t){return t>0},u=function(t){return t>=0},p={},f={attractorDistance:u,color:n,defaultDistance:s.isNumber,display:o,doAdvancedPlot:!1,draft:!1,drawLabels:!1,drawZero:!1,face:a,factor:s.isNumber,fillColor:n,fillOpacity:s.isNumber,firstArrow:!1,fontSize:h,dash:h,gridX:s.isNumber,gridY:s.isNumber,hasGrid:!1,highlightFillColor:n,highlightFillOpacity:s.isNumber,highlightStrokeColor:n,highlightStrokeOpacity:s.isNumber,insertTicks:!1,lastArrow:!1,majorHeight:h,minorHeight:h,minorTicks:u,minTicksDistance:l,numberPointsHigh:l,numberPointsLow:l,opacity:s.isNumber,radius:s.isNumber,RDPsmoothing:!1,renderer:c,right:r,showCopyright:!1,showInfobox:!1,showNavigation:!1,size:h,snapSizeX:d,snapSizeY:d,snapWidth:s.isNumber,snapToGrid:!1,snatchDistance:u,straightFirst:!1,straightLast:!1,stretch:!1,strokeColor:n,strokeOpacity:s.isNumber,strokeWidth:h,takeFirst:!1,takeSizeFromFile:!1,to10:!1,toOrigin:!1,translateTo10:!1,translateToOrigin:!1,useASCIIMathML:!1,useDirection:!1,useMathJax:!1,withLabel:!1,withTicks:!1,zoom:!1};for(e in f)f.hasOwnProperty(e)&&(p[e.toLowerCase()]=f[e]);return p}(),t.normalizePointFace=function(t){return{cross:"x",x:"x",circle:"o",o:"o",square:"[]","[]":"[]",plus:"+","+":"+",diamond:"<>","<>":"<>",triangleup:"^",a:"^","^":"^",triangledown:"v",v:"v",triangleleft:"<","<":"<",triangleright:">",">":">"}[t]},t.useStandardOptions=function(i){var r,s,o,n,a=t.Options,h=i.hasGrid;i.options.grid.hasGrid=a.grid.hasGrid,i.options.grid.gridX=a.grid.gridX,i.options.grid.gridY=a.grid.gridY,i.options.grid.gridColor=a.grid.gridColor,i.options.grid.gridOpacity=a.grid.gridOpacity,i.options.grid.gridDash=a.grid.gridDash,i.options.grid.snapToGrid=a.grid.snapToGrid,i.options.grid.snapSizeX=a.grid.SnapSizeX,i.options.grid.snapSizeY=a.grid.SnapSizeY,i.takeSizeFromFile=a.takeSizeFromFile,n=function(t,e){t.visProp.fillcolor=e.fillColor,t.visProp.highlightfillcolor=e.highlightFillColor,t.visProp.strokecolor=e.strokeColor,t.visProp.highlightstrokecolor=e.highlightStrokeColor};for(r in i.objects)if(i.objects.hasOwnProperty(r))if(o=i.objects[r],o.elementClass===e.OBJECT_CLASS_POINT)n(o,a.point);else if(o.elementClass===e.OBJECT_CLASS_LINE)for(n(o,a.line),s=0;sl&&(m=(o.scrCoords[1]-e.scrCoords[1])*d/u,g=(o.scrCoords[2]-e.scrCoords[2])*d/u,o=new i(r.COORDS_BY_SCREEN,[o.scrCoords[1]-m,o.scrCoords[2]-g],t.board)),E&&n.evaluate(t.visProp.touchfirstpoint)&&(u=e.distance(r.COORDS_BY_SCREEN,o))>l&&(p=(o.scrCoords[1]-e.scrCoords[1])*c/u,f=(o.scrCoords[2]-e.scrCoords[2])*c/u,e=new i(r.COORDS_BY_SCREEN,[e.scrCoords[1]+p,e.scrCoords[2]+f],t.board)),p=f=m=g=0,u=e.distance(r.COORDS_BY_SCREEN,o),n.exists(E.type)&&(b=n.evaluate(E.type)),n.exists(S.type)&&(v=n.evaluate(S.type)),E&&(y=3,n.exists(E.size)&&(y=n.evaluate(E.size)),""!==h&&n.exists(E[h+"size"])&&(y=n.evaluate(E[h+"size"])),_=a*y,2===b?(_*=.5,C+=a*y):3===b?(_=a*y/3,C+=a):C+=a*y),S&&(y=3,n.exists(S.size)&&(y=n.evaluate(S.size)),""!==h&&n.exists(S[h+"size"])&&(y=n.evaluate(S[h+"size"])),P=a*y,2===v?(P*=.5,C+=a*y):3===v?(P=a*y/3,C+=a):C+=a*y),E&&"vml"!==t.board.renderer.type&&(u>=C?(p=(o.scrCoords[1]-e.scrCoords[1])*_/u,f=(o.scrCoords[2]-e.scrCoords[2])*_/u):_=0),S&&"vml"!==t.board.renderer.type&&(u>=C?(m=(o.scrCoords[1]-e.scrCoords[1])*P/u,g=(o.scrCoords[2]-e.scrCoords[2])*P/u):P=0)),{c1:e,c2:o,d1x:p,d1y:f,d2x:m,d2y:g,sFirst:_,sLast:P}},setLineCap:function(t){},drawTicks:function(t){t.rendNode=this.appendChildPrim(this.createPrim("path",t.id),n.evaluate(t.visProp.layer)),this.appendNodesToElement(t,"path")},updateTicks:function(t){},drawCurve:function(t){t.rendNode=this.appendChildPrim(this.createPrim("path",t.id),n.evaluate(t.visProp.layer)),this.appendNodesToElement(t,"path"),t.numberPoints>1&&this.makeArrows(t),this._updateVisual(t,{shadow:!0},!0),this.updateCurve(t)},updateCurve:function(t){var e,i,r,s=n.evaluate(t.visProp.strokewidth);n.evaluate(t.visProp.handdrawing)?this.updatePathPrim(t.rendNode,this.updatePathStringBezierPrim(t),t.board):this.updatePathPrim(t.rendNode,this.updatePathStringPrim(t),t.board),t.numberPoints>1&&(this.makeArrows(t),i=n.evaluate(t.visProp.firstarrow),i&&(e=n.exists(i.size)?n.evaluate(i.size):3,this._setArrowWidth(t.rendNodeTriangleStart,s,t.rendNode,e)),(r=n.evaluate(t.visProp.lastarrow))&&(e=n.exists(r.size)?n.evaluate(r.size):3,this._setArrowWidth(t.rendNodeTriangleEnd,s,t.rendNode,e))),this._updateVisual(t)},drawEllipse:function(t){t.rendNode=this.appendChildPrim(this.createPrim("ellipse",t.id),n.evaluate(t.visProp.layer)),this.appendNodesToElement(t,"ellipse"),this.updateEllipse(t)},updateEllipse:function(t){this._updateVisual(t);var e=t.Radius();e>0&&Math.abs(t.center.coords.usrCoords[0])>s.eps&&!isNaN(e+t.center.coords.scrCoords[1]+t.center.coords.scrCoords[2])&&e*t.board.unitX<2e6&&this.updateEllipsePrim(t.rendNode,t.center.coords.scrCoords[1],t.center.coords.scrCoords[2],e*t.board.unitX,e*t.board.unitY)},drawPolygon:function(t){t.rendNode=this.appendChildPrim(this.createPrim("polygon",t.id),n.evaluate(t.visProp.layer)),this.appendNodesToElement(t,"polygon"),this.updatePolygon(t)},updatePolygon:function(t){this._updateVisual(t,{stroke:!0,dash:!0}),this.updatePolygonPrim(t.rendNode,t)},displayCopyright:function(t,e){},drawInternalText:function(t){},updateInternalText:function(t){},drawText:function(t){var e,i,r,s;"html"===n.evaluate(t.visProp.display)&&a.isBrowser&&"no"!==this.type?(e=this.container.ownerDocument.createElement("div"),e.style.position="absolute",e.className=n.evaluate(t.visProp.cssclass),r=n.evaluate(t.visProp.layer),n.exists(r)||(r=0),i=""===this.container.style.zIndex?0:parseInt(this.container.style.zIndex,10),e.style.zIndex=i+r,this.container.appendChild(e),e.setAttribute("id",this.container.id+"_"+t.id)):e=this.drawInternalText(t),t.rendNode=e,t.htmlStr="",t.visProp.islabel&&n.exists(t.visProp.anchor)?(s=n.evaluate(t.visProp.anchor.visProp.visible),t.prepareUpdate().updateVisibility(s)):t.prepareUpdate().updateVisibility(),this.updateText(t)},updateText:function(e){var i,r,s,o,a,h=e.plaintext;if(e.visPropCalc.visible)if(this.updateTextStyle(e,!1),"html"===n.evaluate(e.visProp.display)&&"no"!==this.type){if(isNaN(e.coords.scrCoords[1]+e.coords.scrCoords[2])||(r=e.coords.scrCoords[1],r=Math.abs(r)<1e6?r:1e6,o=e.getAnchorX(),i="right"===o?Math.floor(e.board.canvasWidth-r):"middle"===o?Math.floor(r-.5*e.size[0]):Math.floor(r),e.visPropOld.left!==o+i&&("right"===o?(e.rendNode.style.right=i+"px",e.rendNode.style.left="auto"):(e.rendNode.style.left=i+"px",e.rendNode.style.right="auto"),e.visPropOld.left=o+i),r=e.coords.scrCoords[2]+this.vOffsetText,r=Math.abs(r)<1e6?r:1e6,a=e.getAnchorY(),i="bottom"===a?Math.floor(e.board.canvasHeight-r):"middle"===a?Math.floor(r-.5*e.size[1]):Math.floor(r),e.visPropOld.top!==a+i&&("bottom"===a?(e.rendNode.style.top="auto",e.rendNode.style.bottom=i+"px"):(e.rendNode.style.bottom="auto",e.rendNode.style.top=i+"px"),e.visPropOld.top=a+i)),e.htmlStr!==h){try{e.rendNode.innerHTML=h}catch(t){s=e.rendNode.parentNode,e.rendNode.parentNode.removeChild(e.rendNode),e.rendNode.innerHTML=h,s.appendChild(e.rendNode)}if(e.htmlStr=h,n.evaluate(e.visProp.usemathjax))try{MathJax.typeset?MathJax.typeset([e.rendNode]):MathJax.Hub.Queue(["Typeset",MathJax.Hub,e.rendNode])}catch(e){t.debug("MathJax (not yet) loaded")}else if(n.evaluate(e.visProp.useasciimathml))try{AMprocessNode(e.rendNode,!1)}catch(e){t.debug("AsciiMathML (not yet) loaded")}}this.transformImage(e,e.transformations)}else this.updateInternalText(e)},_css2js:function(t){var e,i,r,s,o,a=[],h=n.trim(t).replace(/;$/,"").split(";");for(i=h.length,e=0;e\nFunction Base64Encode(inData)\n Const Base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"\n Dim cOut, sOut, I\n For I = 1 To LenB(inData) Step 3\n Dim nGroup, pOut, sGroup\n nGroup = &H10000 * AscB(MidB(inData, I, 1)) + _\n &H100 * MyASC(MidB(inData, I + 1, 1)) + MyASC(MidB(inData, I + 2, 1))\n nGroup = Oct(nGroup)\n nGroup = String(8 - Len(nGroup), "0") & nGroup\n pOut = Mid(Base64, CLng("&o" & Mid(nGroup, 1, 2)) + 1, 1) + _\n Mid(Base64, CLng("&o" & Mid(nGroup, 3, 2)) + 1, 1) + _\n Mid(Base64, CLng("&o" & Mid(nGroup, 5, 2)) + 1, 1) + _\n Mid(Base64, CLng("&o" & Mid(nGroup, 7, 2)) + 1, 1)\n sOut = sOut + pOut\n Next\n Select Case LenB(inData) Mod 3\n Case 1: \'8 bit final\n sOut = Left(sOut, Len(sOut) - 2) + "=="\n Case 2: \'16 bit final\n sOut = Left(sOut, Len(sOut) - 1) + "="\n End Select\n Base64Encode = sOut\nEnd Function\n\nFunction MyASC(OneChar)\n If OneChar = "" Then MyASC = 0 Else MyASC = AscB(OneChar)\nEnd Function\n\nFunction jxgBinFileReader(xhr)\n Dim byteString\n Dim b64String\n Dim i\n byteString = xhr.responseBody\n ReDim byteArray(LenB(byteString))\n For i = 1 To LenB(byteString)\n byteArray(i-1) = AscB(MidB(byteString, i, 1))\n Next\n b64String = Base64Encode(byteString)\n jxgBinFileReader = b64String\nEnd Function\n<\/script>\n'),t.FileReader}),define("parser/geonext",["jxg","base/constants","utils/type"],function(t,e,i){"use strict";return t.GeonextParser={replacePow:function(t){var e,i,r,s,o,n,a,h,l,c,d,u;for(t=t.replace(/(\s*)\^(\s*)/g,"^"),c=t.indexOf("^"),s=-1;c>=0&&c=0&&e>0;)r=l.charAt(i),")"===r?e++:"("===r&&(e-=1),i-=1;if(0!==e)throw new Error("JSXGraph: Missing '(' in expression");for(o="",a=l.substring(0,i+1),h=i;h>=0&&a.substr(h,1).match(/([\w\.]+)/);)o=RegExp.$1+o,h-=1;o+=l.substring(i+1,l.length),o=o.replace(/([\(\)\+\*\%\^\-\/\]\[])/g,"\\$1")}else o="[\\w\\.]+";if(d.match(/^([\w\.]*\()/)){for(e=1,i=RegExp.$1.length;i0;)r=d.charAt(i),")"===r?e-=1:"("===r&&(e+=1),i+=1;if(0!==e)throw new Error("JSXGraph: Missing ')' in expression");n=d.substring(0,i),n=n.replace(/([\(\)\+\*\%\^\-\/\[\]])/g,"\\$1")}else n="[\\w\\.]+";u=new RegExp("("+o+")\\^("+n+")"),t=t.replace(u,"pow($1,$2)"),c=t.indexOf("^")}return t},replaceIf:function(t){var e,i,r,s,o,n,a,h,l,c="",d=null,u=null,p=null;if((r=t.indexOf("If("))<0)return t;for(t=t.replace(/""/g,"0");r>=0;){for(e=t.slice(0,r),i=t.slice(r+3),o=1,s=0,n=-1,a=-1;s0;)h=i.charAt(s),")"===h?o-=1:"("===h?o+=1:","===h&&1===o&&(n<0?n=s:a=s),s+=1;if(l=i.slice(0,s-1),i=i.slice(s),n<0)return"";if(a<0)return"";d=l.slice(0,n),u=l.slice(n+1,a),p=l.slice(a+1),d=this.replaceIf(d),u=this.replaceIf(u),p=this.replaceIf(p),c+=e+"(("+d+")?("+u+"):("+p+"))",t=i,d=null,u=null,r=t.indexOf("If(")}return c+=i},replaceNameById:function(t,e,i){var r,s,o,n,a=0,h=["X","Y","L","V"],l=function(t){return i?"$('"+t+"')":t};for(n=0;n=0;)a>=0&&(r=t.indexOf(")",a+2))>=0&&(s=t.slice(a+2,r),s=s.replace(/\\(['"])?/g,"$1"),(o=e.elementsByName[s])&&(t=t.slice(0,a+2)+(i?"$('":"")+l(o.id)+t.slice(r))),r=t.indexOf(")",a+2),a=t.indexOf(h[n]+"(",r);for(a=t.indexOf("Dist(");a>=0;)a>=0&&(r=t.indexOf(",",a+5))>=0&&(s=t.slice(a+5,r),s=s.replace(/\\(['"])?/g,"$1"),(o=e.elementsByName[s])&&(t=t.slice(0,a+5)+l(o.id)+t.slice(r))),r=t.indexOf(",",a+5),a=t.indexOf(",",r),r=t.indexOf(")",a+1),r>=0&&(s=t.slice(a+1,r),s=s.replace(/\\(['"])?/g,"$1"),(o=e.elementsByName[s])&&(t=t.slice(0,a+1)+l(o.id)+t.slice(r))),r=t.indexOf(")",a+1),a=t.indexOf("Dist(",r);for(h=["Deg","Rad"],n=0;n=0;)a>=0&&(r=t.indexOf(",",a+4))>=0&&(s=t.slice(a+4,r),s=s.replace(/\\(['"])?/g,"$1"),(o=e.elementsByName[s])&&(t=t.slice(0,a+4)+l(o.id)+t.slice(r))),r=t.indexOf(",",a+4),a=t.indexOf(",",r),r=t.indexOf(",",a+1),r>=0&&(s=t.slice(a+1,r),s=s.replace(/\\(['"])?/g,"$1"),(o=e.elementsByName[s])&&(t=t.slice(0,a+1)+l(o.id)+t.slice(r))),r=t.indexOf(",",a+1),a=t.indexOf(",",r),r=t.indexOf(")",a+1),r>=0&&(s=t.slice(a+1,r),s=s.replace(/\\(['"])?/g,"$1"),(o=e.elementsByName[s])&&(t=t.slice(0,a+1)+l(o.id)+t.slice(r))),r=t.indexOf(")",a+1),a=t.indexOf(h[n]+"(",r);return t},replaceIdByObj:function(t){var e=/(X|Y|L)\(([\w_]+)\)/g;return t=t.replace(e,"$('$2').$1()"),e=/(V)\(([\w_]+)\)/g,t=t.replace(e,"$('$2').Value()"),e=/(Dist)\(([\w_]+),([\w_]+)\)/g,t=t.replace(e,"dist($('$2'), $('$3'))"),e=/(Deg)\(([\w_]+),([ \w\[\w_]+),([\w_]+)\)/g,t=t.replace(e,"deg($('$2'),$('$3'),$('$4'))"),e=/Rad\(([\w_]+),([\w_]+),([\w_]+)\)/g,t=t.replace(e,"rad($('$1'),$('$2'),$('$3'))"),e=/N\((.+)\)/g,t=t.replace(e,"($1)")},geonext2JS:function(t,e){var i,r,s,o=["Abs","ACos","ASin","ATan","Ceil","Cos","Exp","Factorial","Floor","Log","Max","Min","Random","Round","Sin","Sqrt","Tan","Trunc"],n=["abs","acos","asin","atan","ceil","cos","exp","factorial","floor","log","max","min","random","round","sin","sqrt","tan","ceil"];for(t=t.replace(/</g,"<"),t=t.replace(/>/g,">"),t=t.replace(/&/g,"&"),r=t,r=this.replaceNameById(r,e),r=this.replaceIf(r),r=this.replacePow(r),r=this.replaceIdByObj(r),s=0;s=0&&o[n].addChild(t)):(h=n.replace(/\[/g,"\\["),h=h.replace(/\]/g,"\\]"),a=new RegExp("\\(([\\w\\[\\]'_ ]+,)*("+h+")(,[\\w\\[\\]'_ ]+)*\\)","g"),r.search(a)>=0&&o[n].addChild(t)))},gxt2jc:function(t,e){var i;return t=t.replace(/</g,"<"),t=t.replace(/>/g,">"),t=t.replace(/&/g,"&"),i=t,i=this.replaceNameById(i,e,!0),i=i.replace(/True/g,"true"),i=i.replace(/False/g,"false"),i=i.replace(/fasle/g,"false")}},t.GeonextParser}),define("base/element",["jxg","base/constants","base/coords","math/math","math/statistics","options","parser/geonext","utils/event","utils/color","utils/type"],function(t,e,i,r,s,o,n,a,h,l){"use strict";return t.GeometryElement=function(t,i,r,s){var o,n,h;if(this.needsUpdate=!0,this.isDraggable=!1,this.isReal=!0,this.childElements={},this.hasLabel=!1,this.highlighted=!1,this.notExistingParents={},this.traces={},this.numTraces=0,this.transformations=[],this.baseElement=null,this.descendants={},this.ancestors={},this.parents=[],this.symbolic={},this.rendNode=null,this.elType="",this.dump=!0,this.subs={},this.inherits=[],this._pos=-1,this.stdform=[1,0,0,0,1,1,0,0],this.methodMap={setLabel:"setLabel",label:"label",setName:"setName",getName:"getName",addTransform:"addTransform",setProperty:"setAttribute",setAttribute:"setAttribute",addChild:"addChild",animate:"animate",on:"on",off:"off",trigger:"trigger"},this.quadraticform=[[1,0,0],[0,1,0],[0,0,1]],this.visProp={},this.visPropCalc={visible:!1},a.eventify(this),this.mouseover=!1,this.lastDragTime=new Date,arguments.length>0){this.board=t,this.type=r,this._org_type=r,this.elementClass=s||e.OBJECT_CLASS_OTHER,this.id=i.id,o=i.name,l.exists(o)||(o=this.board.generateName(this)),""!==o&&(this.board.elementsByName[o]=this),this.name=o,this.needsRegularUpdate=i.needsregularupdate,l.clearVisPropOld(this),h=this.resolveShortcuts(i);for(n in h)h.hasOwnProperty(n)&&this._set(n,h[n]);this.visProp.draft=h.draft&&h.draft.draft}},t.extend(t.GeometryElement.prototype,{addChild:function(t){var e,i;this.childElements[t.id]=t,this.addDescendants(t),t.ancestors[this.id]=this;for(e in this.descendants)if(this.descendants.hasOwnProperty(e)){this.descendants[e].ancestors[this.id]=this;for(i in this.ancestors)this.ancestors.hasOwnProperty(i)&&(this.descendants[e].ancestors[this.ancestors[i].id]=this.ancestors[i])}for(e in this.ancestors)if(this.ancestors.hasOwnProperty(e))for(i in this.descendants)this.descendants.hasOwnProperty(i)&&(this.ancestors[e].descendants[this.descendants[i].id]=this.descendants[i]);return this},addDescendants:function(t){var e;this.descendants[t.id]=t;for(e in t.childElements)t.childElements.hasOwnProperty(e)&&this.addDescendants(t.childElements[e]);return this},addParents:function(t){var e,i,r;for(r=l.isArray(t)?t:arguments,i=r.length,e=0;e0?n.applyOnce(a):this.transformations.length>0&&this.transformations[this.transformations.length-1].isNumericMatrix?this.transformations[this.transformations.length-1].melt(n):this.addTransform(n),s=0;s=0&&l.isString(e)&&9===e.length&&"#"===e.charAt(0))e=h.rgba2rgbo(e),this.visProp[t]=e[0],this.visProp[t.replace("color","opacity")]=e[1];else if(null===e||!l.isObject(e)||l.exists(e.id)||l.exists(e.name))this.visProp[t]=e;else{this.visProp[t]={};for(i in e)e.hasOwnProperty(i)&&(this.visProp[t][i.toLocaleLowerCase()]=e[i])}},resolveShortcuts:function(t){var e,i;for(e in o.shortcuts)if(o.shortcuts.hasOwnProperty(e)&&l.exists(t[e]))for(i=0;i/g,">"),this.label.setText(t)),this},setName:function(t){t=t.replace(//g,">"),"slider"!==this.elType&&this.setLabelText(t),this.setAttribute({name:t})},setProperty:function(){t.deprecated("setProperty()","setAttribute()"),this.setAttribute.apply(this,arguments)},setAttribute:function(i){var r,s,o,n,a,c,d,u,p,f={};for(r=0;r0&&c>0&&(n=this.board.getBoundingBox(),r=Math.round(r/h)*h,s=Math.round(s/c)*c,i||(rn[2]&&(r-=h),sn[1]&&(s-=c)),this.coords.setCoordinates(e.COORDS_BY_USER,[r,s]))),this):this},getBoundingBox:function(){var t,i,r,s,o,n=[1/0,1/0,-1/0,-1/0];if(this.type==e.OBJECT_TYPE_POLYGON){if((i=this.vertices.length-1)<=0)return n;for(t=0;tn[2]?r:n[2],r=this.vertices[t].Y(),n[1]=rn[3]?r:n[3]}else if(el.elementClass==e.OBJECT_CLASS_CIRCLE)s=this.center.X(),o=this.center.Y(),n=[s-this.radius,o+this.radius,s+this.radius,o-this.radius];else if(el.elementClass==e.OBJECT_CLASS_CURVE){if(0==(i=this.vertices.length))return n;for(t=0;tn[2]?r:n[2],r=this.points[t].coords.usrCoords[1],n[1]=rn[3]?r:n[3]}return n},addEvent:t.shortcut(t.GeometryElement.prototype,"on"),removeEvent:t.shortcut(t.GeometryElement.prototype,"off"),__evt__over:function(t){},__evt__mouseover:function(t){},__evt__out:function(t){},__evt__mouseout:function(t){},__evt__move:function(t){},__evt__mousemove:function(t){},__evt__drag:function(t){},__evt__mousedrag:function(t){},__evt__pendrag:function(t){},__evt__touchdrag:function(t){},__evt__down:function(t){},__evt__mousedown:function(t){},__evt__pendown:function(t){},__evt__touchdown:function(t){},__evt__up:function(t){},__evt__mouseup:function(t){},__evt__penup:function(t){},__evt__touchup:function(t){},__evt__attribute:function(t,e){},__evt__attribute_:function(t,e,i){},__evt:function(){}}),t.GeometryElement}),define("base/transformation",["jxg","base/constants","math/math","utils/type"],function(t,e,i,r){"use strict";return t.Transformation=function(t,i,r){this.elementClass=e.OBJECT_CLASS_OTHER,this.type=e.OBJECT_TYPE_TRANSFORMATION,this.matrix=[[1,0,0],[0,1,0],[0,0,1]],this.board=t,this.isNumericMatrix=!1,this.setMatrix(t,i,r),this.methodMap={apply:"apply",applyOnce:"applyOnce",bindTo:"bindTo",bind:"bind",melt:"melt"}},t.Transformation.prototype={},t.extend(t.Transformation.prototype,{update:function(){return this},setMatrix:function(t,e,s){var o;for(this.isNumericMatrix=!0,o=0;o0&&s.length<=2&&(this.evalParam=r.createEvalFunction(t,s,1),2!==s.length||r.isArray(s[1])||(s[1]=t.select(s[1]))),this.update=function(){var t,e,i=this.evalParam(0),o=Math.cos(i),n=Math.sin(i);this.matrix[1][1]=o,this.matrix[1][2]=-n,this.matrix[2][1]=n,this.matrix[2][2]=o,s.length>1&&(3===s.length?(t=this.evalParam(1),e=this.evalParam(2)):r.isArray(s[1])?(t=s[1][0],e=s[1][1]):(t=s[1].X(),e=s[1].Y()),this.matrix[1][0]=t*(1-o)+e*n,this.matrix[2][0]=e*(1-o)-t*n)};else if("shear"===e){if(2!==s.length)throw new Error("JSXGraph: shear transformation needs 2 parameters.");this.evalParam=r.createEvalFunction(t,s,2),this.update=function(){this.matrix[1][2]=this.evalParam(0),this.matrix[2][1]=this.evalParam(1)}}else if("generic"===e){if(9!==s.length)throw new Error("JSXGraph: generic transformation needs 9 parameters.");this.evalParam=r.createEvalFunction(t,s,9),this.update=function(){this.matrix[0][0]=this.evalParam(0),this.matrix[0][1]=this.evalParam(1),this.matrix[0][2]=this.evalParam(2),this.matrix[1][0]=this.evalParam(3),this.matrix[1][1]=this.evalParam(4),this.matrix[1][2]=this.evalParam(5),this.matrix[2][0]=this.evalParam(6),this.matrix[2][1]=this.evalParam(7),this.matrix[2][2]=this.evalParam(8)}}},apply:function(t,e){return this.update(),r.exists(e)?i.matVecMult(this.matrix,t.initialCoords.usrCoords):i.matVecMult(this.matrix,t.coords.usrCoords)},applyOnce:function(t){var s,o,n;for(r.isArray(t)||(t=[t]),o=t.length,n=0;n1)for(t=0;t=0?1:-1,o=Math.abs(o),_=p*o/(o+1)):Math.abs(e[0])0&&Math.abs(this._smax-this._smin)>=i.eps&&(_=Math.max(Math.min(_,1),0),h=_*(this._smax-this._smin)+this._smin,h=Math.round(h/P)*P,_=(h-this._smin)/(this._smax-this._smin),this.update(!0)),e=T.point1.coords,!c.evaluate(T.visProp.straightfirst)&&Math.abs(e.usrCoords[0])>i.eps&&_<0&&(C=e,w=!0,_=0),s=T.point2.coords,!c.evaluate(T.visProp.straightlast)&&Math.abs(s.usrCoords[0])>i.eps&&_>1&&(C=s,w=!0,_=1)}else if(T.type===a.OBJECT_TYPE_TURTLE)this.updateConstraint(),C=r.projectPointToTurtle(this,T,this.board),_=this.position;else if(T.elementClass===a.OBJECT_CLASS_CURVE)if(T.type===a.OBJECT_TYPE_ARC||T.type===a.OBJECT_TYPE_SECTOR)C=r.projectPointToCircle(this,T,this.board),g=r.rad(T.radiuspoint,T.center,this),f=0,m=r.rad(T.radiuspoint,T.center,T.anglepoint),_=g,P=c.evaluate(T.visProp.selection),("minor"===P&&m>Math.PI||"major"===P&&mm)&&(_=m,(g.5*f||g>m&&g>.5*m+Math.PI)&&(_=f),this.needsUpdateFromParent=!0,this.updateGliderFromParent()),O=m-f,this.visProp.isgeonext&&(O=1), +Math.abs(O)>i.eps&&(_/=O);else if(this.updateConstraint(),T.transformations.length>0){for(x=!1,E=T.getTransformationSource(),E[0]&&(x=E[0],N.push(T),N.push(E[1]));E[0]&&c.exists(E[1]._transformationSource);)E=E[1].getTransformationSource(),N.push(E[1]);if(S=this.coords.usrCoords,x){for(t=0;t=0;t--)S=i.matVecMult(N[t].transformMat,S);v[0]=new n(a.COORDS_BY_USER,S,this.board)}else T.updateTransformMatrix(),y=i.inverse(T.transformMat),S=i.matVecMult(y,S),b=new n(a.COORDS_BY_USER,S,this.board).usrCoords,v=r.projectCoordsToCurve(b[1],b[2],this.position||0,T,this.board);C=v[0],_=v[1]}else C=r.projectPointToCurve(this,T,this.board),_=this.position;else c.isPoint(T)&&(C=r.projectPointToPoint(this,T,this.board),_=this.position);this.coords.setCoordinates(a.COORDS_BY_USER,C.usrCoords,w),this.position=_},updateGliderFromParent:function(){var t,e,s,o,h,l,d,u,p,f,m,g,b=this.slideObject,v=[],y=2*Math.PI;if(!this.needsUpdateFromParent)return void(this.needsUpdateFromParent=!0);if(b.elementClass===a.OBJECT_CLASS_CIRCLE)s=b.Radius(),c.evaluate(this.visProp.isgeonext)&&(y=1),h=[b.center.X()+s*Math.cos(this.position*y),b.center.Y()+s*Math.sin(this.position*y)];else if(b.elementClass===a.OBJECT_CLASS_LINE)t=b.point1.coords.usrCoords,e=b.point2.coords.usrCoords,0===t[0]&&0===t[1]&&0===t[2]||0===e[0]&&0===e[1]&&0===e[2]?h=[0,0,0]:Math.abs(e[0])1?(o-1)/(o-2):(1-o)/o,h=[e[0]+o*t[0],e[1]+o*t[1],e[2]+o*t[2]]):(o=this.position,h=[t[0]+o*(e[0]-t[0]),t[1]+o*(e[1]-t[1]),t[2]+o*(e[2]-t[2])]);else if(b.type===a.OBJECT_TYPE_TURTLE)this.coords.setCoordinates(a.COORDS_BY_USER,[b.Z(this.position),b.X(this.position),b.Y(this.position)]),this.updateConstraint(),h=r.projectPointToTurtle(this,b,this.board).usrCoords;else if(b.elementClass===a.OBJECT_CLASS_CURVE){for(u=!1,l=b.getTransformationSource(),l[0]&&(u=l[0],v.push(b),v.push(l[1]));l[0]&&c.exists(l[1]._transformationSource);)l=l[1].getTransformationSource(),v.push(l[1]);if(u?this.coords.setCoordinates(a.COORDS_BY_USER,[v[v.length-1].Z(this.position),v[v.length-1].X(this.position),v[v.length-1].Y(this.position)]):this.coords.setCoordinates(a.COORDS_BY_USER,[b.Z(this.position),b.X(this.position),b.Y(this.position)]),b.type===a.OBJECT_TYPE_ARC||b.type===a.OBJECT_TYPE_SECTOR)p=r.rad([b.center.X()+1,b.center.Y()],b.center,b.radiuspoint),f=0,g=r.rad(b.radiuspoint,b.center,b.anglepoint),("minor"===b.visProp.selection&&g>Math.PI||"major"===b.visProp.selection&&gg)&&(m=g,(m.5*f||m>g&&m>.5*g+Math.PI)&&(m=f),this.position=m,Math.abs(y)>i.eps&&(this.position/=y)),s=b.Radius(),h=[b.center.X()+s*Math.cos(this.position*y+p),b.center.Y()+s*Math.sin(this.position*y+p)];else if(this.updateConstraint(),u)for(h=r.projectPointToCurve(this,v[v.length-1],this.board).usrCoords,d=v.length-2;d>=0;d--)h=new n(a.COORDS_BY_USER,i.matVecMult(v[d].transformMat,h),this.board).usrCoords;else h=r.projectPointToCurve(this,b,this.board).usrCoords}else c.isPoint(b)&&(h=r.projectPointToPoint(this,b,this.board).usrCoords);this.coords.setCoordinates(a.COORDS_BY_USER,h,!1)},updateRendererGeneric:function(t){return this.needsUpdate?(this.visPropCalc.visible&&(this.isReal=!isNaN(this.coords.usrCoords[1]+this.coords.usrCoords[2]),this.isReal=Math.abs(this.coords.usrCoords[0])>i.eps&&this.isReal,this.isReal||this.updateVisibility(!1)),this.visPropCalc.visible&&this.board.renderer[t](this),this.hasLabel&&this.visPropCalc.visible&&this.label&&this.label.visPropCalc.visible&&this.isReal&&(this.label.update(),this.board.renderer.updateText(this.label)),this.setDisplayRendNode(),this.needsUpdate=!1,this):this},X:function(){return this.coords.usrCoords[1]},Y:function(){return this.coords.usrCoords[2]},Z:function(){return this.coords.usrCoords[0]},XEval:function(){return this.coords.usrCoords[1]},YEval:function(){return this.coords.usrCoords[2]},ZEval:function(){return this.coords.usrCoords[0]},Dist:function(t){return this.isReal&&t.isReal?this.coords.distance(a.COORDS_BY_USER,t.coords):NaN},snapToGrid:function(t){return this.handleSnapToGrid(t)},handleSnapToPoints:function(t){var e,i,s,o,n,h,l,d,u=0,p=1/0,f=null,m=c.evaluate(this.visProp.ignoredsnaptopoints),g=!1;if(o=this.board.objectsList.length,m&&(l=m.length),c.evaluate(this.visProp.snaptopoints)||t){for(n=c.evaluate(this.visProp.attractorunit),h=c.evaluate(this.visProp.attractordistance),e=0;e1?e.point2.coords:new n(a.COORDS_BY_USER,s[0],this.board)):e.elementClass===a.OBJECT_CLASS_CIRCLE?i=r.projectPointToCircle(this,e,this.board):e.elementClass===a.OBJECT_CLASS_CURVE?i=r.projectPointToCurve(this,e,this.board):e.type===a.OBJECT_TYPE_TURTLE&&(i=r.projectPointToTurtle(this,e,this.board)),(o="screen"===h?i.distance(a.COORDS_BY_SCREEN,this.coords):i.distance(a.COORDS_BY_USER,this.coords))=d&&this.popSlideObject()}return this}},setPositionDirectly:function(t,e){var r,s,h,l,d=this.coords;if(this.relativeCoords)return s=new n(t,e,this.board),c.evaluate(this.visProp.islabel)?(h=o.subtract(s.scrCoords,d.scrCoords),this.relativeCoords.scrCoords[1]+=h[1],this.relativeCoords.scrCoords[2]+=h[2]):(h=o.subtract(s.usrCoords,d.usrCoords),this.relativeCoords.usrCoords[1]+=h[1],this.relativeCoords.usrCoords[2]+=h[2]),this;for(this.coords.setCoordinates(t,e),this.handleSnapToGrid(),this.handleSnapToPoints(),this.handleAttractors(),r=this.transformations.length-1;r>=0;r--)t===a.COORDS_BY_SCREEN?l=new n(t,e,this.board).usrCoords:(2===e.length&&(e=[1].concat(e)),l=e),this.initialCoords.setCoordinates(a.COORDS_BY_USER,i.matVecMult(i.inverse(this.transformations[r].matrix),l));return this.prepareUpdate().update(),this.board.isSuspendedUpdate&&this.type===a.OBJECT_TYPE_GLIDER&&this.updateGlider(),this},setPositionByTransform:function(t,e){var i;return e=new n(t,e,this.board),i=this.board.create("transform",e.usrCoords.slice(1),{type:"translate"}),this.transformations.length>0&&this.transformations[this.transformations.length-1].isNumericMatrix?this.transformations[this.transformations.length-1].melt(i):this.addTransform(this,i),this.prepareUpdate().update(),this},setPosition:function(t,e){return this.setPositionDirectly(t,e)},setGliderPosition:function(t){return this.type===a.OBJECT_TYPE_GLIDER&&(this.position=t,this.board.update()),this},makeGlider:function(e){var i,r,s,o=this.board.select(e),n=!1;if(o.type===a.OBJECT_TYPE_POLYGON){for(i=Number.MAX_VALUE,r=0;r0&&(this.slideObjects.pop(),this.slideObject.removeChild(this),0===this.slideObjects.length?(this.type=this._org_type,this.type===a.OBJECT_TYPE_POINT?this.elType="point":this.elementClass===a.OBJECT_CLASS_TEXT?this.elType="text":this.type===a.OBJECT_TYPE_IMAGE&&(this.elType="image"),this.slideObject=null):this.slideObject=this.slideObjects[this.slideObjects.length-1])},free:function(){var t,e;if(this.type!==a.OBJECT_TYPE_GLIDER){if(this.transformations.length=0,this.updateConstraint=function(){return this},this.isDraggable)return;this.isDraggable=!0,this.elementClass===a.OBJECT_CLASS_POINT&&(this.type=a.OBJECT_TYPE_POINT,this.elType="point"),this.XEval=function(){return this.coords.usrCoords[1]},this.YEval=function(){return this.coords.usrCoords[2]},this.ZEval=function(){return this.coords.usrCoords[0]},this.Xjc=null,this.Yjc=null}for(t in this.board.objects)this.board.objects.hasOwnProperty(t)&&(e=this.board.objects[t],e.descendants&&(delete e.descendants[this.id],delete e.childElements[this.id],this.hasLabel&&(delete e.descendants[this.label.id],delete e.childElements[this.label.id])));this.ancestors={},this.slideObject=null,this.slideObjects=[],this.elementClass===a.OBJECT_CLASS_POINT?(this.type=a.OBJECT_TYPE_POINT,this.elType="point"):this.elementClass===a.OBJECT_CLASS_TEXT?(this.type=this._org_type,this.elType="text"):this.elementClass===a.OBJECT_CLASS_OTHER&&(this.type=this._org_type,this.elType="image")},addConstraint:function(t){var e,i,r=[],s=["X","Y"];for(this.elementClass===a.OBJECT_CLASS_POINT&&(this.type=a.OBJECT_TYPE_CAS),this.isDraggable=!1,e=0;e"===r.effect?Math.pow(Math.sin(t/h*Math.PI/2),2):t/h};if(!c.exists(e)||0===e||Math.abs(t.usrCoords[0]-this.coords.usrCoords[0])>i.eps)return this.setPosition(a.COORDS_BY_USER,t.usrCoords),this.board.update(this);if(!c.exists(r.callback)&&Math.abs(p)=0;s--)l[h-s]=[t.usrCoords[0],d+p*m(s),u+f*m(s)];return this.animationPath=l,this.animationCallback=r.callback,this.board.addAnimation(this),this},visit:function(t,e,i){t=new n(a.COORDS_BY_USER,t,this.board);var r,s,o,h=this.board.attr.animationdelay,l=[],d=this.coords.usrCoords[1],u=this.coords.usrCoords[2],p=t.usrCoords[1]-d,f=t.usrCoords[2]-u,m=function(t){var e=t"===i.effect?Math.pow(Math.sin(e*Math.PI/2),2):e};for(c.isNumber(i)?i={repeat:i}:(i=i||{},c.exists(i.repeat)||(i.repeat=1)),o=Math.ceil(e/(h*i.repeat)),s=0;s=0;r--)l[s*(o+1)+o-r]=[t.usrCoords[0],d+p*m(r),u+f*m(r)];return this.animationPath=l,this.animationCallback=i.callback,this.board.addAnimation(this),this},_anim:function(t,e){var i,s,o,n,h,l,c,d;return this.intervalCount+=1,this.intervalCount>e&&(this.intervalCount=0),this.slideObject.elementClass===a.OBJECT_CLASS_LINE?(c=this.slideObject.point1.coords.scrCoords,d=this.slideObject.point2.coords.scrCoords,i=Math.round((d[1]-c[1])*this.intervalCount/e),s=Math.round((d[2]-c[2])*this.intervalCount/e),t>0?n=this.slideObject.point1:(n=this.slideObject.point2,i*=-1,s*=-1),this.coords.setCoordinates(a.COORDS_BY_SCREEN,[n.coords.scrCoords[1]+i,n.coords.scrCoords[2]+s])):this.slideObject.elementClass===a.OBJECT_CLASS_CURVE?(h=t>0?Math.round(this.intervalCount/e*this.board.canvasWidth):Math.round((e-this.intervalCount)/e*this.board.canvasWidth),this.coords.setCoordinates(a.COORDS_BY_SCREEN,[h,0]),this.coords=r.projectPointToCurve(this,this.slideObject,this.board)):this.slideObject.elementClass===a.OBJECT_CLASS_CIRCLE&&(o=2*Math.PI,o*=t<0?this.intervalCount/e:e-this.intervalCount,l=this.slideObject.Radius(),this.coords.setCoordinates(a.COORDS_BY_USER,[this.slideObject.center.coords.usrCoords[1]+l*Math.cos(o),this.slideObject.center.coords.usrCoords[2]+l*Math.sin(o)])),this.board.update(this),this},getTextAnchor:function(){return this.coords},getLabelAnchor:function(){return this.coords},getParents:function(){var t=[this.Z(),this.X(),this.Y()];return 0!==this.parents.length&&(t=this.parents),this.type===a.OBJECT_TYPE_GLIDER&&(t=[this.X(),this.Y(),this.slideObject.id]),t}}),t.CoordsElement.create=function(t,e,i,r,s,o){var n,a,h=!1;for(a=0;a0&&(i=h.matVecMult(h.inverse(this.board.renderer.joinTransforms(this,this.transformations)),[1,t,e]),t=i[1],e=i[2]),n=this.getAnchorX(),i="right"===n?this.coords.scrCoords[1]-this.size[0]:"middle"===n?this.coords.scrCoords[1]-.5*this.size[0]:this.coords.scrCoords[1],r=i+this.size[0],l=this.getAnchorY(),o="top"===l?this.coords.scrCoords[2]+this.size[1]:"middle"===l?this.coords.scrCoords[2]+.5*this.size[1]:this.coords.scrCoords[2],s=o-this.size[1],"all"===a.evaluate(this.visProp.dragarea)?t>=i-c&&t=s-c&&e<=o+c:e>=s-c&&e<=o+c&&(t>=i-c&&t<=i+2*c||t>=r-2*c&&t<=r+c)},_setUpdateText:function(t){var e,i,r=a.evaluate(this.visProp.parse),s=a.evaluate(this.visProp.usemathjax);this.orgText=t,a.isFunction(t)?this.updateText=function(){i=t().toString(),this.plaintext=r&&!s?this.replaceSub(this.replaceSup(this.convertGeonext2CSS(i))):i}:a.isString(t)&&!r?this.updateText=function(){this.plaintext=t}:(a.isNumber(t)?this.content=a.toFixed(t,a.evaluate(this.visProp.digits)):a.evaluate(this.visProp.useasciimathml)?this.content="'`"+t+"`'":this.content=s?"'"+t+"'":this.generateTerm(t,!0,!0),e=this.board.jc.snippet(this.content,!0,"",!1),this.updateText=function(){this.plaintext=e()})},_setText:function(t){return this._setUpdateText(t),this.updateText(),this.fullUpdate(),this.board.infobox&&this.id===this.board.infobox.id||this.updateSize(),this},setTextJessieCode:function(t){var e;return this.visProp.castext=t,e=a.isFunction(t)?function(){return a.sanitizeHTML(t())}:a.isNumber(t)?t:a.sanitizeHTML(t),this._setText(e)},setText:function(t){return this._setText(t)},updateSize:function(){var t,e,i,r=a.evaluate(this.visProp.display);return n.isBrowser&&"no"!==this.board.renderer.type?(i=this.rendNode,"html"===r||"vml"===this.board.renderer.type?a.exists(i.offsetWidth)?(e=this,window.setTimeout(function(){e.size=[i.offsetWidth,i.offsetHeight],e.needsUpdate=!0,e.updateRenderer()},0)):this.size=this.crudeSizeEstimate():"internal"===r&&("svg"===this.board.renderer.type?(e=this,window.setTimeout(function(){try{t=i.getBBox(),e.size=[t.width,t.height],e.needsUpdate=!0,e.updateRenderer()}catch(t){}},0)):"canvas"===this.board.renderer.type&&(this.size=this.crudeSizeEstimate())),this):this},crudeSizeEstimate:function(){var t=parseFloat(a.evaluate(this.visProp.fontsize));return[t*this.plaintext.length*.45,.9*t]},utf8_decode:function(t){return t.replace(/&#x(\w+);/g,function(t,e){return String.fromCharCode(parseInt(e,16))})},replaceSub:function(t){if(!t.indexOf)return t;for(var e,i=t.indexOf("_{");i>=0;)t=t.substr(0,i)+t.substr(i).replace(/_\{/,""),e=t.substr(i).indexOf("}"),e>=0&&(t=t.substr(0,e)+t.substr(e).replace(/\}/,"")),i=t.indexOf("_{");for(i=t.indexOf("_");i>=0;)t=t.substr(0,i)+t.substr(i).replace(/_(.?)/,"$1"),i=t.indexOf("_");return t},replaceSup:function(t){if(!t.indexOf)return t;for(var e,i=t.indexOf("^{");i>=0;)t=t.substr(0,i)+t.substr(i).replace(/\^\{/,""),e=t.substr(i).indexOf("}"),e>=0&&(t=t.substr(0,e)+t.substr(e).replace(/\}/,"")),i=t.indexOf("^{");for(i=t.indexOf("^");i>=0;)t=t.substr(0,i)+t.substr(i).replace(/\^(.?)/,"$1"),i=t.indexOf("^");return t},getSize:function(){return this.size},setCoords:function(t,i){var r,s,o;return a.isArray(t)&&t.length>1&&(i=t[1],t=t[0]),a.evaluate(this.visProp.islabel)&&a.exists(this.element)?(r=this.element.getLabelAnchor(),s=(t-r.usrCoords[1])*this.board.unitX,o=-(i-r.usrCoords[2])*this.board.unitY,this.relativeCoords.setCoordinates(e.COORDS_BY_SCREEN,[s,o])):this.coords.setCoordinates(e.COORDS_BY_USER,[t,i]),this.fullUpdate(),this},update:function(t){return this.needsUpdate?(this.updateCoords(t),this.updateText(),"internal"===a.evaluate(this.visProp.display)&&a.isString(this.plaintext)&&(this.plaintext=this.utf8_decode(this.plaintext)),this.checkForSizeUpdate(),this.needsSizeUpdate&&this.updateSize(),this):this},checkForSizeUpdate:function(){this.board.infobox&&this.id===this.board.infobox.id?this.needsSizeUpdate=!1:(this.needsSizeUpdate=this.plaintextOld!==this.plaintext,this.needsSizeUpdate&&(this.plaintextOld=this.plaintext))},updateRenderer:function(){return a.evaluate(this.visProp.autoposition)&&this.setAutoPosition().updateConstraint(),this.updateRendererGeneric("updateText")},expandShortMath:function(t){var e=/([\)0-9\.])\s*([\(a-zA-Z_])/g;return t.replace(e,"$1*$2")},generateTerm:function(t,e,i){var r,o,n,h,l='""';if(t=t||"",t=t.replace(/\r/g,""),t=t.replace(/\n/g,""),t=t.replace(/"/g,"'"),t=t.replace(/'/g,"\\'"),t=t.replace(/&arc;/g,"∠"),t=t.replace(//g,"∠"),t=t.replace(/<arc\s*\/>/g,"∠"),t=t.replace(/<sqrt\s*\/>/g,"√"),t=t.replace(/<value>/g,""),t=t.replace(/<\/value>/g,""),n=t.indexOf(""),h=t.indexOf(""),n>=0)for(;n>=0;)l+=' + "'+this.replaceSub(this.replaceSup(t.slice(0,n)))+'"',o=t.slice(n+7,h),o=o.replace(/\s+/g,""),!0===e&&(o=this.expandShortMath(o)),r=i?o:s.geonext2JS(o,this.board),r=r.replace(/\\"/g,"'"),r=r.replace(/\\'/g,"'"),r.indexOf("toFixed")<0&&a.isNumber(a.bind(this.board.jc.snippet(r,!0,"",!1),this)())?l+="+("+r+").toFixed("+a.evaluate(this.visProp.digits)+")":l+="+("+r+")",t=t.slice(h+8),n=t.indexOf(""),h=t.indexOf("");return l+=' + "'+this.replaceSub(this.replaceSup(t))+'"',l=this.convertGeonext2CSS(l),l=l.replace(/&/g,"&"),l=l.replace(/"/g,"'")},convertGeonext2CSS:function(t){return a.isString(t)&&(t=t.replace(//g,""),t=t.replace(/<overline>/g,""),t=t.replace(/<\/overline>/g,""),t=t.replace(/<\/overline>/g,""),t=t.replace(//g,""),t=t.replace(/<arrow>/g,""),t=t.replace(/<\/arrow>/g,""),t=t.replace(/<\/arrow>/g,"")),t},notifyParents:function(t){var e,i=null;t=t.replace(/<value>/g,""),t=t.replace(/<\/value>/g,"");do{e=/([\w\s\*\/\^\-\+\(\)\[\],<>=!]+)<\/value>/,null!==(i=e.exec(t))&&(s.findDependencies(this,i[1],this.board),t=t.substr(i.index),t=t.replace(e,""))}while(null!==i);return this},getParents:function(){var t;return t=void 0!==this.relativeCoords?[this.relativeCoords.usrCoords[1],this.relativeCoords.usrCoords[2],this.orgText]:[this.Z(),this.X(),this.Y(),this.orgText],0!==this.parents.length&&(t=this.parents),t},bounds:function(){var t=this.coords.usrCoords;return a.evaluate(this.visProp.islabel)||0===this.board.unitY||0===this.board.unitX?[0,0,0,0]:[t[1],t[2]+this.size[1]/this.board.unitY,t[1]+this.size[0]/this.board.unitX,t[2]]},getAnchorX:function(){var t=a.evaluate(this.visProp.anchorx);if("auto"==t)switch(this.visProp.position){case"top":case"bot":return"middle";case"rt":case"lrt":case"urt":return"left";case"lft":case"llft":case"ulft":default:return"right"}return t},getAnchorY:function(){var t=a.evaluate(this.visProp.anchory);if("auto"==t)switch(this.visProp.position){case"top":case"ulft":case"urt":return"bottom";case"bot":case"lrt":case"llft":return"top";case"rt":case"lft":default:return"middle"}return t},getNumberofConflicts:function(t,e,i,r){var s,o,n,a,h=0;for(a=this.board.options.precision.hasPoint,this.board.options.precision.hasPoint=.5*Math.max(i,r),s=0,n=this.board.objectsList.length;s.2?"left":"middle",this}}),t.createText=function(e,i,r){var s,o=a.copyAttributes(r,e.options,"text"),n=i.slice(0,-1),h=i[i.length-1];if(o.anchor=o.parent||o.anchor,!(s=c.create(t.Text,e,n,o,h)))throw new Error("JSXGraph: Can't create text with parent types '"+typeof i[0]+"' and '"+typeof i[1]+"'.\nPossible parent types: [x,y], [z,x,y], [element,transformation]");return 0!==o.rotate&&"internal"===o.display&&s.addRotation(o.rotate),s},t.registerElement("text",t.createText),t.createHTMLSlider=function(e,i,r){var s,o,h=a.copyAttributes(r,e.options,"htmlslider");if(2!==i.length||2!==i[0].length||3!==i[1].length)throw new Error("JSXGraph: Can't create htmlslider with parent types '"+typeof i[0]+"' and '"+typeof i[1]+"'.\nPossible parents are: [[x,y], [min, start, max]]");h.anchor=h.parent||h.anchor,h.fixed=h.fixed||!0,o=[i[0][0],i[0][1],'
'],s=t.createText(e,o,h),s.type=a.OBJECT_TYPE_HTMLSLIDER,s.rendNodeForm=s.rendNode.childNodes[0],s.rendNodeRange=s.rendNodeForm.childNodes[0],s.rendNodeRange.min=i[1][0],s.rendNodeRange.max=i[1][2],s.rendNodeRange.step=h.step,s.rendNodeRange.value=i[1][1],s.rendNodeLabel=s.rendNodeForm.childNodes[1],s.rendNodeLabel.id=s.rendNode.id+"_label",h.withlabel&&(s.rendNodeLabel.innerHTML=s.name+"="),s.rendNodeOut=s.rendNodeForm.childNodes[2],s.rendNodeOut.value=i[1][1];try{s.rendNodeForm.id=s.rendNode.id+"_form",s.rendNodeRange.id=s.rendNode.id+"_range",s.rendNodeOut.id=s.rendNode.id+"_out"}catch(e){t.debug(e)}return s.rendNodeRange.style.width=h.widthrange+"px",s.rendNodeRange.style.verticalAlign="middle",s.rendNodeOut.style.width=h.widthout+"px",s._val=i[1][1],t.supportsVML()?n.addEvent(s.rendNodeForm,"change",d.HTMLSliderInputEventHandler,s):n.addEvent(s.rendNodeForm,"input",d.HTMLSliderInputEventHandler,s),s.Value=function(){return this._val},s},t.registerElement("htmlslider",t.createHTMLSlider),{Text:t.Text,createText:t.createText,createHTMLSlider:t.createHTMLSlider}}),define("utils/uuid",["jxg"],function(t){"use strict";var e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",i=e.split("");return t.Util=t.Util||{},t.Util.genUUID=function(){var t,e,r=[],s=0;for(e=0;e<36;e++)8===e||13===e||18===e||23===e?r[e]="-":14===e?r[e]="4":(s<=2&&(s=33554432+16777216*Math.random()|0),t=15&s,s>>=4,r[e]=i[19===e?3&t|8:t]);return r.join("")},t.Util}),define("parser/jessiecode",["jxg","base/constants","base/text","math/math","math/geometry","math/statistics","utils/type","utils/uuid","utils/env"],function(JXG,Const,Text,Mat,Geometry,Statistics,Type,UUID,Env){Object.create||(Object.create=function(t,e){function i(){}if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object prototype may only be an Object: "+t);if(null===t)throw new Error("This browser's implementation of Object.create is a shim and doesn't support 'null' as the first argument.");if(void 0!==e)throw new Error("This browser's implementation of Object.create is a shim and doesn't support a second argument.");return i.prototype=t,new i});var priv={modules:{math:Mat,"math/geometry":Geometry,"math/statistics":Statistics,"math/numerics":Mat.Numerics}};JXG.JessieCode=function(t,e){this.scope={id:0,hasChild:!0,args:[],locals:{},context:null,previous:null},this.scopes=[],this.scopes.push(this.scope),this.dpstack=[[]],this.pscope=0,this.propstack=[{}],this.propscope=0,this.lhs=[],this.isLHS=!1,this.warnLog="jcwarn",this.$log=[],this.builtIn=this.defineBuiltIn(),this.board=null,this.lineToElement={},this.parCurLine=1,this.parCurColumn=0,this.line=1,this.col=1,JXG.CA&&(this.CA=new JXG.CA(this.node,this.createNode,this)),this.code="","string"==typeof t&&this.parse(t,e)},JXG.extend(JXG.JessieCode.prototype,{node:function(t,e,i){return{type:t,value:e,children:i}},createNode:function(t,e,i){var r,s=this.node(t,e,[]);for(r=2;r-1)return e;e=e.previous}return null},isCreator:function(t){return!!JXG.elements[t]},isMathMethod:function(t){return"E"!==t&&!!Math[t]},isBuiltIn:function(t){return!!this.builtIn[t]},getvar:function(t,e){var i;return e=Type.def(e,!1),i=this.isLocalVariable(t),null!==i?i.locals[t]:this.isCreator(t)?this.creator(t):this.isBuiltIn(t)?this.builtIn[t]:this.isMathMethod(t)?Math[t]:e||(i=this.board.select(t))===t?void 0:i},resolve:function(t){for(var e=this.scope;null!==e;){if(Type.exists(e.locals[t]))return e.locals[t];e=e.previous}},getvarJS:function(t,e,i){var r="";return e=Type.def(e,!1),i=Type.def(i,!1),null!==this.isParameter(t)?t:null===this.isLocalVariable(t)||i?this.isCreator(t)?"(function () { var a = Array.prototype.slice.call(arguments, 0), props = "+(i?"a.pop()":"{}")+"; return $jc$.board.create.apply($jc$.board, ['"+t+"'].concat([a, props])); })":(i&&this._error("Syntax error (attribute values are allowed with element creators only)"),this.isBuiltIn(t)?this.builtIn[t].src||this.builtIn[t]:this.isMathMethod(t)?"Math."+t:e?"":(Type.isId(this.board,t)?(r="$jc$.board.objects['"+t+"']","slider"===this.board.objects[t].elType&&(r+=".Value()")):Type.isName(this.board,t)?(r="$jc$.board.elementsByName['"+t+"']","slider"===this.board.elementsByName[t].elType&&(r+=".Value()")):Type.isGroup(this.board,t)&&(r="$jc$.board.groups['"+t+"']"),r)):"$jc$.resolve('"+t+"')"},makeMap:function(t){return t.isMap=!0,t},functionCodeJS:function(t){var e=t.children[0].join(", "),i="",r="";return"op_map"===t.value&&(i="{ return ",r=" }"),"function ("+e+") {\nvar $oldscope$ = $jc$.scope;\n$jc$.scope = $jc$.scopes["+this.scope.id+"];\nvar r = (function () "+i+this.compile(t.children[1],!0)+r+")();\n$jc$.scope = $oldscope$;\nreturn r;\n}"},defineFunction:function(node){var fun,i,list=node.children[0],scope=this.pushScope(list);if(this.board.options.jc.compile){for(this.isLHS=!1,i=0;i0;e--)Type.exists(t.children[e-1])&&(t.children[e-1]=this.replaceIDs(t.children[e-1]));return t},replaceNames:function(t){var e,i;if(i=t.value,"node_op"===t.type&&"op_lhs"===i&&1===t.children.length?this.isLHS=!0:"node_var"===t.type&&(this.isLHS?this.letvar(i,!0):!Type.exists(this.getvar(i,!0))&&Type.exists(this.board.elementsByName[i])&&(t=this.createReplacementNode(t))),t.children)for(e=t.children.length;e>0;e--)Type.exists(t.children[e-1])&&(t.children[e-1]=this.replaceNames(t.children[e-1]));return"node_op"===t.type&&"op_lhs"===t.value&&1===t.children.length&&(this.isLHS=!1),t},createReplacementNode:function(t){var e=t.value,i=this.board.elementsByName[e];return t=this.createNode("node_op","op_execfun",this.createNode("node_var","$"),[this.createNode("node_str",i.id)]),t.replaced=!0,t},collectDependencies:function(t,e){var i,r,s,o;if(Type.isArray(t))for(o=t.length,i=0;i1&&"$"===t.children[0].value&&t.children[1].length>0&&(s=t.children[1][0].value,e[s]=this.board.objects[s]),t.children)for(i=t.children.length;i>0;i--)Type.exists(t.children[i-1])&&this.collectDependencies(t.children[i-1],e)},resolveProperty:function(t,e,i){return i=Type.def(i,!1),t&&t.methodMap&&(Type.exists(t.subs)&&Type.exists(t.subs[e])?t=t.subs:Type.exists(t.methodMap[e])?e=t.methodMap[e]:(t=t.visProp,e=e.toLowerCase())),Type.isFunction(t)&&this._error("Accessing function properties is not allowed."),Type.exists(t)||this._error(t+" is not an object"),Type.exists(t[e])||this._error("unknown property "+e),i&&"function"==typeof t[e]?function(){return t[e].apply(t,arguments)}:t[e]},getLHS:function(t){var e;if("node_var"===t.type)e={o:this.scope.locals,what:t.value};else if("node_op"===t.type&&"op_property"===t.value)e={o:this.execute(t.children[0]),what:t.children[1]};else{if("node_op"!==t.type||"op_extvalue"!==t.value)throw new Error("Syntax error: Invalid left-hand side of assignment.");e={o:this.execute(t.children[0]),what:this.execute(t.children[1])}}return e},getLHSCompiler:function(t,e){var i;if("node_var"===t.type)i=t.value;else if("node_op"===t.type&&"op_property"===t.value)i=[this.compile(t.children[0],e),"'"+t.children[1]+"'"];else{if("node_op"!==t.type||"op_extvalue"!==t.value)throw new Error("Syntax error: Invalid left-hand side of assignment.");i=[this.compile(t.children[0],e),"node_const"===t.children[1].type?t.children[1].value:this.compile(t.children[1],e)]}return i},execute:function(t){var e,i,r,s,o,n,a,h,l,c,d=[];if(e=0,!t)return e;switch(this.line=t.line,this.col=t.col,t.type){case"node_op":switch(t.value){case"op_none":t.children[0]&&this.execute(t.children[0]),t.children[1]&&(e=this.execute(t.children[1]));break;case"op_assign":i=this.getLHS(t.children[0]),this.lhs[this.scope.id]=i[1],i.o.type&&i.o.elementClass&&i.o.methodMap&&"label"===i.what&&this._error("Left-hand side of assignment is read-only."),e=this.execute(t.children[1]),i.o!==this.scope.locals||Type.isArray(i.o)&&"number"==typeof i.what?this.setProp(i.o,i.what,e):this.letvar(i.what,e),this.lhs[this.scope.id]=0;break;case"op_if":this.execute(t.children[0])&&(e=this.execute(t.children[1]));break;case"op_conditional":case"op_if_else":e=this.execute(t.children[0])?this.execute(t.children[1]):this.execute(t.children[2]);break;case"op_while":for(;this.execute(t.children[0]);)this.execute(t.children[1]);break;case"op_do":do{this.execute(t.children[0])}while(this.execute(t.children[1]));break;case"op_for":for(this.execute(t.children[0]);this.execute(t.children[1]);this.execute(t.children[2]))this.execute(t.children[3]);break;case"op_proplst":t.children[0]&&this.execute(t.children[0]),t.children[1]&&this.execute(t.children[1]);break;case"op_emptyobject":e={};break;case"op_proplst_val":this.propstack.push({}),this.propscope++,this.execute(t.children[0]),e=this.propstack[this.propscope],this.propstack.pop(),this.propscope--;break;case"op_prop":this.propstack[this.propscope][t.children[0]]=this.execute(t.children[1]);break;case"op_array":for(e=[],o=t.children[0].length,r=0;rthis.execute(t.children[1]);break;case"op_lot":e=this.execute(t.children[0])=this.execute(t.children[1]);break;case"op_loe":e=this.execute(t.children[0])<=this.execute(t.children[1]);break;case"op_or":e=this.execute(t.children[0])||this.execute(t.children[1]);break;case"op_and":e=this.execute(t.children[0])&&this.execute(t.children[1]);break;case"op_not":e=!this.execute(t.children[0]);break;case"op_add":e=this.add(this.execute(t.children[0]),this.execute(t.children[1]));break;case"op_sub":e=this.sub(this.execute(t.children[0]),this.execute(t.children[1]));break;case"op_div":e=this.div(this.execute(t.children[0]),this.execute(t.children[1]));break;case"op_mod":e=this.mod(this.execute(t.children[0]),this.execute(t.children[1]),!0);break;case"op_mul":e=this.mul(this.execute(t.children[0]),this.execute(t.children[1]));break;case"op_exp":e=this.pow(this.execute(t.children[0]),this.execute(t.children[1]));break;case"op_neg":e=this.neg(this.execute(t.children[0]))}break;case"node_var":e=this.getvar(t.value);break;case"node_const":e=Number(t.value);break;case"node_const_bool":e=t.value;break;case"node_str":e=t.value.replace(/\\(.)/,"$1")}return e},compile:function(t,e){var i,r,s,o="";if(Type.exists(e)||(e=!1),!t)return o;switch(t.type){case"node_op":switch(t.value){case"op_none":t.children[0]&&(o=this.compile(t.children[0],e)),t.children[1]&&(o+=this.compile(t.children[1],e));break;case"op_assign":e?(i=this.getLHSCompiler(t.children[0],e),Type.isArray(i)?o="$jc$.setProp("+i[0]+", "+i[1]+", "+this.compile(t.children[1],e)+");\n":(this.isLocalVariable(i)!==this.scope&&(this.scope.locals[i]=!0),o="$jc$.scopes["+this.scope.id+"].locals['"+i+"'] = "+this.compile(t.children[1],e)+";\n")):(i=this.compile(t.children[0]),o=i+" = "+this.compile(t.children[1],e)+";\n");break;case"op_if":o=" if ("+this.compile(t.children[0],e)+") "+this.compile(t.children[1],e);break;case"op_if_else":o=" if ("+this.compile(t.children[0],e)+")"+this.compile(t.children[1],e),o+=" else "+this.compile(t.children[2],e);break;case"op_conditional":o="(("+this.compile(t.children[0],e)+")?("+this.compile(t.children[1],e),o+="):("+this.compile(t.children[2],e)+"))";break;case"op_while":o=" while ("+this.compile(t.children[0],e)+") {\n"+this.compile(t.children[1],e)+"}\n";break;case"op_do":o=" do {\n"+this.compile(t.children[0],e)+"} while ("+this.compile(t.children[1],e)+");\n";break;case"op_for":o=" for ("+this.compile(t.children[0],e)+"; "+this.compile(t.children[1],e)+"; "+this.compile(t.children[2],e)+") {\n"+this.compile(t.children[3],e)+"\n}\n";break;case"op_proplst":t.children[0]&&(o=this.compile(t.children[0],e)+", "),o+=this.compile(t.children[1],e);break;case"op_prop":o=t.children[0]+": "+this.compile(t.children[1],e);break;case"op_emptyobject":o=e?"{}":"<< >>";break;case"op_proplst_val":o=this.compile(t.children[0],e);break;case"op_array":for(s=[],r=0;r "+this.compile(t.children[1],e);break;case"op_function":s=t.children[0],this.pushScope(s),o=e?this.functionCodeJS(t):" function ("+s.join(", ")+") "+this.compile(t.children[1],e),this.popScope();break;case"op_execfunmath":console.log("TODO"),o="-1";break;case"op_execfun":if(t.children[2]){for(s=[],r=0;r "+this.compile(t.children[1],e)+")";break;case"op_lot":o="("+this.compile(t.children[0],e)+" < "+this.compile(t.children[1],e)+")";break;case"op_gre":o="("+this.compile(t.children[0],e)+" >= "+this.compile(t.children[1],e)+")";break;case"op_loe":o="("+this.compile(t.children[0],e)+" <= "+this.compile(t.children[1],e)+")";break;case"op_or":o="("+this.compile(t.children[0],e)+" || "+this.compile(t.children[1],e)+")";break;case"op_and":o="("+this.compile(t.children[0],e)+" && "+this.compile(t.children[1],e)+")";break;case"op_not":o="!("+this.compile(t.children[0],e)+")";break;case"op_add":o=e?"$jc$.add("+this.compile(t.children[0],e)+", "+this.compile(t.children[1],e)+")":"("+this.compile(t.children[0],e)+" + "+this.compile(t.children[1],e)+")";break;case"op_sub":o=e?"$jc$.sub("+this.compile(t.children[0],e)+", "+this.compile(t.children[1],e)+")":"("+this.compile(t.children[0],e)+" - "+this.compile(t.children[1],e)+")";break;case"op_div":o=e?"$jc$.div("+this.compile(t.children[0],e)+", "+this.compile(t.children[1],e)+")":"("+this.compile(t.children[0],e)+" / "+this.compile(t.children[1],e)+")";break;case"op_mod":o=e?"$jc$.mod("+this.compile(t.children[0],e)+", "+this.compile(t.children[1],e)+", true)":"("+this.compile(t.children[0],e)+" % "+this.compile(t.children[1],e)+")";break;case"op_mul":o=e?"$jc$.mul("+this.compile(t.children[0],e)+", "+this.compile(t.children[1],e)+")":"("+this.compile(t.children[0],e)+" * "+this.compile(t.children[1],e)+")";break;case"op_exp":o=e?"$jc$.pow("+this.compile(t.children[0],e)+", "+this.compile(t.children[1],e)+")":"("+this.compile(t.children[0],e)+"^"+this.compile(t.children[1],e)+")";break;case"op_neg":o=e?"$jc$.neg("+this.compile(t.children[0],e)+")":"(-"+this.compile(t.children[0],e)+")"}break;case"node_var":o=e?this.getvarJS(t.value,!1,t.withProps):t.value;break;case"node_const":case"node_const_bool":o=t.value;break;case"node_str":o="'"+t.value+"'"}return t.needsBrackets&&(o="{\n"+o+"}\n"),o},X:function(t){return t.X()},Y:function(t){return t.Y()},V:function(t){return t.Value()},L:function(t){return t.L()},dist:function(t,e){return Type.exists(t)&&Type.exists(t.Dist)||this._error("Error: Can't calculate distance."),t.Dist(e)},add:function(t,e){var i,r,s;if(t=Type.evalSlider(t),e=Type.evalSlider(e),Type.isArray(t)&&Type.isArray(e))for(r=Math.min(t.length,e.length),s=[],i=0;i")},_error:function(t){var e=new Error("Error("+this.line+"): "+t);throw e.line=this.line,e},_warn:function(t){"object"==typeof console?console.log("Warning("+this.line+"): "+t):Env.isBrowser&&document&&null!==document.getElementById(this.warnLog)&&(document.getElementById(this.warnLog).innerHTML+="Warning("+this.line+"): "+t+"
")},_log:function(t){"object"!=typeof window&&"object"==typeof self&&self.postMessage?self.postMessage({type:"log",msg:"Log: "+t.toString()}):console.log("Log: ",arguments)}});var parser=function(){function t(){this.yy={}}var e=function(t,e,i,r){for(i=i||{},r=t.length;r--;i[t[r]]=e);return i},i=[2,14],r=[1,13],s=[1,37],o=[1,14],n=[1,15],a=[1,21],h=[1,16],l=[1,17],c=[1,33],d=[1,18],u=[1,19],p=[1,12],f=[1,59],m=[1,60],g=[1,58],b=[1,46],v=[1,48],y=[1,49],C=[1,50],_=[1,51],P=[1,52],E=[1,53],S=[1,54],x=[1,45],O=[1,38],w=[1,39],T=[5,7,8,14,15,16,17,19,20,21,23,26,27,50,51,58,65,74,75,76,77,78,79,80,82,91,93],N=[5,7,8,12,14,15,16,17,19,20,21,23,26,27,50,51,58,65,74,75,76,77,78,79,80,82,91,93],M=[8,10,16,32,34,35,37,39,41,42,43,45,46,47,48,50,51,53,54,55,57,64,65,66,83,86],A=[2,48],R=[1,72],k=[10,16,32,34,35,37,39,41,42,43,45,46,47,48,50,51,53,54,55,57,66,83,86],L=[1,78],B=[8,10,16,32,34,35,37,41,42,43,45,46,47,48,50,51,53,54,55,57,64,65,66,83,86],Y=[1,82],D=[8,10,16,32,34,35,37,39,45,46,47,48,50,51,53,54,55,57,64,65,66,83,86],j=[1,83],I=[1,84],X=[1,85],G=[8,10,16,32,34,35,37,39,41,42,43,50,51,53,54,55,57,64,65,66,83,86],J=[1,89],U=[1,90],F=[1,91],z=[1,92],H=[1,97],V=[8,10,16,32,34,35,37,39,41,42,43,45,46,47,48,53,54,55,57,64,65,66,83,86],$=[1,103],q=[1,104],W=[8,10,16,32,34,35,37,39,41,42,43,45,46,47,48,50,51,57,64,65,66,83,86],Z=[1,105],Q=[1,106],K=[1,107],tt=[1,126],et=[1,139],it=[83,86],rt=[1,149],st=[10,66,86],ot=[8,10,16,20,32,34,35,37,39,41,42,43,45,46,47,48,50,51,53,54,55,57,64,65,66,82,83,86],nt=[1,166],at=[10,86],ht={trace:function(){},yy:{},symbols_:{error:2,Program:3,StatementList:4,EOF:5,IfStatement:6,IF:7,"(":8,Expression:9,")":10,Statement:11,ELSE:12,LoopStatement:13,WHILE:14,FOR:15,";":16,DO:17,UnaryStatement:18,USE:19,IDENTIFIER:20,DELETE:21,ReturnStatement:22,RETURN:23,EmptyStatement:24,StatementBlock:25,"{":26,"}":27,ExpressionStatement:28,AssignmentExpression:29,ConditionalExpression:30,LeftHandSideExpression:31,"=":32,LogicalORExpression:33,"?":34,":":35,LogicalANDExpression:36,"||":37,EqualityExpression:38,"&&":39,RelationalExpression:40,"==":41,"!=":42,"~=":43,AdditiveExpression:44,"<":45,">":46,"<=":47,">=":48,MultiplicativeExpression:49,"+":50,"-":51,UnaryExpression:52,"*":53,"/":54,"%":55,ExponentExpression:56,"^":57,"!":58,MemberExpression:59,CallExpression:60,PrimaryExpression:61,FunctionExpression:62,MapExpression:63,".":64,"[":65,"]":66,BasicLiteral:67,ObjectLiteral:68,ArrayLiteral:69,NullLiteral:70,BooleanLiteral:71,StringLiteral:72,NumberLiteral:73,NULL:74,TRUE:75,FALSE:76,STRING:77,NUMBER:78,NAN:79,INFINITY:80,ElementList:81,"<<":82,">>":83,PropertyList:84,Property:85,",":86,PropertyName:87,Arguments:88,AttributeList:89,Attribute:90,FUNCTION:91,ParameterDefinitionList:92,MAP:93,"->":94,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",7:"IF",8:"(",10:")",12:"ELSE",14:"WHILE",15:"FOR",16:";",17:"DO",19:"USE",20:"IDENTIFIER",21:"DELETE",23:"RETURN",26:"{",27:"}",32:"=",34:"?",35:":",37:"||",39:"&&",41:"==",42:"!=",43:"~=",45:"<",46:">",47:"<=",48:">=",50:"+",51:"-",53:"*",54:"/",55:"%",57:"^",58:"!",64:".",65:"[",66:"]",74:"NULL",75:"TRUE",76:"FALSE",77:"STRING",78:"NUMBER",79:"NAN",80:"INFINITY",82:"<<",83:">>",86:",",91:"FUNCTION",93:"MAP",94:"->"},productions_:[0,[3,2],[6,5],[6,7],[13,5],[13,9],[13,7],[18,2],[18,2],[22,2],[22,3],[24,1],[25,3],[4,2],[4,0],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[28,2],[9,1],[29,1],[29,3],[30,1],[30,5],[33,1],[33,3],[36,1],[36,3],[38,1],[38,3],[38,3],[38,3],[40,1],[40,3],[40,3],[40,3],[40,3],[44,1],[44,3],[44,3],[49,1],[49,3],[49,3],[49,3],[56,1],[56,3],[52,1],[52,2],[52,2],[52,2],[31,1],[31,1],[59,1],[59,1],[59,1],[59,3],[59,4],[61,1],[61,1],[61,1],[61,1],[61,3],[67,1],[67,1],[67,1],[67,1],[70,1],[71,1],[71,1],[72,1],[73,1],[73,1],[73,1],[69,2],[69,3],[68,2],[68,3],[84,1],[84,3],[85,3],[87,1],[87,1],[87,1],[60,2],[60,3],[60,2],[60,4],[60,3],[88,2],[88,3],[89,1],[89,3],[90,1],[90,1],[81,1],[81,3],[62,4],[62,5],[63,6],[92,1],[92,3]],performAction:function(t,e,i,r,s,o,n){var a=o.length-1;switch(s){case 1:return o[a-1];case 2:this.$=lt.createNode(ct(n[a-4]),"node_op","op_if",o[a-2],o[a]);break;case 3:this.$=lt.createNode(ct(n[a-6]),"node_op","op_if_else",o[a-4],o[a-2],o[a]);break;case 4:this.$=lt.createNode(ct(n[a-4]),"node_op","op_while",o[a-2],o[a]);break;case 5:this.$=lt.createNode(ct(n[a-8]),"node_op","op_for",o[a-6],o[a-4],o[a-2],o[a]);break;case 6:this.$=lt.createNode(ct(n[a-6]),"node_op","op_do",o[a-5],o[a-2]);break;case 7:this.$=lt.createNode(ct(n[a-1]),"node_op","op_use",o[a]);break;case 8:this.$=lt.createNode(ct(n[a-1]),"node_op","op_delete",o[a]);break;case 9:this.$=lt.createNode(ct(n[a-1]),"node_op","op_return",void 0);break;case 10:this.$=lt.createNode(ct(n[a-2]),"node_op","op_return",o[a-1]);break;case 11:case 14:this.$=lt.createNode(ct(n[a]),"node_op","op_none");break;case 12:this.$=o[a-1],this.$.needsBrackets=!0;break;case 13:this.$=lt.createNode(ct(n[a-1]),"node_op","op_none",o[a-1],o[a]);break;case 15:case 16:case 17:case 18:case 19:case 20:case 21:case 23:case 24:case 26:case 28:case 30:case 32:case 36:case 41:case 44:case 48:case 50:case 52:case 54:case 55:case 56:case 58:case 62:case 81:case 84:case 85:case 86:this.$=o[a];break;case 22:case 65:case 93:this.$=o[a-1];break;case 25:this.$=lt.createNode(ct(n[a-2]),"node_op","op_assign",o[a-2],o[a]),this.$.isMath=!1;break;case 27:this.$=lt.createNode(ct(n[a-4]),"node_op","op_conditional",o[a-4],o[a-2],o[a]),this.$.isMath=!1;break;case 29:this.$=lt.createNode(ct(n[a-2]),"node_op","op_or",o[a-2],o[a]),this.$.isMath=!1;break;case 31:this.$=lt.createNode(ct(n[a-2]),"node_op","op_and",o[a-2],o[a]),this.$.isMath=!1;break;case 33:this.$=lt.createNode(ct(n[a-2]),"node_op","op_equ",o[a-2],o[a]),this.$.isMath=!1;break;case 34:this.$=lt.createNode(ct(n[a-2]),"node_op","op_neq",o[a-2],o[a]),this.$.isMath=!1;break;case 35:this.$=lt.createNode(ct(n[a-2]),"node_op","op_approx",o[a-2],o[a]),this.$.isMath=!1;break;case 37:this.$=lt.createNode(ct(n[a-2]),"node_op","op_lot",o[a-2],o[a]),this.$.isMath=!1;break;case 38:this.$=lt.createNode(ct(n[a-2]),"node_op","op_grt",o[a-2],o[a]),this.$.isMath=!1;break;case 39:this.$=lt.createNode(ct(n[a-2]),"node_op","op_loe",o[a-2],o[a]),this.$.isMath=!1;break;case 40:this.$=lt.createNode(ct(n[a-2]),"node_op","op_gre",o[a-2],o[a]),this.$.isMath=!1;break;case 42:this.$=lt.createNode(ct(n[a-2]),"node_op","op_add",o[a-2],o[a]),this.$.isMath=!0;break;case 43:this.$=lt.createNode(ct(n[a-2]),"node_op","op_sub",o[a-2],o[a]),this.$.isMath=!0;break;case 45:this.$=lt.createNode(ct(n[a-2]),"node_op","op_mul",o[a-2],o[a]),this.$.isMath=!0;break;case 46:this.$=lt.createNode(ct(n[a-2]),"node_op","op_div",o[a-2],o[a]),this.$.isMath=!0;break;case 47:this.$=lt.createNode(ct(n[a-2]),"node_op","op_mod",o[a-2],o[a]),this.$.isMath=!0;break;case 49:this.$=lt.createNode(ct(n[a-2]),"node_op","op_exp",o[a-2],o[a]),this.$.isMath=!0;break;case 51:this.$=lt.createNode(ct(n[a-1]),"node_op","op_not",o[a]),this.$.isMath=!1;break;case 53:this.$=lt.createNode(ct(n[a-1]),"node_op","op_neg",o[a]),this.$.isMath=!0;break;case 57:case 63:case 64:case 66:case 67:case 68:case 97:this.$=o[a],this.$.isMath=!1;break;case 59:case 91:this.$=lt.createNode(ct(n[a-2]),"node_op","op_property",o[a-2],o[a]),this.$.isMath=!0;break;case 60:case 90:this.$=lt.createNode(ct(n[a-3]),"node_op","op_extvalue",o[a-3],o[a-1]),this.$.isMath=!0;break;case 61:this.$=lt.createNode(ct(n[a]),"node_var",o[a]);break;case 69:this.$=o[a],this.$.isMath=!0;break;case 70:this.$=lt.createNode(ct(n[a]),"node_const",null);break;case 71:this.$=lt.createNode(ct(n[a]),"node_const_bool",!0);break;case 72:this.$=lt.createNode(ct(n[a]),"node_const_bool",!1);break;case 73:this.$=lt.createNode(ct(n[a]),"node_str",o[a].substring(1,o[a].length-1));break;case 74:this.$=lt.createNode(ct(n[a]),"node_const",parseFloat(o[a]));break;case 75:this.$=lt.createNode(ct(n[a]),"node_const",NaN);break;case 76:this.$=lt.createNode(ct(n[a]),"node_const",1/0);break;case 77:this.$=lt.createNode(ct(n[a-1]),"node_op","op_array",[]);break;case 78:this.$=lt.createNode(ct(n[a-2]),"node_op","op_array",o[a-1]);break;case 79:this.$=lt.createNode(ct(n[a-1]),"node_op","op_emptyobject",{});break;case 80:this.$=lt.createNode(ct(n[a-2]),"node_op","op_proplst_val",o[a-1]);break;case 82:this.$=lt.createNode(ct(n[a-2]),"node_op","op_proplst",o[a-2],o[a]);break;case 83:this.$=lt.createNode(ct(n[a-2]),"node_op","op_prop",o[a-2],o[a]);break;case 87:case 89:this.$=lt.createNode(ct(n[a-1]),"node_op","op_execfun",o[a-1],o[a]), +this.$.isMath=!0;break;case 88:this.$=lt.createNode(ct(n[a-2]),"node_op","op_execfun",o[a-2],o[a-1],o[a],!0),this.$.isMath=!1;break;case 92:this.$=[];break;case 94:case 98:case 103:this.$=[o[a]];break;case 95:case 99:case 104:this.$=o[a-2].concat(o[a]);break;case 96:this.$=lt.createNode(ct(n[a]),"node_var",o[a]),this.$.isMath=!0;break;case 100:this.$=lt.createNode(ct(n[a-3]),"node_op","op_function",[],o[a]),this.$.isMath=!1;break;case 101:this.$=lt.createNode(ct(n[a-4]),"node_op","op_function",o[a-2],o[a]),this.$.isMath=!1;break;case 102:this.$=lt.createNode(ct(n[a-5]),"node_op","op_map",o[a-3],o[a])}},table:[e([5,7,8,14,15,16,17,19,20,21,23,26,50,51,58,65,74,75,76,77,78,79,80,82,91,93],i,{3:1,4:2}),{1:[3]},{5:[1,3],6:6,7:r,8:s,9:20,11:4,13:7,14:o,15:n,16:a,17:h,18:8,19:l,20:c,21:d,22:9,23:u,24:11,25:5,26:p,28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{1:[2,1]},e(T,[2,13]),e(N,[2,15]),e(N,[2,16]),e(N,[2,17]),e(N,[2,18]),e(N,[2,19]),e(N,[2,20]),e(N,[2,21]),e([7,8,14,15,16,17,19,20,21,23,26,27,50,51,58,65,74,75,76,77,78,79,80,82,91,93],i,{4:61}),{8:[1,62]},{8:[1,63]},{8:[1,64]},{6:6,7:r,8:s,9:20,11:65,13:7,14:o,15:n,16:a,17:h,18:8,19:l,20:c,21:d,22:9,23:u,24:11,25:5,26:p,28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{20:[1,66]},{20:[1,67]},{8:s,9:69,16:[1,68],20:c,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{16:[1,70]},e(N,[2,11]),e(M,[2,23]),e(M,[2,24]),e([8,10,16,34,35,37,39,41,42,43,45,46,47,48,50,51,53,54,55,64,65,66,83,86],A,{32:[1,71],57:R}),e([8,10,16,32,35,39,41,42,43,45,46,47,48,50,51,53,54,55,57,64,65,66,83,86],[2,26],{34:[1,73],37:[1,74]}),e(k,[2,54],{88:77,8:L,64:[1,75],65:[1,76]}),e(k,[2,55],{88:79,8:L,64:[1,81],65:[1,80]}),e(B,[2,28],{39:Y}),e(M,[2,56]),e(M,[2,57]),e(M,[2,58]),e(D,[2,30],{41:j,42:I,43:X}),e(M,[2,61]),e(M,[2,62]),e(M,[2,63]),e(M,[2,64]),{8:s,9:86,20:c,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{8:[1,87]},{8:[1,88]},e(G,[2,32],{45:J,46:U,47:F,48:z}),e(M,[2,66]),e(M,[2,67]),e(M,[2,68]),e(M,[2,69]),{20:H,72:98,73:99,77:_,78:P,79:E,80:S,83:[1,93],84:94,85:95,87:96},{8:s,20:c,29:102,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,66:[1,100],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,81:101,82:x,91:O,93:w},e(V,[2,36],{50:$,51:q}),e(M,[2,70]),e(M,[2,71]),e(M,[2,72]),e(M,[2,73]),e(M,[2,74]),e(M,[2,75]),e(M,[2,76]),e(W,[2,41],{53:Z,54:Q,55:K}),e(M,[2,44]),e(M,[2,50]),{8:s,20:c,31:109,50:f,51:m,52:108,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{8:s,20:c,31:109,50:f,51:m,52:110,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{8:s,20:c,31:109,50:f,51:m,52:111,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{6:6,7:r,8:s,9:20,11:4,13:7,14:o,15:n,16:a,17:h,18:8,19:l,20:c,21:d,22:9,23:u,24:11,25:5,26:p,27:[1,112],28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{8:s,9:113,20:c,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{8:s,9:114,20:c,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{8:s,9:115,20:c,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{14:[1,116]},e(N,[2,7]),e(N,[2,8]),e(N,[2,9]),{16:[1,117]},e(N,[2,22]),{8:s,20:c,29:118,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{8:s,20:c,31:109,50:f,51:m,52:119,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{8:s,20:c,29:120,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{8:s,20:c,31:109,36:121,38:32,40:40,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{20:[1,122]},{8:s,9:123,20:c,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},e(M,[2,87],{89:124,90:125,68:127,20:tt,82:x}),{8:s,10:[1,128],20:c,29:102,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,81:129,82:x,91:O,93:w},e(M,[2,89]),{8:s,9:130,20:c,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{20:[1,131]},{8:s,20:c,31:109,38:132,40:40,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{8:s,20:c,31:109,40:133,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{8:s,20:c,31:109,40:134,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{8:s,20:c,31:109,40:135,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{10:[1,136]},{10:[1,137],20:et,92:138},{20:et,92:140},{8:s,20:c,31:109,44:141,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{8:s,20:c,31:109,44:142,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{8:s,20:c,31:109,44:143,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{8:s,20:c,31:109,44:144,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},e(M,[2,79]),{83:[1,145],86:[1,146]},e(it,[2,81]),{35:[1,147]},{35:[2,84]},{35:[2,85]},{35:[2,86]},e(M,[2,77]),{66:[1,148],86:rt},e(st,[2,98]),{8:s,20:c,31:109,49:150,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{8:s,20:c,31:109,49:151,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{8:s,20:c,31:109,50:f,51:m,52:152,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{8:s,20:c,31:109,50:f,51:m,52:153,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{8:s,20:c,31:109,50:f,51:m,52:154,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},e(M,[2,51]),e([8,10,16,32,34,35,37,39,41,42,43,45,46,47,48,50,51,53,54,55,64,65,66,83,86],A,{57:R}),e(M,[2,52]),e(M,[2,53]),e([5,7,8,10,12,14,15,16,17,19,20,21,23,26,27,32,34,35,37,39,41,42,43,45,46,47,48,50,51,53,54,55,57,58,64,65,66,74,75,76,77,78,79,80,82,83,86,91,93],[2,12]),{10:[1,155]},{10:[1,156]},{16:[1,157]},{8:[1,158]},e(N,[2,10]),e(M,[2,25]),e(M,[2,49]),{35:[1,159]},e(B,[2,29],{39:Y}),e(M,[2,59]),{66:[1,160]},e([8,10,16,32,34,35,37,39,41,42,43,45,46,47,48,50,51,53,54,55,57,64,65,66,83],[2,88],{86:[1,161]}),e(M,[2,94]),e(M,[2,96]),e(M,[2,97]),e(ot,[2,92]),{10:[1,162],86:rt},{66:[1,163]},e(M,[2,91]),e(D,[2,31],{41:j,42:I,43:X}),e(G,[2,33],{45:J,46:U,47:F,48:z}),e(G,[2,34],{45:J,46:U,47:F,48:z}),e(G,[2,35],{45:J,46:U,47:F,48:z}),e(M,[2,65]),{25:164,26:p},{10:[1,165],86:nt},e(at,[2,103]),{10:[1,167],86:nt},e(V,[2,37],{50:$,51:q}),e(V,[2,38],{50:$,51:q}),e(V,[2,39],{50:$,51:q}),e(V,[2,40],{50:$,51:q}),e(M,[2,80]),{20:H,72:98,73:99,77:_,78:P,79:E,80:S,85:168,87:96},{8:s,20:c,29:169,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},e(M,[2,78]),{8:s,20:c,29:170,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},e(W,[2,42],{53:Z,54:Q,55:K}),e(W,[2,43],{53:Z,54:Q,55:K}),e(M,[2,45]),e(M,[2,46]),e(M,[2,47]),{6:6,7:r,8:s,9:20,11:171,13:7,14:o,15:n,16:a,17:h,18:8,19:l,20:c,21:d,22:9,23:u,24:11,25:5,26:p,28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{6:6,7:r,8:s,9:20,11:172,13:7,14:o,15:n,16:a,17:h,18:8,19:l,20:c,21:d,22:9,23:u,24:11,25:5,26:p,28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{8:s,9:173,20:c,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{8:s,9:174,20:c,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{8:s,20:c,29:175,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},e(M,[2,60]),{20:tt,68:127,82:x,90:176},e(ot,[2,93]),e(M,[2,90]),e(M,[2,100]),{25:177,26:p},{20:[1,178]},{94:[1,179]},e(it,[2,82]),e(it,[2,83]),e(st,[2,99]),e(T,[2,2],{12:[1,180]}),e(N,[2,4]),{16:[1,181]},{10:[1,182]},e(M,[2,27]),e(M,[2,95]),e(M,[2,101]),e(at,[2,104]),{8:s,9:183,20:c,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{6:6,7:r,8:s,9:20,11:184,13:7,14:o,15:n,16:a,17:h,18:8,19:l,20:c,21:d,22:9,23:u,24:11,25:5,26:p,28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{8:s,9:185,20:c,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{16:[1,186]},e(M,[2,102]),e(N,[2,3]),{10:[1,187]},e(N,[2,6]),{6:6,7:r,8:s,9:20,11:188,13:7,14:o,15:n,16:a,17:h,18:8,19:l,20:c,21:d,22:9,23:u,24:11,25:5,26:p,28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},e(N,[2,5])],defaultActions:{3:[2,1],97:[2,84],98:[2,85],99:[2,86]},parseError:function(t,e){if(!e.recoverable){var i=new Error(t);throw i.hash=e,i}this.trace(t)},parse:function(t){var e=this,i=[0],r=[null],s=[],o=this.table,n="",a=0,h=0,l=0,c=s.slice.call(arguments,1),d=Object.create(this.lexer),u={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(u.yy[p]=this.yy[p]);d.setInput(t,u.yy),u.yy.lexer=d,u.yy.parser=this,void 0===d.yylloc&&(d.yylloc={});var f=d.yylloc;s.push(f);var m=d.options&&d.options.ranges;"function"==typeof u.yy.parseError?this.parseError=u.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var g,b,v,y,C,_,P,E,S,x=function(){var t;return t=d.lex()||1,"number"!=typeof t&&(t=e.symbols_[t]||t),t},O={};;){if(v=i[i.length-1],this.defaultActions[v]?y=this.defaultActions[v]:(null!==g&&void 0!==g||(g=x()),y=o[v]&&o[v][g]),void 0===y||!y.length||!y[0]){var w="";S=[];for(_ in o[v])this.terminals_[_]&&_>2&&S.push("'"+this.terminals_[_]+"'");w=d.showPosition?"Parse error on line "+(a+1)+":\n"+d.showPosition()+"\nExpecting "+S.join(", ")+", got '"+(this.terminals_[g]||g)+"'":"Parse error on line "+(a+1)+": Unexpected "+(1==g?"end of input":"'"+(this.terminals_[g]||g)+"'"),this.parseError(w,{text:d.match,token:this.terminals_[g]||g,line:d.yylineno,loc:f,expected:S})}if(y[0]instanceof Array&&y.length>1)throw new Error("Parse Error: multiple actions possible at state: "+v+", token: "+g);switch(y[0]){case 1:i.push(g),r.push(d.yytext),s.push(d.yylloc),i.push(y[1]),g=null,b?(g=b,b=null):(h=d.yyleng,n=d.yytext,a=d.yylineno,f=d.yylloc,l>0&&l--);break;case 2:if(P=this.productions_[y[1]][1],O.$=r[r.length-P],O._$={first_line:s[s.length-(P||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-(P||1)].first_column,last_column:s[s.length-1].last_column},m&&(O._$.range=[s[s.length-(P||1)].range[0],s[s.length-1].range[1]]),void 0!==(C=this.performAction.apply(O,[n,h,a,u.yy,y[1],r,s].concat(c))))return C;P&&(i=i.slice(0,-1*P*2),r=r.slice(0,-1*P),s=s.slice(0,-1*P)),i.push(this.productions_[y[1]][0]),r.push(O.$),s.push(O._$),E=o[i[i.length-2]][i[i.length-1]],i.push(E);break;case 3:return!0}}return!0}},lt={node:function(t,e,i){return{type:t,value:e,children:i}},createNode:function(t,e,i,r){var s,o=this.node(e,i,[]);for(s=3;s20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var i,r,s;if(this.options.backtrack_lexer&&(s={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(s.yylloc.range=this.yylloc.range.slice(0))),r=t[0].match(/(?:\r\n?|\n).*/g),r&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],i=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),i)return i;if(this._backtrack){for(var o in s)this[o]=s[o];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var t,e,i,r;this._more||(this.yytext="",this.match="");for(var s=this._currentRules(),o=0;oe[0].length)){if(e=i,r=o,this.options.backtrack_lexer){if(!1!==(t=this.test_match(i,s[o])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,s[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return t=this.conditionStack.length-1-Math.abs(t||0),t>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(t,e,i,r){switch(i){case 0:break;case 1:case 2:return 78;case 3:case 4:return 77;case 5:case 6:break;case 7:return 7;case 8:return 12;case 9:return 14;case 10:return 17;case 11:return 15;case 12:return 91;case 13:return 93;case 14:return 19;case 15:return 23;case 16:return 21;case 17:return 75;case 18:return 76;case 19:return 74;case 20:return 80;case 21:return 94;case 22:return 82;case 23:return 83;case 24:return 26;case 25:return 27;case 26:return 16;case 27:return"#";case 28:return 34;case 29:return 35;case 30:return 79;case 31:return 64;case 32:return 65;case 33:return 66;case 34:return 8;case 35:return 10;case 36:return 58;case 37:return 57;case 38:return 53;case 39:return 54;case 40:return 55;case 41:return 50;case 42:return 51;case 43:return 47;case 44:return 45;case 45:return 48;case 46:return 46;case 47:return 41;case 48:return 43;case 49:return 42;case 50:return 39;case 51:return 37;case 52:return 32;case 53:return 86;case 54:return 5;case 55:return 20;case 56:return"INVALID"}},rules:[/^(?:\s+)/,/^(?:[0-9]+\.[0-9]*|[0-9]*\.[0-9]+\b)/,/^(?:[0-9]+)/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:\/\/.*)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:if\b)/,/^(?:else\b)/,/^(?:while\b)/,/^(?:do\b)/,/^(?:for\b)/,/^(?:function\b)/,/^(?:map\b)/,/^(?:use\b)/,/^(?:return\b)/,/^(?:delete\b)/,/^(?:true\b)/,/^(?:false\b)/,/^(?:null\b)/,/^(?:Infinity\b)/,/^(?:->)/,/^(?:<<)/,/^(?:>>)/,/^(?:\{)/,/^(?:\})/,/^(?:;)/,/^(?:#)/,/^(?:\?)/,/^(?::)/,/^(?:NaN\b)/,/^(?:\.)/,/^(?:\[)/,/^(?:\])/,/^(?:\()/,/^(?:\))/,/^(?:!)/,/^(?:\^)/,/^(?:\*)/,/^(?:\/)/,/^(?:%)/,/^(?:\+)/,/^(?:-)/,/^(?:<=)/,/^(?:<)/,/^(?:>=)/,/^(?:>)/,/^(?:==)/,/^(?:~=)/,/^(?:!=)/,/^(?:&&)/,/^(?:\|\|)/,/^(?:=)/,/^(?:,)/,/^(?:$)/,/^(?:[A-Za-z_\$][A-Za-z0-9_]*)/,/^(?:.)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56],inclusive:!0}}}}();return ht.lexer=dt,t.prototype=ht,ht.Parser=t,new t}();return void 0!==require&&"undefined"!=typeof exports&&(exports.parser=parser,exports.Parser=parser.Parser,exports.parse=function(){return parser.parse.apply(parser,arguments)},exports.main=function(t){t[1]||(console.log("Usage: "+t[0]+" FILE"),process.exit(1));var e=require("fs").readFileSync(require("path").normalize(t[1]),"utf8");return exports.parser.parse(e)},"undefined"!=typeof module&&require.main===module&&exports.main(process.argv.slice(1))),parser.yy.parseError=parser.parseError,JXG.JessieCode}),define("base/point",["jxg","options","math/math","math/geometry","math/numerics","base/coords","base/constants","base/element","parser/geonext","utils/type","base/transformation","base/coordselement"],function(t,e,i,r,s,o,n,a,h,l,c,d){"use strict";return t.Point=function(t,e,i){this.constructor(t,i,n.OBJECT_TYPE_POINT,n.OBJECT_CLASS_POINT),this.element=this.board.select(i.anchor),this.coordsConstructor(e),this.elType="point",this.id=this.board.setId(this,"P"),this.board.renderer.drawPoint(this),this.board.finalizeAdding(this),this.createLabel()},t.Point.prototype=new a,l.copyPrototypeMethods(t.Point,d,"coordsConstructor"),t.extend(t.Point.prototype,{hasPoint:function(t,e){var i,r=this.coords.scrCoords,s=l.evaluate(this.visProp.sizeunit);return i=parseFloat(l.evaluate(this.visProp.size)),"user"===s&&(i*=Math.sqrt(this.board.unitX*this.board.unitY)),i+=.5*parseFloat(l.evaluate(this.visProp.strokewidth)),ii.eps||Math.abs(c.Y()-t.usrCoords[2])>i.eps||Math.abs(c.Z()-t.usrCoords[0])>i.eps?t:r.meet(a.stdform,h.stdform,1,a.board)}],s),o.type=n.OBJECT_TYPE_INTERSECTION,o.elType="otherintersection",o.setParents([a.id,h.id,c]),a.addChild(o),h.addChild(o),o.generatePolynomial=function(){var t=a.generatePolynomial(o),e=h.generatePolynomial(o);return 0===t.length||0===e.length?[]:[t[0],e[0]]},o},t.createPolePoint=function(e,i,r){var s,o,a,h,l,c,d;if(i.length>1&&(h=i[0].type===n.OBJECT_TYPE_CONIC||i[0].elementClass===n.OBJECT_CLASS_CIRCLE,l=i[1].type===n.OBJECT_TYPE_CONIC||i[1].elementClass===n.OBJECT_CLASS_CIRCLE,c=i[0].elementClass===n.OBJECT_CLASS_LINE,d=i[1].elementClass===n.OBJECT_CLASS_LINE),2!==i.length||!(h&&d||c&&l))throw new Error("JSXGraph: Can't create 'pole point' with parent types '"+typeof i[0]+"' and '"+typeof i[1]+"'.\nPossible parent type: [conic|circle,line], [line,conic|circle]");return d?(o=e.select(i[0]),a=e.select(i[1])):(o=e.select(i[1]),a=e.select(i[0])),s=e.create("point",[function(){var e=o.quadraticform,i=a.stdform.slice(0,3);return[t.Math.Numerics.det([i,e[1],e[2]]),t.Math.Numerics.det([e[0],i,e[2]]),t.Math.Numerics.det([e[0],e[1],i])]}],r),s.elType="polepoint",s.setParents([o.id,a.id]),o.addChild(s),a.addChild(s),s},t.registerElement("point",t.createPoint),t.registerElement("glider",t.createGlider),t.registerElement("intersection",t.createIntersectionPoint),t.registerElement("otherintersection",t.createOtherIntersectionPoint),t.registerElement("polepoint",t.createPolePoint),{Point:t.Point,createPoint:t.createPoint,createGlider:t.createGlider,createIntersection:t.createIntersectionPoint,createOtherIntersection:t.createOtherIntersectionPoint,createPolePoint:t.createPolePoint}}),define("base/line",["jxg","math/math","math/geometry","math/numerics","math/statistics","base/constants","base/coords","base/element","utils/type","base/point"],function(t,e,i,r,s,o,n,a,h,l){"use strict";return t.Line=function(e,i,r,s){this.constructor(e,s,o.OBJECT_TYPE_LINE,o.OBJECT_CLASS_LINE),this.point1=this.board.select(i),this.point2=this.board.select(r),this.ticks=[],this.defaultTicks=null,this.parentPolygon=null,this.id=this.board.setId(this,"L"),this.board.renderer.drawLine(this),this.board.finalizeAdding(this),this.elType="line",this.point1.addChild(this),this.point2.addChild(this),this.inherits.push(this.point1,this.point2),this.updateStdform(),this.createLabel(),this.methodMap=t.deepCopy(this.methodMap,{point1:"point1",point2:"point2",getSlope:"getSlope",getRise:"getRise",getYIntersect:"getRise",getAngle:"getAngle",L:"L",length:"L",addTicks:"addTicks",removeTicks:"removeTicks",removeAllTicks:"removeAllTicks"})},t.Line.prototype=new a,t.extend(t.Line.prototype,{hasPoint:function(t,r){var s,a,l,c,d,u,p,f,m=[],g=[1,t,r],b=h.evaluate(this.visProp.strokewidth);return f=this.board.options.precision.hasPoint+.5*b,m[0]=this.stdform[0]-this.stdform[1]*this.board.origin.scrCoords[1]/this.board.unitX+this.stdform[2]*this.board.origin.scrCoords[2]/this.board.unitY,m[1]=this.stdform[1]/this.board.unitX,m[2]=this.stdform[2]/-this.board.unitY,s=i.distPointLine(g,m),!(isNaN(s)||s>f)&&(!(!h.evaluate(this.visProp.straightfirst)||!h.evaluate(this.visProp.straightlast))||(l=this.point1.coords,c=this.point2.coords,a=[0,m[1],m[2]],a=e.crossProduct(a,g),a=e.crossProduct(a,m),a[1]/=a[0],a[2]/=a[0],a[0]=1,a=new n(o.COORDS_BY_SCREEN,a.slice(1),this.board).usrCoords,d=l.distance(o.COORDS_BY_USER,c),l=l.usrCoords.slice(0),c=c.usrCoords.slice(0),d1)))},update:function(){var t;return this.needsUpdate?(this.constrained&&(h.isFunction(this.funps)?(t=this.funps())&&t.length&&2===t.length&&(this.point1=t[0],this.point2=t[1]):(h.isFunction(this.funp1)&&(t=this.funp1(),h.isPoint(t)?this.point1=t:t&&t.length&&2===t.length&&this.point1.setPositionDirectly(o.COORDS_BY_USER,t)),h.isFunction(this.funp2)&&(t=this.funp2(),h.isPoint(t)?this.point2=t:t&&t.length&&2===t.length&&this.point2.setPositionDirectly(o.COORDS_BY_USER,t)))),this.updateSegmentFixedLength(),this.updateStdform(),h.evaluate(this.visProp.trace)&&this.cloneToBackground(!0),this):this},updateSegmentFixedLength:function(){var t,i,r,s,n,a,l,c;return this.hasFixedLength?(t=this.point1.Dist(this.point2),i=this.fixedLength(),r=this.fixedLengthOldCoords[0].distance(o.COORDS_BY_USER,this.point1.coords),s=this.fixedLengthOldCoords[1].distance(o.COORDS_BY_USER,this.point2.coords),(r>e.eps||s>e.eps||t!==i)&&(n=this.point1.isDraggable&&this.point1.type!==o.OBJECT_TYPE_GLIDER&&!h.evaluate(this.point1.visProp.fixed),a=this.point2.isDraggable&&this.point2.type!==o.OBJECT_TYPE_GLIDER&&!h.evaluate(this.point2.visProp.fixed),t>e.eps?r>s&&a||r<=s&&a&&!n?(this.point2.setPositionDirectly(o.COORDS_BY_USER,[this.point1.X()+(this.point2.X()-this.point1.X())*i/t,this.point1.Y()+(this.point2.Y()-this.point1.Y())*i/t]),this.point2.fullUpdate()):(r<=s&&n||r>s&&n&&!a)&&(this.point1.setPositionDirectly(o.COORDS_BY_USER,[this.point2.X()+(this.point1.X()-this.point2.X())*i/t,this.point2.Y()+(this.point1.Y()-this.point2.Y())*i/t]),this.point1.fullUpdate()):(l=Math.random()-.5,c=Math.random()-.5,t=Math.sqrt(l*l+c*c),a?(this.point2.setPositionDirectly(o.COORDS_BY_USER,[this.point1.X()+l*i/t,this.point1.Y()+c*i/t]),this.point2.fullUpdate()):n&&(this.point1.setPositionDirectly(o.COORDS_BY_USER,[this.point2.X()+l*i/t,this.point2.Y()+c*i/t]),this.point1.fullUpdate())),this.fixedLengthOldCoords[0].setCoordinates(o.COORDS_BY_USER,this.point1.coords.usrCoords),this.fixedLengthOldCoords[1].setCoordinates(o.COORDS_BY_USER,this.point2.coords.usrCoords)),this):this},updateStdform:function(){var t=e.crossProduct(this.point1.coords.usrCoords,this.point2.coords.usrCoords);this.stdform[0]=t[0],this.stdform[1]=t[1],this.stdform[2]=t[2],this.stdform[3]=0,this.normalize()},updateRenderer:function(){return this.needsUpdate?(this.visPropCalc.visible&&(this.isReal=!isNaN(this.point1.coords.usrCoords[1]+this.point1.coords.usrCoords[2]+this.point2.coords.usrCoords[1]+this.point2.coords.usrCoords[2])&&e.innerProduct(this.stdform,this.stdform,3)>=e.eps*e.eps,this.isReal||this.updateVisibility(!1)),this.visPropCalc.visible&&this.board.renderer.updateLine(this),this.hasLabel&&this.visPropCalc.visible&&this.label&&this.label.visPropCalc.visible&&this.isReal&&(this.label.update(),this.board.renderer.updateText(this.label)),this.setDisplayRendNode(),this.needsUpdate=!1,this):this},generatePolynomial:function(t){var e=this.point1.symbolic.x,i=this.point1.symbolic.y,r=this.point2.symbolic.x,s=this.point2.symbolic.y,o=t.symbolic.x,n=t.symbolic.y;return[["(",i,")*(",o,")-(",i,")*(",r,")+(",n,")*(",r,")-(",e,")*(",n,")+(",e,")*(",s,")-(",o,")*(",s,")"].join("")]},getRise:function(){return Math.abs(this.stdform[2])>=e.eps?-this.stdform[0]/this.stdform[2]:1/0},getSlope:function(){return Math.abs(this.stdform[2])>=e.eps?-this.stdform[1]/this.stdform[2]:1/0},getAngle:function(){return Math.atan2(-this.stdform[1],this.stdform[2])},setStraight:function(t,e){return this.visProp.straightfirst=t,this.visProp.straightlast=e,this.board.renderer.updateLine(this),this},getTextAnchor:function(){return new n(o.COORDS_BY_USER,[.5*(this.point2.X()+this.point1.X()),.5*(this.point2.Y()+this.point1.Y())],this.board)},setLabelRelativeCoords:function(t){h.exists(this.label)&&(this.label.relativeCoords=new n(o.COORDS_BY_SCREEN,[t[0],-t[1]],this.board))},getLabelAnchor:function(){var t,r,s=0,a=new n(o.COORDS_BY_USER,this.point1.coords.usrCoords,this.board),l=new n(o.COORDS_BY_USER,this.point2.coords.usrCoords,this.board),c=h.evaluate(this.visProp.straightfirst),d=h.evaluate(this.visProp.straightlast);if((c||d)&&i.calcStraight(this,a,l,0),a=a.scrCoords,l=l.scrCoords,!h.exists(this.label))return new n(o.COORDS_BY_SCREEN,[NaN,NaN],this.board);switch(h.evaluate(this.label.visProp.position)){case"lft":case"llft":case"ulft":a[1]<=l[1]?(t=a[1],r=a[2]):(t=l[1],r=l[2]);break;case"rt":case"lrt":case"urt":a[1]>l[1]?(t=a[1],r=a[2]):(t=l[1],r=l[2]);break;default:t=.5*(a[1]+l[1]),r=.5*(a[2]+l[2])}return(c||d)&&(h.exists(this.label)&&(s=h.evaluate(this.label.visProp.fontsize)),Math.abs(t)t&&t>this.board.canvasWidth-s-e.eps&&(t=this.board.canvasWidth-s),e.eps+s>r&&r>-e.eps?r=s:this.board.canvasHeight+e.eps>r&&r>this.board.canvasHeight-s-e.eps&&(r=this.board.canvasHeight-s)),new n(o.COORDS_BY_SCREEN,[t,r],this.board)},cloneToBackground:function(){var t,e,i,r={};return r.id=this.id+"T"+this.numTraces,r.elementClass=o.OBJECT_CLASS_LINE,this.numTraces++,r.point1=this.point1,r.point2=this.point2,r.stdform=this.stdform,r.board=this.board,r.visProp=h.deepCopy(this.visProp,this.visProp.traceattributes,!0),r.visProp.layer=this.board.options.layer.trace,h.clearVisPropOld(r),r.visPropCalc={visible:h.evaluate(r.visProp.visible)},e=this.getSlope(),t=this.getRise(),r.getSlope=function(){return e},r.getRise=function(){return t},i=this.board.renderer.enhancedRendering,this.board.renderer.enhancedRendering=!0,this.board.renderer.drawLine(r),this.board.renderer.enhancedRendering=i,this.traces[r.id]=r.rendNode,this},addTransform:function(t){var e,i=h.isArray(t)?t:[t],r=i.length;for(e=0;e0&&f>0&&(r=i.projectPointToLine({coords:e},this,this.board),a=s.subtract([1,Math.round(d/p)*p,Math.round(u/f)*f],r.usrCoords),l=this.board.create("transform",a.slice(1),{type:"translate"}),l.applyOnce([this.point1,this.point2]))):(this.point1.handleSnapToGrid(!1,!0),this.point2.handleSnapToGrid(!1,!0)),this},snapToPoints:function(){var t=h.evaluate(this.visProp.snaptopoints);return this.parents.length<3&&(this.point1.handleSnapToPoints(t),this.point2.handleSnapToPoints(t)),this},X:function(t){var i,r=this.stdform[2];return i=Math.abs(this.point1.coords.usrCoords[0])>e.eps?this.point1.coords.usrCoords[1]:this.point2.coords.usrCoords[1],t=2*(t-.5),(1-Math.abs(t))*i-t*r},Y:function(t){var i,r=this.stdform[1];return i=Math.abs(this.point1.coords.usrCoords[0])>e.eps?this.point1.coords.usrCoords[2]:this.point2.coords.usrCoords[2],t=2*(t-.5),(1-Math.abs(t))*i+t*r},Z:function(t){var i=Math.abs(this.point1.coords.usrCoords[0])>e.eps?this.point1.coords.usrCoords[0]:this.point2.coords.usrCoords[0];return t=2*(t-.5),(1-Math.abs(t))*i},L:function(){return this.point1.Dist(this.point2)},minX:function(){return 0},maxX:function(){return 1},bounds:function(){var t=this.point1.coords.usrCoords,e=this.point2.coords.usrCoords;return[Math.min(t[1],e[1]),Math.max(t[2],e[2]),Math.max(t[1],e[1]),Math.min(t[2],e[2])]},addTicks:function(t){return""!==t.id&&h.exists(t.id)||(t.id=this.id+"_ticks_"+(this.ticks.length+1)),this.board.renderer.drawTicks(t),this.ticks.push(t),t.id},remove:function(){this.removeAllTicks(),a.prototype.remove.call(this)},removeAllTicks:function(){var t;for(t=this.ticks.length;t>0;t--)this.removeTicks(this.ticks[t-1]);this.ticks=[],this.board.update()},removeTicks:function(t){var e,i;for(h.exists(this.defaultTicks)&&this.defaultTicks===t&&(this.defaultTicks=null),e=this.ticks.length;e>0;e--)if(this.ticks[e-1]===t){if(this.board.removeObject(this.ticks[e-1]),this.ticks[e-1].ticks)for(i=0;i1)d=h.copyAttributes(r,e.options,"line","point1"),n=e.create("point",i[0],d);else if(h.isString(i[0])||h.isPoint(i[0]))n=e.select(i[0]);else if(h.isFunction(i[0])&&h.isPoint(i[0]()))n=i[0](),m=!0;else if(h.isFunction(i[0])&&i[0]().length&&i[0]().length>=2)d=h.copyAttributes(r,e.options,"line","point1"),n=l.createPoint(e,i[0](),d),m=!0;else{if(!h.isObject(i[0])||!h.isTransformationOrArray(i[1]))throw new Error("JSXGraph: Can't create line with parent types '"+typeof i[0]+"' and '"+typeof i[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]");f=!0,d=h.copyAttributes(r,e.options,"line","point1"),n=e.create("point",[i[0].point1,i[1]],d)}if(f)d=h.copyAttributes(r,e.options,"line","point2"),a=e.create("point",[i[0].point2,i[1]],d);else if(h.isArray(i[1])&&i[1].length>1)d=h.copyAttributes(r,e.options,"line","point2"),a=e.create("point",i[1],d);else if(h.isString(i[1])||h.isPoint(i[1]))a=e.select(i[1]);else if(h.isFunction(i[1])&&h.isPoint(i[1]()))a=i[1](),m=!0;else{if(!(h.isFunction(i[1])&&i[1]().length&&i[1]().length>=2))throw new Error("JSXGraph: Can't create line with parent types '"+typeof i[0]+"' and '"+typeof i[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]");d=h.copyAttributes(r,e.options,"line","point2"),a=l.createPoint(e,i[1](),d),m=!0}d=h.copyAttributes(r,e.options,"line"),o=new t.Line(e,n,a,d),m?(o.constrained=!0,o.funp1=i[0],o.funp2=i[1]):f||(o.isDraggable=!0),o.setParents([n.id,a.id])}else if(3===i.length){for(u=!0,c=0;c<3;c++)if(h.isNumber(i[c]))p[c]=h.createFunction(i[c]);else{if(!h.isFunction(i[c]))throw new Error("JSXGraph: Can't create line with parent types '"+typeof i[0]+"' and '"+typeof i[1]+"' and '"+typeof i[2]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]");p[c]=i[c],u=!1}d=h.copyAttributes(r,e.options,"line","point1"),n=u?e.create("point",[p[2]()*p[2]()+p[1]()*p[1](),p[2]()-p[1]()*p[0]()+p[2](),-p[1]()-p[2]()*p[0]()-p[1]()],d):e.create("point",[function(){return.5*(p[2]()*p[2]()+p[1]()*p[1]())},function(){return.5*(p[2]()-p[1]()*p[0]()+p[2]())},function(){return.5*(-p[1]()-p[2]()*p[0]()-p[1]())}],d),d=h.copyAttributes(r,e.options,"line","point2"),a=u?e.create("point",[p[2]()*p[2]()+p[1]()*p[1](),-p[1]()*p[0]()+p[2](),-p[2]()*p[0]()-p[1]()],d):e.create("point",[function(){return p[2]()*p[2]()+p[1]()*p[1]()},function(){return-p[1]()*p[0]()+p[2]()},function(){return-p[2]()*p[0]()-p[1]()}],d),n.prepareUpdate().update(),a.prepareUpdate().update(),d=h.copyAttributes(r,e.options,"line"),o=new t.Line(e,n,a,d),o.isDraggable=u,o.setParents([n,a])}else if(1===i.length&&h.isFunction(i[0])&&2===i[0]().length&&h.isPoint(i[0]()[0])&&h.isPoint(i[0]()[1]))s=i[0](),d=h.copyAttributes(r,e.options,"line"),o=new t.Line(e,s[0],s[1],d),o.constrained=!0,o.funps=i[0],o.setParents(s);else{if(!(1===i.length&&h.isFunction(i[0])&&3===i[0]().length&&h.isNumber(i[0]()[0])&&h.isNumber(i[0]()[1])&&h.isNumber(i[0]()[2])))throw new Error("JSXGraph: Can't create line with parent types '"+typeof i[0]+"' and '"+typeof i[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]");s=i[0],d=h.copyAttributes(r,e.options,"line","point1"),n=e.create("point",[function(){var t=s();return[.5*(t[2]*t[2]+t[1]*t[1]),.5*(t[2]-t[1]*t[0]+t[2]),.5*(-t[1]-t[2]*t[0]-t[1])]}],d),d=h.copyAttributes(r,e.options,"line","point2"),a=e.create("point",[function(){var t=s();return[t[2]*t[2]+t[1]*t[1],-t[1]*t[0]+t[2],-t[2]*t[0]-t[1]]}],d),d=h.copyAttributes(r,e.options,"line"),o=new t.Line(e,n,a,d),o.constrained=!0,o.funps=i[0],o.setParents([n,a])}return o},t.registerElement("line",t.createLine),t.createSegment=function(t,e,i){var r,s;if(i.straightFirst=!1,i.straightLast=!1,s=h.copyAttributes(i,t.options,"segment"),r=t.create("line",e.slice(0,2),s),3===e.length){if(r.hasFixedLength=!0,h.isNumber(e[2]))r.fixedLength=function(){return e[2]};else{if(!h.isFunction(e[2]))throw new Error("JSXGraph: Can't create segment with third parent type '"+typeof e[2]+"'.\nPossible third parent types: number or function");r.fixedLength=e[2]}r.getParents=function(){return this.parents.concat(this.fixedLength())},r.fixedLengthOldCoords=[],r.fixedLengthOldCoords[0]=new n(o.COORDS_BY_USER,r.point1.coords.usrCoords.slice(1,3),t),r.fixedLengthOldCoords[1]=new n(o.COORDS_BY_USER,r.point2.coords.usrCoords.slice(1,3),t)}return r.elType="segment",r},t.registerElement("segment",t.createSegment),t.createArrow=function(t,e,i){var r,s;return i.straightFirst=!1,i.straightLast=!1,s=h.copyAttributes(i,t.options,"arrow"),r=t.create("line",e,s),r.type=o.OBJECT_TYPE_VECTOR,r.elType="arrow",r},t.registerElement("arrow",t.createArrow),t.createAxis=function(t,e,i){var r,s,n,a,l;if(!h.isArray(e[0])&&!h.isPoint(e[0])||!h.isArray(e[1])&&!h.isPoint(e[1]))throw new Error("JSXGraph: Can't create axis with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]]");r=h.copyAttributes(i,t.options,"axis"),n=t.create("line",e,r),n.type=o.OBJECT_TYPE_AXIS,n.isDraggable=!1,n.point1.isDraggable=!1,n.point2.isDraggable=!1;for(a in n.ancestors)n.ancestors.hasOwnProperty(a)&&(n.ancestors[a].type=o.OBJECT_TYPE_AXISPOINT);return s=h.copyAttributes(i,t.options,"axis","ticks"),l=h.exists(s.ticksdistance)?s.ticksdistance:h.isArray(s.ticks)?s.ticks:1,n.defaultTicks=t.create("ticks",[n,l],s),n.defaultTicks.dump=!1,n.elType="axis",n.subs={ticks:n.defaultTicks},n.inherits.push(n.defaultTicks),n},t.registerElement("axis",t.createAxis),t.createTangent=function(t,i,s){var n,a,l,c,d,u,p;if(1===i.length)n=i[0],a=n.slideObject;else{if(2!==i.length)throw new Error("JSXGraph: Can't create tangent with parent types '"+typeof i[0]+"' and '"+typeof i[1]+"'.\nPossible parent types: [glider], [point,line|curve|circle|conic]");if(h.isPoint(i[0]))n=i[0],a=i[1];else{if(!h.isPoint(i[1]))throw new Error("JSXGraph: Can't create tangent with parent types '"+typeof i[0]+"' and '"+typeof i[1]+"'.\nPossible parent types: [glider], [point,line|curve|circle|conic]");a=i[0],n=i[1]}}if(a.elementClass===o.OBJECT_CLASS_LINE?(p=t.create("line",[a.point1,a.point2],s),p.glider=n):a.elementClass===o.OBJECT_CLASS_CURVE&&a.type!==o.OBJECT_TYPE_CONIC?"plot"!==h.evaluate(a.visProp.curvetype)?(l=a.X,c=a.Y,p=t.create("line",[function(){return-n.X()*r.D(c)(n.position)+n.Y()*r.D(l)(n.position)},function(){return r.D(c)(n.position)},function(){return-r.D(l)(n.position)}],s),n.addChild(p),p.glider=n):(p=t.create("line",[function(){var t,e,i=Math.floor(n.position);return i===a.numberPoints-1&&i--,i<0?1:(t=a.points[i].usrCoords,e=a.points[i+1].usrCoords,t[2]*e[1]-t[1]*e[2])},function(){var t,e,i=Math.floor(n.position);return i===a.numberPoints-1&&i--,i<0?0:(t=a.points[i].usrCoords,e=a.points[i+1].usrCoords,e[2]-t[2])},function(){var t,e,i=Math.floor(n.position);return i===a.numberPoints-1&&i--,i<0?0:(t=a.points[i].usrCoords,e=a.points[i+1].usrCoords,t[1]-e[1])}],s),n.addChild(p),p.glider=n):a.type===o.OBJECT_TYPE_TURTLE?(p=t.create("line",[function(){var t=Math.floor(n.position);for(d=0;d1&&(a=e[0].type===o.OBJECT_TYPE_CONIC||e[0].elementClass===o.OBJECT_CLASS_CIRCLE,l=e[1].type===o.OBJECT_TYPE_CONIC||e[1].elementClass===o.OBJECT_CLASS_CIRCLE,c=h.isPoint(e[0]),d=h.isPoint(e[1])),2!==e.length||!(a&&d||c&&l))throw new Error("JSXGraph: Can't create 'polar line' with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent type: [conic|circle,point], [point,conic|circle]");return d?(s=t.select(e[0]),n=t.select(e[1])):(s=t.select(e[1]),n=t.select(e[0])),r=t.create("tangent",[s,n],i),r.elType="polarline",r},t.registerElement("tangent",t.createTangent),t.registerElement("polar",t.createTangent),t.registerElement("radicalaxis",t.createRadicalAxis),t.registerElement("polarline",t.createPolarLine),{Line:t.Line,createLine:t.createLine,createTangent:t.createTangent,createPolar:t.createTangent,createSegment:t.createSegment,createAxis:t.createAxis,createArrow:t.createArrow,createRadicalAxis:t.createRadicalAxis,createPolarLine:t.createPolarLine}}),define("base/curve",["jxg","base/constants","base/coords","base/element","math/math","math/statistics","math/numerics","math/geometry","parser/geonext","utils/type","base/transformation","math/qdt"],function(t,e,i,r,s,o,n,a,h,l,c,d){"use strict";return t.Curve=function(t,i,r){this.constructor(t,r,e.OBJECT_TYPE_CURVE,e.OBJECT_CLASS_CURVE),this.points=[],this.numberPoints=l.evaluate(this.visProp.numberpointshigh),this.bezierDegree=1,this.dataX=null,this.dataY=null,this.qdt=null,l.exists(i[0])?this.varname=i[0]:this.varname="x",this.xterm=i[1],this.yterm=i[2],this.generateTerm(this.varname,this.xterm,this.yterm,i[3],i[4]),this.updateCurve(),this.id=this.board.setId(this,"G"),this.board.renderer.drawCurve(this),this.board.finalizeAdding(this),this.createGradient(),this.elType="curve",this.createLabel(),l.isString(this.xterm)&&this.notifyParents(this.xterm),l.isString(this.yterm)&&this.notifyParents(this.yterm),this.methodMap=l.deepCopy(this.methodMap,{generateTerm:"generateTerm",setTerm:"generateTerm",move:"moveTo",moveTo:"moveTo"})},t.Curve.prototype=new r,t.extend(t.Curve.prototype,{minX:function(){var t;return"polar"===l.evaluate(this.visProp.curvetype)?0:(t=new i(e.COORDS_BY_SCREEN,[0,0],this.board,!1),t.usrCoords[1])},maxX:function(){var t;return"polar"===l.evaluate(this.visProp.curvetype)?2*Math.PI:(t=new i(e.COORDS_BY_SCREEN,[this.board.canvasWidth,0],this.board,!1),t.usrCoords[1])},X:function(t){return NaN},Y:function(t){return NaN},Z:function(t){return 1},hasPoint:function(t,r,o){var n,h,c,d,u,p,f,m,g,b,v,y,C,_,P,E=[],S=l.evaluate(this.visProp.numberpointslow),x=(this.maxX()-this.minX())/S,O=this.board.options.precision.hasPoint,w=1/0;if(h=new i(e.COORDS_BY_SCREEN,[t,r],this.board,!1),t=h.usrCoords[1],r=h.usrCoords[2],O+=.5*l.evaluate(this.visProp.strokewidth),O*=O,v=this.board.unitX*this.board.unitX,y=this.board.unitY*this.board.unitY,_=this.minX(),P=this.maxX(),l.exists(this._visibleArea)&&(_=this._visibleArea[0],P=this._visibleArea[1],x=(P-_)/S),"parameter"===(C=l.evaluate(this.visProp.curvetype))||"polar"===C)for(this.transformations.length>0&&(this.updateTransformMatrix(),d=s.inverse(this.transformMat),u=s.matVecMult(d,[1,t,r]),t=u[1],r=u[2]),p=0,n=_;p=0&&E[1]<=1&&(t-E[0][1])*(t-E[0][1])*v+(r-E[0][2])*(r-E[0][2])*y<=O)return!0;return!1}return w0&&(this.points[a].prev=this.points[a-1]),as.eps){i=!0;break}this.isReal=i},updateParametricCurveNaive:function(t,i,r){var s,o,n=!1,a=(i-t)/r;for(s=0;s1&&function(t,e,i){var r,o,n=i[1]-t[1],a=i[2]-t[2],h=e[0]-t[1],l=e[1]-t[2],c=h*h+l*l;return c>=s.eps&&(r=(n*h+a*l)/c)>0&&(r<=1?(n-=r*h,a-=r*l):(n-=h,a-=l)),o=n*n+a*a,Math.sqrt(o)}(this.points[S-2].scrCoords,[h,l],this.points[S-1].scrCoords)<.015&&(S-=1),this.points[S]=new i(e.COORDS_BY_SCREEN,[h,l],this.board,!1),this.points[S]._t=a,S+=1,c=h,d=l,t0=a,u-=1,h=_[u][0],l=_[u][1],p=C[u]+1,n=2*y[u]}while(u>0&&S<5e5);return this.numberPoints=this.points.length,this},isSegmentOutside:function(t,e,i,r){return e<0&&r<0||e>this.board.canvasHeight&&r>this.board.canvasHeight||t<0&&i<0||t>this.board.canvasWidth&&i>this.board.canvasWidth},isDistOK:function(t,e,i,r){return Math.abs(t)-500&&t.scrCoords[2]>-500&&t.scrCoords[1].7||Math.abs(t.scrCoords[2]-this._lastCrds[2])>.7))&&(t._t=e,this.points.push(t),this._lastCrds=t.copy("scrCoords"))},_intersectWithBorder:function(t,e,i){var r,o,n,a;return i<=0?(r=[-e[0],1,0],o=s.crossProduct(r,t),0!==o[0]?(n=o[1]/o[0],a=o[2]/o[0]):a=1/0,ae[1]&&(r=[-e[1],0,1],o=s.crossProduct(r,t),0!==o[0]?(n=o[1]/o[0],a=o[2]/o[0]):n=1/0)):(r=[-e[2],1,0],o=s.crossProduct(r,t),0!==o[0]?(n=o[1]/o[0],a=o[2]/o[0]):a=1/0,ae[1]&&(r=[-e[1],0,1],o=s.crossProduct(r,t),0!==o[0]?(n=o[1]/o[0],a=o[2]/o[0]):n=1/0)),[1,n,a]},_borderCase:function(t,r,s,o,n,a,h){var l,c,d,u,p,f,m,g,b,v,y,C=null,_=!1;if(h<=1){c=new i(e.COORDS_BY_USER,[0,0],this.board,!1),u=0;do{if(isNaN(t[1]+t[2])&&!isNaN(s[1]+s[2]))p=o,f=a,m=n;else if(isNaN(r[1]+r[2])&&!isNaN(s[1]+s[2]))p=n,f=a,m=o;else if(isNaN(s[1]+s[2])&&!isNaN(r[1]+r[2]))p=a,f=n,m=n+(n-a);else{if(!isNaN(s[1]+s[2])||isNaN(t[1]+t[2]))return!1;p=a,f=o,m=o-(a-o)}l=.5*(p+f),c.setCoordinates(e.COORDS_BY_USER,[this.X(l,!0),this.Y(l,!0)],!1),d=c.usrCoords,_=isNaN(d[1]+d[2]),_?p=l:(m=f,f=l),++u}while(_&&u<30);if(u<30&&(C=d.slice(),s=d.slice(),f=l),g=this.X(f,!0),v=this.X(m,!0),(g-v)/(f-m),b=this.Y(f,!0),y=this.Y(m,!0),(b-y)/(f-m),null!==C)return this._insertPoint(new i(e.COORDS_BY_USER,C,this.board,!1)),!0}return!1},_triangleDists:function(t,e,i){var r,s,o,n,h;return r=[t[0]*e[0],.5*(t[1]+e[1]),.5*(t[2]+e[2])],s=a.distance(t,e,3),o=a.distance(t,i,3),n=a.distance(i,e,3),h=a.distance(i,r,3),[s,o,n,h]},_isUndefined:function(t,r,s,o){var n,a,h;if(!isNaN(t[1]+t[2])||!isNaN(s[1]+s[2]))return!1;for(h=new i(e.COORDS_BY_USER,[0,0],this.board,!1),a=0;a<20;++a)if(n=r+Math.random()*(o-r),h.setCoordinates(e.COORDS_BY_USER,[this.X(n,!0),this.Y(n,!0)],!1),!isNaN(h.scrCoords[0]+h.scrCoords[1]+h.scrCoords[2]))return!1;return!0},_isOutside:function(t,e,i,r){var s=this.board.canvasWidth,o=this.board.canvasHeight;return!!(t[1]<-500&&i[1]<-500||t[2]<-500&&i[2]<-500||t[1]>s+500&&i[1]>s+500||t[2]>o+500&&i[2]>o+500)},_isOutsidePoint:function(t){var e=this.board.canvasWidth,i=this.board.canvasHeight;return!!(t[1]<-500||t[2]<-500||t[1]>e+500||t[2]>i+500)},_findStartPoint:function(t,r,s,o){var a,h,l,c,d,u,p,f,m,g,b,v,y=new i(e.COORDS_BY_USER,[0,0],this.board,!1),C=this.board.getBoundingBox();if(!this._isOutsidePoint(t))return[t,r];for(p=.3*(C[2]-C[0]),f=.3*(C[1]-C[3]),h=(o-r)/40,l=r+h,u=!1,m=function(t){return this.X(t,!0)-(C[0]-p)},b=function(t){return this.X(t,!0)-(C[1]+f)},g=function(t){return this.X(t,!0)-(C[2]+p)},v=function(t){return this.X(t,!0)-(C[1]-f)},a=0;a<40;++a){if(d=C[0]-p,c=n.fzero(m,[l-h,l],this),Math.abs(this.X(c,!0)-d)<.01){u=!0;break}if(d=C[1]+f,c=n.fzero(b,[l-h,l],this),Math.abs(this.Y(c,!0)-d)<.01){u=!0;break}if(d=C[2]+p,c=n.fzero(g,[l-h,l],this),Math.abs(this.X(c,!0)-d)<.01){u=!0;break}if(d=C[3]-f,c=n.fzero(v,[l-h,l],this),Math.abs(this.Y(c,!0)-d)<.01){u=!0;break}l+=h}return u?(y.setCoordinates(e.COORDS_BY_USER,[this.X(c,!0),this.Y(c,!0)],!1),[y.scrCoords,c]):[t,r]},_plotRecursive:function(t,r,s,o,n,a){var h,l,c,d,u,p,f=0,m=new i(e.COORDS_BY_USER,[0,0],this.board,!1);if(!(this.numberPoints>65536))return n.99*c[0]||c[1]>.99*c[0]||c[0]===1/0||c[1]===1/0||c[2]===1/0),p=n0&&(i=s.matVecMult(this.transformMat,t.usrCoords),t.setCoordinates(e.COORDS_BY_USER,[i[1],i[2]],!1,!0)),t},addTransform:function(t){var e,i=l.isArray(t)?t:[t],r=i.length;for(e=0;e=h)return l.isFunction(a[a.length-1])?a[a.length-1]():a[a.length-1];for(r=3*Math.floor(t),o=t%1,n=1-o,s=0;s<4;s++)l.isFunction(a[r+s])?c[s]=a[r+s]():c[s]=a[r+s];return n*n*(n*c[0]+3*o*c[1])+(3*n*c[2]+o*c[3])*o*o}if((r=t>h-2?h-2:parseInt(Math.floor(t),10))===t)return l.isFunction(a[r])?a[r]():a[r];for(s=0;s<2;s++)l.isFunction(a[r+s])?c[s]=a[r+s]():c[s]=a[r+s];return c[0]+(c[1]-c[0])*(t-r)}},generateTerm:function(t,e,i,r,s){var o,n;l.isArray(e)?(this.dataX=e,this.numberPoints=this.dataX.length,this.X=this.interpolationFunctionFromArray("X"),this.visProp.curvetype="plot",this.isDraggable=!0):(this.X=l.createFunction(e,this.board,t),l.isString(e)?this.visProp.curvetype="functiongraph":(l.isFunction(e)||l.isNumber(e))&&(this.visProp.curvetype="parameter"),this.isDraggable=!0),l.isArray(i)?(this.dataY=i,this.Y=this.interpolationFunctionFromArray("Y")):this.Y=l.createFunction(i,this.board,t),l.isFunction(e)&&l.isArray(i)&&(o=l.createFunction(i[0],this.board,""),n=l.createFunction(i[1],this.board,""),this.X=function(t){return e(t)*Math.cos(t)+o()},this.Y=function(t){return e(t)*Math.sin(t)+n()},this.visProp.curvetype="polar"),l.exists(r)&&(this.minX=l.createFunction(r,this.board,"")),l.exists(s)&&(this.maxX=l.createFunction(s,this.board,""))},notifyParents:function(t){var e,i,r,s=!1;r={xterm:1,yterm:1};for(e in r)if(r.hasOwnProperty(e)&&this.hasOwnProperty(e)&&this[e].origin){s=!0;for(i in this[e].origin.deps)this[e].origin.deps.hasOwnProperty(i)&&this[e].origin.deps[i].addChild(this)}s||h.findDependencies(this,t,this.board)},getLabelAnchor:function(){var t,r,s,o=.05*this.board.canvasWidth,n=.05*this.board.canvasHeight,h=.95*this.board.canvasWidth,c=.95*this.board.canvasHeight;switch(l.evaluate(this.visProp.label.position)){case"ulft":r=o,s=n;break;case"llft":r=o,s=c;break;case"rt":r=h,s=.5*c;break;case"lrt":r=h,s=c;break;case"urt":r=h,s=n;break;case"top":r=.5*h,s=n;break;case"bot":r=.5*h,s=c;break;default:r=o,s=.5*c}return t=new i(e.COORDS_BY_SCREEN,[r,s],this.board,!1),a.projectCoordsToCurve(t.usrCoords[1],t.usrCoords[2],0,this,this.board)[0]},cloneToBackground:function(){var t,i={id:this.id+"T"+this.numTraces,elementClass:e.OBJECT_CLASS_CURVE,points:this.points.slice(0),bezierDegree:this.bezierDegree,numberPoints:this.numberPoints,board:this.board,visProp:l.deepCopy(this.visProp,this.visProp.traceattributes,!0)};return i.visProp.layer=this.board.options.layer.trace,i.visProp.curvetype=this.visProp.curvetype,this.numTraces++,l.clearVisPropOld(i),i.visPropCalc={visible:l.evaluate(i.visProp.visible)},t=this.board.renderer.enhancedRendering,this.board.renderer.enhancedRendering=!0,this.board.renderer.drawCurve(i),this.board.renderer.enhancedRendering=t,this.traces[i.id]=i.rendNode,this},bounds:function(){var t,e,i,r=1/0,s=-1/0,o=1/0,a=-1/0,h=this.points.length;if(3===this.bezierDegree){for(t=0;tthis.points[t].usrCoords[1]&&(r=this.points[t].usrCoords[1]),sthis.points[t].usrCoords[2]&&(o=this.points[t].usrCoords[2]),a0&&!l.evaluate(this.visProp.fixed)&&(i=this.points[0],r=3===t.length?[t[0]-i.usrCoords[0],t[1]-i.usrCoords[1],t[2]-i.usrCoords[2]]:[t[0]-i.usrCoords[1],t[1]-i.usrCoords[2]],this.setPosition(e.COORDS_BY_USER,r)),this},getTransformationSource:function(){var t,i;return l.exists(this._transformationSource)&&(i=this._transformationSource,i.elementClass===e.OBJECT_CLASS_CURVE&&(t=!0)),[t,i]}}),t.createCurve=function(i,r,s){var o,n,a=l.copyAttributes(s,i.options,"curve");return o=i.select(r[0],!0),l.isObject(o)&&(o.type===e.OBJECT_TYPE_CURVE||o.type===e.OBJECT_TYPE_ANGLE||o.type===e.OBJECT_TYPE_ARC||o.type===e.OBJECT_TYPE_CONIC||o.type===e.OBJECT_TYPE_SECTOR)&&l.isTransformationOrArray(r[1])?(o.type===e.OBJECT_TYPE_SECTOR?a=l.copyAttributes(s,i.options,"sector"):o.type===e.OBJECT_TYPE_ARC?a=l.copyAttributes(s,i.options,"arc"):o.type===e.OBJECT_TYPE_ANGLE?(l.exists(s.withLabel)||(s.withLabel=!1),a=l.copyAttributes(s,i.options,"angle")):a=l.copyAttributes(s,i.options,"curve"),a=l.copyAttributes(a,i.options,"curve"),n=new t.Curve(i,["x",[],[]],a),n.updateDataArray=function(){var t,e=o.numberPoints;for(this.bezierDegree=o.bezierDegree,this.dataX=[],this.dataY=[],t=0;t1)p[d]=t.create("point",r[d],f);else if(n.isPoint(r[d]))p[d]=t.select(r[d]);else if(n.isFunction(r[d])&&n.isPoint(r[d]()))p[d]=r[d]();else{if(!n.isString(r[d]))throw new Error("JSXGraph: Can't create Ellipse with parent types '"+typeof r[0]+"' and '"+typeof r[1]+"'.\nPossible parent types: [point,point,point], [point,point,number|function]");p[d]=t.select(r[d])}if(n.isNumber(r[2]))c=n.createFunction(r[2],t);else if(n.isFunction(r[2])&&n.isNumber(r[2]()))c=r[2];else{if(n.isPoint(r[2]))l=t.select(r[2]);else if(r[2].length>1)l=t.create("point",r[2],f);else if(n.isFunction(r[2])&&n.isPoint(r[2]()))l=r[2]();else{if(!n.isString(r[2]))throw new Error("JSXGraph: Can't create Ellipse with parent types '"+typeof r[0]+"' and '"+typeof r[1]+"' and '"+typeof r[2]+"'.\nPossible parent types: [point,point,point], [point,point,number|function]");l=t.select(r[2])}c=function(){return l.Dist(p[0])+l.Dist(p[1])}}for(n.exists(r[4])||(r[4]=2*Math.PI),n.exists(r[3])||(r[3]=0),h=t.create("point",[function(){return.5*(p[0].X()+p[1].X())},function(){return.5*(p[0].Y()+p[1].Y())}],m),a=t.create("curve",[function(t){return 0},function(t){return 0},r[3],r[4]],g),a.majorAxis=c,u=a.hasPoint,o=function(t,e){var i,r,s,o,n,h,l,d,u;e||(i=c(),r=i*i,s=p[0].X(),o=p[0].Y(),n=p[1].X(),h=p[1].Y(),l=s-n,d=o-h,u=(r-s*s-o*o+n*n+h*h)/(2*i),a.quadraticform=[[u*u-n*n-h*h,u*l/i+n,u*d/i+h],[u*l/i+n,l*l/r-1,l*d/r],[u*d/i+h,l*d/r,d*d/r-1]])},a.X=function(t,e){var i=c(),r=p[1].Dist(p[0]),s=.5*(r*r-i*i)/(r*Math.cos(t)-i),n=Math.atan2(p[1].Y()-p[0].Y(),p[1].X()-p[0].X());return e||o(t,e),p[0].X()+Math.cos(n+t)*s},a.Y=function(t,e){var i=c(),r=p[1].Dist(p[0]),s=.5*(r*r-i*i)/(r*Math.cos(t)-i),o=Math.atan2(p[1].Y()-p[0].Y(),p[1].X()-p[0].X());return p[0].Y()+Math.sin(o+t)*s},a.midpoint=a.center=h,a.type=e.OBJECT_TYPE_CONIC,a.subs={center:a.center},a.inherits.push(a.center,p[0],p[1]),n.isPoint(l)&&a.inherits.push(l),a.hasPoint=function(t,r){var s,o,a,h;return n.evaluate(this.visProp.hasinnerpoints)?(s=p[0].coords,o=p[1].coords,a=this.majorAxis(),h=new i(e.COORDS_BY_SCREEN,[t,r],this.board),h.distance(e.COORDS_BY_USER,s)+h.distance(e.COORDS_BY_USER,o)<=a):u.apply(this,arguments)},h.addChild(a),d=0;d<2;d++)n.isPoint(p[d])&&p[d].addChild(a);return n.isPoint(l)&&l.addChild(a),a.setParents(r),a},t.createHyperbola=function(t,i,r){var s,o,a,h,l,c,d=[],u=n.copyAttributes(r,t.options,"conic","foci"),p=n.copyAttributes(r,t.options,"conic","center"),f=n.copyAttributes(r,t.options,"conic");for(c=0;c<2;c++)if(i[c].length>1)d[c]=t.create("point",i[c],u);else if(n.isPoint(i[c]))d[c]=t.select(i[c]);else if(n.isFunction(i[c])&&n.isPoint(i[c]()))d[c]=i[c]();else{if(!n.isString(i[c]))throw new Error("JSXGraph: Can't create Hyperbola with parent types '"+typeof i[0]+"' and '"+typeof i[1]+"'.\nPossible parent types: [point,point,point], [point,point,number|function]");d[c]=t.select(i[c])}if(n.isNumber(i[2]))l=n.createFunction(i[2],t);else if(n.isFunction(i[2])&&n.isNumber(i[2]()))l=i[2];else{if(n.isPoint(i[2]))h=t.select(i[2]);else if(i[2].length>1)h=t.create("point",i[2],u);else if(n.isFunction(i[2])&&n.isPoint(i[2]()))h=i[2]();else{if(!n.isString(i[2]))throw new Error("JSXGraph: Can't create Hyperbola with parent types '"+typeof i[0]+"' and '"+typeof i[1]+"' and '"+typeof i[2]+"'.\nPossible parent types: [point,point,point], [point,point,number|function]");h=t.select(i[2])}l=function(){return h.Dist(d[0])-h.Dist(d[1])}}for(n.exists(i[4])||(i[4]=1.0001*Math.PI),n.exists(i[3])||(i[3]=-1.0001*Math.PI),a=t.create("point",[function(){return.5*(d[0].X()+d[1].X())},function(){return.5*(d[0].Y()+d[1].Y())}],p),o=t.create("curve",[function(t){return 0},function(t){return 0},i[3],i[4]],f),o.majorAxis=l,s=function(t,e){var i,r,s,n,a,h,c,u,p;e||(i=l(),r=i*i,s=d[0].X(),n=d[0].Y(),a=d[1].X(),h=d[1].Y(),c=s-a,u=n-h,p=(r-s*s-n*n+a*a+h*h)/(2*i),o.quadraticform=[[p*p-a*a-h*h,p*c/i+a,p*u/i+h],[p*c/i+a,c*c/r-1,c*u/r],[p*u/i+h,c*u/r,u*u/r-1]])},o.X=function(t,e){var i=l(),r=d[1].Dist(d[0]),o=.5*(r*r-i*i)/(r*Math.cos(t)+i),n=Math.atan2(d[1].Y()-d[0].Y(),d[1].X()-d[0].X());return e||s(t,e),d[0].X()+Math.cos(n+t)*o},o.Y=function(t,e){var i=l(),r=d[1].Dist(d[0]),s=.5*(r*r-i*i)/(r*Math.cos(t)+i),o=Math.atan2(d[1].Y()-d[0].Y(),d[1].X()-d[0].X());return d[0].Y()+Math.sin(o+t)*s},o.midpoint=o.center=a,o.subs={center:o.center},o.inherits.push(o.center,d[0],d[1]),n.isPoint(h)&&o.inherits.push(h),o.type=e.OBJECT_TYPE_CONIC,a.addChild(o),c=0;c<2;c++)n.isPoint(d[c])&&d[c].addChild(o);return n.isPoint(h)&&h.addChild(o),o.setParents(i),o},t.createParabola=function(t,i,r){var s,a,h,l,c=i[0],d=i[1],u=n.copyAttributes(r,t.options,"conic","foci"),p=n.copyAttributes(r,t.options,"conic","center"),f=n.copyAttributes(r,t.options,"conic");if(i[0].length>1)c=t.create("point",i[0],u);else if(n.isPoint(i[0]))c=t.select(i[0]);else if(n.isFunction(i[0])&&n.isPoint(i[0]()))c=i[0]();else{if(!n.isString(i[0]))throw new Error("JSXGraph: Can't create Parabola with parent types '"+typeof i[0]+"' and '"+typeof i[1]+"'.\nPossible parent types: [point,line]");c=t.select(i[0])}return n.isArray(d)&&2==d.length&&(l=n.copyAttributes(r,t.options,"conic","line"),d=t.create("line",d,l)),n.exists(i[3])||(i[3]=10),n.exists(i[2])||(i[2]=-10),h=t.create("point",[function(){return o.projectPointToLine(c,d,t).usrCoords}],p),a=t.create("curve",[function(t){return 0},function(t){return 0},i[2],i[3]],f),a.midpoint=a.center=h,a.subs={center:a.center},a.inherits.push(a.center),s=function(t,e){var i,r,s,o,n,h;e||(i=d.stdform[1],r=d.stdform[2],s=d.stdform[0],o=i*i+r*r,n=c.X(),h=c.Y(),a.quadraticform=[[s*s-o*(n*n+h*h),s*i+o*n,s*r+o*h],[s*i+o*n,-r*r,i*r],[s*r+o*h,i*r,-i*i]])},a.X=function(t,e){var i,r,n=d.getAngle(),a=o.distPointLine(c.coords.usrCoords,d.stdform),h=d.point1.coords.usrCoords,l=d.point2.coords.usrCoords,u=c.coords.usrCoords;return 0===h[0]?h=[1,l[1]+d.stdform[2],l[2]-d.stdform[1]]:0===l[0]&&(l=[1,h[1]+d.stdform[2],h[2]-d.stdform[1]]),r=(l[1]-h[1])*(u[2]-h[2])-(l[2]-h[2])*(u[1]-h[1])>=0?1:-1,i=r*a/(1-Math.sin(t)),e||s(t,e),c.X()+Math.cos(t+n)*i},a.Y=function(t,e){var i,r,s=d.getAngle(),n=o.distPointLine(c.coords.usrCoords,d.stdform),a=d.point1.coords.usrCoords,h=d.point2.coords.usrCoords,l=c.coords.usrCoords;return 0===a[0]?a=[1,h[1]+d.stdform[2],h[2]-d.stdform[1]]:0===h[0]&&(h=[1,a[1]+d.stdform[2],a[2]-d.stdform[1]]),r=(h[1]-a[1])*(l[2]-a[2])-(h[2]-a[2])*(l[1]-a[1])>=0?1:-1,i=r*n/(1-Math.sin(t)),c.Y()+Math.sin(t+s)*i},a.type=e.OBJECT_TYPE_CONIC,h.addChild(a),n.isPoint(c)&&(c.addChild(a),a.inherits.push(c)),d.addChild(a),a.setParents(i),a},t.createConic=function(t,i,o){var a,h,l,c,d,u,p,f,m,g,b,v,y,C,_=[[1,0,0],[0,1,0],[0,0,1]],P=[[1,0,0],[0,1,0],[0,0,1]],E=[],S=[],x=n.copyAttributes(o,t.options,"conic","point"),O=n.copyAttributes(o,t.options,"conic","center"),w=n.copyAttributes(o,t.options,"conic");if(5===i.length)C=!0;else{if(6!==i.length)throw new Error("JSXGraph: Can't create generic Conic with "+i.length+" parameters.");C=!1}if(C)for(v=0;v<5;v++)if(i[v].length>1)E[v]=t.create("point",i[v],x);else if(n.isPoint(i[v]))E[v]=t.select(i[v]);else if(n.isFunction(i[v])&&n.isPoint(i[v]()))E[v]=i[v]();else{if(!n.isString(i[v]))throw new Error("JSXGraph: Can't create Conic section with parent types '"+typeof i[v]+"'.\nPossible parent types: [point,point,point,point,point], [a00,a11,a22,a01,a02,a12]");E[v]=t.select(i[v])}else y=[[0,0,0],[0,0,0],[0,0,0]],y[0][0]=n.isFunction(i[2])?function(){return i[2]()}:function(){return i[2]},y[0][1]=n.isFunction(i[4])?function(){return i[4]()}:function(){return i[4]},y[0][2]=n.isFunction(i[5])?function(){return i[5]()}:function(){return i[5]},y[1][1]=n.isFunction(i[0])?function(){return i[0]()}:function(){return i[0]},y[1][2]=n.isFunction(i[3])?function(){return i[3]()}:function(){return i[3]},y[2][2]=n.isFunction(i[1])?function(){return i[1]()}:function(){return i[1]};if(d=function(t){var e,i;for(e=0;e<3;e++)for(i=e;i<3;i++)t[e][i]+=t[i][e];for(e=0;e<3;e++)for(i=0;ii&&(P[o][i]=P[i][o]);for(h.quadraticform=P,u=s.Jacobi(P),u[0][0][0]<0&&(u[0][0][0]*=-1,u[0][1][1]*=-1,u[0][2][2]*=-1),i=0;i<3;i++){for(a=0,o=0;o<3;o++)a+=u[1][o][i]*u[1][o][i];a=Math.sqrt(a)}_=u[1],m=Math.sqrt(Math.abs(u[0][0][0])),p=Math.sqrt(Math.abs(u[0][1][1])),f=Math.sqrt(Math.abs(u[0][2][2]))}return u[0][1][1]<=0&&u[0][2][2]<=0?d=r.matVecMult(_,[1/m,Math.cos(t)/p,Math.sin(t)/f]):u[0][1][1]<=0&&u[0][2][2]>0?d=r.matVecMult(_,[Math.cos(t)/m,1/p,Math.sin(t)/f]):u[0][2][2]<0&&(d=r.matVecMult(_,[Math.sin(t)/m,Math.cos(t)/p,1/f])),n.exists(d)?(d[1]/=d[0],d[2]/=d[0],d[0]=1):d=[1,NaN,NaN],d},h.X=function(t,e){return a(t,e)[1]},h.Y=function(t,e){return a(t,e)[2]},h.midpoint=t.create("point",[function(){var t=h.quadraticform;return[t[1][1]*t[2][2]-t[1][2]*t[1][2],t[1][2]*t[0][2]-t[2][2]*t[0][1],t[0][1]*t[1][2]-t[1][1]*t[0][2]]}],O),h.type=e.OBJECT_TYPE_CONIC,h.center=h.midpoint,h.subs={center:h.center},h.inherits.push(h.center),h.inherits=h.inherits.concat(E),C){for(v=0;v<5;v++)n.isPoint(E[v])&&E[v].addChild(h);h.setParents(i)}return h.addChild(h.center),h},t.registerElement("ellipse",t.createEllipse),t.registerElement("hyperbola",t.createHyperbola),t.registerElement("parabola",t.createParabola),t.registerElement("conic",t.createConic),{createEllipse:t.createEllipse,createHyperbola:t.createHyperbola,createParabola:t.createParabola,createConic:t.createConic}}),define("base/circle",["jxg","base/element","base/coords","base/constants","element/conic","parser/geonext","utils/type"],function(t,e,i,r,s,o,n){"use strict";return t.Circle=function(t,e,i,s,o){this.constructor(t,o,r.OBJECT_TYPE_CIRCLE,r.OBJECT_CLASS_CIRCLE),this.method=e,this.midpoint=this.board.select(i),this.center=this.board.select(i),this.point2=null,this.radius=0,this.line=null,this.circle=null,"twoPoints"===e?(this.point2=t.select(s),this.radius=this.Radius()):"pointRadius"===e?(this.gxtterm=s,this.updateRadius=n.createFunction(s,this.board,null,!0),this.updateRadius()):"pointLine"===e?(this.line=t.select(s),this.radius=this.line.point1.coords.distance(r.COORDS_BY_USER,this.line.point2.coords)):"pointCircle"===e&&(this.circle=t.select(s),this.radius=this.circle.Radius()),this.id=this.board.setId(this,"C"),this.board.renderer.drawEllipse(this),this.board.finalizeAdding(this),this.createGradient(),this.elType="circle",this.createLabel(),this.center.addChild(this),"pointRadius"===e?this.notifyParents(s):"pointLine"===e?this.line.addChild(this):"pointCircle"===e?this.circle.addChild(this):"twoPoints"===e&&this.point2.addChild(this),this.methodMap=n.deepCopy(this.methodMap,{setRadius:"setRadius",getRadius:"getRadius",Area:"Area",area:"Area",radius:"Radius",center:"center",line:"line",point2:"point2"})},t.Circle.prototype=new e,t.extend(t.Circle.prototype,{hasPoint:function(t,e){var s,o,a,h=this.board.options.precision.hasPoint,l=this.center.coords.usrCoords,c=new i(r.COORDS_BY_SCREEN,[t,e],this.board),d=this.Radius();return s=l[1]-c.usrCoords[1],o=l[2]-c.usrCoords[2],a=Math.sqrt(s*s+o*o),h+=.5*n.evaluate(this.visProp.strokewidth),h/=Math.sqrt(this.board.unitX*this.board.unitY),n.evaluate(this.visProp.hasinnerpoints)?a0&&this.vertices[this.vertices.length-1].id!==this.vertices[0].id&&this.vertices.push(this.vertices[0]),this.borders=[],this.withLines)for(h=this.vertices.length-1,l=0;le!=this.vertices[r].coords.scrCoords[2]>e&&t<(this.vertices[r].coords.scrCoords[1]-this.vertices[i].coords.scrCoords[1])*(e-this.vertices[i].coords.scrCoords[2])/(this.vertices[r].coords.scrCoords[2]-this.vertices[i].coords.scrCoords[2])+this.vertices[i].coords.scrCoords[1]&&(n=!n);if(n)return!0}for(s=this.borders.length,i=0;is&&(s=this.vertices[n].X()),this.vertices[n].Y()>r&&(r=this.vertices[n].Y()),this.vertices[n].Y()i[2]&&(i[2]=e),e=this.vertices[t].Y(),e>i[1]?i[1]=e:ethis.vertices.length-2)return this;for(i=1;i-1&&r-1;e--)s[a[e]]=-1,this.withLines&&a[e]-1>a[e-1]&&(h[h.length-1][1]=a[e],h.push([a[e-1]]));for(this.withLines&&(h[h.length-1][1]=a[0]),this.vertices=[],e=0;en.length-1&&(i=n.length-1),this.board.removeObject(this.borders[i]),n[i]=-1;0!==h[e][1]&&h[e][0]!==s.length-1&&(n[h[e][0]-1]=this.board.create("segment",[s[Math.max(h[e][1]-1,0)],s[Math.min(h[e][0]+1,this.vertices.length-1)]],this.attr_line))}for(this.borders=[],e=0;e=0};for(s=0;s 2 as input.");if(o.isNumber(t.select(a))?(l--,c=!1):(a=l,c=!0),!1===(u=o.providePoints(t,i.slice(0,l),r,"regularpolygon",["vertices"])))throw new Error("JSXGraph: Can't create regular polygon with parent types other than 'point' and 'coordinate arrays' or a function returning an array of coordinates");for(d=o.copyAttributes(r,t.options,"regularpolygon","vertices"),n=2;n=a-2&&(d.id=d.ids[n-2]),u[n]=t.create("point",[u[n-2],h],d),u[n].type=e.OBJECT_TYPE_CAS,u[n].isDraggable=!0,u[n].visProp.fixed=!1);return d=o.copyAttributes(r,t.options,"regularpolygon"),s=t.create("polygon",u,d),s.elType="regularpolygon",s},t.createPolygonalChain=function(t,e,i){var r,s;return r=o.copyAttributes(i,t.options,"polygonalchain"),s=t.create("polygon",e,r),s.elType="polygonalchain",s.vertices.pop(),t.removeObject(s.borders[s.borders.length-1]),s.borders.pop(),s},t.registerElement("polygon",t.createPolygon),t.registerElement("regularpolygon",t.createRegularPolygon),t.registerElement("polygonalchain",t.createPolygonalChain),{Polygon:t.Polygon,createPolygon:t.createPolygon,createRegularPolygon:t.createRegularPolygon}}),define("element/arc",["jxg","math/geometry","math/math","base/coords","base/circle","utils/type","base/constants","base/curve","element/composition"],function(t,e,i,r,s,o,n,a,h){"use strict";return t.createArc=function(a,h,l){var c,d,u;if(!1===(u=o.providePoints(a,h,l,"arc",["center","radiuspoint","anglepoint"]))||u.length<3)throw new Error("JSXGraph: Can't create Arc with parent types '"+typeof h[0]+"' and '"+typeof h[1]+"' and '"+typeof h[2]+"'.\nPossible parent types: [point,point,point], [arc, transformation]");return d=o.copyAttributes(l,a.options,"arc"),c=a.create("curve",[[0],[0]],d),c.elType="arc",c.setParents(u),c.type=n.OBJECT_TYPE_ARC,c.center=u[0],c.radiuspoint=u[1],c.point2=c.radiuspoint,c.anglepoint=u[2],c.point3=c.anglepoint,c.center.addChild(c),c.radiuspoint.addChild(c),c.anglepoint.addChild(c),c.useDirection=d.usedirection,c.updateDataArray=function(){var t,i,r,s,n,a,h=1,l=this.radiuspoint,c=this.center,d=this.anglepoint,p=o.evaluate(this.visProp.selection);i=e.rad(l,c,d),("minor"===p&&i>Math.PI||"major"===p&&i0&&(this.updateTransformMatrix(),p=i.inverse(this.transformMat),f=i.matVecMult(p,h.usrCoords),h=new r(n.COORDS_BY_USER,f,this.board)),a=this.center.coords.distance(n.COORDS_BY_USER,h),l=Math.abs(a-g)Math.PI||"major"===b&&uu)&&(l=!1)),l)},c.hasPointSector=function(t,i){var s,a,h,l=new r(n.COORDS_BY_SCREEN,[t,i],this.board),c=this.Radius(),d=this.center.coords.distance(n.COORDS_BY_USER,l),u=dMath.PI||"major"===p&&hh)&&(u=!1)),u},c.getTextAnchor=function(){return this.center.coords},c.getLabelAnchor=function(){var t,i,s,a,h,l=e.rad(this.radiuspoint,this.center,this.anglepoint),c=10/this.board.unitX,d=10/this.board.unitY,u=this.point2.coords.usrCoords,p=this.center.coords.usrCoords,f=u[1]-p[1],m=u[2]-p[2],g=o.evaluate(this.visProp.selection),b=this.label?this.label.visProp:this.visProp.label;return("minor"===g&&l>Math.PI||"major"===g&&l=0?1:-1):c.direction1=h[2]>=0?1:-1,n.isArray(h[3])?(2===h[3].length&&(h[3]=[1].concat(h[3])),p=e.projectPointToLine({coords:{usrCoords:h[3]}},c.line2,a),p=r.subtract(p.usrCoords,u.usrCoords),c.direction2=i.innerProduct(p,[0,c.line2.stdform[2],-c.line2.stdform[1]],3)>=0?1:-1):c.direction2=h[3]>=0?1:-1,c.updateDataArray=function(){var t,n,a,h,l=[0,0,0],d=[0,0,0],u=[0,0,0];if(n=this.line1,a=this.line2,d=i.crossProduct(n.stdform,a.stdform),Math.abs(d[0])>i.eps*i.eps&&(d[1]/=d[0],d[2]/=d[0],d[0]/=d[0]),t=this.direction1*this.Radius(),l=r.add(d,[0,t*n.stdform[2],-t*n.stdform[1]]),t=this.direction2*this.Radius(),u=r.add(d,[0,t*a.stdform[2],-t*a.stdform[1]]),this.point2.coords=new s(o.COORDS_BY_USER,l,c.board),this.point1.coords=new s(o.COORDS_BY_USER,d,c.board),this.point3.coords=new s(o.COORDS_BY_USER,u,c.board),Math.abs(l[0])Math.PI||"major"===d&&o=0&&(l=this.point2,a=this.point3)),a=a.coords.usrCoords,h=h.coords.usrCoords,l=l.coords.usrCoords,t=e.bezierArc(a,h,l,!0,c),this.dataX=t[0],this.dataY=t[1],this.bezierDegree=3},c.Radius=function(){return this.point2.Dist(this.point1)},d=n.copyAttributes(l,a.options,"sector","arc"),d.withLabel=!1,d.name+="_arc",c.arc=a.create("arc",[c.point1,c.point2,c.point3],d),c.addChild(c.arc)),c.center=c.point1,c.radiuspoint=c.point2,c.anglepoint=c.point3,c.hasPointCurve=function(t,i){var r,a,h,l,c,d=new s(o.COORDS_BY_SCREEN,[t,i],this.board),u=this.Radius(),p=this.center.coords.distance(o.COORDS_BY_USER,d),f=n.evaluate(this.visProp.selection);return l=this.board.options.precision.hasPoint/Math.min(this.board.unitX,this.board.unitY),c=Math.abs(p-u)Math.PI||"major"===f&&hh)&&(c=!1)),c},c.hasPointSector=function(t,i){var r,a,h,l=new s(o.COORDS_BY_SCREEN,[t,i],this.board),c=this.Radius(),d=this.point1.coords.distance(o.COORDS_BY_USER,l),u=dMath.PI||"major"===p&&hh)&&(u=!1)),u},c.hasPoint=function(t,e){return n.evaluate(this.visProp.highlightonsector)||n.evaluate(this.visProp.hasinnerpoints)?this.hasPointSector(t,e):this.hasPointCurve(t,e)},c.getTextAnchor=function(){return this.point1.coords},c.getLabelAnchor=function(){var t,i,r,a,h,l=e.rad(this.point2,this.point1,this.point3),c=13/this.board.unitX,d=13/this.board.unitY,u=this.point2.coords.usrCoords,p=this.point1.coords.usrCoords,f=u[1]-p[1],m=u[2]-p[2],g=n.evaluate(this.visProp.selection),b=this.label?this.label.visProp:this.visProp.label;return("minor"===g&&l>Math.PI||"major"===g&&lMath.PI||"major"===c&&i0&&(t.transformations.pop(),t.isDraggable=!0,t.parents=[]),this},h.setParents(p)),n.exists(h.visProp.text)&&h.label.setText(n.evaluate(h.visProp.text)),h.elType="angle",h.type=o.OBJECT_TYPE_ANGLE,h.subs={},h.updateDataArraySquare=function(){var t,r,s,o,n,a,h,l,c=this.Radius();"2lines"===f&&this.updateDataArraySector(),t=this.point2,r=this.point1,s=this.point3,t=t.coords.usrCoords,r=r.coords.usrCoords,s=s.coords.usrCoords,o=e.distance(t,r,3),n=e.distance(s,r,3),t=[1,r[1]+(t[1]-r[1])*c/o,r[2]+(t[2]-r[2])*c/o],s=[1,r[1]+(s[1]-r[1])*c/n,r[2]+(s[2]-r[2])*c/n],a=i.crossProduct(s,r),h=[-t[1]*a[1]-t[2]*a[2],t[0]*a[1],t[0]*a[2]],a=i.crossProduct(t,r),l=[-s[1]*a[1]-s[2]*a[2],s[0]*a[1],s[0]*a[2]],a=i.crossProduct(h,l),a[1]/=a[0],a[2]/=a[0],this.dataX=[r[1],t[1],a[1],s[1],r[1]],this.dataY=[r[2],t[2],a[2],s[2],r[2]],this.bezierDegree=1},h.updateDataArrayNone=function(){this.dataX=[NaN],this.dataY=[NaN],this.bezierDegree=1},h.updateDataArray=function(){var t=n.evaluate(this.visProp.type),r=e.trueAngle(this.point2,this.point1,this.point3),s=n.evaluate(this.visProp.selection);("minor"===s&&r>180||"major"===s&&r<180)&&(r=360-r),Math.abs(r-90)Math.PI||"major"===u&&aMath.PI||"major"===g&&d=Math.PI?t:2*Math.PI-t},o},t.registerElement("reflexangle",t.createReflexAngle),{createSector:t.createSector,createCircumcircleSector:t.createCircumcircleSector,createMinorSector:t.createMinorSector,createMajorSector:t.createMajorSector,createAngle:t.createAngle,createReflexAngle:t.createReflexAngle,createNonreflexAngle:t.createNonreflexAngle}}),define("element/composition",["jxg","math/math","math/geometry","math/numerics","math/statistics","base/coords","utils/type","base/constants","base/point","base/line","base/circle","base/transformation","base/composition","base/curve","base/text","base/polygon","element/arc","element/sector"],function(t,e,i,r,s,o,n,a,h,l,c,d,u,p,f,m,g,b){"use strict";return t.createOrthogonalProjection=function(t,e,r){var s,o,h,l;if(e[0]=t.select(e[0]),e[1]=t.select(e[1]),n.isPointType(t,e[0])&&e[1].elementClass===a.OBJECT_CLASS_LINE)o=n.providePoints(t,[e[0]],r,"point")[0],s=e[1];else{if(!n.isPointType(t,e[1])||e[0].elementClass!==a.OBJECT_CLASS_LINE)throw new Error("JSXGraph: Can't create perpendicular point with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,line]");o=n.providePoints(t,[e[1]],r,"point")[0],s=e[0]}return l=n.copyAttributes(r,t.options,"orthogonalprojection"),h=t.create("point",[function(){ +return i.projectPointToLine(o,s,t)}],l),o.addChild(h),s.addChild(h),h.elType="orthogonalprojection",h.setParents([o.id,h.id]),h.update(),h.generatePolynomial=function(){var t=s.point1.symbolic.x,e=s.point1.symbolic.y,i=s.point2.symbolic.x,r=s.point2.symbolic.y,n=o.symbolic.x,a=o.symbolic.y,l=h.symbolic.x,c=h.symbolic.y;return["("+e+")*("+l+")-("+e+")*("+i+")+("+c+")*("+i+")-("+t+")*("+c+")+("+t+")*("+r+")-("+l+")*("+r+")","("+a+")*("+e+")-("+a+")*("+r+")-("+c+")*("+e+")+("+c+")*("+r+")+("+n+")*("+t+")-("+n+")*("+i+")-("+l+")*("+t+")+("+l+")*("+i+")"]},h},t.createPerpendicular=function(t,e,i){var r,s,o,h;if(e[0]=t.select(e[0]),e[1]=t.select(e[1]),n.isPointType(t,e[0])&&e[1].elementClass===a.OBJECT_CLASS_LINE)s=e[1],r=n.providePoints(t,[e[0]],i,"point")[0];else{if(!n.isPointType(t,e[1])||e[0].elementClass!==a.OBJECT_CLASS_LINE)throw new Error("JSXGraph: Can't create perpendicular with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [line,point]");s=e[0],r=n.providePoints(t,[e[1]],i,"point")[0]}return h=n.copyAttributes(i,t.options,"perpendicular"),o=l.createLine(t,[function(){return s.stdform[2]*r.X()-s.stdform[1]*r.Y()},function(){return-s.stdform[2]*r.Z()},function(){return s.stdform[1]*r.Z()}],h),o.elType="perpendicular",o.setParents([s.id,r.id]),o},t.createPerpendicularPoint=function(t,e,r){var s,o,h;if(e[0]=t.select(e[0]),e[1]=t.select(e[1]),n.isPointType(t,e[0])&&e[1].elementClass===a.OBJECT_CLASS_LINE)o=n.providePoints(t,[e[0]],r,"point")[0],s=e[1];else{if(!n.isPointType(t,e[1])||e[0].elementClass!==a.OBJECT_CLASS_LINE)throw new Error("JSXGraph: Can't create perpendicular point with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,line]");o=n.providePoints(t,[e[1]],r,"point")[0],s=e[0]}return h=t.create("point",[function(){return i.perpendicular(s,o,t)[0]}],r),o.addChild(h),s.addChild(h),h.elType="perpendicularpoint",h.setParents([o.id,s.id]),h.update(),h.generatePolynomial=function(){var t=s.point1.symbolic.x,e=s.point1.symbolic.y,i=s.point2.symbolic.x,r=s.point2.symbolic.y,n=o.symbolic.x,a=o.symbolic.y,l=h.symbolic.x,c=h.symbolic.y;return["("+e+")*("+l+")-("+e+")*("+i+")+("+c+")*("+i+")-("+t+")*("+c+")+("+t+")*("+r+")-("+l+")*("+r+")","("+a+")*("+e+")-("+a+")*("+r+")-("+c+")*("+e+")+("+c+")*("+r+")+("+n+")*("+t+")-("+n+")*("+i+")-("+l+")*("+t+")+("+l+")*("+i+")"]},h},t.createPerpendicularSegment=function(e,r,s){var o,h,c,d,u;if(r[0]=e.select(r[0]),r[1]=e.select(r[1]),n.isPointType(e,r[0])&&r[1].elementClass===a.OBJECT_CLASS_LINE)h=r[1],o=n.providePoints(e,[r[0]],s,"point")[0];else{if(!n.isPointType(e,r[1])||r[0].elementClass!==a.OBJECT_CLASS_LINE)throw new Error("JSXGraph: Can't create perpendicular with parent types '"+typeof r[0]+"' and '"+typeof r[1]+"'.\nPossible parent types: [line,point]");h=r[0],o=n.providePoints(e,[r[1]],s,"point")[0]}return u=n.copyAttributes(s,e.options,"perpendicularsegment","point"),d=t.createPerpendicularPoint(e,[h,o],u),d.dump=!1,n.exists(s.layer)||(s.layer=e.options.layer.line),u=n.copyAttributes(s,e.options,"perpendicularsegment"),c=l.createLine(e,[function(){return i.perpendicular(h,o,e)[1]?[d,o]:[o,d]}],u),c.point=d,c.elType="perpendicularsegment",c.setParents([o.id,h.id]),c.subs={point:d},c.inherits.push(d),c},t.createMidpoint=function(t,i,r){var s,o,h,l,c;for(l=0;l=3&&n.isPoint(e[0])&&n.isPoint(e[1])&&n.isPoint(e[2])))throw new Error("JSXGraph: Can't create incenter with parent types '"+typeof e[0]+"', '"+typeof e[1]+"' and '"+typeof e[2]+"'.\nPossible parent types: [point,point,point]");return s=e[0],h=e[1],l=e[2],r=t.create("point",[function(){var e,i,r;return e=Math.sqrt((h.X()-l.X())*(h.X()-l.X())+(h.Y()-l.Y())*(h.Y()-l.Y())),i=Math.sqrt((s.X()-l.X())*(s.X()-l.X())+(s.Y()-l.Y())*(s.Y()-l.Y())),r=Math.sqrt((h.X()-s.X())*(h.X()-s.X())+(h.Y()-s.Y())*(h.Y()-s.Y())),new o(a.COORDS_BY_USER,[(e*s.X()+i*h.X()+r*l.X())/(e+i+r),(e*s.Y()+i*h.Y()+r*l.Y())/(e+i+r)],t)}],i),r.elType="incenter",r.setParents(e),r},t.createCircumcircle=function(e,i,r){var s,o,a;if(!1===(i=n.providePoints(e,i,r,"point")))throw new Error("JSXGraph: Can't create circumcircle with parent types '"+typeof i[0]+"', '"+typeof i[1]+"' and '"+typeof i[2]+"'.\nPossible parent types: [point,point,point]");try{a=n.copyAttributes(r,e.options,"circumcircle","center"),s=t.createCircumcenter(e,i,a),s.dump=!1,n.exists(r.layer)||(r.layer=e.options.layer.circle),a=n.copyAttributes(r,e.options,"circumcircle"),o=c.createCircle(e,[s,i[0]],a),o.elType="circumcircle",o.setParents(i),o.subs={center:s},o.inherits.push(o)}catch(t){throw new Error("JSXGraph: Can't create circumcircle with parent types '"+typeof i[0]+"', '"+typeof i[1]+"' and '"+typeof i[2]+"'.\nPossible parent types: [point,point,point]")}return o},t.createIncircle=function(e,i,r){var s,o,a;if(!1===(i=n.providePoints(e,i,r,"point")))throw new Error("JSXGraph: Can't create circumcircle with parent types '"+typeof i[0]+"', '"+typeof i[1]+"' and '"+typeof i[2]+"'.\nPossible parent types: [point,point,point]");try{a=n.copyAttributes(r,e.options,"incircle","center"),s=t.createIncenter(e,i,a),s.dump=!1,n.exists(r.layer)||(r.layer=e.options.layer.circle),a=n.copyAttributes(r,e.options,"incircle"),o=c.createCircle(e,[s,function(){var t=Math.sqrt((i[1].X()-i[2].X())*(i[1].X()-i[2].X())+(i[1].Y()-i[2].Y())*(i[1].Y()-i[2].Y())),e=Math.sqrt((i[0].X()-i[2].X())*(i[0].X()-i[2].X())+(i[0].Y()-i[2].Y())*(i[0].Y()-i[2].Y())),r=Math.sqrt((i[1].X()-i[0].X())*(i[1].X()-i[0].X())+(i[1].Y()-i[0].Y())*(i[1].Y()-i[0].Y())),s=(t+e+r)/2;return Math.sqrt((s-t)*(s-e)*(s-r)/s)}],a),o.elType="incircle",o.setParents(i),o.center=s,o.subs={center:o.center},o.inherits.push(s)}catch(t){throw new Error("JSXGraph: Can't create circumcircle with parent types '"+typeof i[0]+"', '"+typeof i[1]+"' and '"+typeof i[2]+"'.\nPossible parent types: [point,point,point]")}return o},t.createReflection=function(t,e,i){var r,s,o,u,f,g,b,v,y="\nPossible parent types: [point|line|curve|polygon|circle|arc|sector, line]";for(g=0;ge[2]&&(r=e[2]-i),r+t.usrCoords[1]},function(){var t=new o(a.COORDS_BY_SCREEN,[0,n.evaluate(this.visProp.offset[1])+this.board.origin.scrCoords[2]],this.board,!1),e=this.board.getBoundingBox(),i=.1*(e[1]-e[3]),r=y.Y();return r>e[1]?r=e[1]-i:ri-d;s-=d)r.dataX.push(h.usrCoords[1],l.usrCoords[1],NaN),r.dataY.push(s,s,NaN);for(e=Math.ceil(h.usrCoords[1]/c)*c,i=Math.floor(l.usrCoords[1]/c)*c,h.usrCoords[1]>l.usrCoords[1]&&(e=Math.floor(l.usrCoords[1]/c)*c,i=Math.ceil(h.usrCoords[1]/c)*c),s=e;s=e.eps?i.perpendicular(r[0],u,t)[0].usrCoords:u.coords.usrCoords,s=[1,u[1]+p[1]*d,u[2]-p[0]*d],o=[1,u[1]-f[1]*d,u[2]+f[0]*d],this.dataX=[s[1],s[1]+p[0]*n,o[1]+f[0]*n,o[1],s[1]],this.dataY=[s[2],s[2]+p[1]*n,o[2]+f[1]*n,o[2],s[2]]};else if(r[0].elementClass===a.OBJECT_CLASS_CURVE&&"functiongraph"===r[0].visProp.curvetype)h=t.create("curve",[[],[]],l),h.hasPoint=function(){return!1},h.updateDataArray=function(){var t,e,i,s,o=this.board.getBoundingBox(),n=r[0].points,a=1.5*(l.inverse?o[1]:o[3]);if(this.dataX=[],this.dataY=[],!((s=n.length)<=0)){for(i=0;i=t&&(e=i,!n[i].isReal());i--);for(this.dataX.push(n[t].usrCoords[1]),this.dataY.push(a),i=t;i<=e;i++)n[i].isReal()&&(this.dataX.push(n[i].usrCoords[1]),this.dataY.push(n[i].usrCoords[2]));this.dataX.push(n[e].usrCoords[1]),this.dataY.push(a)}};else if(o=n.createFunction(r[0]),!n.exists(o))throw new Error("JSXGraph: Can't create area with the given parents.\nPossible parent types: [line], [function]");return h.addParents(r[0]),h},t.registerElement("arrowparallel",t.createArrowParallel),t.registerElement("bisector",t.createBisector),t.registerElement("bisectorlines",t.createAngularBisectorsOfTwoLines),t.registerElement("msector",t.createMsector),t.registerElement("circumcircle",t.createCircumcircle),t.registerElement("circumcirclemidpoint",t.createCircumcenter),t.registerElement("circumcenter",t.createCircumcenter),t.registerElement("incenter",t.createIncenter),t.registerElement("incircle",t.createIncircle),t.registerElement("integral",t.createIntegral),t.registerElement("midpoint",t.createMidpoint),t.registerElement("mirrorelement",t.createMirrorElement),t.registerElement("mirrorpoint",t.createMirrorPoint),t.registerElement("normal",t.createNormal),t.registerElement("orthogonalprojection",t.createOrthogonalProjection),t.registerElement("parallel",t.createParallel),t.registerElement("parallelpoint",t.createParallelPoint),t.registerElement("perpendicular",t.createPerpendicular),t.registerElement("perpendicularpoint",t.createPerpendicularPoint),t.registerElement("perpendicularsegment",t.createPerpendicularSegment),t.registerElement("reflection",t.createReflection),t.registerElement("grid",t.createGrid),t.registerElement("inequality",t.createInequality),{createArrowParallel:t.createArrowParallel,createBisector:t.createBisector,createAngularBisectorOfTwoLines:t.createAngularBisectorsOfTwoLines,createCircumcircle:t.createCircumcircle,createCircumcenter:t.createCircumcenter,createIncenter:t.createIncenter,createIncircle:t.createIncircle,createIntegral:t.createIntegral,createMidpoint:t.createMidpoint,createMirrorElement:t.createMirrorElement,createMirrorPoint:t.createMirrorPoint,createNormal:t.createNormal,createOrthogonalProjection:t.createOrthogonalProjection,createParallel:t.createParallel,createParallelPoint:t.createParallelPoint,createPerpendicular:t.createPerpendicular,createPerpendicularPoint:t.createPerpendicularPoint,createPerpendicularSegmen:t.createPerpendicularSegment,createReflection:t.createReflection,createGrid:t.createGrid,createInequality:t.createInequality}}),define("base/board",["jxg","base/constants","base/coords","options","math/numerics","math/math","math/geometry","math/complex","math/statistics","parser/jessiecode","parser/geonext","utils/color","utils/type","utils/event","utils/env","base/transformation","base/point","base/line","base/text","element/composition","base/composition"],function(t,e,i,r,s,o,n,a,h,l,c,d,u,p,f,m,g,b,v,y,C){"use strict";return t.Board=function(t,i,s,o,n,a,h,c,d,m,g){if(this.BOARD_MODE_NONE=0,this.BOARD_MODE_DRAG=1,this.BOARD_MODE_MOVE_ORIGIN=2,this.BOARD_QUALITY_LOW=1,this.BOARD_QUALITY_HIGH=2,this.BOARD_MODE_ZOOM=17,u.exists(g.document)&&!1!==g.document?this.document=g.document:"undefined"!=typeof document&&u.isObject(document)&&(this.document=document),this.container=t,this.containerObj=f.isBrowser?this.document.getElementById(this.container):null,f.isBrowser&&"no"!==i.type&&null===this.containerObj)throw new Error("\nJSXGraph: HTML container element '"+t+"' not found.");this.renderer=i,this.grids=[],this.options=u.deepCopy(r),this.attr=g,this.dimension=2,this.jc=new l,this.jc.use(this),this.origin={},this.origin.usrCoords=[1,0,0],this.origin.scrCoords=[1,o[0],o[1]],this.zoomX=n,this.zoomY=a,this.unitX=h*this.zoomX,this.unitY=c*this.zoomY,this.keepaspectratio=!1,this.canvasWidth=d,this.canvasHeight=m,u.exists(s)&&""!==s&&f.isBrowser&&!u.exists(this.document.getElementById(s))?this.id=s:this.id=this.generateId(),p.eventify(this),this.hooks=[],this.dependentBoards=[],this.inUpdate=!1,this.objects={},this.objectsList=[],this.groups={},this.animationObjects={},this.highlightedObjects={},this.numObjects=0,this.elementsByName={},this.mode=this.BOARD_MODE_NONE,this.updateQuality=this.BOARD_QUALITY_HIGH,this.isSuspendedRedraw=!1,this.calculateSnapSizes(),this.drag_dx=0,this.drag_dy=0,this.drag_position=[0,0],this.mouse={},this.touches=[],this.xmlString="",this.cPos=[],this.positionAccessLast=0,this.downObjects=[],this.attr.showcopyright&&this.renderer.displayCopyright(e.licenseText,parseInt(this.options.text.fontSize,10)),this.needsFullUpdate=!1,this.reducedUpdate=!1,this.currentCBDef="none",this.geonextCompatibilityMode=!1,this.options.text.useASCIIMathML&&translateASCIIMath?init():this.options.text.useASCIIMathML=!1,this.hasMouseHandlers=!1,this.hasTouchHandlers=!1,this.hasPointerHandlers=!1,this.hasMouseUp=!1,this.hasTouchEnd=!1,this.hasPointerUp=!1,this._drag_offset=[0,0],this._board_touches=[],this.selectingMode=!1,this.isSelecting=!1,this.selectingBox=[[0,0],[0,0]],this.attr.registerevents&&this.addEventHandlers(),this.methodMap={update:"update",fullUpdate:"fullUpdate",on:"on",off:"off",trigger:"trigger",setView:"setBoundingBox",setBoundingBox:"setBoundingBox",migratePoint:"migratePoint",colorblind:"emulateColorblindness",suspendUpdate:"suspendUpdate",unsuspendUpdate:"unsuspendUpdate",clearTraces:"clearTraces",left:"clickLeftArrow",right:"clickRightArrow",up:"clickUpArrow",down:"clickDownArrow",zoomIn:"zoomIn",zoomOut:"zoomOut",zoom100:"zoom100",zoomElements:"zoomElements",remove:"removeObject",removeObject:"removeObject"}},t.extend(t.Board.prototype,{generateName:function(t){var i,r,s=this.attr.maxnamelength,o="",n="",a=[],h="";if(t.type===e.OBJECT_TYPE_TICKS)return"";for(i=u.isPoint(t)?["","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]:t.type===e.OBJECT_TYPE_ANGLE?["","α","β","γ","δ","ε","ζ","η","θ","ι","κ","λ","μ","ν","ξ","ο","π","ρ","σ","τ","υ","φ","χ","ψ","ω"]:["","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],u.isPoint(t)||t.elementClass===e.OBJECT_CLASS_LINE||t.type===e.OBJECT_TYPE_ANGLE||(o=t.type===e.OBJECT_TYPE_POLYGON?"P_{":t.elementClass===e.OBJECT_CLASS_CIRCLE?"k_{":t.elementClass===e.OBJECT_CLASS_TEXT?"t_{":"s_{",n="}"),r=0;r0;r--)h+=i[a[r-1]];if(!u.exists(this.elementsByName[h+n]))return h+n}for(a[0]=i.length, +r=1;r0&&(this.mode===this.BOARD_MODE_DRAG||this.mode===this.BOARD_MODE_MOVE_ORIGIN||(new Date).getTime()-this.positionAccessLast<1e3))return this.cPos;if(this.positionAccessLast=(new Date).getTime(),a.getBoundingClientRect){for(i=a.getBoundingClientRect(),r=1,s=a;s&&u.exists(s.parentNode);)u.exists(s.style)&&u.exists(s.style.zoom)&&""!==s.style.zoom&&(r*=parseFloat(s.style.zoom)),s=s.parentNode;return t=[i.left*r,i.top*r],t[0]+=f.getProp(a,"border-left-width"),t[1]+=f.getProp(a,"border-top-width"),"vml"!==this.renderer.type&&(t[0]+=f.getProp(a,"padding-left"),t[1]+=f.getProp(a,"padding-top")),this.cPos=t.slice(),this.cPos}return t=f.getOffset(a),e=this.document.documentElement.ownerDocument,!this.containerObj.currentStyle&&e.defaultView&&(t[0]+=f.getProp(o,"margin-left"),t[1]+=f.getProp(o,"margin-top"),t[0]+=f.getProp(o,"border-left-width"),t[1]+=f.getProp(o,"border-top-width"),t[0]+=f.getProp(o,"padding-left"),t[1]+=f.getProp(o,"padding-top")),n&&(t[0]+=f.getProp(n,"left"),t[1]+=f.getProp(n,"top")),"object"==typeof google&&google.translate&&(t[0]+=10,t[1]+=25),t[0]+=f.getProp(a,"border-left-width"),t[1]+=f.getProp(a,"border-top-width"),"vml"!==this.renderer.type&&(t[0]+=f.getProp(a,"padding-left"),t[1]+=f.getProp(a,"padding-top")),t[0]+=this.attr.offsetx,t[1]+=this.attr.offsety,this.cPos=t.slice(),this.cPos},getMousePosition:function(t,e){var i,r,s=this.getCoordsTopLeftCorner();return i=f.getPosition(t,e,this.document),u.exists(this.cssTransMat)||this.updateCSSTransforms(),r=[1,i[0]-s[0],i[1]-s[1]],r=o.matVecMult(this.cssTransMat,r),r[1]/=r[0],r[2]/=r[0],[r[1],r[2]]},initMoveOrigin:function(t,e){this.drag_dx=t-this.origin.scrCoords[1],this.drag_dy=e-this.origin.scrCoords[2],this.mode=this.BOARD_MODE_MOVE_ORIGIN,this.updateQuality=this.BOARD_QUALITY_LOW},initMoveObject:function(t,i,r,s){var o,n,a,l=[],c=[],d=this.objectsList.length,p={visProp:{layer:-1e4}};for(n=0;np.visProp.layer||o.visProp.layer===p.visProp.layer&&o.lastDragTime.getTime()>=p.lastDragTime.getTime())&&(this.attr.ignorelabels&&u.exists(p.label)&&o===p.label||(p=o,l.push(p),u.exists(p.coords)?c.push(h.subtract(p.coords.scrCoords.slice(1),[t,i])):c.push([0,0])));return l.length>0&&(this.mode=this.BOARD_MODE_DRAG),this.attr.takefirst?(l.length=1,this._drag_offset=c[0]):(l=l.slice(-1),this._drag_offset=c[c.length-1]),this._drag_offset||(this._drag_offset=[0,0]),"svg"===this.renderer.type&&u.exists(l[0])&&u.evaluate(l[0].visProp.dragtotopoflayer)&&1===l.length&&u.exists(l[0].rendNode)&&l[0].rendNode.parentNode.appendChild(l[0].rendNode),this.previousRotation=0,this.previousScale=1,l.length>=1&&(l[0].highlight(!0),this.triggerEventHandlers(["mousehit","hit"],[r,l[0]])),l},moveObject:function(t,r,s,o,n){var a,l,c,d=new i(e.COORDS_BY_SCREEN,this.getScrCoordsOfMouse(t,r),this);s&&s.obj&&(a=s.obj,a.coords&&(l=a.coords.scrCoords.slice()),this.drag_position=[d.scrCoords[1],d.scrCoords[2]],this.drag_position=h.add(this.drag_position,this._drag_offset),u.exists(a.coords)?a.setPositionDirectly(e.COORDS_BY_SCREEN,this.drag_position):(this.showInfobox(!1),isNaN(s.targets[0].Xprev+s.targets[0].Yprev)||a.setPositionDirectly(e.COORDS_BY_SCREEN,[d.scrCoords[1],d.scrCoords[2]],[s.targets[0].Xprev,s.targets[0].Yprev]),s.targets[0].Xprev=d.scrCoords[1],s.targets[0].Yprev=d.scrCoords[2]),u.exists(a.coords)&&(a.prepareUpdate().update(!1).updateRenderer(),this.updateInfobox(a),a.prepareUpdate().update(!0).updateRenderer()),a.coords&&(c=a.coords.scrCoords),a.coords&&l[1]===c[1]&&l[2]===c[2]||(a.triggerEventHandlers([n+"drag","drag"],[o]),this.update()),a.highlight(!0),this.triggerEventHandlers(["mousehit","hit"],[o,a]),a.lastDragTime=new Date)},twoFingerMove:function(t,r,s,o){var n,a,h;u.exists(s)&&u.exists(s.obj)&&(h=s.obj,n=new i(e.COORDS_BY_SCREEN,this.getScrCoordsOfMouse(t[0],t[1]),this),a=new i(e.COORDS_BY_SCREEN,this.getScrCoordsOfMouse(r[0],r[1]),this),h.elementClass===e.OBJECT_CLASS_LINE||h.type===e.OBJECT_TYPE_POLYGON?this.twoFingerTouchObject(n,a,s,h,o):h.elementClass===e.OBJECT_CLASS_CIRCLE&&this.twoFingerTouchCircle(n,a,s,h),h.triggerEventHandlers(["touchdrag","drag"],[o]),s.targets[0].Xprev=n.scrCoords[1],s.targets[0].Yprev=n.scrCoords[2],s.targets[1].Xprev=a.scrCoords[1],s.targets[1].Yprev=a.scrCoords[2])},twoFingerTouchObject:function(t,r,s,a,h){var l,c,d,p,f,m,g,b,v,y,C,_,P,E,S,x,O,w,T;if(u.exists(s.targets[0])&&u.exists(s.targets[1])&&!isNaN(s.targets[0].Xprev+s.targets[0].Yprev+s.targets[1].Xprev+s.targets[1].Yprev)){if(l=t.usrCoords,c=r.usrCoords,d=new i(e.COORDS_BY_SCREEN,[s.targets[0].Xprev,s.targets[0].Yprev],this).usrCoords,p=new i(e.COORDS_BY_SCREEN,[s.targets[1].Xprev,s.targets[1].Yprev],this).usrCoords,m=[1,.5*(d[1]+p[1]),.5*(d[2]+p[2])],f=[1,.5*(l[1]+c[1]),.5*(l[2]+c[2])],b=o.crossProduct(d,p),g=o.crossProduct(l,c),C=o.crossProduct(b,g),Math.abs(C[0])0&&n.push(i.points[0].usrCoords);else try{n.push(i.coords.usrCoords)}catch(e){t.debug("JSXGraph+ saveStartPos: obj.coords.usrCoords not available: "+e)}for(o=n.length,s=0;s.2*Math.PI&&Math.abs(s)<1.8*Math.PI&&(g=!0),a=n.distance([t.touches[0].clientX,t.touches[0].clientY],[t.touches[1].clientX,t.touches[1].clientY],2),void 0===t.scale&&(t.scale=a/this.prevDist),"pan"===this.isPreviousGesture||g||(Math.abs(t.scale)<.77||Math.abs(t.scale)>1.3)&&(g=!0),o=t.scale/this.prevScale,this.prevScale=t.scale,this.prevCoords=[[t.touches[0].clientX,t.touches[0].clientY],[t.touches[1].clientX,t.touches[1].clientY]],r=new i(e.COORDS_BY_SCREEN,this.getMousePosition(t,0),this),this.attr.pan.enabled&&this.attr.pan.needtwofingers&&!g?(this.isPreviousGesture="pan",this.moveOrigin(r.scrCoords[1],r.scrCoords[2],!0)):this.attr.zoom.enabled&&Math.abs(o-1)<.5&&((this.attr.zoom.pinchhorizontal||this.attr.zoom.pinchvertical)&&(h=Math.abs(t.touches[0].clientX-t.touches[1].clientX),l=Math.abs(t.touches[0].clientY-t.touches[1].clientY),c=Math.abs(Math.atan2(l,h)),p=Math.PI*this.attr.zoom.pinchsensitivity/90),this.attr.zoom.pinchhorizontal&&c1)return"touch";if("mouse"===t.pointerType)return"mouse";if("pen"===t.pointerType)return"pen"}return"mouse"},pointerDownListener:function(t,e){var i,r,s,o,n,a,h,l,c,d="mouse";if(!e&&this._isPointerEventAlreadyThere(t))return!1;if(this.hasPointerUp||(window.navigator.msPointerEnabled?f.addEvent(this.document,"MSPointerUp",this.pointerUpListener,this):f.addEvent(this.document,"pointerup",this.pointerUpListener,this),this.hasPointerUp=!0),this.hasMouseHandlers&&this.removeMouseEventHandlers(),this.hasTouchHandlers&&this.removeTouchEventHandlers(),this.document.selection&&u.isFunction(this.document.selection.empty))this.document.selection.empty();else if(window.getSelection&&(a=window.getSelection(),a.removeAllRanges))try{a.removeAllRanges()}catch(t){}if(d=this._getPointerInputDevice(t),h=this.options.precision[d],this.options.precision.hasPoint=h,o=this.getMousePosition(t),this._testForSelection(t),this.selectingMode)return this._startSelecting(o),void this.triggerEventHandlers(["touchstartselecting","pointerstartselecting","startselecting"],[t]);if(e?(n=[e],this.mode=this.BOARD_MODE_DRAG):n=this.initMoveObject(o[0],o[1],t,d),n.length>0){for(c=n[n.length-1],l=!1,i=0;i0&&(t.preventDefault(),t.stopPropagation()),f.isBrowser&&"touch"!==this._getPointerInputDevice(t)?this.mode===this.BOARD_MODE_NONE&&this.mouseOriginMoveStart(t):(this._pointerAddBoardTouches(t),t.touches=this._board_touches,this.mode===this.BOARD_MODE_NONE&&this.touchOriginMoveStart(t)||this.mode!==this.BOARD_MODE_NONE&&this.mode!==this.BOARD_MODE_MOVE_ORIGIN||2!=t.touches.length||(this.mode===this.BOARD_MODE_MOVE_ORIGIN&&this.originMoveEnd(),this.gestureStartListener(t))),this.triggerEventHandlers(["touchstart","down","pointerdown","MSPointerDown"],[t]),!1},pointerOutListener:function(t){return(t.target===this.containerObj||"svg"==this.renderer.type&&t.target===this.renderer.foreignObjLayer)&&this.pointerUpListener(t),this.mode===this.BOARD_MODE_NONE},pointerMoveListener:function(t){var e,i,r,s=this._getPointerInputDevice(t);if("touch"==this._getPointerInputDevice(t)&&!this._pointerIsTouchRegistered(t))return this.BOARD_MODE_NONE;if(this.mode!==this.BOARD_MODE_DRAG&&(this.dehighlightAll(),this.showInfobox(!1)),this.mode!==this.BOARD_MODE_NONE&&(t.preventDefault(),t.stopPropagation()),this.updateQuality=this.BOARD_QUALITY_LOW,this.selectingMode)r=this.getMousePosition(t),this._moveSelecting(r),this.triggerEventHandlers(["touchmoveselecting","moveselecting","pointermoveselecting"],[t,this.mode]);else if(!this.mouseOriginMove(t))if(this.mode===this.BOARD_MODE_DRAG){for(e=0;e-1;e--){for(r=!1,i=0;i0;if(n=this.initMoveObject(o[0],o[1],i,"touch"),0!==n.length)if(l=n[n.length-1],u.isPoint(l)||l.elementClass===e.OBJECT_CLASS_TEXT||l.type===e.OBJECT_TYPE_TICKS||l.type===e.OBJECT_TYPE_IMAGE)d=[{num:s,X:g[s].screenX,Y:g[s].screenY,Xprev:NaN,Yprev:NaN,Xstart:[],Ystart:[],Zstart:[]}],this.saveStartPos(l,d[0]),this.touches.push({obj:l,targets:d}),l.highlight(!0);else if(l.elementClass===e.OBJECT_CLASS_LINE||l.elementClass===e.OBJECT_CLASS_CIRCLE||l.elementClass===e.OBJECT_CLASS_CURVE||l.type===e.OBJECT_TYPE_POLYGON){for(c=!1,a=0;a0&&(i.preventDefault(),i.stopPropagation()),this.mode===this.BOARD_MODE_NONE&&this.touchOriginMoveStart(i)||2!=g.length||this.mode!==this.BOARD_MODE_NONE&&this.mode!==this.BOARD_MODE_MOVE_ORIGIN||(this.mode===this.BOARD_MODE_MOVE_ORIGIN&&this.originMoveEnd(),this.gestureStartListener(i)),this.options.precision.hasPoint=this.options.precision.mouse,this.triggerEventHandlers(["touchstart","down"],[i]),!1},touchMoveListener:function(e){var i,r,s,o=e[t.touchProperty];if(this.mode!==this.BOARD_MODE_NONE&&(e.preventDefault(),e.stopPropagation()),this.mode!==this.BOARD_MODE_DRAG&&(this.dehighlightAll(),this.showInfobox(!1)),this.options.precision.hasPoint=this.options.precision.touch,this.updateQuality=this.BOARD_QUALITY_LOW,this.selectingMode){for(i=0;ithis.canvasWidth||r[1]<0||r[1]>this.canvasHeight)return;this.touches[i].targets[0].X=o[this.touches[i].targets[0].num].screenX,this.touches[i].targets[0].Y=o[this.touches[i].targets[0].num].screenY,this.moveObject(r[0],r[1],this.touches[i],e,"touch")}}else if(2===this.touches[i].targets.length&&this.touches[i].targets[0].num>-1&&this.touches[i].targets[1].num>-1&&o[this.touches[i].targets[0].num]&&o[this.touches[i].targets[1].num]){if(r=this.getMousePosition(e,this.touches[i].targets[0].num),s=this.getMousePosition(e,this.touches[i].targets[1].num),r[0]<0||r[0]>this.canvasWidth||r[1]<0||r[1]>this.canvasHeight||s[0]<0||s[0]>this.canvasWidth||s[1]<0||s[1]>this.canvasHeight)return;this.touches[i].targets[0].X=o[this.touches[i].targets[0].num].screenX,this.touches[i].targets[0].Y=o[this.touches[i].targets[0].num].screenY,this.touches[i].targets[1].X=o[this.touches[i].targets[1].num].screenX,this.touches[i].targets[1].Y=o[this.touches[i].targets[1].num].screenY,this.twoFingerMove(r,s,this.touches[i],e)}}else 2==o.length&&this.gestureChangeListener(e),r=this.getMousePosition(e,0),this.highlightElements(r[0],r[1],e,-1);return this.mode!==this.BOARD_MODE_DRAG&&this.showInfobox(!1),this.triggerEventHandlers(["touchmove","move"],[e,this.mode]),this.options.precision.hasPoint=this.options.precision.mouse,this.updateQuality=this.BOARD_QUALITY_HIGH,this.mode===this.BOARD_MODE_NONE},touchEndListener:function(i){var r,s,o,n,a,h=this.options.precision.touch,l=[],c=i&&i[t.touchProperty];if(this.triggerEventHandlers(["touchend","up"],[i]),this.showInfobox(!1),this.selectingMode)this._stopSelecting(i),this.triggerEventHandlers(["touchstopselecting","stopselecting"],[i]);else if(c&&c.length>0){for(r=0;r-1;r--){for(n=!1,s=0;s0?this.zoomIn(s.usrCoords[1],s.usrCoords[2]):this.zoomOut(s.usrCoords[1],s.usrCoords[2]),this.triggerEventHandlers(["mousewheel"],[t]),t.preventDefault(),!1},initInfobox:function(){var t=u.copyAttributes({},this.options,"infobox");return t.id=this.id+"_infobox",this.infobox=this.create("text",[0,0,"0,0"],t),this.infobox.distanceX=-20,this.infobox.distanceY=25,this.infobox.dump=!1,this.showInfobox(!1),this},updateInfobox:function(t){var e,i,r,s,o;return u.evaluate(t.visProp.showinfobox)?(u.isPoint(t)&&(r=t.coords.usrCoords[1],s=t.coords.usrCoords[2],o=u.evaluate(t.visProp.infoboxdigits),this.infobox.setCoords(r+this.infobox.distanceX/this.unitX,s+this.infobox.distanceY/this.unitY),"string"!=typeof t.infoboxText?("auto"===o?(e=u.autoDigits(r),i=u.autoDigits(s)):u.isNumber(o)?(e=u.toFixed(r,o),i=u.toFixed(s,o)):(e=r,i=s),this.highlightInfobox(e,i,t)):this.highlightCustomInfobox(t.infoboxText,t),this.showInfobox(!0)),this):this},showInfobox:function(t){return this.infobox.hiddenByParent==t&&(this.infobox.hiddenByParent=!t,this.infobox.prepareUpdate().updateVisibility(t).updateRenderer()),this},highlightInfobox:function(t,e,i){return this.highlightCustomInfobox("("+t+", "+e+")",i),this},highlightCustomInfobox:function(t,e){return this.infobox.setText(t),this},dehighlightAll:function(){var t,e,i=!1;for(t in this.highlightedObjects)this.highlightedObjects.hasOwnProperty(t)&&(e=this.highlightedObjects[t],(this.hasMouseHandlers||this.hasPointerHandlers)&&e.noHighlight(),i=!0);return this.highlightedObjects={},"canvas"===this.renderer.type&&i&&(this.prepareUpdate(),this.renderer.suspendRedraw(this),this.updateRenderer(),this.renderer.unsuspendRedraw()),this},getScrCoordsOfMouse:function(t,e){return[t,e]},getUsrCoordsOfMouse:function(t){var r=this.getCoordsTopLeftCorner(),s=f.getPosition(t,null,this.document),o=s[0]-r[0],n=s[1]-r[1];return new i(e.COORDS_BY_SCREEN,[o,n],this).usrCoords.slice(1)},getAllUnderMouse:function(t){var e=this.getAllObjectsUnderMouse(t);return e.push(this.getUsrCoordsOfMouse(t)),e},getAllObjectsUnderMouse:function(t){var e,i,r=this.getCoordsTopLeftCorner(),s=f.getPosition(t,null,this.document),o=s[0]-r[0],n=s[1]-r[1],a=[],h=this.objectsList.length;for(e=0;ethis.maxboundingbox[1]||h[1]>this.maxboundingbox[2]||h[2]"),m=i.indexOf(""),g=function(t,i,r,s){return function(){var o,n;o=t.select(i.id),n=o.coords.usrCoords[s],2===s?o.setPositionDirectly(e.COORDS_BY_USER,[r(),n]):o.setPositionDirectly(e.COORDS_BY_USER,[n,r()]),o.prepareUpdate().update()}},b=function(t,e,i,r){return function(){var s,o;s=t.select(e.id),o=i(),"strokewidth"===r?s.visProp.strokewidth=o:(o=d.rgba2rgbo(o),s.visProp[r+"color"]=o[0],s.visProp[r+"opacity"]=o[1])}};if(!(f<0)){for(;f>=0;){if(r=i.slice(f+6,m),s=r.indexOf("="),o=r.slice(0,s),n=r.slice(s+1),s=o.indexOf("."),a=o.slice(0,s),h=this.elementsByName[u.unescapeHTML(a)],l=o.slice(s+1).replace(/\s+/g,"").toLowerCase(),n=u.createFunction(n,this,"",!0),u.exists(this.elementsByName[a]))switch(p+='el = this.objects["'+h.id+'"];\n',l){case"x":c.push(g(this,h,n,2));break;case"y":c.push(g(this,h,n,1));break;case"visible":c.push(function(t,e,i){return function(){var r,s;r=t.select(e.id),s=i(),r.setAttribute({visible:s})}}(this,h,n));break;case"position":c.push(function(t,e,i){return function(){t.select(e.id).position=i()}}(this,h,n));break;case"stroke":c.push(b(this,h,n,"stroke"));break;case"style":c.push(function(t,e,i){return function(){t.select(e.id).setStyle(i())}}(this,h,n));break;case"strokewidth":c.push(b(this,h,n,"strokewidth"));break;case"fill":c.push(b(this,h,n,"fill"));break;case"label":break;default:t.debug("property '"+l+"' in conditions not yet implemented:"+n)}else t.debug("debug conditions: |"+a+"| undefined");i=i.slice(m+7),f=i.indexOf(""),m=i.indexOf("")}this.updateConditions=function(){var t;for(t=0;t25;)this.options.grid.snapSizeX*=2,s/=2;for(this.options.grid.snapSizeY=this.options.grid.gridY;Math.abs(o)>25;)this.options.grid.snapSizeY*=2,o/=2;return this},applyZoom:function(){return this.updateCoords().calculateSnapSizes().clearTraces().fullUpdate(),this},zoomIn:function(t,e){var i=this.getBoundingBox(),r=this.attr.zoom.factorx,s=this.attr.zoom.factory,o=(i[2]-i[0])*(1-1/r),n=(i[1]-i[3])*(1-1/s),a=.5,h=.5,l=this.attr.zoom.eps||this.attr.zoom.min||.001;return this.zoomX>this.attr.zoom.max&&r>1||this.zoomY>this.attr.zoom.max&&s>1||this.zoomXn&&(n=s.coords.usrCoords[1]),s.coords.usrCoords[2]>h?h=s.coords.usrCoords[2]:s.coords.usrCoords[2]l[1]&&(l[1]=r[1]),r[2]>l[2]&&(l[2]=r[2]),r[3]-1)for(this.objectsList.splice(i._pos,1),s=i._pos;s=0&&(e+=""+this.objects[t].id+": ");for(i in this.objects[t].childElements)this.objects[t].childElements.hasOwnProperty(i)&&(e+=this.objects[t].childElements[i].id+"("+this.objects[t].childElements[i].name+"), ");e+="

\n"}return e+="

\n",r=window.open(),r.document.open(),r.document.write(e),r.document.close(),this},showXML:function(){var t=window.open("");return t.document.open(),t.document.write("
"+u.escapeHTML(this.xmlString)+"
"),t.document.close(),this},prepareUpdate:function(){var t,e,i=this.objectsList.length;for(t=0;th&&n[s]=0;e--)this.dependentBoards[e]===t&&this.dependentBoards.splice(e,1);return this},update:function(t){var e,i,r,s;if(this.inUpdate||this.isSuspendedUpdate)return this;for(this.inUpdate=!0,"all"===this.attr.minimizereflow&&this.containerObj&&"vml"!==this.renderer.type&&(s=this.renderer.removeToInsertLater(this.containerObj)),"svg"===this.attr.minimizereflow&&"svg"===this.renderer.type&&(s=this.renderer.removeToInsertLater(this.renderer.svgRoot)),this.prepareUpdate().updateElements(t).updateConditions(),this.renderer.suspendRedraw(this),this.updateRenderer(),this.renderer.unsuspendRedraw(),this.triggerEventHandlers(["update"],[]),s&&s(),i=this.dependentBoards.length,e=0;ethis.maxboundingbox[1]||t[2]>this.maxboundingbox[2]||t[3]r&&r>s[3])},updateCSSTransforms:function(){var t=this.containerObj,e=t,i=t;for(this.cssTransMat=f.getCSSTransformMatrix(e),e=e.offsetParent;e;){for(this.cssTransMat=o.matMatMult(f.getCSSTransformMatrix(e),this.cssTransMat),i=i.parentNode;i!==e;)this.cssTransMat=o.matMatMult(f.getCSSTransformMatrix(e),this.cssTransMat),i=i.parentNode;e=e.offsetParent}return this.cssTransMat=o.inverse(this.cssTransMat),this},startSelectionMode:function(){this.selectingMode=!0,this.selectionPolygon.setAttribute({visible:!0}),this.selectingBox=[[0,0],[0,0]],this._setSelectionPolygonFromBox(),this.selectionPolygon.fullUpdate()},stopSelectionMode:function(){return this.selectingMode=!1,this.selectionPolygon.setAttribute({visible:!1}),[this.selectionPolygon.vertices[0].coords,this.selectionPolygon.vertices[2].coords]},_startSelecting:function(t){this.isSelecting=!0,this.selectingBox=[[t[0],t[1]],[t[0],t[1]]],this._setSelectionPolygonFromBox()},_moveSelecting:function(t){this.isSelecting&&(this.selectingBox[1]=[t[0],t[1]],this._setSelectionPolygonFromBox(),this.selectionPolygon.fullUpdate())},_stopSelecting:function(t){var e=this.getMousePosition(t);this.isSelecting=!1,this.selectingBox[1]=[e[0],e[1]],this._setSelectionPolygonFromBox()},_setSelectionPolygonFromBox:function(){var e=this.selectingBox[0],i=this.selectingBox[1];this.selectionPolygon.vertices[0].setPositionDirectly(t.COORDS_BY_SCREEN,[e[0],e[1]]),this.selectionPolygon.vertices[1].setPositionDirectly(t.COORDS_BY_SCREEN,[e[0],i[1]]),this.selectionPolygon.vertices[2].setPositionDirectly(t.COORDS_BY_SCREEN,[i[0],i[1]]),this.selectionPolygon.vertices[3].setPositionDirectly(t.COORDS_BY_SCREEN,[i[0],e[1]])},_testForSelection:function(t){this._isRequiredKeyPressed(t,"selection")&&(u.exists(this.selectionPolygon)||this._createSelectionPolygon(this.attr),this.startSelectionMode())},_createSelectionPolygon:function(t){var e;return u.exists(this.selectionPolygon)||(e=u.copyAttributes(t,r,"board","selection"),!0===e.enabled&&(this.selectionPolygon=this.create("polygon",[[0,0],[0,0],[0,0],[0,0]],e))),this},__evt__down:function(t){},__evt__mousedown:function(t){},__evt__pendown:function(t){},__evt__pointerdown:function(t){},__evt__touchstart:function(t){},__evt__up:function(t){},__evt__mouseup:function(t){},__evt__pointerup:function(t){},__evt__touchend:function(t){},__evt__move:function(t,e){},__evt__mousemove:function(t,e){},__evt__penmove:function(t,e){},__evt__pointermove:function(t,e){},__evt__touchmove:function(t,e){},__evt__hit:function(t,e,i){},__evt__mousehit:function(t,e,i){},__evt__update:function(){},__evt__boundingbox:function(){},__evt__startselecting:function(){},__evt__mousestartselecting:function(){},__evt__pointerstartselecting:function(){},__evt__touchstartselecting:function(){},__evt__stopselecting:function(){},__evt__mousestopselecting:function(){},__evt__pointerstopselecting:function(){},__evt__touchstopselecting:function(){},__evt__moveselecting:function(){},__evt__mousemoveselecting:function(){},__evt__pointermoveselecting:function(){},__evt__touchmoveselecting:function(){},__evt:function(){},toFullscreen:function(){var t,e=this.container,i="fullscreenwrap_"+e,r=document.createElement("div");return this.document.getElementById(i)||(r.classList.add("JXG_wrap_private"),r.setAttribute("id",i),t=this.containerObj,t.parentNode.insertBefore(r,t),r.appendChild(t)),f.toFullscreen(i,e),this},fullscreenListener:function(t){this.updateCSSTransforms()},createRoulette:function(t,e,i,r,o,n,h){var l=this;return new function(){var c,d=0,u=0,p=0,f=i,m=s.root(function(i){var r=t.X(f),s=t.Y(f),o=e.X(i),n=e.Y(i);return(r-o)*(r-o)+(s-n)*(s-n)},[0,2*Math.PI]),g=0,b=0,v=l.create("transform",[function(){return d}],{type:"rotate"}),y=l.create("transform",[function(){return d},function(){return t.X(f)},function(){return t.Y(f)}],{type:"rotate"}),C=l.create("transform",[function(){return u},function(){return p}],{type:"translate"}),_=function(t,e,i){var r=s.D(t.X)(e),o=s.D(t.Y)(e),n=s.D(t.X)(i),a=s.D(t.Y)(i),h=s.D(t.X)(.5*(e+i)),l=s.D(t.Y)(.5*(e+i)),c=Math.sqrt(r*r+o*o),d=Math.sqrt(n*n+a*a);return(c+4*Math.sqrt(h*h+l*l)+d)*(i-e)/6},P=function(t){return c-_(e,m,t)},E=Math.PI/18,S=9*E,x=null;return this.rolling=function(){var i,n,x,O,w;g=f+o*r,c=_(t,f,g),b=s.root(P,m),i=new a(t.X(g),t.Y(g)),n=new a(e.X(b),e.Y(b)),x=new a(s.D(t.X)(g),s.D(t.Y)(g)),O=new a(s.D(e.X)(b),s.D(e.Y)(b)),w=a.C.div(x,O),d=Math.atan2(w.imaginary,w.real),w.div(a.C.abs(w)),w.mult(n),u=i.real-w.real,p=i.imaginary-w.imaginary,d<-E&&d>-S?(d=-E,y.applyOnce(h)):d>E&&d0&&(x=window.setInterval(this.rolling,n)),this},this.stop=function(){return window.clearInterval(x),this},this}}}),t.Board}),define("renderer/svg",["jxg","options","renderer/abstract","base/constants","utils/type","utils/color","utils/base64","math/numerics"],function(t,e,i,r,s,o,n,a){"use strict";return t.SVGRenderer=function(t,i){var r;for(this.type="svg",this.isIE=-1!==navigator.appVersion.indexOf("MSIE")||navigator.userAgent.match(/Trident\//),this.svgRoot=null,this.svgNamespace="http://www.w3.org/2000/svg",this.xlinkNamespace="http://www.w3.org/1999/xlink",this.container=t,this.container.style.MozUserSelect="none",this.container.style.userSelect="none",this.container.style.overflow="hidden",""===this.container.style.position&&(this.container.style.position="relative"),this.svgRoot=this.container.ownerDocument.createElementNS(this.svgNamespace,"svg"),this.svgRoot.style.overflow="hidden",this.resize(i.width,i.height),this.container.appendChild(this.svgRoot),this.defs=this.container.ownerDocument.createElementNS(this.svgNamespace,"defs"),this.svgRoot.appendChild(this.defs),this.filter=this.container.ownerDocument.createElementNS(this.svgNamespace,"filter"),this.filter.setAttributeNS(null,"id",this.container.id+"_f1"),this.filter.setAttributeNS(null,"width","300%"),this.filter.setAttributeNS(null,"height","300%"),this.filter.setAttributeNS(null,"filterUnits","userSpaceOnUse"),this.feOffset=this.container.ownerDocument.createElementNS(this.svgNamespace,"feOffset"),this.feOffset.setAttributeNS(null,"result","offOut"),this.feOffset.setAttributeNS(null,"in","SourceAlpha"),this.feOffset.setAttributeNS(null,"dx","5"),this.feOffset.setAttributeNS(null,"dy","5"),this.filter.appendChild(this.feOffset),this.feGaussianBlur=this.container.ownerDocument.createElementNS(this.svgNamespace,"feGaussianBlur"),this.feGaussianBlur.setAttributeNS(null,"result","blurOut"),this.feGaussianBlur.setAttributeNS(null,"in","offOut"),this.feGaussianBlur.setAttributeNS(null,"stdDeviation","3"),this.filter.appendChild(this.feGaussianBlur),this.feBlend=this.container.ownerDocument.createElementNS(this.svgNamespace,"feBlend"),this.feBlend.setAttributeNS(null,"in","SourceGraphic"),this.feBlend.setAttributeNS(null,"in2","blurOut"),this.feBlend.setAttributeNS(null,"mode","normal"),this.filter.appendChild(this.feBlend),this.defs.appendChild(this.filter),this.layer=[],r=0;r0&&(r=this.joinTransforms(t,e),i=[r[1][1],r[2][1],r[1][2],r[2][2],r[1][0],r[2][0]].join(","),o+=" matrix("+i+") ",s.setAttributeNS(null,"transform",o))},updateImageURL:function(t){var e=s.evaluate(t.url);t.rendNode.setAttributeNS(this.xlinkNamespace,"xlink:href",e)},updateImageStyle:function(t,e){var i=s.evaluate(e?t.visProp.highlightcssclass:t.visProp.cssclass);t.rendNode.setAttributeNS(null,"class",i)},appendChildPrim:function(t,i){return s.exists(i)?i>=e.layer.numlayers&&(i=e.layer.numlayers-1):i=0,this.layer[i].appendChild(t),t},createPrim:function(t,e){var i=this.container.ownerDocument.createElementNS(this.svgNamespace,t);return i.setAttributeNS(null,"id",this.container.id+"_"+e),i.style.position="absolute","path"===t&&(i.setAttributeNS(null,"stroke-linecap","round"),i.setAttributeNS(null,"stroke-linejoin","round")),i},remove:function(t){s.exists(t)&&s.exists(t.parentNode)&&t.parentNode.removeChild(t)},makeArrows:function(t){var e,i=s.evaluate(t.visProp.firstarrow),r=s.evaluate(t.visProp.lastarrow);if(t.visPropOld.firstarrow===i&&t.visPropOld.lastarrow===r)return void(this.isIE&&t.visPropCalc.visible&&(i||r)&&t.rendNode.parentNode.insertBefore(t.rendNode,t.rendNode));i?(e=t.rendNodeTriangleStart,s.exists(e)?this.defs.appendChild(e):(e=this._createArrowHead(t,"End"),this.defs.appendChild(e),t.rendNodeTriangleStart=e,t.rendNode.setAttributeNS(null,"marker-start","url(#"+this.container.id+"_"+t.id+"TriangleEnd)"))):(e=t.rendNodeTriangleStart,s.exists(e)&&this.remove(e)),r?(e=t.rendNodeTriangleEnd,s.exists(e)?this.defs.appendChild(e):(e=this._createArrowHead(t,"Start"),this.defs.appendChild(e),t.rendNodeTriangleEnd=e,t.rendNode.setAttributeNS(null,"marker-end","url(#"+this.container.id+"_"+t.id+"TriangleStart)"))):(e=t.rendNodeTriangleEnd,s.exists(e)&&this.remove(e)),t.visPropOld.firstarrow=i,t.visPropOld.lastarrow=r},updateEllipsePrim:function(t,e,i,r,s){var o=1e6;o=2e5,e=Math.abs(e)"===i?r=" M "+(s[1]-e)+" "+s[2]+" L "+s[1]+" "+(s[2]+e)+" L "+(s[1]+e)+" "+s[2]+" L "+s[1]+" "+(s[2]-e)+" Z ":"^"===i?r=" M "+s[1]+" "+(s[2]-e)+" L "+(s[1]-o)+" "+(s[2]+n)+" L "+(s[1]+o)+" "+(s[2]+n)+" Z ":"v"===i?r=" M "+s[1]+" "+(s[2]+e)+" L "+(s[1]-o)+" "+(s[2]-n)+" L "+(s[1]+o)+" "+(s[2]-n)+" Z ":">"===i?r=" M "+(s[1]+e)+" "+s[2]+" L "+(s[1]-n)+" "+(s[2]-o)+" L "+(s[1]-n)+" "+(s[2]+o)+" Z ":"<"===i&&(r=" M "+(s[1]-e)+" "+s[2]+" L "+(s[1]+n)+" "+(s[2]-o)+" L "+(s[1]+n)+" "+(s[2]+o)+" Z "),r},updatePathStringPrim:function(t){var e,i,r,s=" M ",o="";if(t.numberPoints<=0)return"";if(r=Math.min(t.points.length,t.numberPoints),1===t.bezierDegree)for(e=0;e0?i.setAttributeNS(null,"stroke-dasharray",this.dashArray[e-1]):i.hasAttributeNS(null,"stroke-dasharray")&&i.removeAttributeNS(null,"stroke-dasharray")},setGradient:function(t){var e,i,r,o=t.rendNode,n=s.evaluate(t.visProp.gradient);"linear"===n||"radial"===n?(e=this.createPrim(n+"Gradient",t.id+"_gradient"),i=this.createPrim("stop",t.id+"_gradient1"),r=this.createPrim("stop",t.id+"_gradient2"),e.appendChild(i),e.appendChild(r),this.defs.appendChild(e),o.setAttributeNS(null,"style","fill:url(#"+this.container.id+"_"+t.id+"_gradient)"),t.gradNode1=i,t.gradNode2=r,t.gradNode=e):o.removeAttributeNS(null,"style")},updateGradientAngle:function(t,e){var i=1,r=Math.cos(e),s=Math.sin(e);Math.abs(r)>Math.abs(s)?i/=Math.abs(r):i/=Math.abs(s),r>=0?(t.setAttributeNS(null,"x1",0),t.setAttributeNS(null,"x2",r*i)):(t.setAttributeNS(null,"x1",-r*i),t.setAttributeNS(null,"x2",0)),s>=0?(t.setAttributeNS(null,"y1",0),t.setAttributeNS(null,"y2",s*i)):(t.setAttributeNS(null,"y1",-s*i),t.setAttributeNS(null,"y2",0))},updateGradientCircle:function(t,e,i,r,s,o,n){t.setAttributeNS(null,"cx",100*e+"%"),t.setAttributeNS(null,"cy",100*i+"%"),t.setAttributeNS(null,"r",100*r+"%"),t.setAttributeNS(null,"fx",100*s+"%"),t.setAttributeNS(null,"fy",100*o+"%"),t.setAttributeNS(null,"fr",100*n+"%")},updateGradient:function(t){var e,i,r=t.gradNode1,o=t.gradNode2,n=s.evaluate(t.visProp.gradient);s.exists(r)&&s.exists(o)&&(i=s.evaluate(t.visProp.fillopacity),i=i>0?i:0,e=s.evaluate(t.visProp.fillcolor),r.setAttributeNS(null,"style","stop-color:"+e+";stop-opacity:"+i),o.setAttributeNS(null,"style","stop-color:"+s.evaluate(t.visProp.gradientsecondcolor)+";stop-opacity:"+s.evaluate(t.visProp.gradientsecondopacity)),r.setAttributeNS(null,"offset",100*s.evaluate(t.visProp.gradientstartoffset)+"%"),o.setAttributeNS(null,"offset",100*s.evaluate(t.visProp.gradientendoffset)+"%"),"linear"===n?this.updateGradientAngle(t.gradNode,s.evaluate(t.visProp.gradientangle)):"radial"===n&&this.updateGradientCircle(t.gradNode,s.evaluate(t.visProp.gradientcx),s.evaluate(t.visProp.gradientcy),s.evaluate(t.visProp.gradientr),s.evaluate(t.visProp.gradientfx),s.evaluate(t.visProp.gradientfy),s.evaluate(t.visProp.gradientfr)))},setObjectTransition:function(t,e){var i,o,n,a,h=["rendNode","rendNodeTriangleStart","rendNodeTriangleEnd"];if(void 0===e&&(e=s.evaluate(t.visProp.transitionduration)),e!==t.visPropOld.transitionduration){for(o=t.elementClass===r.OBJECT_CLASS_TEXT&&"html"===s.evaluate(t.visProp.display)?" color "+e+"ms, opacity "+e+"ms":" fill "+e+"ms, fill-opacity "+e+"ms, stroke "+e+"ms, stroke-opacity "+e+"ms",a=h.length,n=0;n0?u:0,e.visPropOld.fillcolor===d&&e.visPropOld.fillopacity===u&&null===p||(s.exists(d)&&!1!==d&&(9!==d.length?(h=d,c=u):(l=o.rgba2rgbo(d),h=l[0],c=u*l[1]),a=void 0===n?e.rendNode:n,"none"!==h&&this._setAttribute(function(){a.setAttributeNS(null,"fill",h)},e.visPropOld.fillcolor),e.type===t.OBJECT_TYPE_IMAGE?this._setAttribute(function(){a.setAttributeNS(null,"opacity",c)},e.visPropOld.fillopacity):("none"===h&&(c=0),this._setAttribute(function(){a.setAttributeNS(null,"fill-opacity",c)},e.visPropOld.fillopacity)),"linear"!==p&&"radial"!==p||this.updateGradient(e)),e.visPropOld.fillcolor=d,e.visPropOld.fillopacity=u)},setObjectStrokeColor:function(t,e,i){var n,a,h,l,c=s.evaluate(e),d=s.evaluate(i);d=d>0?d:0,t.visPropOld.strokecolor===c&&t.visPropOld.strokeopacity===d||(s.exists(c)&&!1!==c&&(9!==c.length?(n=c,h=d):(a=o.rgba2rgbo(c),n=a[0],h=d*a[1]),l=t.rendNode,t.elementClass===r.OBJECT_CLASS_TEXT?"html"===s.evaluate(t.visProp.display)?this._setAttribute(function(){l.style.color=n,l.style.opacity=h},t.visPropOld.strokecolor):this._setAttribute(function(){l.setAttributeNS(null,"style","fill:"+n),l.setAttributeNS(null,"style","fill-opacity:"+h)},t.visPropOld.strokecolor):this._setAttribute(function(){l.setAttributeNS(null,"stroke",n),l.setAttributeNS(null,"stroke-opacity",h)},t.visPropOld.strokecolor),t.elementClass!==r.OBJECT_CLASS_CURVE&&t.elementClass!==r.OBJECT_CLASS_LINE||(s.evaluate(t.visProp.firstarrow)&&this._setArrowColor(t.rendNodeTriangleStart,n,h,t),s.evaluate(t.visProp.lastarrow)&&this._setArrowColor(t.rendNodeTriangleEnd,n,h,t))),t.visPropOld.strokecolor=c,t.visPropOld.strokeopacity=d)},setObjectStrokeWidth:function(t,e){var i,r=s.evaluate(e);isNaN(r)||t.visPropOld.strokewidth===r||(i=t.rendNode,this.setPropertyPrim(i,"stroked","true"),s.exists(r)&&this.setPropertyPrim(i,"stroke-width",r+"px"),t.visPropOld.strokewidth=r)},setLineCap:function(t){var e=s.evaluate(t.visProp.linecap);void 0!==e&&""!==e&&t.visPropOld.linecap!==e&&s.exists(t.rendNode)&&(this.setPropertyPrim(t.rendNode,"stroke-linecap",e),t.visPropOld.linecap=e)},setShadow:function(t){var e=s.evaluate(t.visProp.shadow);t.visPropOld.shadow!==e&&(s.exists(t.rendNode)&&(e?t.rendNode.setAttributeNS(null,"filter","url(#"+this.container.id+"_f1)"):t.rendNode.removeAttributeNS(null,"filter")),t.visPropOld.shadow=e)},suspendRedraw:function(){},unsuspendRedraw:function(){},resize:function(t,e){this.svgRoot.style.width=parseFloat(t)+"px",this.svgRoot.style.height=parseFloat(e)+"px",this.svgRoot.setAttribute("width",parseFloat(t)),this.svgRoot.setAttribute("height",parseFloat(e))},createTouchpoints:function(t){var e,i,r,s;for(this.touchpoints=[],e=0;e=0&&2*t=0&&2*t=0&&2*t0)for(r=document.createElement("canvas"),n=0;n1&&(e=e.replace(/xmlns=\"http:\/\/www.w3.org\/2000\/svg\"/g,"")),e=e.replace(/ /g," "),s.exists(this.foreignObjLayer)&&this.foreignObjLayer.hasChildNodes())for(!0===t&&h.appendChild(this.foreignObjLayer);this.foreignObjLayer.firstChild;)this.container.appendChild(this.foreignObjLayer.firstChild);return"data:image/svg+xml;base64,"+l(unescape(encodeURIComponent(e)))},dumpToCanvas:function(t,e,i,r){var s,o,n,a;return n=document.getElementById(t),n.width=n.width,a=n.getContext("2d"),void 0!==e&&void 0!==i&&(n.style.width=parseFloat(e)+"px",n.style.height=parseFloat(i)+"px",n.setAttribute("width",parseFloat(e)),n.setAttribute("height",parseFloat(i))),o=new Image,s=this.dumpToDataURI(r),o.src=s,"Promise"in window?new Promise(function(t,r){try{o.onload=function(){a.drawImage(o,0,0,e,i),t()}}catch(t){r(t)}}):(o.onload=function(){window.setTimeout(function(){try{a.drawImage(o,0,0,e,i)}catch(t){console.log("screenshots not longer supported on IE")}},200)},this)},screenshot:function(t,e,i){var r,o,n,a,h,l,c,d,u,p,f,m,g=this.container.ownerDocument,b=this.container.parentNode,v=t.attr.screenshot,y=!1;return"no"===this.type?this:(d=v.scale*parseFloat(this.container.style.width),u=v.scale*parseFloat(this.container.style.height),void 0===e||""===e?(y=!0,h=new Image,h.style.width=d+"px",h.style.height=u+"px"):(y=!1,h=g.getElementById(e)),y&&(r=g.createElement("div"),r.style.cssText=v.css,r.style.width=d+"px",r.style.height=u+"px",r.style.zIndex=this.container.style.zIndex+120,o=t.getCoordsTopLeftCorner(),r.style.position="absolute",r.style.left=o[0]+"px",r.style.top=o[1]+"px"),n=g.createElement("canvas"),a=Math.random().toString(36).substr(2,5),n.setAttribute("id",a),n.setAttribute("width",d),n.setAttribute("height",u),n.style.width=d+"px",n.style.height=d+"px",n.style.display="none",b.appendChild(n),y&&(l=g.createElement("span"),c=g.createTextNode("✖"),l.style.cssText=v.cssButton,l.appendChild(c),l.onclick=function(){r.parentNode.removeChild(r)},r.appendChild(h),r.appendChild(l),b.appendChild(r)),p=document.getElementById(this.container.id+"_navigationbar"),s.exists(p)&&(f=p.style.display,p.style.display="none"),m=function(){h.src=n.toDataURL("image/png"),b.removeChild(n)},"Promise"in window?this.dumpToCanvas(a,d,u,i).then(m):(this.dumpToCanvas(a,d,u,i),window.setTimeout(m,200)),s.exists(p)&&(p.style.display=f),this)}}),t.SVGRenderer}),define("renderer/vml",["jxg","renderer/abstract","base/constants","utils/type","utils/color","math/math","math/numerics"],function(t,e,i,r,s,o,n){"use strict";return t.VMLRenderer=function(e){this.type="vml",this.container=e,this.container.style.overflow="hidden",""===this.container.style.position&&(this.container.style.position="relative"),this.container.onselectstart=function(){return!1},this.resolution=10,r.exists(t.vmlStylesheet)||(e.ownerDocument.namespaces.add("jxgvml","urn:schemas-microsoft-com:vml"),t.vmlStylesheet=this.container.ownerDocument.createStyleSheet(),t.vmlStylesheet.addRule(".jxgvml","behavior:url(#default#VML)"));try{e.ownerDocument.namespaces.jxgvml||e.ownerDocument.namespaces.add("jxgvml","urn:schemas-microsoft-com:vml"),this.createNode=function(t){return e.ownerDocument.createElement("')}}catch(t){this.createNode=function(t){return e.ownerDocument.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="jxgvml">')}}this.dashArray=["Solid","1 1","ShortDash","Dash","LongDash","ShortDashDot","LongDashDot"]},t.VMLRenderer.prototype=new e,t.extend(t.VMLRenderer.prototype,{_setAttr:function(e,i,r,s){try{8===this.container.ownerDocument.documentMode?e[i]=r:e.setAttribute(i,r,s)}catch(e){t.debug("_setAttr: "+i+" "+r+"
\n")}},updateTicks:function(t){var e,i,s,o,n,a=this.resolution,h=[];for(i=t.ticks.length,e=0;e0){for(i=this.joinTransforms(t,e),c[0]=o.matVecMult(i,t.coords.scrCoords),c[0][1]/=c[0][0],c[0][2]/=c[0][0],c[1]=o.matVecMult(i,[1,t.coords.scrCoords[1]+t.size[0],t.coords.scrCoords[2]]),c[1][1]/=c[1][0],c[1][2]/=c[1][0],c[2]=o.matVecMult(i,[1,t.coords.scrCoords[1]+t.size[0],t.coords.scrCoords[2]-t.size[1]]),c[2][1]/=c[2][0],c[2][2]/=c[2][0],c[3]=o.matVecMult(i,[1,t.coords.scrCoords[1],t.coords.scrCoords[2]-t.size[1]]),c[3][1]/=c[3][0],c[3][2]/=c[3][0],r=c[0][1],n=c[0][1],s=c[0][2],a=c[0][2],h=1;h<4;h++)r=Math.max(r,c[h][1]),n=Math.min(n,c[h][1]),s=Math.max(s,c[h][2]),a=Math.min(a,c[h][2]);l.style.left=Math.floor(n)+"px",l.style.top=Math.floor(a)+"px",l.filters.item(0).M11=i[1][1],l.filters.item(0).M12=i[1][2],l.filters.item(0).M21=i[2][1],l.filters.item(0).M22=i[2][2],l.filters.item(0).enabled=!0}},updateImageURL:function(t){var e=r.evaluate(t.url);this._setAttr(t.rendNode,"src",e)},appendChildPrim:function(t,e){return r.exists(e)||(e=0),t.style.zIndex=e,this.container.appendChild(t),t},appendNodesToElement:function(t,e){"shape"!==e&&"path"!==e&&"polygon"!==e||(t.rendNodePath=this.getElementById(t.id+"_path")),t.rendNodeFill=this.getElementById(t.id+"_fill"),t.rendNodeStroke=this.getElementById(t.id+"_stroke"),t.rendNodeShadow=this.getElementById(t.id+"_shadow"),t.rendNode=this.getElementById(t.id)},createPrim:function(t,e){var i,r,s=this.createNode("fill"),o=this.createNode("stroke"),n=this.createNode("shadow");return this._setAttr(s,"id",this.container.id+"_"+e+"_fill"),this._setAttr(o,"id",this.container.id+"_"+e+"_stroke"),this._setAttr(n,"id",this.container.id+"_"+e+"_shadow"),"circle"===t||"ellipse"===t?(i=this.createNode("oval"),i.appendChild(s),i.appendChild(o),i.appendChild(n)):"polygon"===t||"path"===t||"shape"===t||"line"===t?(i=this.createNode("shape"),i.appendChild(s),i.appendChild(o),i.appendChild(n),r=this.createNode("path"),this._setAttr(r,"id",this.container.id+"_"+e+"_path"),i.appendChild(r)):(i=this.createNode(t),i.appendChild(s),i.appendChild(o),i.appendChild(n)),i.style.position="absolute",i.style.left="0px",i.style.top="0px",this._setAttr(i,"id",this.container.id+"_"+e),i},remove:function(t){r.exists(t)&&t.removeNode(!0)},makeArrows:function(t){var e,i=r.evaluate(t.visProp.firstarrow),s=r.evaluate(t.visProp.lastarrow);t.visPropOld.firstarrow===i&&t.visPropOld.lastarrow===s||(i?(e=t.rendNodeStroke,this._setAttr(e,"startarrow","block"),this._setAttr(e,"startarrowlength","long")):(e=t.rendNodeStroke,r.exists(e)&&this._setAttr(e,"startarrow","none")),s?(e=t.rendNodeStroke,this._setAttr(e,"id",this.container.id+"_"+t.id+"stroke"),this._setAttr(e,"endarrow","block"),this._setAttr(e,"endarrowlength","long")):(e=t.rendNodeStroke,r.exists(e)&&this._setAttr(e,"endarrow","none")),t.visPropOld.firstarrow=i,t.visPropOld.lastarrow=s)},updateEllipsePrim:function(t,e,i,r,s){t.style.left=Math.floor(e-r)+"px",t.style.top=Math.floor(i-s)+"px",t.style.width=Math.floor(2*Math.abs(r))+"px",t.style.height=Math.floor(2*Math.abs(s))+"px"},updateLinePrim:function(t,e,i,r,s,o){var n,a=this.resolution;isNaN(e+i+r+s)||(n=["m ",Math.floor(a*e),", ",Math.floor(a*i)," l ",Math.floor(a*r),", ",Math.floor(a*s)],this.updatePathPrim(t,n,o))},updatePathPrim:function(t,e,i){var r=i.canvasWidth,s=i.canvasHeight;e.length<=0&&(e=["m 0,0"]),t.style.width=r,t.style.height=s,this._setAttr(t,"coordsize",[Math.floor(this.resolution*r),Math.floor(this.resolution*s)].join(",")),this._setAttr(t,"path",e.join(""))},updatePathStringPoint:function(t,e,i){var r=[],s=Math.round,o=t.coords.scrCoords,n=e*Math.sqrt(3)*.5,a=.5*e,h=this.resolution;return"x"===i?r.push([" m ",s(h*(o[1]-e)),", ",s(h*(o[2]-e))," l ",s(h*(o[1]+e)),", ",s(h*(o[2]+e))," m ",s(h*(o[1]+e)),", ",s(h*(o[2]-e))," l ",s(h*(o[1]-e)),", ",s(h*(o[2]+e))].join("")):"+"===i?r.push([" m ",s(h*(o[1]-e)),", ",s(h*o[2])," l ",s(h*(o[1]+e)),", ",s(h*o[2])," m ",s(h*o[1]),", ",s(h*(o[2]-e))," l ",s(h*o[1]),", ",s(h*(o[2]+e))].join("")):"<>"===i?r.push([" m ",s(h*(o[1]-e)),", ",s(h*o[2])," l ",s(h*o[1]),", ",s(h*(o[2]+e))," l ",s(h*(o[1]+e)),", ",s(h*o[2])," l ",s(h*o[1]),", ",s(h*(o[2]-e))," x e "].join("")):"^"===i?r.push([" m ",s(h*o[1]),", ",s(h*(o[2]-e))," l ",s(h*(o[1]-n)),", ",s(h*(o[2]+a))," l ",s(h*(o[1]+n)),", ",s(h*(o[2]+a))," x e "].join("")):"v"===i?r.push([" m ",s(h*o[1]),", ",s(h*(o[2]+e))," l ",s(h*(o[1]-n)),", ",s(h*(o[2]-a))," l ",s(h*(o[1]+n)),", ",s(h*(o[2]-a))," x e "].join("")):">"===i?r.push([" m ",s(h*(o[1]+e)),", ",s(h*o[2])," l ",s(h*(o[1]-a)),", ",s(h*(o[2]-n))," l ",s(h*(o[1]-a)),", ",s(h*(o[2]+n))," l ",s(h*(o[1]+e)),", ",s(h*o[2])].join("")):"<"===i&&r.push([" m ",s(h*(o[1]-e)),", ",s(h*o[2])," l ",s(h*(o[1]+a)),", ",s(h*(o[2]-n))," l ",s(h*(o[1]+a)),", ",s(h*(o[2]+n))," x e "].join("")),r},updatePathStringPrim:function(t){var e,i,r=[],s=this.resolution,o=Math.round,n=" m ",a=Math.min(t.numberPoints,8192);if(t.numberPoints<=0)return"";if(a=Math.min(a,t.points.length),1===t.bezierDegree)for(e=0;e2e4?i[1]=2e4:i[1]<-2e4&&(i[1]=-2e4),i[2]>2e4?i[2]=2e4:i[2]<-2e4&&(i[2]=-2e4),r.push([n,o(s*i[1]),", ",o(s*i[2])].join("")),n=" l ");else if(3===t.bezierDegree)for(e=0;e2e4?o[1]=2e4:o[1]<-2e4&&(o[1]=-2e4),o[2]>2e4?o[2]=2e4:o[2]<-2e4&&(o[2]=-2e4)," m "===p?l.push([p,u(d*o[1])," ",u(d*o[2])].join("")):(s=2*i,l.push([p,u(d*(a+.333*(o[1]-a)+c*(s*Math.random()-i)))," ",u(d*(h+.333*(o[2]-h)+c*(s*Math.random()-i)))," ",u(d*(a+.666*(o[1]-a)+c*(s*Math.random()-i)))," ",u(d*(h+.666*(o[2]-h)+c*(s*Math.random()-i)))," ",u(d*o[1])," ",u(d*o[2])].join(""))),p=" c ",a=o[1],h=o[2]);return l.push(" e"),l},updatePolygonPrim:function(t,e){var i,r,s=e.vertices.length,o=this.resolution,n=[];if(this._setAttr(t,"stroked","false"),r=e.vertices[0].coords.scrCoords,!isNaN(r[1]+r[2])){for(n.push(["m ",Math.floor(o*r[1]),",",Math.floor(o*r[2])," l "].join("")),i=1;i=0&&(t.style.width=r+"px"),s>=0&&(t.style.height=s+"px")},setPropertyPrim:function(t,e,i){var s,o="";switch(e){case"stroke":o="strokecolor";break;case"stroke-width":o="strokeweight";break;case"stroke-dasharray":o="dashstyle"}""!==o&&(s=r.evaluate(i),this._setAttr(t,o,s))},display:function(t,e){t&&t.rendNode&&(t.visPropOld.visible=e,t.rendNode.style.visibility=e?"inherit":"hidden")},show:function(e){t.deprecated("Board.renderer.show()","Board.renderer.display()"), +e&&e.rendNode&&(e.rendNode.style.visibility="inherit")},hide:function(e){t.deprecated("Board.renderer.hide()","Board.renderer.display()"),e&&e.rendNode&&(e.rendNode.style.visibility="hidden")},setDashStyle:function(t,e){var i;e.dash>=0&&(i=t.rendNodeStroke,this._setAttr(i,"dashstyle",this.dashArray[e.dash]))},setGradient:function(t){var e=t.rendNodeFill,i=r.evaluate(t.visProp.gradient);"linear"===i?(this._setAttr(e,"type","gradient"),this._setAttr(e,"color2",r.evaluate(t.visProp.gradientsecondcolor)),this._setAttr(e,"opacity2",r.evaluate(t.visProp.gradientsecondopacity)),this._setAttr(e,"angle",r.evaluate(t.visProp.gradientangle))):"radial"===i?(this._setAttr(e,"type","gradientradial"),this._setAttr(e,"color2",r.evaluate(t.visProp.gradientsecondcolor)),this._setAttr(e,"opacity2",r.evaluate(t.visProp.gradientsecondopacity)),this._setAttr(e,"focusposition",100*r.evaluate(t.visProp.gradientpositionx)+"%,"+100*r.evaluate(t.visProp.gradientpositiony)+"%"),this._setAttr(e,"focussize","0,0")):this._setAttr(e,"type","solid")},setObjectFillColor:function(t,e,o){var n,a,h,l=r.evaluate(e),c=r.evaluate(o),d=t.rendNode;c=c>0?c:0,t.visPropOld.fillcolor===l&&t.visPropOld.fillopacity===c||(r.exists(l)&&!1!==l&&(9!==l.length?(n=l,h=c):(a=s.rgba2rgbo(l),n=a[0],h=c*a[1]),"none"===n||!1===n?this._setAttr(t.rendNode,"filled","false"):(this._setAttr(t.rendNode,"filled","true"),this._setAttr(t.rendNode,"fillcolor",n),r.exists(h)&&t.rendNodeFill&&this._setAttr(t.rendNodeFill,"opacity",100*h+"%")),t.type===i.OBJECT_TYPE_IMAGE&&d.filters.length>1&&(d.filters.item(1).opacity=Math.round(100*h),d.filters.item(1).enabled=!0)),t.visPropOld.fillcolor=l,t.visPropOld.fillopacity=c)},setObjectStrokeColor:function(t,e,s){var o,n,a,h,l=r.evaluate(e),c=r.evaluate(s),d=t.rendNode;c=c>0?c:0,t.visPropOld.strokecolor===l&&t.visPropOld.strokeopacity===c||(r.exists(l)&&!1!==l&&(9!==l.length?(o=l,a=c):(n=e.rgba2rgbo(l),o=n[0],a=c*n[1]),t.elementClass===i.OBJECT_CLASS_TEXT?(d.filters.length>1&&(d.filters.item(1).opacity=Math.round(100*a),d.filters.item(1).enabled=!0),d.style.color=o):(!1!==o&&(this._setAttr(d,"stroked","true"),this._setAttr(d,"strokecolor",o)),h=t.rendNodeStroke,r.exists(a)&&t.type!==i.OBJECT_TYPE_IMAGE&&this._setAttr(h,"opacity",100*a+"%"))),t.visPropOld.strokecolor=l,t.visPropOld.strokeopacity=c)},setObjectStrokeWidth:function(t,e){var i,s=r.evaluate(e);isNaN(s)||t.visPropOld.strokewidth===s||(i=t.rendNode,this.setPropertyPrim(i,"stroked","true"),r.exists(s)&&(this.setPropertyPrim(i,"stroke-width",s),0===s&&r.exists(t.rendNodeStroke)&&this._setAttr(i,"stroked","false")),t.visPropOld.strokewidth=s)},setShadow:function(t){var e=t.rendNodeShadow,i=r.evaluate(t.visProp.shadow);e&&t.visPropOld.shadow!==i&&(i?(this._setAttr(e,"On","True"),this._setAttr(e,"Offset","3pt,3pt"),this._setAttr(e,"Opacity","60%"),this._setAttr(e,"Color","#aaaaaa")):this._setAttr(e,"On","False"),t.visPropOld.shadow=i)},suspendRedraw:function(){this.container.style.display="none"},unsuspendRedraw:function(){this.container.style.display=""}}),t.VMLRenderer}),define("renderer/canvas",["jxg","renderer/abstract","base/constants","utils/env","utils/type","utils/uuid","utils/color","base/coords","math/math","math/geometry","math/numerics"],function(t,e,i,r,s,o,n,a,h,l,c){"use strict";return t.CanvasRenderer=function(t,e){this.type="canvas",this.canvasRoot=null,this.suspendHandle=null,this.canvasId=o.genUUID(),this.canvasNamespace=null,r.isBrowser?(this.container=t,this.container.style.MozUserSelect="none",this.container.style.userSelect="none",this.container.style.overflow="hidden",""===this.container.style.position&&(this.container.style.position="relative"),this.container.innerHTML=['<',"/canvas>"].join(""),this.canvasRoot=this.container.ownerDocument.getElementById(this.canvasId),this.context=this.canvasRoot.getContext("2d")):r.isNode()&&(this.canvasId="object"==typeof module?module.require("canvas"):require("canvas"),this.canvasRoot=new this.canvasId(500,500),this.context=this.canvasRoot.getContext("2d")),this.dashArray=[[2,2],[5,5],[10,10],[20,20],[20,10,10,10],[20,5,10,5]]},t.CanvasRenderer.prototype=new e,t.extend(t.CanvasRenderer.prototype,{_drawFilledPolygon:function(t){var e,i=t.length,r=this.context;if(i>0){for(r.beginPath(),r.moveTo(t[0][0],t[0][1]),e=0;e0&&r.lineTo(t[e][0],t[e][1]);r.lineTo(t[0][0],t[0][1]),r.fill()}},_fill:function(t){var e=this.context;e.save(),this._setColor(t,"fill")&&e.fill(),e.restore()},_rotatePoint:function(t,e,i){return[e*Math.cos(t)-i*Math.sin(t),e*Math.sin(t)+i*Math.cos(t)]},_rotateShape:function(t,e){var i,r=[],s=t.length;if(s<=0)return t;for(i=0;iMath.abs(v)?g/=Math.abs(b):g/=Math.abs(v),b>=0?(o=0,n=b*g):(o=-b*g,n=0),v>=0?(h=0,l=v*g):(h=-v*g,l=0),r=new a(i.COORDS_BY_USER,[y[0],y[1]],t.board),s=new a(i.COORDS_BY_USER,[y[2],y[3]],t.board),f=s.scrCoords[1]-r.scrCoords[1],m=s.scrCoords[2]-r.scrCoords[2],c=r.scrCoords[1]+f*o,u=r.scrCoords[2]+m*h,d=r.scrCoords[1]+f*n,p=r.scrCoords[2]+m*l,this.context.createLinearGradient(c,u,d,p)},updateGradientCircle:function(t,e,r,s,o,n,h){var l,c,d,u,p,f,m,g,b,v,y=t.getBoundingBox();return l=new a(i.COORDS_BY_USER,[y[0],y[1]],t.board),c=new a(i.COORDS_BY_USER,[y[2],y[3]],t.board),b=c.scrCoords[1]-l.scrCoords[1],v=l.scrCoords[2]-c.scrCoords[2],d=l.scrCoords[1]+b*e,u=c.scrCoords[2]+v*r,f=l.scrCoords[1]+b*o,m=c.scrCoords[2]+v*n,p=s*(b+v)*.5,g=h*(b+v)*.5,this.context.createRadialGradient(f,m,g,d,u,p)},updateGradient:function(t){var e,i,r,o=s.evaluate(t.visProp.gradient);return i=s.evaluate(t.visProp.fillopacity),i=i>0?i:0,e=s.evaluate(t.visProp.fillcolor),"linear"===o?r=this.updateGradientAngle(t,s.evaluate(t.visProp.gradientangle)):"radial"===o&&(r=this.updateGradientCircle(t,s.evaluate(t.visProp.gradientcx),s.evaluate(t.visProp.gradientcy),s.evaluate(t.visProp.gradientr),s.evaluate(t.visProp.gradientfx),s.evaluate(t.visProp.gradientfy),s.evaluate(t.visProp.gradientfr))),r.addColorStop(s.evaluate(t.visProp.gradientstartoffset),e),r.addColorStop(s.evaluate(t.visProp.gradientendoffset),s.evaluate(t.visProp.gradientsecondcolor)),r},_setColor:function(t,e,i){var r,o,a,h,l,c,d,u,p=!0,f=t.visProp;return e=e||"stroke",i=i||e,r=this._getHighlighted(t),"linear"===(u=s.evaluate(t.visProp.gradient))||"radial"===u?(this.context[i+"Style"]=this.updateGradient(t),p):(a=s.evaluate(f[r+e+"color"]),"none"!==a&&!1!==a?(c=s.evaluate(f[r+e+"opacity"]),c=c>0?c:0,9!==a.length?(l=a,d=c):(h=n.rgba2rgbo(a),l=h[0],d=c*h[1]),this.context.globalAlpha=d,this.context[i+"Style"]=l):p=!1,o=parseFloat(s.evaluate(f[r+"strokewidth"])),"stroke"!==e||isNaN(o)||(0===o?this.context.globalAlpha=0:this.context.lineWidth=o),"stroke"===e&&void 0!==f.linecap&&""!==f.linecap&&(this.context.lineCap=f.linecap),p)},_stroke:function(t){var e=this.context,i=s.evaluate(t.visProp.dash);e.save(),i>0?e.setLineDash&&e.setLineDash(this.dashArray[i]):this.context.lineDashArray=[],this._setColor(t,"stroke")&&e.stroke(),e.restore()},_translateShape:function(t,e,i){var r,s=[],o=t.length;if(o<=0)return t;for(r=0;r":h.beginPath(),h.moveTo(r[1]-i,r[2]),h.lineTo(r[1],r[2]+i),h.lineTo(r[1]+i,r[2]),h.lineTo(r[1],r[2]-i),h.closePath(),this._fill(t),this._stroke(t);break;case"triangleup":case"a":case"^":h.beginPath(),h.moveTo(r[1],r[2]-i),h.lineTo(r[1]-o,r[2]+n),h.lineTo(r[1]+o,r[2]+n),h.closePath(),this._fill(t),this._stroke(t);break;case"triangledown":case"v":h.beginPath(),h.moveTo(r[1],r[2]+i),h.lineTo(r[1]-o,r[2]-n),h.lineTo(r[1]+o,r[2]-n),h.closePath(),this._fill(t),this._stroke(t);break;case"triangleleft":case"<":h.beginPath(),h.moveTo(r[1]-i,r[2]),h.lineTo(r[1]+n,r[2]-o),h.lineTo(r[1]+n,r[2]+o),h.closePath(),this.fill(t),this._stroke(t);break;case"triangleright":case">":h.beginPath(),h.moveTo(r[1]+i,r[2]),h.lineTo(r[1]-n,r[2]-o),h.lineTo(r[1]-n,r[2]+o),h.closePath(),this._fill(t),this._stroke(t)}},updatePoint:function(t){this.drawPoint(t)},drawArrows:function(t,e,r,o){var n,a,h,l,c,d,u,p,f,m,g,b,v,y,C,_=this.context,P=3,E=1,S=s.evaluate(t.visProp.firstarrow),x=s.evaluate(t.visProp.lastarrow);if("none"!==s.evaluate(t.visProp.strokecolor)&&(S||x)){if(t.elementClass===i.OBJECT_CLASS_LINE)n=e.scrCoords[1],a=e.scrCoords[2],h=r.scrCoords[1],l=r.scrCoords[2],y=C=Math.atan2(l-a,h-n);else{if(n=t.points[0].scrCoords[1],a=t.points[0].scrCoords[2],(v=t.points.length-1)<1)return;h=t.points[t.points.length-1].scrCoords[1],l=t.points[t.points.length-1].scrCoords[2],f=t.points[1].scrCoords[1]-t.points[0].scrCoords[1],m=t.points[1].scrCoords[2]-t.points[0].scrCoords[2],g=t.points[v].scrCoords[1]-t.points[v-1].scrCoords[1],b=t.points[v].scrCoords[2]-t.points[v-1].scrCoords[2],S&&(y=Math.atan2(m,f)),x&&(C=Math.atan2(b,g))}c=s.evaluate(t.visProp[o+"strokewidth"]),S&&(P=3,s.exists(S.size)&&(P=s.evaluate(S.size)),""!==o&&s.exists(S[o+"size"])&&(P=s.evaluate(S[o+"size"])),d=c*P,s.exists(S.type)&&(E=s.evaluate(S.type)),p=2===E?[[d,.5*-d],[0,0],[d,.5*d],[.5*d,0]]:3===E?[[d/3,.5*-d],[0,.5*-d],[0,.5*d],[d/3,.5*d]]:[[d,.5*-d],[0,0],[d,.5*d]]),x&&(P=3,s.exists(x.size)&&(P=s.evaluate(x.size)),""!==o&&s.exists(x[o+"size"])&&(P=s.evaluate(x[o+"size"])),d=c*P,s.exists(x.type)&&(E=s.evaluate(x.type)),u=2===E?[[-d,.5*-d],[0,0],[-d,.5*d],[.5*-d,0]]:3===E?[[-d/3,.5*-d],[0,.5*-d],[0,.5*d],[-d/3,.5*d]]:[[-d,.5*-d],[0,0],[-d,.5*d]]),_.save(),this._setColor(t,"stroke","fill")&&(S&&this._drawFilledPolygon(this._translateShape(this._rotateShape(p,y),n,a)),x&&this._drawFilledPolygon(this._translateShape(this._rotateShape(u,C),h,l))),_.restore()}},drawLine:function(t){var e,r,o=new a(i.COORDS_BY_USER,t.point1.coords.usrCoords,t.board),n=new a(i.COORDS_BY_USER,t.point2.coords.usrCoords,t.board),h=null,c=s.evaluate(t.visProp.firstarrow),d=s.evaluate(t.visProp.lastarrow);t.visPropCalc.visible&&((c||d)&&(h=-4),l.calcStraight(t,o,n,h),r=this._getHighlighted(t),e=this.getPositionArrowHead(t,o,n,s.evaluate(t.visProp[r+"strokewidth"]),r),this.context.beginPath(),this.context.moveTo(e.c1.scrCoords[1]+e.d1x,e.c1.scrCoords[2]+e.d1y),this.context.lineTo(e.c2.scrCoords[1]-e.d2x,e.c2.scrCoords[2]-e.d2y),this._stroke(t),(c&&e.sFirst>0||d&&e.sLast>0)&&this.drawArrows(t,e.c1,e.c2,r))},updateLine:function(t){this.drawLine(t)},drawTicks:function(){},updateTicks:function(t){var e,i,r,s,o,n,a=t.ticks.length,h=this.context;for(h.beginPath(),e=0;e1&&(e=this._getHighlighted(t),this.drawArrows(t,null,null,e))},updateCurve:function(t){this.drawCurve(t)},drawEllipse:function(t){var e=t.center.coords.scrCoords[1],i=t.center.coords.scrCoords[2],r=t.board.unitX,s=t.board.unitY,o=2*t.Radius(),n=2*t.Radius(),a=o*r,h=n*s,l=e-a/2,c=i-h/2,d=a/2*.5522848,u=h/2*.5522848,p=l+a,f=c+h,m=l+a/2,g=c+h/2,b=this.context;o>0&&n>0&&!isNaN(e+i)&&(b.beginPath(),b.moveTo(l,g),b.bezierCurveTo(l,g-u,m-d,c,m,c),b.bezierCurveTo(m+d,c,p,g-u,p,g),b.bezierCurveTo(p,g+u,m+d,f,m,f),b.bezierCurveTo(m-d,f,l,g+u,l,g),b.closePath(),this._fill(t),this._stroke(t))},updateEllipse:function(t){return this.drawEllipse(t)},displayCopyright:function(t,e){var i=this.context;i.save(),i.font=e+"px Arial",i.fillStyle="#aaa",i.lineWidth=.5,i.fillText(t,10,2+e),i.restore()},drawInternalText:function(t){var e=s.evaluate(t.visProp.fontsize),i=t.getAnchorX(),r=t.getAnchorY(),o=this.context;return o.save(),this._setColor(t,"stroke","fill")&&!isNaN(t.coords.scrCoords[1]+t.coords.scrCoords[2])&&(o.font=(e>0?e:0)+"px Arial",this.transformImage(t,t.transformations),"left"===i?o.textAlign="left":"right"===i?o.textAlign="right":"middle"===i&&(o.textAlign="center"),"bottom"===r?o.textBaseline="bottom":"top"===r?o.textBaseline="top":"middle"===r&&(o.textBaseline="middle"),o.fillText(t.plaintext,t.coords.scrCoords[1],t.coords.scrCoords[2])),o.restore(),null},updateInternalText:function(t){this.drawInternalText(t)},setObjectStrokeColor:function(t,e,r){var o,a,h,l,c=s.evaluate(e),d=s.evaluate(r);d=d>0?d:0,t.visPropOld.strokecolor===c&&t.visPropOld.strokeopacity===d||(s.exists(c)&&!1!==c&&(9!==c.length?(o=c,h=d):(a=n.rgba2rgbo(c),o=a[0],h=d*a[1]),l=t.rendNode,t.elementClass===i.OBJECT_CLASS_TEXT&&"html"===s.evaluate(t.visProp.display)&&(l.style.color=o,l.style.opacity=h)),t.visPropOld.strokecolor=c,t.visPropOld.strokeopacity=d)},drawImage:function(t){t.rendNode=new Image,t._src="",this.updateImage(t)},updateImage:function(t){var e=this.context,i=s.evaluate(t.visProp.fillopacity),r=s.bind(function(){t.imgIsLoaded=!0,t.size[0]<=0||t.size[1]<=0||(e.save(),e.globalAlpha=i,this.transformImage(t,t.transformations),e.drawImage(t.rendNode,t.coords.scrCoords[1],t.coords.scrCoords[2]-t.size[1],t.size[0],t.size[1]),e.restore())},this);this.updateImageURL(t)?t.rendNode.onload=r:t.imgIsLoaded&&r()},transformImage:function(t,e){var i,r=e.length,s=this.context;r>0&&(i=this.joinTransforms(t,e),Math.abs(c.det(i))>=h.eps&&s.transform(i[1][1],i[2][1],i[1][2],i[2][2],i[1][0],i[2][0]))},updateImageURL:function(t){var e;return e=s.evaluate(t.url),t._src!==e&&(t.imgIsLoaded=!1,t.rendNode.src=e,t._src=e,!0)},remove:function(t){s.exists(t)&&s.exists(t.parentNode)&&t.parentNode.removeChild(t)},updatePathStringPrim:function(t){var e,i,r,s,o,n="M",a=this.context;if(!(t.numberPoints<=0)){if(o=Math.min(t.points.length,t.numberPoints),a.beginPath(),1===t.bezierDegree)for(e=0;e5e3?i[1]=5e3:i[1]<-5e3&&(i[1]=-5e3),i[2]>5e3?i[2]=5e3:i[2]<-5e3&&(i[2]=-5e3),"M"===n?a.moveTo(i[1],i[2]):a.lineTo(i[1],i[2]),n="L");else if(3===t.bezierDegree)for(e=0;e5e3?o[1]=5e3:o[1]<-5e3&&(o[1]=-5e3),o[2]>5e3?o[2]=5e3:o[2]<-5e3&&(o[2]=-5e3),"M"===l?p.moveTo(o[1],o[2]):(r=2*i,p.bezierCurveTo(n+.333*(o[1]-n)+d*(r*Math.random()-i),a+.333*(o[2]-a)+d*(r*Math.random()-i),n+.666*(o[1]-n)+d*(r*Math.random()-i),a+.666*(o[2]-a)+d*(r*Math.random()-i),o[1],o[2])),l="C",n=o[1],a=o[2]);p.lineCap="round",this._fill(t),this._stroke(t)}},updatePolygonPrim:function(t,e){var i,r,s,o=e.vertices.length,n=this.context,a=!0;if(!(o<=0)&&e.visPropCalc.visible){for("polygonalchain"===e.elType&&o++,n.beginPath(),r=0;!e.vertices[r].isReal&&r0?e:0,s.evaluate(t.visProp.fillcolor)},setShadow:function(t){t.visPropOld.shadow!==t.visProp.shadow&&(t.visPropOld.shadow=t.visProp.shadow)},highlight:function(t){return t.elementClass===i.OBJECT_CLASS_TEXT&&"html"===s.evaluate(t.visProp.display)?this.updateTextStyle(t,!0):(t.board.prepareUpdate(),t.board.renderer.suspendRedraw(t.board),t.board.updateRenderer(),t.board.renderer.unsuspendRedraw()),this},noHighlight:function(t){return t.elementClass===i.OBJECT_CLASS_TEXT&&"html"===s.evaluate(t.visProp.display)?this.updateTextStyle(t,!1):(t.board.prepareUpdate(),t.board.renderer.suspendRedraw(t.board),t.board.updateRenderer(),t.board.renderer.unsuspendRedraw()),this},suspendRedraw:function(e){this.context.save(),this.context.clearRect(0,0,this.canvasRoot.width,this.canvasRoot.height),e&&e.attr.showcopyright&&this.displayCopyright(t.licenseText,12)},unsuspendRedraw:function(){this.context.restore()},resize:function(t,e){this.container?(this.canvasRoot.style.width=parseFloat(t)+"px",this.canvasRoot.style.height=parseFloat(e)+"px",this.canvasRoot.setAttribute("width",2*parseFloat(t)+"px"),this.canvasRoot.setAttribute("height",2*parseFloat(e)+"px")):(this.canvasRoot.width=2*parseFloat(t),this.canvasRoot.height=2*parseFloat(e)),this.context=this.canvasRoot.getContext("2d"),this.context.scale(2,2)},removeToInsertLater:function(){return function(){}}}),t.CanvasRenderer}),define("renderer/no",["jxg","renderer/abstract"],function(t,e){"use strict";return t.NoRenderer=function(){this.enhancedRendering=!1,this.type="no"},t.extend(t.NoRenderer.prototype,{drawPoint:function(t){},updatePoint:function(t){},changePointStyle:function(t){},drawLine:function(t){},updateLine:function(t){},drawTicks:function(t){},updateTicks:function(t){},drawCurve:function(t){},updateCurve:function(t){},drawEllipse:function(t){},updateEllipse:function(t){},drawPolygon:function(t){},updatePolygon:function(t){},displayCopyright:function(t,e){},drawInternalText:function(t){},updateInternalText:function(t){},drawText:function(t){},updateText:function(t){},updateTextStyle:function(t,e){},updateInternalTextStyle:function(t,e,i){},drawImage:function(t){},updateImage:function(t){},transformImage:function(t,e){},updateImageURL:function(t){},appendChildPrim:function(t,e){},appendNodesToElement:function(t,e){},createPrim:function(t,e){return null},remove:function(t){},makeArrows:function(t){},updateEllipsePrim:function(t,e,i,r,s){},updateLinePrim:function(t,e,i,r,s,o){},updatePathPrim:function(t,e,i){},updatePathStringPoint:function(t,e,i){},updatePathStringPrim:function(t){},updatePathStringBezierPrim:function(t){},updatePolygonPrim:function(t,e){},updateRectPrim:function(t,e,i,r,s){},setPropertyPrim:function(t,e,i){},display:function(t,e){t&&(t.visPropOld.visible=e)},show:function(t){},hide:function(t){},setBuffering:function(t,e){},setDashStyle:function(t){},setDraft:function(t){},removeDraft:function(t){},setGradient:function(t){},updateGradient:function(t){},setObjectTransition:function(t,e){},setObjectFillColor:function(t,e,i){},setObjectStrokeColor:function(t,e,i){},setObjectStrokeWidth:function(t,e){},setShadow:function(t){},highlight:function(t){},noHighlight:function(t){},suspendRedraw:function(){},unsuspendRedraw:function(){},drawZoomBar:function(t){},getElementById:function(t){return null},resize:function(t,e){},removeToInsertLater:function(){return function(){}}}),t.NoRenderer.prototype=new e,t.NoRenderer}),define("jsxgraph",["jxg","utils/env","utils/type","base/board","reader/file","options","renderer/svg","renderer/vml","renderer/canvas","renderer/no"],function(t,e,i,r,s,o,n,a,h,l){"use strict";return t.JSXGraph={rendererType:function(){return o.board.renderer="no",e.supportsVML()&&(o.board.renderer="vml",document.onmousemove=function(){var t;return document.body&&(t=document.body.scrollLeft,t+=document.body.scrollTop),t}),e.supportsCanvas()&&(o.board.renderer="canvas"),e.supportsSVG()&&(o.board.renderer="svg"),e.isNode()&&e.supportsCanvas()&&(o.board.renderer="canvas"),(e.isNode()||"no"===o.renderer)&&(o.text.display="internal",o.infobox.display="internal"),o.board.renderer}(),initRenderer:function(t,e,r,s){var o;if(i.exists(r)&&!1!==r||"object"!=typeof document||(r=document),"object"==typeof r&&null!==t)for(o=r.getElementById(t);o.firstChild;)o.removeChild(o.firstChild);else o=t;return void 0!==s&&"auto"!==s||(s=this.rendererType),"svg"===s?new n(o,e):"vml"===s?new a(o):"canvas"===s?new h(o,e):new l},initBoard:function(s,n){var a,h,l,c,d,u,p,f,m,g,b,v,y,C;return n=n||{},g=i.copyAttributes(n,o,"board"),g.zoom=i.copyAttributes(g,o,"board","zoom"),g.pan=i.copyAttributes(g,o,"board","pan"),g.selection=i.copyAttributes(g,o,"board","selection"),g.navbar=i.copyAttributes(g.navbar,o,"navbar"),f=e.getDimensions(s,g.document),g.unitx||g.unity?(a=i.def(g.originx,150),h=i.def(g.originy,150),l=i.def(g.unitx,50),c=i.def(g.unity,50)):(m=g.boundingbox,m[0]g.maxboundingbox[1]&&(m[1]=g.maxboundingbox[1]),m[2]>g.maxboundingbox[2]&&(m[2]=g.maxboundingbox[2]),m[3]-1)s.construct(e);else try{s.jc.parse(e)}catch(e){t.debug(e)}return s},g=function(e,i,r,s){return function(){var o;t.JSXGraph.freeBoard(e),o=m(i,r,s),o.reload=g(o,i,r,s)}};for(r=0;r/g,""),f[r].innerHTML=p,a=m(p,e,c),a.reload=g(a,p,e,c)):t.debug("JSXGraph: Apparently the div injection failed. Can't create a board, sorry.")}},window),t.JSXGraph}),define("base/group",["jxg","base/constants","math/math","math/geometry","utils/type"],function(t,e,i,r,s){"use strict";return t.Group=function(t,i,r,o,n){var a,h,l,c;for(this.board=t,this.objects={},a=this.board.numObjects,this.board.numObjects+=1,""!==i&&s.exists(i)?this.id=i:this.id=this.board.id+"Group"+a,this.board.groups[this.id]=this,this.type=e.OBJECT_TYPE_POINT,this.elementClass=e.OBJECT_CLASS_POINT,""!==r&&s.exists(r)?this.name=r:this.name="group_"+this.board.generateName(this),delete this.type,this.coords={},this.needsRegularUpdate=n.needsregularupdate,this.rotationCenter="centroid",this.scaleCenter=null,this.rotationPoints=[],this.translationPoints=[],this.scalePoints=[],this.scaleDirections={},this.parents=[],h=s.isArray(o)?o:Array.prototype.slice.call(arguments,3),l=0;l=0&&delete e.groups[i]);return this.objects={},this},addParents:function(t){var e,i,r;for(r=s.isArray(t)?t:arguments,i=r.length,e=0;e=0?a:1,l=this.scaleDirections[t.id].indexOf("y")>=0?a:1,d=this.board.create("transform",[1,0,0,u[0]*(1-h),h,0,u[1]*(1-l),0,l],{type:"generic"}),d.update()}}this._update_apply_transformation(t,d),this.needsUpdate=!1;for(e in this.objects)if(this.objects.hasOwnProperty(e))for(n in this.objects[e].descendants)this.objects[e].descendants.hasOwnProperty(n)&&(this.objects[e].descendants.needsUpdate=this.objects[e].descendants.needsRegularUpdate||this.board.needsFullUpdate);this.board.updateElements(t);for(e in this.objects)this.objects.hasOwnProperty(e)&&this._updateCoordsCache(e);return this},_update_find_drag_type:function(){var t,r,o,n="nothing",a=[];for(t in this.objects)this.objects.hasOwnProperty(t)&&(r=this.objects[t].point,r.coords.distance(e.COORDS_BY_USER,this.coords[t])>i.eps&&a.push(r.id));return 0===a.length?{action:n,id:"",changed:a}:(o=a[0],r=this.objects[o].point,a.length>1?n="translation":s.isInArray(this.rotationPoints,r)&&s.exists(this.rotationCenter)?n="rotation":s.isInArray(this.scalePoints,r)&&s.exists(this.scaleCenter)?n="scaling":s.isInArray(this.translationPoints,r)&&(n="translation"),{action:n,id:o,changed:a})},_update_centroid_center:function(){var t,e,i;t=[0,0],e=0;for(i in this.coords)this.coords.hasOwnProperty(i)&&(t[0]+=this.coords[i].usrCoords[1],t[1]+=this.coords[i].usrCoords[2],++e);return e>0&&(t[0]/=e,t[1]/=e),t},_update_apply_transformation:function(t,r){var o,n;for(o in this.objects)this.objects.hasOwnProperty(o)&&(s.exists(this.board.objects[o])?(n=this.objects[o].point,n.id!==t.id?"translation"===t.action?s.isInArray(t.changed,n.id)||n.coords.setCoordinates(e.COORDS_BY_USER,[this.coords[o].usrCoords[1]+r[0],this.coords[o].usrCoords[2]+r[1]]):"rotation"!==t.action&&"scaling"!==t.action||r.applyOnce([n]):"rotation"!==t.action&&"scaling"!==t.action||n.coords.setCoordinates(e.COORDS_BY_USER,i.matVecMult(r.matrix,this.coords[n.id].usrCoords))):delete this.objects[o])},addPoint:function(t){return this.objects[t.id]={point:this.board.select(t)},this._updateCoordsCache(t.id),this.translationPoints.push(t),t.groups.push(this.id),t.groups=s.uniqueArray(t.groups),this},addPoints:function(t){var e;for(e=0;e-1&&this[t+"Points"].splice(i,1),this},setProperty:function(){t.deprecated("Group.setProperty","Group.setAttribute()"),this.setAttribute.apply(this,arguments)},setAttribute:function(){var t;for(t in this.objects)this.objects.hasOwnProperty(t)&&this.objects[t].point.setAttribute.apply(this.objects[t].point,arguments);return this}}),t.createGroup=function(e,i,r){var o=s.copyAttributes(r,e.options,"group"),n=new t.Group(e,o.id,o.name,i,o);return n.elType="group",n.setParents(i),n},t.registerElement("group",t.createGroup),{Group:t.Group,createGroup:t.createGroup}}),define("element/locus",["jxg","math/symbolic","utils/type","base/constants","base/curve"],function(t,e,i,r,s){"use strict";return t.createLocus=function(t,r,s){var o,n;if(!i.isArray(r)||1!==r.length||!i.isPoint(r[0]))throw new Error("JSXGraph: Can't create locus with parent of type other than point.\nPossible parent types: [point]");return n=r[0],o=t.create("curve",[[null],[null]],s),o.dontCallServer=!1,o.elType="locus",o.setParents([n.id]),o.updateDataArray=function(){var i,r,s;o.board.mode>0||(i=e.generatePolynomials(t,n,!0).join("|"))!==o.spe&&(o.spe=i,r=function(t,e,i,r){o.dataX=t,o.dataY=e,o.eq=i,o.ctime=r,o.generatePolynomial=function(t){return function(e){var i,r="("+e.symbolic.x+")",s="("+e.symbolic.y+")",o=[];for(i=0;i=-a&&o-this.size[0]<=a&&n>=-a&&n-this.size[1]<=a):(h=new i(e.COORDS_BY_SCREEN,[t,r],this.board),h=h.usrCoords,l=[h[0]-this.span[0][0],h[1]-this.span[0][1],h[2]-this.span[0][2]],d=s.innerProduct,0<=(c=d(l,this.span[1]))&&c<=d(this.span[1],this.span[1])&&0<=(c=d(l,this.span[2]))&&c<=d(this.span[2],this.span[2]))},update:function(t){return this.needsUpdate?(this.updateCoords(t),this.updateSize(),this.updateSpan(),this):this},updateRenderer:function(){return this.updateRendererGeneric("updateImage")},updateSize:function(){return this.usrSize=[this.W(),this.H()],this.size=[Math.abs(this.usrSize[0]*this.board.unitX),Math.abs(this.usrSize[1]*this.board.unitY)],this},updateSpan:function(){var t,e,i=this.transformations.length,r=[];if(0===i)this.span=[[this.Z(),this.X(),this.Y()],[this.Z(),this.W(),0],[this.Z(),0,this.H()]];else{for(r[0]=[this.Z(),this.X(),this.Y()],r[1]=[this.Z(),this.X()+this.W(),this.Y()],r[2]=[this.Z(),this.X(),this.Y()+this.H()],t=0;t=1||Math.abs(o[1][0]-o[1][1])>=1))if(0===this.line.stdform[1]){if(Math.abs(i-.5*(o[1][0]+o[1][1]))<2*h&&o[0][0]-he.eps?(a=c.usrCoords[1]/l.usrCoords[1],d[0]*=a,d[2]*=a,this.board.setBoundingBox(d,!1)):Math.abs(this.line.stdform[2])e.eps&&(h=c.usrCoords[2]/l.usrCoords[2],d[3]*=h,d[1]*=h,this.board.setBoundingBox(d,!1)),this):this},calculateTicksCoordinates:function(){var t,i,r,s;if(this.setTicksSizeVariables(),!(Math.abs(this.dx)=e.eps&&f.scrCoords[1]>=0&&f.scrCoords[1]<=this.board.canvasWidth&&f.scrCoords[2]>=0&&f.scrCoords[2]<=this.board.canvasHeight,b=Math.abs(m.usrCoords[0])>=e.eps&&m.scrCoords[1]>=0&&m.scrCoords[1]<=this.board.canvasWidth&&m.scrCoords[2]>=0&&m.scrCoords[2]<=this.board.canvasHeight,v=n.evaluate(this.line.visProp.straightfirst),y=n.evaluate(this.line.visProp.straightlast),C=n.evaluate(this.visProp.includeboundaries);return n.exists(s)||"tickdistance"===s?i.calcStraight(this.line,f,m,n.evaluate(this.line.visProp.margin)):i.calcLineDelimitingPoints(this.line,f,m),l=n.evaluate(this.line.visProp.firstarrow),c=n.evaluate(this.line.visProp.lastarrow),(l||c)&&(p=this.board.renderer.getPositionArrowHead(this.line,f,m,n.evaluate(this.line.visProp.strokewidth)),l&&f.setCoordinates(r.COORDS_BY_SCREEN,[f.scrCoords[1]-p.d1x,f.scrCoords[2]-p.d1y]),c&&m.setCoordinates(r.COORDS_BY_SCREEN,[m.scrCoords[1]-p.d2x,m.scrCoords[2]-p.d2y])),d=this.getDistanceFromZero(t,f),u=this.getDistanceFromZero(t,m),de.eps?(a=this.adjustTickDistance(a,t,o),a/=l+1):h||(a/=l+1),this.ticksDelta=a,!(a=i.lower-s&&this.processTickPosition(t,r,a,o),r+=a;for(r=-a;r>=i.lower-s;)r<=i.upper+s&&this.processTickPosition(t,r,a,o),r-=a}},adjustTickDistance:function(t,e,i){var s,a,h,l=1,c=n.evaluate(this.visProp.minorticks);if(this.getLowerAndUpperBounds(e,"ticksdistance"),s=e.usrCoords[1]+i.x*t,a=e.usrCoords[2]+i.y*t,h=e.distance(r.COORDS_BY_SCREEN,new o(r.COORDS_BY_USER,[s,a],this.board)),0==t)return 0;for(;h/(c+1)=i.lower-u&&this.fixedTicks[h]<=i.upper+u&&(this.ticks.push(l),m&&(p||n.exists(this.visProp.labels[h]))?(a=p?n.evaluate(this.visProp.labels[h]):this.fixedTicks[h],this.labelsData.push(this.generateLabelData(this.generateLabelText(s,t,a),s,h))):this.labelsData.push(null))},getXandYdeltas:function(){var t,i,s=this.line.point1.Dist(this.line.point2);return this.line.type===r.OBJECT_TYPE_AXIS?(t=this.line.point1.coords.usrCoords,i=this.line.point2.coords.usrCoords,(t[1]>i[1]||Math.abs(t[1]-i[1])i[2])&&(t=this.line.point2.coords.usrCoords,i=this.line.point1.coords.usrCoords)):(t=this.line.point1.coords.usrCoords,i=this.line.point2.coords.usrCoords),{x:(i[1]-t[1])/s,y:(i[2]-t[2])/s}},_isInsideCanvas:function(t,e,i){var r=this.board.canvasWidth,s=this.board.canvasHeight;return void 0===i&&(i=0),t[0]>=i&&t[0]<=r-i&&e[0]>=i&&e[0]<=s-i||t[1]>=i&&t[1]<=r-i&&e[1]>=i&&e[1]<=s-i},createTickPath:function(t,e){var r,s,o,a,h,l,c,d,u,p=[-2e6,-2e6],f=[-2e6,-2e6];if(r=t.scrCoords,e?(a=this.dxMaj,h=this.dyMaj,u=this.majStyle):(a=this.dxMin,h=this.dyMin,u=this.minStyle),s=[-h*r[1]-a*r[2],h,a],e&&"polar"==n.evaluate(this.visProp.type)){var m,g,b,v=this.board.getBoundingBox(),y=2*Math.PI,C=y/180;this.board.unitY,this.board.X;if(r=t.usrCoords,g=Math.sqrt(r[1]*r[1]+r[2]*r[2]),b=Math.max(Math.sqrt(v[0]*v[0]+v[1]*v[1]),Math.sqrt(v[2]*v[2]+v[3]*v[3])),g"==n.evaluate(this.visProp.face)?Math.PI/4:"<"==n.evaluate(this.visProp.face)?-Math.PI/4:0,l=Math.cos(d)*a-Math.sin(d)*h,c=Math.sin(d)*a+Math.cos(d)*h,p[0]=r[1]+l*n.evaluate(this.visProp.tickendings[0]),f[0]=r[2]-c*n.evaluate(this.visProp.tickendings[0]),p[1]=r[1],f[1]=r[2],d=-d,l=Math.cos(d)*a-Math.sin(d)*h,c=Math.sin(d)*a+Math.cos(d)*h,p[2]=r[1]-l*n.evaluate(this.visProp.tickendings[1]),f[2]=r[2]+c*n.evaluate(this.visProp.tickendings[1])),this._isInsideCanvas(p,f))return[p,f,e];return[]},formatLabelText:function(t){var e=t.toString(),i=n.evaluate(this.visProp.scalesymbol);return n.isNumber(t)&&((e.length>n.evaluate(this.visProp.maxlabellength)||-1!==e.indexOf("e"))&&(e=t.toPrecision(n.evaluate(this.visProp.precision)).toString()),e.indexOf(".")>-1&&-1===e.indexOf("e")&&(e=e.replace(/0+$/,""),e=e.replace(/\.$/,""))),i.length>0&&("1"===e?e=i:"-1"===e?e="-"+i:"0"!==e&&(e+=i)),n.evaluate(this.visProp.useunicodeminus)&&(e=e.replace(/-/g,"−")),e},generateLabelText:function(t,i,r){var s,o=this.getDistanceFromZero(i,t);return Math.abs(o)e.eps?this.position=(t-this._smin)/i:this.position=0,this.position=Math.max(0,Math.min(1,this.position)),this},_.setMin=function(t){return this._smin=t,this},S&&(w=s.copyAttributes(a,t.options,"slider","label"),E=t.create("text",[function(){return.05*(m.X()-f.X())+m.X()},function(){return.05*(m.Y()-f.Y())+m.Y()},function(){var t,e=s.evaluate(_.visProp.suffixlabel),i=s.evaluate(_.visProp.unitlabel),r=s.evaluate(_.visProp.postlabel);return t=null!==e?e:_.name&&""!==_.name?_.name+" = ":"",t+=s.toFixed(_.Value(),T),null!==i&&(t+=i),null!==r&&(t+=r),t}],w),_.label=E,_.visProp.withlabel=!0,_.hasLabel=!0),_.point1=f,_.point2=m,_.baseline=g,_.highline=P,x&&(w=s.copyAttributes(a,t.options,"slider","ticks"),s.exists(w.generatelabeltext)||(w.generateLabelText=function(t,i,r){var s=_.point1.Dist(_.point2),o=_._smin,n=_._smax,a=this.getDistanceFromZero(i,t)*(n-o)/s+o;return st&&(r[i]=parseFloat(this.data[i][t]));return r},getRow:function(t){var i,r;if(e.isString(t))for(r=0;r=0?"left":"right"}}(o))):(g[0]=t.create("point",[a,0],v),g[1]=t.create("point",[a,d],v),g[2]=t.create("point",[c,d],v),g[3]=t.create("point",[c,0],v),h.exists(p.labels)&&h.exists(p.labels[s])&&(f.anchorX="middle",o=t.create("text",[l,d,p.labels[s]],f),o.visProp.anchory=function(t){return function(){return t.Y()>=0?"bottom":"top"}}(o))),h.isArray(p.colors)&&(u=p.colors,p.fillcolor=u[s%u.length]),m[s]=t.create("polygon",g,p),h.exists(p.labels)&&h.exists(p.labels[s])&&(m[s].text=o);return m},drawPoints:function(t,e,i,r){var s,o=[],n=r.infoboxarray;for(r.fixed=!0,r.name="",s=0;sd[a]&&(d[a]=i[n][a]),i[n][a]=8192&&(this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this._attributes),this.objects.push(this.curve)),this.pos[0]+=i,this.pos[1]+=r,this.isPenDown&&(this.curve.dataX.push(this.pos[0]),this.curve.dataY.push(this.pos[1])),this.board.update(),this},back:function(t){return this.forward(-t)},right:function(t){if(this.dir-=t,this.dir%=360,!this.turtleIsHidden){this.board.create("transform",[-t*Math.PI/180,this.turtle],{type:"rotate"}).applyOnce(this.turtle2)}return this.board.update(),this},left:function(t){return this.right(-t)},penUp:function(){return this.isPenDown=!1,this},penDown:function(){return this.isPenDown=!0,this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this._attributes),this.objects.push(this.curve),this},clean:function(){var t,i;for(t=0;t=8192&&(this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this._attributes),this.objects.push(this.curve)),this.pos[0]=t[0],this.pos[1]=t[1],this.isPenDown&&(this.curve.dataX.push(this.pos[0]),this.curve.dataY.push(this.pos[1])),this.board.update()),this},fd:function(t){return this.forward(t)},bk:function(t){return this.back(t)},lt:function(t){return this.left(t)},rt:function(t){return this.right(t)},pu:function(){return this.penUp()},pd:function(){return this.penDown()},ht:function(){return this.hideTurtle()},st:function(){return this.showTurtle()},cs:function(){return this.clearScreen()},push:function(){return this.pushTurtle()},pop:function(){return this.popTurtle()},evalAt:function(t,i){var r,s,o,n,a=this.objects.length;for(r=0,s=0;r=2?t.children[1][1].value:a.children[0][0],h=a.children[1]):(h=t.children[1][0],f=["x"],p=t.children[1].length>=2?t.children[1][1].value:"x"),m=t.children[1].length>=3?t.children[1][2].value:1,d=h,m>=1)for(;m>=1;)d=this.derivative(d,p),d=this.removeTrivialNodes(d),m--;c="node_op"==e.type&&"op_assign"==e.value?this.createNode("node_op","op_map",f,d):d,this.setMath(c),t.type=c.type,t.value=c.value,t.children[0]=c.children[0],t.children[1]=c.children[1]}}}return t},removeTrivialNodes:function(t){var e,i,r,s,o;if(n.isArray(t))for(i=t.length,e=0;e0?r.value=1/0:r.value=-1/0,r;if("node_op"==r.type&&"op_neg"==r.value&&"node_op"==s.type&&"op_neg"==s.value)return t.children=[r.children[0],s.children[0]],this.mayNotBeSimplified=!0,t;if("op_neg"==r.value&&"op_neg"!=s.value)return t.type="node_op",t.value="op_neg",t.children=[this.createNode("node_op","op_div",r.children[0],s)],this.mayNotBeSimplified=!0,t;if("op_neg"!=r.value&&"op_neg"==s.value)return t.type="node_op",t.value="op_neg",t.children=[this.createNode("node_op","op_div",r,s.children[0])],this.mayNotBeSimplified=!0,t;if("node_op"==r.type&&"op_exp"==r.value&&(s.hash||(s.hash=this.parser.compile(s)),r.children[0].hash||(r.children[0].hash=this.parser.compile(r.children[0])),s.hash===r.children[0].hash))return r.children[1]=this.createNode("node_op","op_sub",r.children[1],this.createNode("node_const",1)),this.mayNotBeSimplified=!0,r;if("node_const"!=s.type&&"node_op"==r.type&&"op_mul"==r.value&&"node_const"==r.children[0].type)return t.value="op_mul",t.children=[r.children[0],this.createNode("node_op","op_div",r.children[1],s)],this.mayNotBeSimplified=!0,t;if("node_op"==r.type&&"op_exp"==r.value&&"node_op"==s.type&&"op_exp"==s.value&&(r.children[0].hash=this.parser.compile(r.children[0]),s.children[0].hash=this.parser.compile(s.children[0]),r.children[0].hash===s.children[0].hash))return r.children[1]=this.createNode("node_op","op_sub",r.children[1],s.children[1]),this.mayNotBeSimplified=!0,r;break;case"op_exp":if(r=t.children[0],s=t.children[1],"node_const"==s.type&&0===s.value)return s.value=1,s;if("node_const"==s.type&&1==s.value)return r;if("node_const"==r.type&&1==r.value)return r;if("node_const"==r.type&&0===r.value&&"node_const"==s.type&&0!==s.value)return r;if("node_op"==r.type&&"op_exp"==r.value)return t.children=[r.children[0],this.createNode("node_op","op_mul",r.children[1],s)],t}switch(t.value){case"op_add":if(r=t.children[0],s=t.children[1],"node_const"==r.type&&"node_const"==s.type&&r.value==s.value)return r.value+=s.value,r +;if("node_var"==r.type&&"node_var"==s.type&&r.value==s.value)return t.children[0]=this.createNode("node_const",2),t.value="op_mul",t;if("node_op"==r.type&&"op_neg"==r.value)return t.value="op_sub",t.children[0]=s,t.children[1]=r.children[0],this.mayNotBeSimplified=!0,t;if("node_op"==s.type&&"op_neg"==s.value)return t.value="op_sub",t.children[1]=s.children[0],this.mayNotBeSimplified=!0,t;if("node_op"==r.type&&"op_mul"==r.value&&"node_op"==s.type&&"op_mul"==s.value&&(r.children[1].hash=this.parser.compile(r.children[1]),s.children[1].hash=this.parser.compile(s.children[1]),r.children[1].hash===s.children[1].hash))return t.value="op_mul",t.children=[this.createNode("node_op","op_add",r.children[0],s.children[0]),r.children[1]],this.mayNotBeSimplified=!0,t;if("node_op"==r.type&&"op_mul"==r.value&&(r.children[1].hash=this.parser.compile(r.children[1]),s.hash=this.parser.compile(s),r.children[1].hash===s.hash))return t.value="op_mul",t.children=[this.createNode("node_op","op_add",r.children[0],this.createNode("node_const",1)),s],this.mayNotBeSimplified=!0,t;if("node_op"==s.type&&"op_mul"==s.value&&(s.children[1].hash=this.parser.compile(s.children[1]),r.hash=this.parser.compile(r),s.children[1].hash===r.hash))return t.value="op_mul",t.children=[this.createNode("node_op","op_add",this.createNode("node_const",1),s.children[0]),r],this.mayNotBeSimplified=!0,t;break;case"op_sub":if(r=t.children[0],s=t.children[1],"node_op"==s.type&&"op_neg"==s.value)return t.value="op_add",t.children[1]=s.children[0],this.mayNotBeSimplified=!0,t;break;case"op_execfun":return this.simplifyElementary(t)}return t},simplifyElementary:function(t){var e=t.children[0].value,i=t.children[1];if(0==i.length)return t;switch(e){case"sin":case"tan":if("node_const"==i[0].type&&0===i[0].value)return t.type="node_const",t.value=0,t;if("node_var"==i[0].type&&"PI"==i[0].value)return t.type="node_const",t.value=0,t;if("node_op"==i[0].type&&"op_mul"==i[0].value&&"node_const"==i[0].children[0].type&&i[0].children[0].value%1==0&&"node_var"==i[0].children[1].type&&"PI"==i[0].children[1].value)return t.type="node_const",t.value=0,t;break;case"cos":if("node_const"==i[0].type&&0===i[0].value)return t.type="node_const",t.value=1,t;if("node_var"==i[0].type&&"PI"==i[0].value)return t.type="node_op",t.value="op_neg",t.children=[this.createNode("node_const",1)],t;break;case"exp":if("node_const"==i[0].type&&0===i[0].value)return t.type="node_const",t.value=1,t;break;case"pow":if("node_const"==i[1].type&&0===i[1].value)return t.type="node_const",t.value=1,t}return t}}),t.CA}),define("utils/dump",["jxg","utils/type"],function(t,e){"use strict";return t.Dump={addMarkers:function(t,i,r){var s,o,n;e.isArray(i)||(i=[i]),e.isArray(r)||(r=[r]),o=Math.min(i.length,r.length),i.length=o,r.length=o;for(s in t.objects)if(t.objects.hasOwnProperty(s))for(n=0;n0;n--)a=e.deepCopy(a,l[n-1],!0);for(s in a)a.hasOwnProperty(s)&&(o=s.toLowerCase(),"object"!=typeof a[s]&&a[s]===h[o]&&delete h[o]);return h},prepareAttributes:function(e,i){var r,s;r=this.minimizeObject(i.getAttributes(),t.Options[i.elType]);for(s in i.subs)i.subs.hasOwnProperty(s)&&(r[s]=this.minimizeObject(i.subs[s].getAttributes(),t.Options[i.elType][s],t.Options[i.subs[s].elType]),r[s].id=i.subs[s].id,r[s].name=i.subs[s].name);return r.id=i.id,r.name=i.name,r},setBoundingBox:function(t,e,i){return t.push({obj:i,method:"setBoundingBox",params:[e.getBoundingBox(),!0]}),t},dump:function(t){var i,r,s,o,n=[],a=[],h=[],l=t.objectsList.length;for(this.addMarkers(t,"dumped",!1),i=0;i> "}return"null";case"string":return"'"+t.replace(/(["'])/g,"\\$1")+"'";case"number":case"boolean":return t.toString();case"null":return"null"}},toJessie:function(t){var e,i,r=this.dump(t),s=[];for(r.methods=this.setBoundingBox(r.methods,t,"$board"),i=r.elements,e=0;e0&&s.push("// "+i[e].attributes.name),s.push("s"+e+" = "+i[e].type+"("+i[e].parents.join(", ")+") "+this.toJCAN(i[e].attributes).replace(/\n/,"\\n")+";"),s.push("");for(e=0;e1)h=i.copyAttributes(r,t.options,"comb","point1"),s=t.create("point",e[0],h);else if(i.isString(e[0])||i.isPoint(e[0]))s=t.select(e[0]);else if(i.isFunction(e[0])&&i.isPoint(e[0]()))s=e[0]();else{if(!(i.isFunction(e[0])&&e[0]().length&&e[0]().length>=2))throw new Error("JSXGraph: Can't create comb with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]]");h=i.copyAttributes(r,t.options,"comb","point1"),s=n.createPoint(t,e[0](),h)}if(i.isArray(e[1])&&e[1].length>1)h=i.copyAttributes(r,t.options,"comb","point2"),o=t.create("point",e[1],h);else if(i.isString(e[1])||i.isPoint(e[1]))o=t.select(e[1]);else if(i.isFunction(e[1])&&i.isPoint(e[1]()))o=e[1]();else{if(!(i.isFunction(e[1])&&e[1]().length&&e[1]().length>=2))throw new Error("JSXGraph: Can't create comb with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]]");h=i.copyAttributes(r,t.options,"comb","point2"),o=n.createPoint(t,e[1](),h)}return h=i.copyAttributes(r,t.options,"comb"),i.merge(h,i.copyAttributes(r,t.options,"comb","curve")),a=t.create("curve",[[0],[0]],h),a.updateDataArray=function(){var t,e,r,n,h,l,c,d,u,p,f=0,m=s.Dist(o),g=s,b=o;for(d=i.evaluate(a.visProp.frequency),u=-i.evaluate(a.visProp.angle),p=i.evaluate(a.visProp.width),i.evaluate(a.visProp.reverse)&&(g=o,b=s,u=-u),t=Math.cos(u),e=Math.sin(u),r=(b.X()-g.X())/m,n=(b.Y()-g.Y())/m,t*=p/Math.abs(e),e*=p/Math.abs(e),this.dataX=[],this.dataY=[];f'],a=s.create("text",h,l),a.type=i.OBJECT_TYPE_CHECKBOX,a.rendNodeCheckbox=a.rendNode.childNodes[0].childNodes[0],a.rendNodeLabel=a.rendNode.childNodes[0].childNodes[1],a.rendNodeTag=a.rendNodeCheckbox,a.rendNodeTag.disabled=!!l.disabled,a.rendNodeLabel.innerHTML=o[2],a.rendNodeCheckbox.id=a.rendNode.id+"_checkbox",a.rendNodeLabel.id=a.rendNode.id+"_label",a.rendNodeLabel.setAttribute("for",a.rendNodeCheckbox.id),a.visPropOld.fontsize="0px",s.renderer.updateTextStyle(a,!1),a.rendNodeCheckbox.checked=l.checked,a._value=l.checked,a.Value=function(){return this._value},a.update=function(){return this.needsUpdate&&(t.Text.prototype.update.call(this),this._value=this.rendNodeCheckbox.checked),this},e.addEvent(a.rendNodeCheckbox,"change",r.CheckboxChangeEventHandler,a),a},t.registerElement("checkbox",t.createCheckbox),{createCheckbox:t.createCheckbox}}),define("element/input",["jxg","utils/env","utils/type"],function(t,e,i){"use strict";var r={InputInputEventHandler:function(t){this._value=this.rendNodeInput.value,this.board.update()}};return t.createInput=function(s,o,n){var a,h,l=i.copyAttributes(n,s.options,"input");return h=[o[0],o[1],''],a=s.create("text",h,l),a.type=i.OBJECT_TYPE_INPUT,a.rendNodeLabel=a.rendNode.childNodes[0].childNodes[0],a.rendNodeInput=a.rendNode.childNodes[0].childNodes[1],a.rendNodeLabel.innerHTML=o[3],a.rendNodeInput.value=o[2],a.rendNodeTag=a.rendNodeInput,a.rendNodeTag.disabled=!!l.disabled,a.rendNodeLabel.id=a.rendNode.id+"_label",a.rendNodeInput.id=a.rendNode.id+"_input",a._value=o[2],a.update=function(){return this.needsUpdate&&(t.Text.prototype.update.call(this),this._value=this.rendNodeInput.value),this},a.Value=function(){return this._value},e.addEvent(a.rendNodeInput,"input",r.InputInputEventHandler,a),e.addEvent(a.rendNodeInput,"mousedown",function(t){i.exists(t.stopPropagation)&&t.stopPropagation()},a),e.addEvent(a.rendNodeInput,"touchstart",function(t){i.exists(t.stopPropagation)&&t.stopPropagation()},a),e.addEvent(a.rendNodeInput,"pointerdown",function(t){i.exists(t.stopPropagation)&&t.stopPropagation()},a),a.visPropOld.fontsize="0px",s.renderer.updateTextStyle(a,!1),a},t.registerElement("input",t.createInput),{createInput:t.createInput}}),define("element/button",["jxg","utils/env","utils/type"],function(t,e,i){"use strict";var r={ButtonClickEventHandler:function(){this._handler&&this._handler(),this.board.update()}};return t.createButton=function(s,o,n){var a,h,l=i.copyAttributes(n,s.options,"button");return h=[o[0],o[1],''],a=s.create("text",h,l),a.type=i.OBJECT_TYPE_BUTTON,a.rendNodeButton=a.rendNode.childNodes[0],a.rendNodeButton.id=a.rendNode.id+"_button",a.rendNodeButton.innerHTML=o[2],a.rendNodeTag=a.rendNodeButton,a.rendNodeTag.disabled=!!l.disabled,a.visPropOld.fontsize="0px",s.renderer.updateTextStyle(a,!1),o[3]&&(i.isString(o[3])?(a._jc=new t.JessieCode,a._jc.use(s),a._handler=function(){a._jc.parse(o[3])}):a._handler=o[3]),e.addEvent(a.rendNodeButton,"click",r.ButtonClickEventHandler,a),e.addEvent(a.rendNodeButton,"mousedown",function(t){i.exists(t.stopPropagation)&&t.stopPropagation()},a),e.addEvent(a.rendNodeButton,"touchstart",function(t){i.exists(t.stopPropagation)&&t.stopPropagation()},a),e.addEvent(a.rendNodeButton,"pointerdown",function(t){i.exists(t.stopPropagation)&&t.stopPropagation()},a),a},t.registerElement("button",t.createButton),{createButton:t.createButton}}),define("../build/core.deps.js",["jxg","utils/env","base/constants","utils/type","utils/xml","utils/event","utils/expect","math/math","math/qdt","math/numerics","math/statistics","math/symbolic","math/geometry","math/clip","math/poly","math/complex","renderer/abstract","reader/file","parser/geonext","base/board","options","jsxgraph","base/element","base/coords","base/coordselement","base/point","base/line","base/group","base/circle","element/conic","base/polygon","base/curve","element/arc","element/sector","base/composition","element/composition","element/locus","base/text","base/image","element/slider","element/measure","base/chart","base/transformation","base/turtle","utils/color","base/ticks","utils/zip","utils/base64","utils/uuid","utils/encoding","server/server","parser/datasource","parser/jessiecode","parser/ca","utils/dump","renderer/svg","renderer/vml","renderer/canvas","renderer/no","element/comb","element/slopetriangle","element/checkbox","element/input","element/button"],function(t,e){"use strict";return e.isBrowser?window.JXG=t:e.isNode()&&"object"==typeof module?module.exports=t:e.isWebWorker()&&(self.JXG=t),t}),require("../build/core.deps.js")}); \ No newline at end of file diff --git a/SLO-apps/perceptron/normalize.css b/SLO-apps/perceptron/normalize.css new file mode 100644 index 0000000..192eb9c --- /dev/null +++ b/SLO-apps/perceptron/normalize.css @@ -0,0 +1,349 @@ +/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ + +/* Document + ========================================================================== */ + +/** + * 1. Correct the line height in all browsers. + * 2. Prevent adjustments of font size after orientation changes in iOS. + */ + +html { + line-height: 1.15; /* 1 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +/* Sections + ========================================================================== */ + +/** + * Remove the margin in all browsers. + */ + +body { + margin: 0; +} + +/** + * Render the `main` element consistently in IE. + */ + +main { + display: block; +} + +/** + * Correct the font size and margin on `h1` elements within `section` and + * `article` contexts in Chrome, Firefox, and Safari. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +/* Grouping content + ========================================================================== */ + +/** + * 1. Add the correct box sizing in Firefox. + * 2. Show the overflow in Edge and IE. + */ + +hr { + box-sizing: content-box; /* 1 */ + height: 0; /* 1 */ + overflow: visible; /* 2 */ +} + +/** + * 1. Correct the inheritance and scaling of font size in all browsers. + * 2. Correct the odd `em` font sizing in all browsers. + */ + +pre { + font-family: monospace, monospace; /* 1 */ + font-size: 1em; /* 2 */ +} + +/* Text-level semantics + ========================================================================== */ + +/** + * Remove the gray background on active links in IE 10. + */ + +a { + background-color: transparent; +} + +/** + * 1. Remove the bottom border in Chrome 57- + * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari. + */ + +abbr[title] { + border-bottom: none; /* 1 */ + text-decoration: underline; /* 2 */ + text-decoration: underline dotted; /* 2 */ +} + +/** + * Add the correct font weight in Chrome, Edge, and Safari. + */ + +b, +strong { + font-weight: bolder; +} + +/** + * 1. Correct the inheritance and scaling of font size in all browsers. + * 2. Correct the odd `em` font sizing in all browsers. + */ + +code, +kbd, +samp { + font-family: monospace, monospace; /* 1 */ + font-size: 1em; /* 2 */ +} + +/** + * Add the correct font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` elements from affecting the line height in + * all browsers. + */ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sub { + bottom: -0.25em; +} + +sup { + top: -0.5em; +} + +/* Embedded content + ========================================================================== */ + +/** + * Remove the border on images inside links in IE 10. + */ + +img { + border-style: none; +} + +/* Forms + ========================================================================== */ + +/** + * 1. Change the font styles in all browsers. + * 2. Remove the margin in Firefox and Safari. + */ + +button, +input, +optgroup, +select, +textarea { + font-family: inherit; /* 1 */ + font-size: 100%; /* 1 */ + line-height: 1.15; /* 1 */ + margin: 0; /* 2 */ +} + +/** + * Show the overflow in IE. + * 1. Show the overflow in Edge. + */ + +button, +input { /* 1 */ + overflow: visible; +} + +/** + * Remove the inheritance of text transform in Edge, Firefox, and IE. + * 1. Remove the inheritance of text transform in Firefox. + */ + +button, +select { /* 1 */ + text-transform: none; +} + +/** + * Correct the inability to style clickable types in iOS and Safari. + */ + +button, +[type="button"], +[type="reset"], +[type="submit"] { + -webkit-appearance: button; +} + +/** + * Remove the inner border and padding in Firefox. + */ + +button::-moz-focus-inner, +[type="button"]::-moz-focus-inner, +[type="reset"]::-moz-focus-inner, +[type="submit"]::-moz-focus-inner { + border-style: none; + padding: 0; +} + +/** + * Restore the focus styles unset by the previous rule. + */ + +button:-moz-focusring, +[type="button"]:-moz-focusring, +[type="reset"]:-moz-focusring, +[type="submit"]:-moz-focusring { + outline: 1px dotted ButtonText; +} + +/** + * Correct the padding in Firefox. + */ + +fieldset { + padding: 0.35em 0.75em 0.625em; +} + +/** + * 1. Correct the text wrapping in Edge and IE. + * 2. Correct the color inheritance from `fieldset` elements in IE. + * 3. Remove the padding so developers are not caught out when they zero out + * `fieldset` elements in all browsers. + */ + +legend { + box-sizing: border-box; /* 1 */ + color: inherit; /* 2 */ + display: table; /* 1 */ + max-width: 100%; /* 1 */ + padding: 0; /* 3 */ + white-space: normal; /* 1 */ +} + +/** + * Add the correct vertical alignment in Chrome, Firefox, and Opera. + */ + +progress { + vertical-align: baseline; +} + +/** + * Remove the default vertical scrollbar in IE 10+. + */ + +textarea { + overflow: auto; +} + +/** + * 1. Add the correct box sizing in IE 10. + * 2. Remove the padding in IE 10. + */ + +[type="checkbox"], +[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Correct the cursor style of increment and decrement buttons in Chrome. + */ + +[type="number"]::-webkit-inner-spin-button, +[type="number"]::-webkit-outer-spin-button { + height: auto; +} + +/** + * 1. Correct the odd appearance in Chrome and Safari. + * 2. Correct the outline style in Safari. + */ + +[type="search"] { + -webkit-appearance: textfield; /* 1 */ + outline-offset: -2px; /* 2 */ +} + +/** + * Remove the inner padding in Chrome and Safari on macOS. + */ + +[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * 1. Correct the inability to style clickable types in iOS and Safari. + * 2. Change font properties to `inherit` in Safari. + */ + +::-webkit-file-upload-button { + -webkit-appearance: button; /* 1 */ + font: inherit; /* 2 */ +} + +/* Interactive + ========================================================================== */ + +/* + * Add the correct display in Edge, IE 10+, and Firefox. + */ + +details { + display: block; +} + +/* + * Add the correct display in all browsers. + */ + +summary { + display: list-item; +} + +/* Misc + ========================================================================== */ + +/** + * Add the correct display in IE 10+. + */ + +template { + display: none; +} + +/** + * Add the correct display in IE 10. + */ + +[hidden] { + display: none; +} diff --git a/SLO-apps/perceptron/perceptron.ico b/SLO-apps/perceptron/perceptron.ico new file mode 100644 index 0000000..897c1c5 Binary files /dev/null and b/SLO-apps/perceptron/perceptron.ico differ diff --git a/SLO-apps/perceptron/style.css b/SLO-apps/perceptron/style.css new file mode 100644 index 0000000..c6781a0 --- /dev/null +++ b/SLO-apps/perceptron/style.css @@ -0,0 +1,288 @@ +:root { + --text-color-black: #0f0f0f; + --text-color-white: #f9f9f9; + --background-color: #fcfcfc; + + --main-color: #E61B72; + --secondary-color: #5CBDC5; + --secondary-blue: #001361; + + --text-area-width: 585px; +} + +html { + font-family: 'Open Sans', 'Lato', 'Roboto', sans-serif; + background: var(--background-color); +} + +body { + height: 100%; + width: 100%; +} + +header { + height: 100px; + width: 100%; + background: var(--main-color); + display: flex; + justify-content: center; + color: var(--text-color-white); +} + +header h1 { + margin: 0; + align-self: center; +} + +#content { + padding: 0 100px; +} + +button, input[type=file] { + width: auto; + overflow: visible; + + background: transparent; + + /* inherit font & color from ancestor */ + color: inherit; + font: inherit; + + /* Normalize `line-height`. Cannot be changed from `normal` in Firefox 4+. */ + line-height: normal; + + /* Corrects font smoothing for webkit */ + -webkit-font-smoothing: inherit; + -moz-osx-font-smoothing: inherit; + + /* Corrects inability to style clickable `input` types in iOS */ + -webkit-appearance: none; + + border: 1px solid #000; + border-radius: 5px; + margin: 2px; + padding: 2px; + cursor: pointer; +} + +button.big-button { + font-size: 15pt; +} + +button:hover, input[type=file]:hover { + background: var(--secondary-blue); + color: white; +} + +button:focus, input[type=file]:focus { + box-shadow: 0 0 0 1px black; +} + +button:active, input[type=file]:active { + background: #1abc9c; + color: white; +} + +#top-info { + display: flex; + flex-direction: row; + justify-content: space-between; + flex-wrap: wrap; +} + +#settings { + flex: 1; +} + +#settings #setting-list { + display: flex; + flex-direction: column; +} + +#setting-list .setting { + width: 300px; + margin: 2px 0; + display: flex; + flex-direction: row; + justify-content: space-between; +} + +#setting-list .setting label { + margin: 5px 0; +} + +#setting-list .setting input { + max-width: 100px; +} + +#setting-list .setting input[type=checkbox] { + width: 100px; +} + +#output { + flex: 1; + width: var(--text-area-width); +} + +#output-block textarea { + height: 40px; + resize: none; +} + +#data-input { + display: flex; + flex-direction: row; + align-content: space-between; + justify-content: space-between; + flex-wrap: wrap; +} + +#data-input .input-column { + width: var(--text-area-width); +} + +#data-input .input-column img { + border:1px solid black; +} + +#data-input .input-column textarea { + resize: none; + height:500px; + width: 100%; + font-size:8pt; + overflow-y: auto; + overflow-x: hidden; + font-family: 'Open Sans'; +} + +#drawing-items { + display: flex; + justify-content: space-between; +} + +#drawing-canvas { + height: 264px; + width: 264px; + image-rendering: -moz-crisp-edges; + image-rendering: -webkit-crisp-edges; + image-rendering: pixelated; + image-rendering: crisp-edges; + border: 2px solid black; + cursor: crosshair; + touch-action: none; +} + +#drawing-items .actions { + margin-left: 30px; +} + +#drawing-items .actions .buttons { + margin-top: 20px; + display: flex; + flex-direction: column; +} + +#drawing-items .actions .buttons button { + +} + +.drop-area { + position: relative; + border: 2px dashed rgb(118, 118, 118); + color: var(--text-color-black); + line-height: 30px; + border-radius: 20px; + width: 100%; + height: 100px; + margin: 10px auto; + display: table; +} + +.drop-area .drop-text{ + text-align: center; + vertical-align: middle; + display: table-cell; +} + +.drop-area .drop-input{ + position: absolute; + padding: 0; + margin: 0; + width: 100%; + height: 100%; + outline: none; + opacity: 0; + cursor: pointer; +} + +.drop-area:hover { + border-color: #2c3e50; + color: #2c3e50; +} + +.drop-area.highlight { + border-color: #d6a14d; +} + +footer::before { + content: ""; + display: block; + height: 50px; + /*position: relative;*/ + left: 0; + right: 0; + background: -webkit-linear-gradient( + 225deg + , #fff 25px, transparent 0) 0 25px, -webkit-linear-gradient( + 315deg + , #fff 25px, transparent 0) 0 25px; + background: linear-gradient(-135deg, #fff 25px, transparent 0) 0 25px, linear-gradient(135deg, #fff 25px, transparent 0) 0 25px; + background-position: top left; + background-repeat: repeat-x; + background-size: 50px 50px; + padding-bottom: 50px; + -webkit-font-smoothing: antialiased; + word-break: break-word; + box-sizing: inherit; +} + +footer { + padding: 0 0 50px 0; + margin-top: 50px; + text-align: center; + background: var(--secondary-blue); + color: var(--text-color-white); +} + +@media screen and (max-width: 1400px) { + #data-input .input-column { + width: 445px; + } + + textarea { + font-size: 6pt; + } +} + +@media screen and (max-width: 1100px) { + #data-input .input-column { + width: 100%; + } + + textarea { + max-width: 445px; + } +} + +@media (pointer:none), (pointer:coarse) { + textarea { + max-width: 425px; + } +} + +.midden{ + text-align: center; +} +.center{ + margin: auto; +} \ No newline at end of file diff --git a/SLO-apps/tensorflow/.DS_Store b/SLO-apps/tensorflow/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/SLO-apps/tensorflow/.DS_Store differ diff --git a/achtergrond_geschiedenis.html b/achtergrond_geschiedenis.html index ee6504c..0bb1e45 100644 --- a/achtergrond_geschiedenis.html +++ b/achtergrond_geschiedenis.html @@ -10,18 +10,18 @@ - +
Geschiedenis en toekomst

Kunstmatige Intelligentie/Achtergrond/Geschiedenis en toekomst

@@ -77,7 +77,7 @@

Automata

Leonardo da Vinci, je kent hem wel, maakte later in de renaissance een automata van een ridder. Deze ridder kon staan, zitten, zijn armen bewegen en zijn vizier verplaatsen! Dat lijkt tegenwoordig misschien niet bijzonder, maar je moet je bedenken dat hij dit in 1495 heeft bedacht! Er is alleen een schets met instructies van de ridder gevonden, maar toen onderzoekers de instructies volgden bleek het apparaat ook echt te werken!


-

Begin de 20ste eeuw

+

Begin van de 20ste eeuw


@@ -90,7 +90,7 @@

Begin de 20ste eeuw

In deze tijd werd ook al hard gewerkt aan de fundering van informatica en kunstmatige intelligentie. Zo werd formele logica bedacht, wat tegenwoordig heel veel gebruikt wordt in algoritmes. Ook werd speltheorie bedacht, een wiskundig model dat helpt met keuzes maken in bepaalde omstandigheden.


-

Eind de 20ste eeuw

+

Eind van de 20ste eeuw

Na de jaren '50 begon AI veel harder te groeien, er gebeurde enorm veel. Door de opkomst van de eerste computers tijdens en na de tweede wereldoorlog, was het voor onderzoekers mogelijk om sneller berekeningen te doen.

diff --git a/achtergrond_intelligentie.html b/achtergrond_intelligentie.html index 6f0d90e..60bdcc2 100644 --- a/achtergrond_intelligentie.html +++ b/achtergrond_intelligentie.html @@ -10,7 +10,7 @@ - +
Wanneer is iets intelligent?
@@ -19,11 +19,11 @@

Kunstmatige Wanneer is iets intelligent?

@@ -77,7 +77,7 @@

Intelligentie

Antwoord
    -
  1. (2) is het proces dat het product in (1) levert: Een automatisch systeem is een machine voortvloeiend uit wetenschapelijk onderzoek.
    +
  2. (2) is het proces dat het product in (1) levert: Een automatisch systeem is een machine voortvloeiend uit wetenschappelijk onderzoek.
    (3) verwijst niet naar de noodzaak van intelligentie van menselijk niveau en deze definitie is daarom weer breder dan definitie (2). Daarnaast moet de machine in (3) zelf intelligent zijn, terwijl bij (2) de machine intelligentie toont.
@@ -88,11 +88,11 @@

Intelligentie

Imitatiespellen

Chatten met een bot

-
+
Open de Cleverbot website
-

In de Cleverbot website kun je chatten met een chatbot. In één van de latere opdrachten in deze cursus kun je zelf aan de slag met het opzetten van een chatbot. +

In de Cleverbot website kun je chatten met een chatbot. In één van de latere opdrachten in deze cursus kun je zelf aan de slag met het opzetten van een chatbot.

Vragen
    diff --git a/achtergrond_introductie.html b/achtergrond_introductie.html index a3144e1..160c4b1 100644 --- a/achtergrond_introductie.html +++ b/achtergrond_introductie.html @@ -9,7 +9,7 @@ Kunstmatige Intelligentie - +
    Introductie
    @@ -17,11 +17,11 @@

    Kunstmatige /Achtergrond / Geschiedenis en toekomst

    @@ -56,7 +56,7 @@

    Kunstmatige
    Passen jouw antwoorden ook bij het door ons gegeven antwoord?
    1. Sommige computerprogramma’s lijken slim. Bijvoorbeeld een sudoku oplosser. Maar zulke programma’s doorlopen eigenlijk gewoon een patroon. Niet het programma, maar de programmeur van zulke programma’s is intelligent.
      - Bij kunstmatige intelligentie is dat anders. Door de KI gemeenschap doorontwikkelde algoritmen herkennen zelf patronen uit grote data sets. Deze patronen worden dus niet door de programmeur in het algoritme gestopt. Uiteindelijk kun je ontdekte patronen weer gebruiken in vervolg applicaties. + Bij kunstmatige intelligentie is dat anders. De door de KI gemeenschap ontwikkelde algoritmen herkennen zelf patronen uit grote data sets. Deze patronen worden dus niet door de programmeur in het algoritme gestopt. Uiteindelijk kun je ontdekte patronen weer gebruiken in vervolg applicaties.
    2. Kunstmatige intelligentie komt op steeds meer plekken voor. Waarschijnlijk heb ook jij er regelmatig mee te maken. Zo is er bijvoorbeeld spraakherkenning door Google. Of door Siri op de iPhone. Sociale netwerken zoals Facebook en Instagram, gebruiken ook kunstmatige intelligentie om gerichte advertenties te kunnen tonen.
    3. @@ -78,7 +78,7 @@

      Natuurlijke en artificiële intelligentie

    Probleemoplossend vermogen, creërend denkvermogen en invoelend vermogen worden tot de menselijke intelligentie gerekend. Soms noemen we dit ook natuurlijke intelligentie. Jij bent in staat om in elke situatie jouw intelligentie aan te spreken om te reageren op die situatie. Meestal is die reactie niet de meest optimale, maar daar leer je dan ook weer van.

    -

    Binnen de computerwetenschap wordt er ook gewerkt aan zelflerende systemen. Deze werkzaamheden vallen onder de term Artificiële Intelligentie (AI), ofwel kunstmatige intelligentie (KI). De heilige graal van het onderzoek in artificiële intelligentie is de zoektocht naar één systeem dat vaardigheden kan leren en vervolgens elk probleem kan oplossen waarmee het te maken krijgt, precies zoals een mens dat kan en liefst nog beter. +

    Binnen de computerwetenschap wordt er ook gewerkt aan zelflerende systemen. Deze werkzaamheden vallen onder de term Artificiële Intelligentie (AI), ofwel kunstmatige intelligentie (KI). De heilige graal ( = het hoogste doel wat men probeert te behalen) van het onderzoek in artificiële intelligentie is de zoektocht naar één systeem dat vaardigheden kan leren en vervolgens elk probleem kan oplossen waarmee het te maken krijgt, precies zoals een mens dat kan en liefst nog beter.

    Is de wetenschap al in de buurt van die heilige graal? Helaas, één systeem dat overal op kan reageren is nog ver weg. Er zijn echter voor specifieke doeleinden al heel wat computeralgoritmen met een lerend vermogen. Nog beter, veel van die algoritmen doen het na training beter en/of sneller dan de mens. Rest nog één heel groot voordeel, als één computer het kunstje heeft geleerd hoeft een andere vergelijkbare computer dat niet meer. De status van het leerproces kan naar andere systemen gekopieerd worden. Jij als leerling kan helaas de inhoud van het brein van je docent niet simpel uploaden in jouw brein, een computer kan dat wel.

    @@ -108,7 +108,7 @@

    Natuurlijke en artificiële intelligentie

    Automatiseren, automatiseren, automatiseren

    Machines en computers hebben al veel werk geautomatiseerd, maar niet alles kan zomaar door een computer worden gedaan. Er wordt verwacht dat kunstmatige intelligentie nog verder gaat en ons nog meer werk uit handen neemt.

    -

    Een goed voorbeeld is een zelfrijdende auto. Met kunstmatige intelligentie kun je een auto zelf laten rijden. Als we niet meer zelf hoeven te sturen en te remmen, dan kunnen we andere dingen doen tijdens het autorijden. Echter, wie is er dan verantwoordelijk wanneer er een ongeluk gebeurd? De maker van de auto omdat zij 'm hebben geprogrammeerd, de auto zelf omdat hij niet goed heeft geleerd een ongeluk af te wenden, of jij, omdat je niet zat op te letten? Best een ingewikkeld vraagstuk waarin ethiek en belangrijke rol speelt. +

    Een goed voorbeeld is een zelfrijdende auto. Met kunstmatige intelligentie kun je een auto zelf laten rijden. Als we niet meer zelf hoeven te sturen en te remmen, dan kunnen we andere dingen doen tijdens het autorijden. Echter, wie is er dan verantwoordelijk wanneer er een ongeluk gebeurd? De maker van de auto omdat zij 'm hebben geprogrammeerd, de auto zelf omdat hij niet goed heeft geleerd een ongeluk af te wenden, of jij, omdat je niet zat op te letten? Best een ingewikkeld vraagstuk waarin ethiek een belangrijke rol speelt.

    Een ander voorbeeld: je zou kunstmatige intelligentie met het Internet Of Things (IOT) kunnen combineren. Bij het Internet Of Things zijn allerlei apparaten met elkaar gekoppeld via het internet. Zo zou bijvoorbeeld jouw koelkast gekoppeld kunnen zijn met de lokale supermarkt. De koelkast herkent, bijvoorbeeld door middel van een camera met beeldherkenning, dat de boter op is en kan dat voor je bestellen. De supermarkt stuurt dan bijvoorbeeld een drone die zelfstandig kan landen in bijvoorbeeld jouw achtertuin en daar de boodschappen achterlaat. @@ -117,7 +117,7 @@

    Automatiseren, automatiseren, automatiseren

    Een ander voorbeeld is om de apparaten in je huis dusdanig af te stellen, dat ze je dagelijkse routine volgen. Stel dat het je dagelijkse routine is om na het opstaan te douchen en daarna een kop koffie te drinken. Het is al mogelijk om je radiator en je koffiezetter hierop in te stellen, bijvoorbeeld met een tijdschakelaar. Kunstmatige intelligentie zou jouw ochtendroutine kunnen herkennen, jouw patronen leren, en jouw apparaten automatisch afstellen. Daarmee zou AI het leven nog gemakkelijker en aangenamer kunnen maken.

    Opdracht -
      +
      1. Bedenk nog een toepassing van AI, bespreek die met een klasgenoot. Waarom is AI nodig in je voorbeeld? In hoeverre vinden jullie deze toepassing eng en nuttig?
      @@ -137,7 +137,7 @@

      Invloeden

      Informatica is misschien uiteindelijk wel het belangrijkst voor kunstmatige intelligentie, omdat we slimme machines proberen te maken met computers. Je zou kunnen zeggen dat alle bovengenoemde disciplines voedingsbodem geven, maar dat informatica uiteindelijk over de implementatie gaat.

      +

      + De 47 minuten durende, maar zeer interessante, documentaire “Zien is geloven” van VPRO tegenlicht geeft goed inzicht in de problemen rond Deep Fakes maar laat ook zien dat er goede dingen mee kunnen worden gedaan.

      Opdracht
      Zoek zelf nog een aansprekend Deepfake videofragment. diff --git a/achtergrond_robotica.html b/achtergrond_robotica.html index 1252c49..3758c15 100644 --- a/achtergrond_robotica.html +++ b/achtergrond_robotica.html @@ -10,7 +10,7 @@ - +
      1 Robotica
      @@ -20,11 +20,11 @@

      Kunstmatige Robotica

      diff --git a/docentenhandreiking.html b/docentenhandreiking.html index 010ad02..8a64e23 100644 --- a/docentenhandreiking.html +++ b/docentenhandreiking.html @@ -10,7 +10,7 @@ - +
      Docentenhandreiking
      @@ -31,7 +31,7 @@

      Kunstmatige

      Doel

      -

      Deze cursus is ontwikkeld om invulling te geven aan de leerdoelen van domein I, Keuzethema Cognitive computing, uit het eindexamenprogramma informatica. Zoals in de inleiding van deze cursus is te lezen proberen we in deze cursus materiaal te bieden voor zowel de in de techniek van AI geïnteresseerde leerling en de leerling die meer geïnteresseerd is in de ethische vraagstukken rond het gebruik van AI. Omdat dit een keuzemodule is en u misschien leerlingen ook echte een keuzevrijheid wil bieden hebben wij getracht het materiaal zo te ontwikkelen dat een leerling geheel zelfstandig het grootste deel van materiaal tot zich zou kunnen nemen. Er zijn ook een aantal groepsopdrachten om discussies tussen leerlingen te stimuleren.

      +

      Deze cursus is ontwikkeld om invulling te geven aan de leerdoelen van domein I, Keuzethema Cognitive computing, uit het eindexamenprogramma informatica. Zoals in de inleiding van deze cursus is te lezen proberen we in deze cursus materiaal te bieden voor zowel de in de techniek van AI geïnteresseerde leerling en de leerling die meer geïnteresseerd is in de ethische vraagstukken rond het gebruik van AI. Omdat dit een keuzemodule is en u misschien leerlingen ook echte een keuzevrijheid wil bieden hebben wij getracht het materiaal zo te ontwikkelen dat een leerling geheel zelfstandig het grootste deel van materiaal tot zich zou kunnen nemen. Er zijn ook een aantal groepsopdrachten om discussies tussen leerlingen te stimuleren.


      Studielast

      De gehele opleiding informatica vraagt 440 studielasturen voor het vwo en 320 studielasturen voor het havo. Het verschil in het eindexamenprogramma is twee keuzemodules. De studielast voor deze cursus zou dus ongeveer 60 studielasturen moeten zijn, lessen, huiswerk, voorbereiding voor een eventuele toets en maken van deze toets. Wij hebben ons ten doel gesteld een cursus te ontwikkelen van acht weken met daarin 3 lessen van ±45 minuten en een toets in een negende week.

      @@ -43,7 +43,7 @@

      Algemeen deel

      • De inleiding beoogt enthousiasme te kweken.
      • In hoofdstuk 1, Achtergrond, introduceren we het begrip AI, geven we een overzicht van de ontwikkeling van AI door de tijd, besteden aandacht aan intelligentie en geven we een aantal praktijkvoorbeelden.
      • -
      • In hoofdstuk 2, Ethiek, geven we inzicht in de gevaren van AI en welke principes er zijn waaraan applicaties, gebruikmakend van AI zouden moeten voldoen om maatschappelijk verantwoord te zijn.
      • +
      • In hoofdstuk 2, Ethiek, geven we inzicht in de gevaren van AI en welke principes er zijn waaraan applicaties, gebruikmakend van AI zouden moeten voldoen om maatschappelijk verantwoord te zijn.
      • In hoofdstuk 3, Technieken, geven we de soorten AI aan en werken we een aantal algoritmen uit op zo'n manier dat een leerling met pen en papier en een simpele data set een analyse zou moeten uitvoeren.

      Toetsing: Het algemene deel leent zich voor een toets met reproductievragen uit hoofdstukken 1, 2 en 3 en een aantal toepassingsvragen uit hoofdstukken 2 en 3.

      @@ -68,9 +68,9 @@

      Niveau

      Werkvormen

      Alles over werkvormen:

        -
      • Zelfstandig, groep of klassikaal
        Deze cursus is ontwikkeld voor het Keuzethema Cognitive computing. Omdat het een keuzethema is hebben we gepoogd het materiaal zo te ontwikkelen dat een leerling zelfstandig de cursus kan doen. Het onderdeel Ethiek leent zich echter heel goed voor klassikale of groepslessen, want er is veel ruimte voor discussie over de maatschappelijke verantwoording van AI-applicaties.
      • +
      • Zelfstandig, groep of klassikaal
        Deze cursus is ontwikkeld voor het Keuzethema Cognitive computing. Omdat het een keuzethema is hebben we gepoogd het materiaal zo te ontwikkelen dat een leerling zelfstandig de cursus kan doen. Het onderdeel Ethiek leent zich echter heel goed voor klassikale of groepslessen, want er is veel ruimte voor discussie over de maatschappelijke verantwoording van AI-applicaties.
      • Keuzes voor leerlingen
        - De leerling kan op vele plekken in het materiaal voor verdieping kiezen. Hopelijk is er voor ieder wat wils.
      • + De leerling kan op vele plekken in het materiaal voor verdieping kiezen. Hopelijk is er voor ieder wat wils.
      • Samenwerkingen met andere vakken en vakgroepen
        NLT, maatschappijwetenschappen en wiskunde zijn vakken die aansluiten bij het materiaal.

      diff --git a/docs/Big Data studenten OCE/Big Data Docentenhandleiding verbeterd.docx b/docs/Big Data studenten OCE/Big Data Docentenhandleiding verbeterd.docx new file mode 100644 index 0000000..180d920 Binary files /dev/null and b/docs/Big Data studenten OCE/Big Data Docentenhandleiding verbeterd.docx differ diff --git a/docs/Big Data studenten OCE/Lesmodule Big Data.pdf b/docs/Big Data studenten OCE/Lesmodule Big Data.pdf new file mode 100644 index 0000000..7aaca54 Binary files /dev/null and b/docs/Big Data studenten OCE/Lesmodule Big Data.pdf differ diff --git a/docs/Big Data studenten OCE/beoordelingsRUBRICS SL 3021 versie voorjaar 2017 Big data.doc b/docs/Big Data studenten OCE/beoordelingsRUBRICS SL 3021 versie voorjaar 2017 Big data.doc new file mode 100644 index 0000000..8cc3607 Binary files /dev/null and b/docs/Big Data studenten OCE/beoordelingsRUBRICS SL 3021 versie voorjaar 2017 Big data.doc differ diff --git a/docs/Big Data studenten OCE/comm MB.pdf b/docs/Big Data studenten OCE/comm MB.pdf new file mode 100644 index 0000000..2d2ab7e Binary files /dev/null and b/docs/Big Data studenten OCE/comm MB.pdf differ diff --git a/docs/Big Data studenten OCE/~$g Data Docentenhandleiding verbeterd.docx b/docs/Big Data studenten OCE/~$g Data Docentenhandleiding verbeterd.docx new file mode 100644 index 0000000..99164d3 Binary files /dev/null and b/docs/Big Data studenten OCE/~$g Data Docentenhandleiding verbeterd.docx differ diff --git a/ethiek_FAIR.html b/ethiek_FAIR.html index 544879d..eb12e74 100644 --- a/ethiek_FAIR.html +++ b/ethiek_FAIR.html @@ -15,18 +15,18 @@ }); - +
      FAIR data

      Kunstmatige Intelligentie/Ethiek/FAIR data

      @@ -170,7 +170,7 @@

      Interoperabiliteit (interoperability)

    antwoord
      -
    • a en c zijn goede voorbeelden van interopearbiliteit. Voorbeeld b is geen goed voorbeeld omdat het delen van hrm-data van medewerkers in dit geval niet noodzakelijk (en wellicht zelfs niet wenselijk) is. +
    • a. en c. zijn goede voorbeelden van interoperabiliteit, b.v. overdracht van gegevens van patiënten in a. gaat dan goed en bij c. kan het toeleveringsbedrijf de voorraadbeheer afstemmen op de voorraad van de fabriek. Voorbeeld b. is geen goed voorbeeld omdat het delen van hrm-data van medewerkers in dit geval niet noodzakelijk (en wellicht zelfs niet wenselijk) is.
    diff --git a/ethiek_FAST.html b/ethiek_FAST.html index ab04a46..d80dd7d 100644 --- a/ethiek_FAST.html +++ b/ethiek_FAST.html @@ -15,18 +15,18 @@ }); - +
    De FAST principes

    Kunstmatige Intelligentie/Ethiek/De FAST principes

    diff --git a/ethiek_engheidsmatrix.html b/ethiek_engheidsmatrix.html index ac4138a..1adf0ff 100644 --- a/ethiek_engheidsmatrix.html +++ b/ethiek_engheidsmatrix.html @@ -15,18 +15,18 @@ }); - +
    De engheidsmatrix

    Kunstmatige Intelligentie/Ethiek en AI/De engheidsmatrix

    diff --git a/ethiek_fast_fair.html b/ethiek_fast_fair.html index 0a5bec0..92b44e3 100644 --- a/ethiek_fast_fair.html +++ b/ethiek_fast_fair.html @@ -15,18 +15,18 @@ }); - +
    Fast & FAIR

    Kunstmatige Intelligentie/Ethiek en AI/Fast & FAIR

    diff --git a/ethiek_gevarenAI.html b/ethiek_gevarenAI.html index 8b8dff8..44fcc98 100644 --- a/ethiek_gevarenAI.html +++ b/ethiek_gevarenAI.html @@ -15,18 +15,18 @@ }); - +
    Gevaren van AI

    Kunstmatige Intelligentie/Ethiek/Gevaren van AI

    - Wil je meer weten over de engheidsmatrix en hoe je die kunt gebruiken om het nut en de ethische aspecten van een AI-toepassing in kaart te brengen? In het keuzedeel Ethiek en AI gaan we verder op de matrix in. + Wil je meer weten over de engheidsmatrix en hoe je die kunt gebruiken om het nut en de ethische aspecten van een AI-toepassing in kaart te brengen? In het keuzedeel Ethiek en AI gaan we verder op de matrix in.

    diff --git a/ethiek_opdracht_essay.html b/ethiek_opdracht_essay.html index afff60c..4f0e60a 100644 --- a/ethiek_opdracht_essay.html +++ b/ethiek_opdracht_essay.html @@ -15,18 +15,18 @@ }); - +
    Opdracht: Schrijf een essay over ethiek en AI

    Kunstmatige Intelligentie/Ethiek en AI/Opdracht: Schrijf een essay over ethiek en AI

    diff --git a/ethiek_opdracht_ontwerp.html b/ethiek_opdracht_ontwerp.html index 4bee009..0158464 100644 --- a/ethiek_opdracht_ontwerp.html +++ b/ethiek_opdracht_ontwerp.html @@ -15,18 +15,18 @@ }); - +
    Opdracht: Bedenk zelf een AI-toepassing

    Kunstmatige Intelligentie/Ethiek en AI/Opdracht: Bedenk zelf een AI-toepassing

    diff --git a/ethiek_standaarden_richtlijnen.html b/ethiek_standaarden_richtlijnen.html index 71abebc..abfc51c 100644 --- a/ethiek_standaarden_richtlijnen.html +++ b/ethiek_standaarden_richtlijnen.html @@ -15,18 +15,18 @@ }); - +
    AI-standaarden en -richtlijnen

    Kunstmatige Intelligentie/Ethiek en AI/AI-standaarden en -richtlijnen

    diff --git a/inleiding_achtergrond.html b/inleiding_achtergrond.html index ed176d9..eedf82c 100644 --- a/inleiding_achtergrond.html +++ b/inleiding_achtergrond.html @@ -10,7 +10,7 @@ Kunstmatige Intelligentie - +
    Achtergrond
    @@ -18,11 +18,11 @@

    Kunstmatige /Achtergrond

    @@ -43,6 +43,7 @@

    Kunstmatige
  1. Druk op het hamertje om de App te maken. Onderin het scherm zie je "Gradle build running". Je kunt op Event log rechts onder klikken als je wilt zien wat er tijdens het maken gebeurt. Duurt een paar minuten.
  2. - +

    Zet de App op een Android telefoon

      -
    • Zet op je Android telefoon de Developer options en USB debugging aan volgens deze instructie: https://developer.android.com/studio/debug/dev-options.html#enable
    • +
    • Zet op je Android telefoon de Developer options en USB debugging aan volgens deze instructie: https://developer.android.com/studio/debug/dev-options.html#enable
    • (Let op: Je moet eerst de de Developer options en USB debugging op je Android telefoon aanzetten en daarna pas de Android telefoon verbinden met he USB - mini USB kabeltje)
    • Verbind je Android telefoon met het USB - USB mini kabeltje met je PC of laptop.
    • -
    • Als dit goed gaat zie je het device verschijnen. Dit ziet er ongeveer zo uit: +
    • Als dit goed gaat zie je het device verschijnen. Dit ziet er ongeveer zo uit:
    • Druk op het pijltje rechts om de App op je Android telefoon te installen. Geef op je Android telefoon toestemming.
    • -
    -

    Daarna moet je een tijd wachten. Tenslotte zie je op je Android telefoon een App als de volgende: -

    + +

    Daarna moet je een tijd wachten. Tenslotte zie je op je Android telefoon een App als de volgende: +


    -

    Test de App

    +

    Test de App

    Je kunt de App testen door plaatjes van bijv. zonnebloemen op het internet te zoeken en kijken of deze als zonnebloemen herkend worden als je met de camera van je Android telefoon naar het plaatje kijkt. Doe dit ook voor wat andere bloemen waarvoor het neurale netwerk getraind is.

    @@ -287,11 +287,11 @@

    Fase 2:Optimaliseren neurale netwerk

    Open
    -

    In Fase1 hebben we een neuraal netwerk gemaakt om bloemen te herkennen. In deze Fase bestudeer je hoe je een dergelijk neuraal netwerk kunt optimaliseren zodat het zo goed mogelijk werkt. +

    In Fase1 hebben we een neuraal netwerk gemaakt om bloemen te herkennen. In deze Fase bestudeer je hoe je een dergelijk neuraal netwerk kunt optimaliseren zodat het zo goed mogelijk werkt.


    Competitie

    -

    We gaan werken in groepjes van drie leerlingen. Maak daarom eerst groepjes en ga daarna verder. Aan het eind van Fase2 doen we een competitie met de in Fase 1 gemaakte verschillende apps en die op de verschillende telefoons staan. Als alle apps met slechts één export zijn gebouwd is iedere app gelijk en is de competitie zinloos. Heeft ieder groepje zelf het netwerk getraind dan gaan we in de competitie als volgt te werk. +

    We gaan werken in groepjes van drie leerlingen. Maak daarom eerst groepjes en ga daarna verder. Aan het eind van Fase2 doen we een competitie met de in Fase 1 gemaakte verschillende apps en die op de verschillende telefoons staan. Als alle apps met slechts één export zijn gebouwd is iedere app gelijk en is de competitie zinloos. Heeft ieder groepje zelf het netwerk getraind dan gaan we in de competitie als volgt te werk.

    • Download op één computer de foto's waarmee de netwerken zijn getraind: @@ -300,31 +300,31 @@

      Competitie

    • Pak dit bestand uit zodat we mappen met foto's van bloemen krijgen.
    • Elk groepje mag uit elke map een zelfde aantal foto's kiezen. De gekozen foto's worden in een testmap gezet. Open de fotobestanden op de computer en scan met de apps op de mobiele telefoons de foto's.
    • Alternatief: Elke groep zoekt een plaatjes op het internet van daisies (madeliefjes), dandelions (paardebloemen), roses (rozen), sunflowers (zonnebloemen) en tulips (tulpen) en plaats die in een testmap
    • -
    -

    Elk groepje test de App met alle foto's uit de test map of alle op het internet gekozen afbeeldingen en telt de percentages op waarmee de App de bloemen goed herkent. Als de App een bloem fout herkent is het percentage 0. De groep met de hoogste score wint. -

    + +

    Elk groepje test de App met alle foto's uit de test map of alle op het internet gekozen afbeeldingen en telt de percentages op waarmee de App de bloemen goed herkent. Als de App een bloem fout herkent is het percentage 0. De groep met de hoogste score wint. +


    Hoe kun je een neural netwerk optimaliseren

    -

    Je kunt het neurale netwerk optimaliseren door een ander pad in het notebook van de vorige keer te kiezen. -

    +

    Je kunt het neurale netwerk optimaliseren door een ander pad in het notebook van de vorige keer te kiezen. +

    • Ga weer met deze link naar de Google Colab tutorial voor het classificeren van beelden.
    • Klik weer op Run in Google Colab en ga naar het nieuw geopende tabblad.
    • Voer all cellen in de sectie Prerequisites uit (2 cellen) om de juiste libraries te importeren.
    • Ga nu naar de sectie "Detailed Process" en voer de cellen uit in Step 1: Load Input Data Specific to an On-device ML App
    • -
    -

    In Step 2: Customize the TensorFlow Model wordt eerst met het zelfde model als je hebt gebruikt in Fase 1 getraind met training data en validatie data. In Step 3: Evaluate the Customized Model wordt vervolgens gekeken hoe goed de test data wordt geclassificeerd. We gaan nu eerst een aantal keer trainen met hetzelfde model en slaan het resultaat op in verschillende mappen, zodat je straks de beste kan gebruiken in je app. + +

    In Step 2: Customize the TensorFlow Model wordt eerst met het zelfde model als je hebt gebruikt in Fase 1 getraind met training data en validatie data. In Step 3: Evaluate the Customized Model wordt vervolgens gekeken hoe goed de test data wordt geclassificeerd. We gaan nu eerst een aantal keer trainen met hetzelfde model en slaan het resultaat op in verschillende mappen, zodat je straks de beste kan gebruiken in je app.

      -
    • Maak eerst een aantal nieuwe mappen aan waar je straks het model naar kunt exporteren. Een nieuwe map maak je door in het bestanden gedeelte met je rechter muisknop te klikken en vervolgens op "nieuwe map te klikken". In de figuur hieronder is de map run1 aangemaakt. -
      +
    • Maak eerst een aantal nieuwe mappen aan waar je straks het model naar kunt exporteren. Een nieuwe map maak je door in het bestanden gedeelte met je rechter muisknop te klikken en vervolgens op "nieuwe map te klikken". In de figuur hieronder is de map run1 aangemaakt. +
    • Voer "Step 2" en "Step 3" uit. Noteer de resultaten loss en accuracy van zowel de laatste training stap van de uitvoer van de eerste cel in "Step 2" en van de uitvoer van de eerste cel in "Step 3" Hoe kleiner de loss en hoe hoger de accuracy hoe beter het resultaat. Na iedere herhaling exporteer je het model naar een nieuwe map door de eerste cel in "Step 4" aan te passen. (b.v. naar model.export(export_dir='./run1') als je de map run1 hebt aangemaakt) Herhaal de stappen "Step 2" , "Step 3" en "Step 4" een aantal keer (b.v 3 keer).
    • Zijn er veel verschillen?
    • -
    -

    In de sectie "Change the model" zijn er een aantal suggesties ter verbetering. -

    + +

    In de sectie "Change the model" zijn er een aantal suggesties ter verbetering. +

    • Probeer een aantal van deze suggesties uit en exporteer de modellen weer naar nieuwe mappen. Gebruik wel steeds de zelfde training , validatie en test data. Vergeet niet iedere keer te exporteren.
    • B.v. in de sectie "Change to the model that's supported in this library" kun je eens kijken wat het effect op loss en accuracy is van de modellen:
      @@ -333,7 +333,7 @@

      Hoe kun je een neural netwerk optimaliseren

    • Als laatste, behalve het herhalen van de training kun je ook proberen het model te verbeteren. Je ziet dat er nu 5 trainingsronden worden uitgevoerd. Je kunt deze verhogen door de epochs waarde in te stellen (b.v. epochs=7).
    • Maak een app met het model met de beste loss en accuracy.
    • -
    +

    Haalt de nieuwe app een hogere score met de afbeeldingen uit de competitie?

    @@ -344,7 +344,7 @@

    Fase 3:Andere dataset gebruiken

    Open
    -

    In de vorige twee fasen hebben we het bloemen voorbeeld van het voorbeeld in Image classification with Tensorflow gebruikt. In deze fase gaan we hetzelfde model gebruiken op een andere dataset. Een dataset met verschillende beroepen. +

    In de vorige twee fasen hebben we het bloemen voorbeeld van het voorbeeld in Image classification with Tensorflow gebruikt. In deze fase gaan we hetzelfde model gebruiken op een andere dataset. Een dataset met verschillende beroepen.

    @@ -356,28 +356,28 @@

    Fase 3:Andere dataset gebruiken

  3. Testen nieuwe app
-
+

Dataset downloaden

-
-

+
+

  • Deze plaatjes zitten in het gecomprimeerde bestand train.tar.gz. Download dit bestand. - train.tar.gz + train.tar.gz
  • Pak train.tar.gz uit (Met Windows 10 lukt het niet om een tar dan wel gz bestand uit te pakken. Gebruik 7-Zip). Je krijgt dan een bestand train.tar.
  • Pak train.tar uit. Je krijgt dan een map train.
  • -
-

In de map train vind je een aantal mappen met namen van beroepen. In deze mappen met namen van beroepen vind je plaatjes (224x224 pixels) van deze beroepen. -

+ +

In de map train vind je een aantal mappen met namen van beroepen. In deze mappen met namen van beroepen vind je plaatjes (224x224 pixels) van deze beroepen. +


Dataset uploaden

-

We gaan de dataset train.tar.gz gebruiken om een model te trainen die de beroepen moet gaan herkennen. Dit doen we weer met Image classification with Tensorflow. -

+

We gaan de dataset train.tar.gz gebruiken om een model te trainen die de beroepen moet gaan herkennen. Dit doen we weer met Image classification with Tensorflow. +

  • Open het tensorflow notebook
  • Klik op: Run in Google Colab en ga weer naar de nieuw geopende tab.
  • @@ -386,23 +386,23 @@

    Dataset uploaden

  • Klik de rechter muis knop en selecteer Upload. Upload vervolgens van je laptop of PC het bestand train.tar.gz. Je kunt nu gerust even pauze nemen want dit duur mogelijk een tijdje.
  • -
-

-

Je ziet nu het bestand train.tar.gz in de /tmp map verschijnen. -

+ +

+

Je ziet nu het bestand train.tar.gz in de /tmp map verschijnen. +

  • Maak vervolgens in de map /tmp een map train aan om de data van de dataset in te zetten door op de rechter muis knop te klikken en New Folder te selecteren.
  • -
-

Als alles correct gegaan is zie je het volgende: -

-
+ +

Als alles correct gegaan is zie je het volgende: +

+

-

Dataset uitpakken

+

Dataset uitpakken

  • Ga nu in het notebook staan in de eerste cel in de sectie "Prerequisites" die begint met: !pip en selecteer in het menu bovenaan: "+ Code".
  • -
-

Je krijgt nu een nieuwe cel. -

+ +

Je krijgt nu een nieuwe cel. +

  • Zet in de nieuwe cel de volgende commando's
    @@ -414,8 +414,8 @@ 

    Dataset uitpakken

    Het tweede commando zorgt ervoor dat bepaalde ongewenste bestanden verwijderd worden.

  • Voer de code cel vervolgens uit door op het pijltje te gaan staan en de linker muis knop te klikken. Je ziet nu dat de dataset wordt uitgepakt in de map /tmp/train.
  • -
- + +

Stappen uit Fase 1 herhalen

    @@ -428,18 +428,18 @@

    Stappen uit Fase 1 herhalen

  • Voer vervolgens deze cel uit.
  • Voer nu weer net als in Fase 1 de cellen uit in de sectie "Run the example".
  • -
-

De cel model.export(export_dir='.') heeft het model model.tflite geplaatst in de map /content. -

-
+ +

De cel model.export(export_dir='.') heeft het model model.tflite geplaatst in de map /content. +

+

-

Maken App met het nieuwe model

-

Nu we weer een getraind model hebben kunnen we deze op dezelfde manier in een app verwerken zoals in Fase 1 is uitgelegd. -

+

Maken App met het nieuwe model

+

Nu we weer een getraind model hebben kunnen we deze op dezelfde manier in een app verwerken zoals in Fase 1 is uitgelegd. +

  • Download model.tflite en hernoem die naar beroepen.tflite en bouw hiermee een nieuwe app.
  • -
+

Testen nieuwe app

Je kunt je App testen door de plaatjes van de dataset train.tar.gz die je op je laptop of PC gedownload hebt op het scherm te openen en je telefoon erbij te houden om te testen hoe goed de App plaatjes van bepaalde beroepen herkent. Je kunt natuurlijk ook op het internet naar plaatjes zoeken die bij deze beroepen horen en kijken of die worden herkend. @@ -453,7 +453,7 @@

Fase 4:Eigen dataset gebruiken

open
-

Nog leuker kan het worden als jullie een eigen dataset gebruiken. In Fase 3 heb je gezien dat er heel veel afbeeldingen per categorie aanwezig zijn. Het zal een hele klus worden om een behoorlijk aantal afbeeldingen bij elkaar te verzamelen en deze ook nog naar een juiste formaat te transformeren. Dat doe je natuurlijk niet alleen. +

Nog leuker kan het worden als jullie een eigen dataset gebruiken. In Fase 3 heb je gezien dat er heel veel afbeeldingen per categorie aanwezig zijn. Het zal een hele klus worden om een behoorlijk aantal afbeeldingen bij elkaar te verzamelen en deze ook nog naar een juiste formaat te transformeren. Dat doe je natuurlijk niet alleen.

@@ -464,16 +464,16 @@

Fase 4:Eigen dataset gebruiken

  • De stappen uit Fase 3 herhalen
  • -
    +

    -

    Thema en klassen verzinnen

    +

    Thema en klassen verzinnen

    • Verzin gezamenlijk een thema met daarin een aantal klassen. b.v. het thema muziek met daarin de klassen blues, house, punk, reggae en soul.
    • -
    -

    + +


    -

    Afbeeldingen verzamelen

    +

    Afbeeldingen verzamelen

    • Verdeel de leerlingen over de klassen en verzamel per leerling afbeeldingen voor de jouw aangewezen klasse op b.v. een usb-stick of in een eigen map op je computer.
    • Als het mogelijk is om een voor iedereen toegankelijke map muziek aan maken met daarin de sub mappen blues, house, punk, reggae en soul. Dan kan iedere leerling zijn verzameling in die map plaatsen. Lukt dat niet laat dan een usb-stick rondgaan met de zelfde structuur en laat iedereen zijn verzameling op die stick plaatsen. De map ziet er dan bijv. als volgt uit: @@ -482,19 +482,19 @@

      Afbeeldingen verzamelen


    -

    Inpakken eigen dataset

    -

    Als er voldoende plaatjes in de sub mappen staan kun je het geheel inpakken als een data set. Het is belangrijk dat je eerst een tar bestand maakt zodat je bijv. een bestand muziek.tar krijgt en daarna de het tar bestand inpakt in een gzip zodat je bijv. een bestand muziek.tar.gz krijgt. In het volgende voorbeeld doen we dit met 7-Zip. -

    +

    Inpakken eigen dataset

    +

    Als er voldoende plaatjes in de sub mappen staan kun je het geheel inpakken als een data set. Het is belangrijk dat je eerst een tar bestand maakt zodat je bijv. een bestand muziek.tar krijgt en daarna de het tar bestand inpakt in een gzip zodat je bijv. een bestand muziek.tar.gz krijgt. In het volgende voorbeeld doen we dit met 7-Zip. +

    • 7-zip als dat programma nog niet beschikbaar is.
    • Ga in de gezamenlijke map zoals bijv. muziek staan en selecteer alle sub mappen met Ctrl-A. Klik op de rechter muis knop en selecteer 7-Zip > Toevoegen aan archief.
    • Selecteer als Archief formaat: tar en druk op OK.
    • Selecteer alleen het aangemaakte tar bestand (Soms zie je er geen .tar achter staan). Klik op de rechter muis knop en selecteer 7-Zip > Toevoegen aan archief.
    • Selecteer als Archief formaat: gzip en druk op OK
    • -
    -

    -

    Je kunt nu het aangemaakte bestand zoals muziek.tar.gz (Soms zie je er geen .gz achter staan) als data set gebruiken om een App aan te maken zoals in Fase3. -

    + +

    +

    Je kunt nu het aangemaakte bestand zoals muziek.tar.gz (Soms zie je er geen .gz achter staan) als data set gebruiken om een App aan te maken zoals in Fase3. +


    Herhaal Fase 3

    Gebruik de eigen dataset om een App aan te maken volgens de instructies in Fase 3. Dit kan iedere leerling weer afzonderlijk doen om eventueel weer een app competitie te houden net als in Fase 2 diff --git a/over_ons.html b/over_ons.html index 6f36f5e..f8abae4 100644 --- a/over_ons.html +++ b/over_ons.html @@ -10,45 +10,79 @@ - +

    👯‍♂️ Over ons

    Kunstmatige Intelligentie/Over ons

    -

    De cursus "Kunstmatige Intelligentie" is ontwikkeld voor het keuzethema cognitive computing, domein I. De totstandkoming is gefinancierd door de Stichting Leerplan Ontwikkeling SLO +

    Deze cursus is ontwikkeld voor het keuzethema cognitive computing, domein I. De totstandkoming is gefinancierd door de Stichting Leerplan Ontwikkeling SLO

    Auteurs

    John Val
    -
    John is docent informatica en wiskunde aan het Rijnlands Lyceum Oegstgeest. Zijn website johnval.nl bevat meer lesmateriaal voor zowel informatica als wiskunde.
    +
    John is docent informatica en wiskunde aan het Rijnlands Lyceum Oegstgeest. Zijn website johnval.nl bevat meer lesmateriaal voor zowel informatica als wiskunde.
    Daniël Haitink
    -
    Daniël is een zelfstandig developer en data analist bij Lions Den Software. Eerder heeft hij Artificial Intelligence gestudeerd aan de Rijksuniversiteit Groningen. Hij is breed onderlegd en heeft een hart voor het onderwijs.
    +
    Daniël is een zelfstandig developer en data analist bij Lions Den Software. Eerder heeft hij Artificial Intelligence gestudeerd aan de Rijksuniversiteit Groningen. Hij is breed onderlegd en heeft een hart voor het onderwijs.
    Hennie Huijgens
    -
    Hennie is docent-onderzoeker bij het lectoraat Organisatie in Digitale Transitie en het Institute for People & Business aan de Hogeschool Utrecht. Hij is de auteur van AI in de praktijk. +
    Hennie is docent-onderzoeker bij het lectoraat Organisatie in Digitale Transitie en het Institute for People & Business aan de Hogeschool Utrecht. Hij is de auteur van AI in de praktijk.
    Hans van den Burg
    -
    Hans is docent informatica aan het Vitus College in Bussum.
    +
    Hans is docent informatica aan het Vitus College in Bussum.
    Tim Steenvoorden
    Tim is universitair docent informatica aan de Open Universiteit. Zijn colleges en onderzoek gaan over het ontwerpen, formaliseren, analyseren en implementeren van programmeertalen.
    Jochem Baas
    Jochem is een informatica docent aan de CS Vincent van Gogh in Assen. Hij heeft ook een opleiding afgerond in Artificial Intelligence aan de Rijksuniversiteit Groningen.
    +

    Bronnen waarvan delen zijn overgenomen

    +
    +
    Fundament team, Instruct +
    +
    Delen van het materiaal in de hoofdstukken achtergrond en technieken zijn overgenomen van materiaal ontwikkeld door Ramon Hagenaars, Adriaan Gijssen en anderen voor Instruct Educatieve Uitgeverij. De hier aangeboden cursus komt ook binnen Fundament gratis ter beschikking van scholen en anderen om het informatica-onderwijs vorm te geven. De cursus zal worden geplaatst in de handreiking informatica. +
    +
    Larbi el Yaakoubi, Julian de Groot, Bert Lobbezoo +
    +
    Delen van het materiaal in de hoofdstukken technieken zijn overgenomen van materiaal ontwikkeld door Larbi el Yaakoubi, Julian de Groot, Bert Lobbezoo voor SLO. +
    +
    Daniel Shiffman
    +
    Hoofdstuk 10. Neural Networks vormt de basis voor de paragraaf "Hoe een neuraal netwerk leert".
    +

    Dankwoord

    De auteurs danken Jos Tolboom van het SLO voor de aanzet tot de ontwikkeling van deze cursus. Dank is ook verschuldigd aan Peter Kegel voor zijn kritische blik op tekst en inhoud.

    Verantwoording

    -

    De cursus Kunstmatige intelligentie is gemaakt in opdracht van SLO en is gelicentieerd onder CC BY-NC-SA 4.0

    +

    De cursus Kunstmatige intelligentie is gemaakt in opdracht van SLO en is gelicentieerd onder CC BY-NC-SA 4.0

    - Deze licentie vereist dat hergebruikers de maker credits geven. Het stelt hergebruikers in staat om het materiaal te distribueren, te remixen, aan te passen en erop voort te bouwen in elk medium of formaat, uitsluitend voor niet-commerciële doeleinden. Als anderen het materiaal wijzigen of aanpassen, moeten ze het gewijzigde materiaal onder identieke voorwaarden in licentie geven. + Je bent vrij om:

    +
      +
    • het werk te delen, te kopiëren, te verspreiden en door te geven via elk medium of bestandsformaat; +
    • +
    • het werk te bewerken, te remixen, te veranderen en afgeleide werken te maken. +

    -Niet-commerciële licenties zijn niet-exclusief.
    - -Zoals alle CC-licenties zijn de NC-licenties niet-exclusief. Dit betekent dat een NC-licentiegever vrij is om het materiaal onder andere voorwaarden aan te bieden, ook tegen commerciële voorwaarden. Mocht u wensen in die richting hebben zoek dan contact met het SLO (info@slo.nl). +De licentiegever kan deze toestemming niet intrekken zolang aan de licentievoorwaarden voldaan wordt.

    +
    +
    Naamsvermelding
    +
    +De gebruiker dient de maker van het werk te vermelden, een link naar de licentie te plaatsen en +aan te geven of het werk veranderd is. Je mag dat op redelijke wijze doen, maar niet zodanig dat de indruk gewekt wordt dat de licentiegever instemt met je werk of je gebruik van het werk. +
    +
    NietCommercieel
    +
    Je mag het werk niet gebruiken voor commerciële doeleinden. +
    +
    GelijkDelen
    +
    Als je het werk hebt geremixt, veranderd, of op het werk hebt voortgebouwd, moet je het veranderde materiaal verspreiden onder dezelfde licentie als het originele werk. +
    +
    Geen aanvullende restricties
    +
    Je mag geen juridische voorwaarden of technologische voorzieningen toepassen die anderen er juridisch in beperken om iets te doen wat de licentie toestaat. +
    Niet-commerciële licenties zijn niet-exclusief.
    +
    Zoals alle CC-licenties zijn de NC-licenties niet-exclusief. Dit betekent dat een NC-licentiegever vrij is om het materiaal onder andere voorwaarden aan te bieden, ook tegen commerciële voorwaarden. Mocht u wensen in die richting hebben zoek dan contact met het SLO (info@slo.nl). +
    +
    diff --git a/techniek_associatie_analyse.html b/techniek_associatie_analyse.html index 28daece..8fa5b12 100644 --- a/techniek_associatie_analyse.html +++ b/techniek_associatie_analyse.html @@ -15,22 +15,22 @@ }); - +
    Associatie analyse

    Kunstmatige Intelligentie/ Technieken/Associatie analyse

    Stel je wordt manager van een supermarkt in een wijk waar veel studenten wonen. Na een paar dagen krijg je onder andere de indruk dat er veel bananen en chocolade verkocht worden. Daarom overweeg je de bananen en de chocolade samen vlak bij de kassa's te leggen om zo de klanten die langs lopen tot meer impuls inkopen te verleiden. Je wilt als verkoper ook niet impulsief te werk gaan, dus ga je een onderzoek doen met alle kassaregistraties van de klanten als gegevens voor je onderzoek. Eén kassaregistratie geeft dan natuurlijk aan wat de klant in het winkelmandje had.

    -

    De methoden die je als onderzoeker tot je beschikking hebt om deze gegevens te onderzoeken vallen onder associatie analyse. Voor we algemeen aan de slag gaan en één van de methoden, het apriori algoritime, in detail uitwerken gaan we eerst intuïtief met bovenstaand voorbeeld aan de slag. Na een week heb je deze gegevens verzameld: +

    De methoden die je als onderzoeker tot je beschikking hebt om deze gegevens te onderzoeken vallen onder associatie analyse. Voor we algemeen aan de slag gaan en één van de methoden, het apriori algoritme, in detail uitwerken gaan we eerst intuïtief met bovenstaand voorbeeld aan de slag. Na een week heb je deze gegevens verzameld:

    • er blijken 8051 klanten te zijn geweest;
    • @@ -211,7 +211,7 @@

      Verzamelingenleer

      In een verzameling bevindt zich elementen (leerlingen, spelers, liedjes). We noteren een verzameling als volgt: $$V=\{v_{1},v_{2},v_{3},\cdots ,v_{n}\}.$$
      - Verzameling $V$ bevat elementen $v$ die we kunnen nummeren. $v_{1}$ is dan het eerste element in de verzameling, $v_{2}$ het tweede, $v_{1}$ is dan het derde, enz. + Verzameling $V$ bevat elementen $v$ die we kunnen nummeren. $v_{1}$ is dan het eerste element in de verzameling, $v_{2}$ het tweede, $v_{3}$ is dan het derde, enz.

      Een verzameling bestaat dus uit elementen, en als $v$ een element is van een verzameling $\small V$ noteren we dit wiskundig als $\small v \in V$. We gebruiken accolades om verzamelingen te noteren.

      @@ -247,7 +247,7 @@

      Verzamelingenleer

    - Zo geldt bijvoorbeeld voor $\small X=\{\text{melk},\text{kaas}\}$ en $\small Y=\{\text{melk},\text{brood},\text{kaas}\}$ dat $\small X ⊂ Y$, $\small X$ is een deelverzameling van $\small Y$ want melk en kaas, de elementen van $X$, zijn ook aanwezig in $Y$. + Zo geldt bijvoorbeeld voor $\small X=\{\text{melk},\text{kaas}\}$ en $\small Y=\{\text{melk},\text{brood},\text{kaas}\}$ dat $\small X \subset Y$, $\small X$ is een deelverzameling van $\small Y$ want melk en kaas, de elementen van $X$, zijn ook aanwezig in $Y$.

    @@ -314,7 +314,7 @@

    Verzamelingenleer

    Zo is bijvoorbeeld de vereniging van de verzamelingen $\small X = \{\text{melk}, \text{brood}, \text{kaas}\}$ en de verzameling $\small Y = \{\text{melk}, \text{brood}, \text{pindakaas}\}$ verzameling met de elementen Kaas, Melk, Brood en Pindakaas, $\small \{\text{melk}, \text{brood}, \text{kaas}, \text{pindakaas}\}$ want alle elementen uit $X$ en $Y$ zijn aanwezig. Notatie: $$ -\small \{\text{melk}, \text{brood}, \text{kaas}\} \cap \{\text{melk}, \text{brood}, \text{pindakaas}\} = \{\text{melk}, \text{brood}, \text{kaas}, \text{pindakaas}\} +\small \{\text{melk}, \text{brood}, \text{kaas}\} \cup \{\text{melk}, \text{brood}, \text{pindakaas}\} = \{\text{melk}, \text{brood}, \text{kaas}, \text{pindakaas}\} $$

    @@ -919,7 +919,11 @@

    Fase 1: Het maken van een collectie $F$ met verzamelingen die voldoende freq
    In de tabel hierboven zie je dat alleen $\{Boter\}$ uit $S1$ de grens van 40% niet haalt. De collectie F met itemsets met voldoende support breiden we dus uit met de 1-itemsets $\{Spaghetti\}$, $\{Tomatensaus\}$ en $\{Brood\}$ dus:
    - $F=\{\{Spaghetti\}, \{Tomatensaus\}, \{Brood\}\}$ +$\begin{array}{ll} + F= & \{\{Spaghetti\}, \\ + & \{Tomatensaus\}, \\ + & \{Brood\}\} +\end{array}$
    @@ -975,11 +979,20 @@

    Fase 1: Het maken van een collectie $F$ met verzamelingen die voldoende freq
    Voeg de 2-itemsets met voldoende support toe aan de collectie $F$
    -
    voorbeeld: +
    voorbeeld:
    In de tabel hierboven zie je dat alle 2-itemsets de grens van 40% halen. De collectie F met itemsets met voldoende support breiden we dus uit met de 2-itemsets -$\{Spaghetti,Tomatensaus\}, \{Spaghetti, Brood \}$ en $\{Tomatensaus, Brood \}$ dus -$F=\{\{Spaghetti\}, \{Tomatensaus\}, \{Brood\},\{Spaghetti,Tomatensaus\}, \{Spaghetti, Brood \},\{Tomatensaus, Brood \}\}$ +$\{Spaghetti,Tomatensaus\}, \{Spaghetti, Brood \}$ en $\{Tomatensaus, Brood \}$ dus:
    +$ +\begin{array}{ll} + F= & \{\{Spaghetti\}, \\ + & \{Tomatensaus\}, \\ + & \{Brood\}, \\ + & \{Spaghetti,Tomatensaus\}, \\ + & \{Spaghetti, Brood\}, \\ + & \{Tomatensaus, Brood\} \} +\end{array} +$

    We komen nu weer aan bij de test "Is er in deze ronde een $k$-itemset aan $F$ toegevoegd?". In het voorbeeld hebben we er weer 3 toegevoegd en is het antwoord dus ja, we zijn dus nog steeds niet klaar. We verhogen $k$ naar 3 en gaan weer verder bij het oranje blok: @@ -1024,15 +1037,32 @@

    Fase 1: Het maken van een collectie $F$ met verzamelingen die voldoende freq
    Voeg de 3-itemsets met voldoende support toe aan de collectie $F$
    -
    voorbeeld: +
    voorbeeld:
    - In de tabel hierboven zie je dat alle 3-itemsets de grens van 20% niet halen. Er kan niets aan $F$ worden toegevoegd. De collectie $F$ blijft dus:dus -$F=\{\{Spaghetti\}, \{Tomatensaus\}, \{Brood\},\{Spaghetti,Tomatensaus\}, \{Spaghetti, Brood \},\{Tomatensaus, Brood \}\}$ + In de tabel hierboven zie je dat alle 3-itemsets de grens van 20% niet halen. Er kan niets aan $F$ worden toegevoegd. De collectie $F$ blijft dus:
    +$ +\begin{array}{ll} + F= & \{\{Spaghetti\}, \\ + & \{Tomatensaus\}, \\ + & \{Brood\}, \\ + & \{Spaghetti,Tomatensaus\}, \\ + & \{Spaghetti, Brood\}, \\ + & \{Tomatensaus, Brood\} \} +\end{array} +$
    -

    We komen nu weer aan bij de test "Is er in deze ronde een $k$-itemset aan $F$ toegevoegd?". In het voorbeeld hebben we niets meer hebben toegevoegd dus nee, we zijn klaar en eindigen dus met de verzameling +

    We komen nu weer aan bij de test "Is er in deze ronde een $k$-itemset aan $F$ toegevoegd?". In het voorbeeld hebben we niets meer hebben toegevoegd dus nee, we zijn klaar en eindigen met de verzameling:

    -$$F=\{\{Spaghetti\}, \{Tomatensaus\}, \{Brood\},\{Spaghetti,Tomatensaus\}, \{Spaghetti, Brood \},\{Tomatensaus, Brood \}\} +$$ +\begin{array}{ll} + F= & \{\{Spaghetti\}, \\ + & \{Tomatensaus\}, \\ + & \{Brood\}, \\ + & \{Spaghetti,Tomatensaus\}, \\ + & \{Spaghetti, Brood\}, \\ + & \{Tomatensaus, Brood\} \} +\end{array} $$

    In het voorbeeld zijn in het algoritme dus 3 iteraties nodig geweest om het proces te stoppen. Andere samenstellingen van de winkelmandjes met vooral meer artikelen zal ervoor zorgen dat er veel meer iteraties nodig zijn.

    @@ -1136,7 +1166,7 @@

    Fase 2: Het opstellen van associatieregels met verzamelingen uit $F$ met vol
    1. Gegeven is de transactiedatabase gerepresenteerd door de - collectie $W$ + collectie $W$:
      Collectie $W$ @@ -1347,7 +1377,7 @@

      Fase 2: Het opstellen van associatieregels met verzamelingen uit $F$ met vol

      De uiteindelijke set van voldoende frequente verzamelingen is
      $F=\{\{a\}, \{b\}, \{c\}, \{d\}, \{a, b \}, \{b, c \}\}$.
      - De daaruit voortvloeiende associatieregels met voldoende confidence zijn + De daaruit voortvloeiende associatieregels met voldoende confidence zijn: @@ -1384,7 +1414,7 @@

      Fase 2: Het opstellen van associatieregels met verzamelingen uit $F$ met vol
    2. Gegeven is de transactiedatabase gerepresenteerd door de - collectie $P$ + collectie $P$:
    3. Associatieregels
      Collectie $P$ @@ -1428,12 +1458,11 @@

      Fase 2: Het opstellen van associatieregels met verzamelingen uit $F$ met vol

        -
      1. DPas het Apriori-algoritme toe op deze collectie met een support van minimaal 50% +
      2. Pas het Apriori-algoritme toe op deze collectie met een support van minimaal 50%
        antwoord
        • Iteratie met k=1 - -
            +
            1. Genereer alle deelverzamelingen (itemsets) kandidaten met lengte $1$.
              $S_{1}=\{\{brood\}, \{bier\},\{ melk \}, \{luier \}, \{cola \}, \{eieren \}\}$
            2. @@ -1618,7 +1647,7 @@

              Fase 2: Het opstellen van associatieregels met verzamelingen uit $F$ met vol
              $F=\{\{brood\}, \{bier\},\{ melk \}, \{luier \},\{brood,melk\}, \{brood,luier\}, \{bier,luier\} , \{melk,luier\}\}$.
              - De daaruit voortvloeiende associatieregels met voldoende confidence zijn + De daaruit voortvloeiende associatieregels met voldoende confidence zijn:

              diff --git a/techniek_cluster_analyse.html b/techniek_cluster_analyse.html index 4603a05..0880ea0 100644 --- a/techniek_cluster_analyse.html +++ b/techniek_cluster_analyse.html @@ -47,22 +47,22 @@ } - +
              Clusteranalyse

              Kunstmatige Intelligentie/Technieken/Clusteranalyse

              @@ -81,7 +81,7 @@

              Kunstmatige
              Methoden ▼
              @@ -239,6 +239,14 @@

              Afstand tussen datapunten (objecten):

              De weergave voor studenten in een schema is niet handig om afstanden te meten. Het is beter deze te plaatsen in een assenstelsel zoals je dat in de wiskunde doet.

              + Wat is de afstand tussen $s_{1}$ en $s_{4}$? +
              antwoord
              +
                +
              • De kortste afstand tussen $s_{1}$ en $s_{4}$ is $\sqrt{13}$. Weet je hoe je die afstand berekent?
                + Als je alleen langs de roosterlijnen mag meten dan is de kortste afstand 5.
                + Het is dus van belang eerst een lengtemaat vast te leggen. +
              • +
              @@ -536,13 +544,13 @@

              $K$-means-clustering

            3. Alle datapunten zitten weer in een cluster. Er zijn datapunten die nu in een nadere cluster zitten. De centra zijn dan niet voor - alle clusters meer hetzelfde en moeten dus opnieuw worden berekend.Hiervoor gebruik je voor ieder + alle clusters meer hetzelfde en moeten dus opnieuw worden berekend. Hiervoor gebruik je voor ieder cluster apart de volgende formule:
              $M(m_{1},m_{2}, \dots, m_{n})= \left( \frac{\sum^{1}_{n} a_{1i}}{n},\frac{\sum^{1}_{n} a_{2i}}{n}, \dots, \frac{\sum^{1}_{n} a_{ni}}{n}\right)$.
              $n$ is dan het aantal elementen in één cluster.
              Met die nieuwe centra veranderen ook weer de afstanden van de datapunten - tot die centra en moet je dus het hele proces vanaf stap 1 weer herhalen, ofwel start de volgende iteratie. + tot die centra en moet je dus het hele proces vanaf stap 2 weer herhalen, ofwel start de volgende iteratie.
            4. Leuk zo'n verhaal maar voorbeelden maken het inzichtelijker. @@ -551,7 +559,7 @@

              $K$-means-clustering

              Voorbeeld E
              - Gegeven een cluster $C$ die de volgende objecten bevat: + Gegeven zijn de volgende vier objecten:
              @@ -679,7 +687,7 @@

              $K$-means-clustering

              Voorbeeld F
              - Gegeven een cluster $C$ die de volgende objecten bevat: + Gegeven zijn de volgende vijf objecten:
              xy
              @@ -1126,7 +1134,7 @@

              K-means

              -
            5. Bereken de afstanden van de datapunten tot de centra $M_{1}$ en $M_{2}$ en vul de volgende tabel in en voer zo nodig een herclustering uit: +
            6. Bereken de afstanden van de datapunten tot de centra $M_{1}$, $M_{2}$ en $M_{3}$ en vul de volgende tabel in en voer zo nodig een herclustering uit:
            7. xy
              @@ -1623,7 +1631,7 @@

              Andere cluster methoden


              -Figuur 6: Verschillende verdelingen datapunten (bron ) en algoritmen. +Figuur 6: Verschillende verdelingen datapunten (bron ) en algoritmen.

              De eerste kolom hoort bij een $K$-means variant. Alleen de verdeling in de vijfde rij past daar echt goed bij. Welk algoritme denk jij dat bij de verschillende rijen het beste past? Er zijn een aantal algoritmen die bij meerdere verdelingen goed scoren, maar die hebben weer andere minpunten. Het is dus van belang om te controleren of je de juiste versie kiest. Heb je meer dan twee assen dan wordt een visuele inspectie zoals in de figuur al een stuk lastiger. diff --git a/techniek_eigen_quickdraw.html b/techniek_eigen_quickdraw.html index ce61e1d..8a913ff 100644 --- a/techniek_eigen_quickdraw.html +++ b/techniek_eigen_quickdraw.html @@ -9,18 +9,18 @@ Kunstmatige Intelligentie - +

              Eigen Quickdraw

              Kunstmatige Intelligentie/Technieken/Eigen Quickdraw

              diff --git a/techniek_introductie.html b/techniek_introductie.html index 09cf324..e4296c6 100644 --- a/techniek_introductie.html +++ b/techniek_introductie.html @@ -15,18 +15,18 @@ }); - +
              Introductie

              Kunstmatige Intelligentie/Technieken/Introductie

              diff --git a/techniek_machine_learning.html b/techniek_machine_learning.html index 896a5d0..69c905f 100644 --- a/techniek_machine_learning.html +++ b/techniek_machine_learning.html @@ -9,18 +9,18 @@ Kunstmatige Intelligentie - +
              Machine Learning

              Kunstmatige Intelligentie/Technieken/Machine Learning

              diff --git a/techniek_multi_agent.html b/techniek_multi_agent.html index 56b639d..27e42ff 100644 --- a/techniek_multi_agent.html +++ b/techniek_multi_agent.html @@ -15,7 +15,7 @@ Kunstmatige Intelligentie - +
              Multi-agentsystemen
              @@ -23,11 +23,11 @@

              Kunstmatige Technieken/Multi-agentsystemen

              diff --git a/techniek_neurale_netwerken.html b/techniek_neurale_netwerken.html index d596e36..ad4c4c5 100644 --- a/techniek_neurale_netwerken.html +++ b/techniek_neurale_netwerken.html @@ -20,7 +20,7 @@ - +
              Neurale netwerken
              @@ -30,11 +30,11 @@

              Kunstmatige Neurale netwerken

              @@ -56,7 +56,7 @@

              Kunstmatige

              Inleiding

              Dit hoofdstuk bevat algemene informatie over neurale netwerken en is ook de inleiding bij de verdieping neurale netwerken.

              -

              In het hoofdstuk machine learning hebben we drie categorieën leerstrategiën besproken, supervised, unsupervised en reinforcement learning. Artificiële of kunstmatige neurale netwerken (ANN) leren vooral via supervised en reinforcement learning. De reden hiervoor is dat neurale netwerken worden ingezet als de relatie tussen de gegevens en de bij een gegeven horende uitkomst, die door de AI applicatie moet worden voorspeld, niet bekend is of te ingewikkeld. Aan de hand van input-output voorbeelden moet het netwerk leren wat de relatie is. Beeldherkenning in de Quickdraw applicatie is al eerder als voorbeeld voor supervised learning aangehaald. AlphaZero (zie afbeelding) is een AI applicatie van het onderzoeksbedrijf DeepMind dat de bordspelen go, shogi en schaken onverslaanbaar kan leren. Bij al deze spellen zijn de regels van het spel precies bekend, alleen zijn het aantal mogelijke patronen zo enorm groot dat de snelste computer niet alle zetten door kan rekenen. Om toch onverslaanbaar te worden is het netwerk getraind door de computer miljoenen keren tegen zichzelf te laten spelen (reinforcement learning). +

              In het hoofdstuk machine learning hebben we drie categorieën leerstrategiën besproken, supervised, unsupervised en reinforcement learning. Artificiële of kunstmatige neurale netwerken (ANN) leren vooral via supervised en reinforcement learning. De reden hiervoor is dat neurale netwerken worden ingezet als de relatie tussen de gegevens en de bij een gegeven horende uitkomst, die door de AI applicatie moet worden voorspeld, niet bekend is of te ingewikkeld. Aan de hand van input-output voorbeelden moet het netwerk leren wat de relatie is. Beeldherkenning in de Quickdraw applicatie is al eerder als voorbeeld voor supervised learning aangehaald. AlphaZero (zie afbeelding) is een AI applicatie van het onderzoeksbedrijf DeepMind dat de bordspelen go, shogi en schaken onverslaanbaar kan leren. Bij al deze spellen zijn de regels van het spel precies bekend, alleen zijn het aantal mogelijke patronen zo enorm groot dat de snelste computer niet alle zetten door kan rekenen. Om toch onverslaanbaar te worden is het netwerk getraind door de computer miljoenen keren tegen zichzelf te laten spelen (reinforcement learning).


              @@ -70,11 +70,11 @@

              Toepassingen

              Hieronder zijn enkele standaardtoepassingen van neurale netwerken weergegeven die aanwezig zijn in verschillende computer programma's . Dit is geenszins een uitgebreide lijst van toepassingen van neurale netwerken, maar hopelijk geeft het je een algemeen beeld van de functies en mogelijkheden.

                -
              • Patroonherkenning - We hebben dit al verschillende keren genoemd en het is waarschijnlijk de meest voorkomende toepassing. Voorbeelden zijn gezichtsherkenning, optische tekenherkenning, etc.
              • -
              • Tijdreeksvoorspelling - Neurale netwerken kunnen worden gebruikt om voorspellingen te doen. Zal de voorraad morgen stijgen of dalen? Zal het regenen of zonnig zijn?
              • -
              • Signaalverwerking — Cochleaire implantaten (een cochleair implantaat is een apparaat dat aan dove kinderen en volwassenen de mogelijkheid biedt weer iets te horen) en gehoorapparaten moeten onnodig geluid wegfilteren en de belangrijke geluiden versterken. Neurale netwerken kunnen worden getraind om een audiosignaal te verwerken en op de juiste manier te filteren.
              • -
              • Controle - Misschien heb je gelezen over recente vorderingen op het gebied van onderzoek naar zelfrijdende auto's. Neurale netwerken worden vaak gebruikt om de sturing van fysieke voertuigen (of gesimuleerde voertuigen) te beheren.
              • -
              • Soft sensors - Een soft sensor verwijst naar het proces van het softwarematig analyseren van een verzameling van vele metingen. Een thermometer kan je de temperatuur van de lucht vertellen, maar wat als je ook de luchtvochtigheid, barometrische druk, dauwpunt, luchtkwaliteit, luchtdichtheid enz. zou weten wat kunnen we dan voorspellen? Neurale netwerken kunnen worden gebruikt om de invoergegevens van veel individuele sensoren te verwerken en als geheel te evalueren.
              • +
              • Patroonherkenning - We hebben dit al verschillende keren genoemd en het is waarschijnlijk de meest voorkomende toepassing. Voorbeelden zijn gezichtsherkenning, optische tekenherkenning, etc.
              • +
              • Tijdreeksvoorspelling - Neurale netwerken kunnen worden gebruikt om voorspellingen te doen. Zal de voorraad morgen stijgen of dalen? Zal het regenen of zonnig zijn?
              • +
              • Signaalverwerking — Cochleaire implantaten (een cochleair implantaat is een apparaat dat aan dove kinderen en volwassenen de mogelijkheid biedt weer iets te horen) en gehoorapparaten moeten onnodig geluid wegfilteren en de belangrijke geluiden versterken. Neurale netwerken kunnen worden getraind om een audiosignaal te verwerken en op de juiste manier te filteren.
              • +
              • Controle - Misschien heb je gelezen over recente vorderingen op het gebied van onderzoek naar zelfrijdende auto's. Neurale netwerken worden vaak gebruikt om de sturing van fysieke voertuigen (of gesimuleerde voertuigen) te beheren.
              • +
              • Soft sensors - Een soft sensor verwijst naar het proces van het softwarematig analyseren van een verzameling van vele metingen. Een thermometer kan je de temperatuur van de lucht vertellen, maar wat als je ook de luchtvochtigheid, barometrische druk, dauwpunt, luchtkwaliteit, luchtdichtheid enz. zou weten wat kunnen we dan voorspellen? Neurale netwerken kunnen worden gebruikt om de invoergegevens van veel individuele sensoren te verwerken en als geheel te evalueren.
              • Anomaliedetectie - Omdat neurale netwerken zo goed zijn in het herkennen van patronen, kunnen ze ook worden getraind om een output te genereren wanneer er iets gebeurt dat niet in het patroon past. Denk aan een neuraal netwerk dat jouw dagelijkse routine gedurende een lange periode bewaakt. Nadat het netwerk de patronen van jouw gedrag heeft geleerd, kan het je waarschuwen wanneer er iets mis is. (De sensoren in de autostoelen in deze Big Data TED-talk )
              • @@ -182,7 +182,7 @@

                Perceptron: input → output

              • Een plaatje heeft 600x800 beeldpunten. Ieder beeldpunt is een input in een neuraal netwerk. Dit netwerk bevat slechts 1 verborgen laag met 4 knopen en heeft 2 output knopen in de output layer. Hoeveel gewichten bevat dit netwerk?
                antwoord
                - Input laag: 600x800 = 48000
                + Input laag: 600x800 = 480000
                Dus 4 x 480001 = 1930004 gewichten in de verborgen laag
                Iedere output knoop krijgt input van de 4 knopen uit de verborgen laag dus 2 x 5 = 10.
                Dus in totaal 1930014 gewichten. @@ -213,9 +213,9 @@

                Perceptron: input → output


                Ecologische voetafdruk

                -

                In vraag 3 hierboven heb je gezien dat er al snel veel parameters geschat moeten worden. Het recursief bepalen van de beste waarden voor parameters is rekenkracht nodig op computers. In de verdieping [Neurale netwerken](https://www.notion.so/N-Neurale-netwerken-a0cfa2a90fc244f98f28bf75a7dd10d9) gaan we op het leren van neurale netwerken in en kun je ervaren dat die rekenkracht al merkbaar is bij kleine projecten. Een computer verbruikt energie en hoe meer een computer moet rekenen hoe hoger het energieverbruik wordt. Er zijn een flink aantal artikelen te vinden op het internet die laten zien dat dat verbruik behoorlijk groot kan zijn. Hoe complexer het neurale netwerk hoe groter het aantal parameters en hoe groter het aantal gegevens moet zijn om die parameters te schatten. Hieronder staan twee artikelen, waarvan wij de informatie niet hebben gecontroleerd, die zorgen over het energieverbruik van AI uitspreken. +

                In vraag 3 hierboven heb je gezien dat er al snel veel parameters geschat moeten worden. Het recursief bepalen van de beste waarden voor parameters is rekenkracht nodig op computers. In de verdieping Neurale netwerken gaan we op het leren van neurale netwerken in en kun je ervaren dat die rekenkracht al merkbaar is bij kleine projecten. Een computer verbruikt energie en hoe meer een computer moet rekenen hoe hoger het energieverbruik wordt. Er zijn een flink aantal artikelen te vinden op het internet die laten zien dat dat verbruik behoorlijk groot kan zijn. Hoe complexer het neurale netwerk hoe groter het aantal parameters en hoe groter het aantal gegevens moet zijn om die parameters te schatten. Hieronder staan twee artikelen, waarvan wij de informatie niet hebben gecontroleerd, die zorgen over het energieverbruik van AI uitspreken.

                -

                In het artikel"It takes a lot of energy for machines to learn – here’s why AI is so power-hungry" wordt verteld wat de oorzaken zijn van het enorme verbruik van energie in AI gebruikt in tekstanalyse. Als voorbeeld wordt het model "Bidirectional Encoder Representations from Transformers (BERT)" gegeven. Om Bert te trainen werden 3,3 miljard woorden uit Engelstalige boeken en Wikipedia artikelen. In een training van BERT moet deze verzameling niet één keer maar wel liefst 40 keer worden gelezen. In vergelijking een kind dat leert praten hoort ongeveer 45 miljoen woorden in de eerste 5 levensjaren, 3,000 keer minder dan BERT. BERT één keer trainen kost net zoveel energie als één persoon verbruikt voor een retourvlucht New York - San Fransisco. En voor dat het juiste model is gevonden zijn vele trainingen nodig. Een zeer accurate opvolger van BERT, genaamd GPT-3 heeft een onderliggend neuraal netwerk met maar liefst 175 miljard parameters en verbruikt nog veel meer energie. +

                In het artikel "It takes a lot of energy for machines to learn – here’s why AI is so power-hungry" wordt verteld wat de oorzaken zijn van het enorme verbruik van energie in AI gebruikt in tekstanalyse. Als voorbeeld wordt het model "Bidirectional Encoder Representations from Transformers (BERT)" gegeven. Om Bert te trainen werden 3,3 miljard woorden uit Engelstalige boeken en Wikipedia artikelen. In een training van BERT moet deze verzameling niet één keer maar wel liefst 40 keer worden gelezen. In vergelijking een kind dat leert praten hoort ongeveer 45 miljoen woorden in de eerste 5 levensjaren, 3,000 keer minder dan BERT. BERT één keer trainen kost net zoveel energie als één persoon verbruikt voor een retourvlucht New York - San Fransisco. En voor dat het juiste model is gevonden zijn vele trainingen nodig. Een zeer accurate opvolger van BERT, genaamd GPT-3 heeft een onderliggend neuraal netwerk met maar liefst 175 miljard parameters en verbruikt nog veel meer energie.

                Ook het artikel "AI Can Do Great Things—if It Doesn't Burn the Planet" gaat in op het grote energieverbruik van het trainen van AI. Als eerste voorbeeld geven zij het trainen van een robothand om een Rubricscube op te lossen. Volgens de auteurs hebben hiervoor 1000 desktop computers en een flink aantal computers met veel grafische processors voor het rekenwerk maanden gerekend om de training af te ronden. Een ruwe schatting is dat hier 2.8 gigawatt-uren elektriciteit voor is verbruikt, ongeveer gelijk aan de opwekking van elektriciteit gedurende 1 uur door drie kernenergiecentrales.

                diff --git a/template.html b/template.html index 25df7f5..fbaf0ee 100644 --- a/template.html +++ b/template.html @@ -16,7 +16,7 @@ }); - +
                In de praktijk
                @@ -25,11 +25,11 @@

                Kunstmatige Neurale netwerken

                diff --git a/terugkoppeling_achtergrond.html b/terugkoppeling_achtergrond.html index 4fb3e58..9c0c952 100644 --- a/terugkoppeling_achtergrond.html +++ b/terugkoppeling_achtergrond.html @@ -10,18 +10,18 @@ Kunstmatige Intelligentie - +
                Terugkoppeling

                Kunstmatige Intelligentie/Achtergrond/Terugkoppeling

                diff --git a/terugkoppeling_ethiek.html b/terugkoppeling_ethiek.html index 68f5b5c..57adf56 100644 --- a/terugkoppeling_ethiek.html +++ b/terugkoppeling_ethiek.html @@ -19,11 +19,11 @@

                Kunstmatige /Terugkoppeling

                diff --git a/terugkoppeling_technieken.html b/terugkoppeling_technieken.html index aca9705..771db1d 100644 --- a/terugkoppeling_technieken.html +++ b/terugkoppeling_technieken.html @@ -19,11 +19,11 @@

                Kunstmatige /Terugkoppeling

                diff --git a/treeview.js b/treeview.js index 9dda886..9b4756b 100644 --- a/treeview.js +++ b/treeview.js @@ -14,4 +14,16 @@ function initTreeview() this.classList.toggle("caret-down"); }); } -} \ No newline at end of file +} +/* + * addPathLead adds a path in leading to this website to the path to a page + * present in this website. + */ +function addPathLead(elemid="path_lead") +{ + // change the path_lead variable to your needs + // const path_lead='John Val/Informatica/'; + // let obj = document.getElementById(elemid); + // if(obj) obj.innerHTML = path_lead+obj.innerHTML; + +}

              $M_{1}$$M_{2}$$M_{3}$toewijzing