From f459a1c78c11226a90a03a26eed1252b00e7a3f7 Mon Sep 17 00:00:00 2001 From: alfred Date: Tue, 24 Jul 2012 16:21:59 +0200 Subject: [PATCH 1/5] JSXGraph release v 0.95 --- ajax/libs/jsxgraph/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ajax/libs/jsxgraph/package.json b/ajax/libs/jsxgraph/package.json index b783a4621..99dff9cde 100644 --- a/ajax/libs/jsxgraph/package.json +++ b/ajax/libs/jsxgraph/package.json @@ -1,7 +1,7 @@ { "name": "jsxgraph", "filename": "jsxgraphcore.js", - "version": "0.94", + "version": "0.95", "description": "JSXGraph is a cross-browser library for interactive geometry, function plotting, charting, and data visualization in a web browser.", "homepage": "http://jsxgraph.org/", "keywords": [ From 3da4f6c6d6b460ed65f4f6335d0c84fdbc20db3d Mon Sep 17 00:00:00 2001 From: alfred Date: Tue, 24 Jul 2012 16:25:04 +0200 Subject: [PATCH 2/5] Release of version 0.95, second try --- .../jsxgraph/0.95/CinderellaReader.min.js | 27 +++++++++++++++++++ ajax/libs/jsxgraph/0.95/GeogebraReader.min.js | 27 +++++++++++++++++++ ajax/libs/jsxgraph/0.95/GeonextReader.min.js | 27 +++++++++++++++++++ ajax/libs/jsxgraph/0.95/IntergeoReader.min.js | 27 +++++++++++++++++++ ajax/libs/jsxgraph/0.95/jsxgraphcore.js | 26 ++++++++++++++++++ 5 files changed, 134 insertions(+) create mode 100644 ajax/libs/jsxgraph/0.95/CinderellaReader.min.js create mode 100644 ajax/libs/jsxgraph/0.95/GeogebraReader.min.js create mode 100644 ajax/libs/jsxgraph/0.95/GeonextReader.min.js create mode 100644 ajax/libs/jsxgraph/0.95/IntergeoReader.min.js create mode 100644 ajax/libs/jsxgraph/0.95/jsxgraphcore.js diff --git a/ajax/libs/jsxgraph/0.95/CinderellaReader.min.js b/ajax/libs/jsxgraph/0.95/CinderellaReader.min.js new file mode 100644 index 000000000..539e253f1 --- /dev/null +++ b/ajax/libs/jsxgraph/0.95/CinderellaReader.min.js @@ -0,0 +1,27 @@ +/* Version 0.95 */ +/* Version 0.95 */ +/* + Copyright 2008-2012 + Matthias Ehmann, + Michael Gerhaeuser, + Carsten Miller, + Bianca Valentin, + Alfred Wassermann, + Peter Wilfahrt + + This file is part of JSXGraph. + + JSXGraph is free software: 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. + + 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 + along with JSXGraph. If not, see . +*/ + JXG.CinderellaReader=new function(){this.parseData=function(l){var t,v,u,s,n,p,m,d,b,q,f,o,h,r,g,c,a,e,x,w,y;t=this.data.split("\n");for(v=0;v. +*/ + JXG.GeogebraReader=new function(){this.ggbAct=function(type,m,n){var v1=m,v2=n,s1,s2,a;switch(type.toLowerCase()){case"end":return v1;break;case"coord":s1=(JXG.GeogebraReader.board.ggbElements[v1])?'JXG.getRef(JXG.GeogebraReader.board, "'+v1+'")':v1;s2=(JXG.GeogebraReader.board.ggbElements[v2])?'JXG.getRef(JXG.GeogebraReader.board, "'+v2+'")':v2;return[s1,s2];break;case"le":return"( ("+v1+") <= ("+v2+") )";break;case"ge":return"( ("+v1+") >= ("+v2+") )";break;case"eq":return"( ("+v1+") == ("+v2+") )";break;case"neq":return"( ("+v1+") != ("+v2+") )";break;case"lt":return"( ("+v1+") < ("+v2+") )";break;case"gt":return"( ("+v1+") > ("+v2+") )";break;case"add":if(JXG.GeogebraReader.isGGBVector(v1)&&JXG.GeogebraReader.isGGBVector(v2)){return[1,v1[1]+"+"+v2[1],v1[2]+"+"+v2[2]]}if(JXG.isString(v1)&&!v1.match(/JXG\.getRef\(JXG\.GeogebraReader\.board, "(.+?)"\)\./)&&v1.match(/JXG\.getRef/)){s1=[v1+".X()",v1+".Y()"]}else{s1=v1}if(JXG.isString(v2)&&!v2.match(/JXG\.getRef\(JXG\.GeogebraReader\.board, "(.+?)"\)\./)&&v2.match(/JXG\.getRef/)){s2=[v2+".X()",v2+".Y()"]}else{s2=v2}if(JXG.GeogebraReader.isGGBVector(s1)&&JXG.isArray(s2)){return[s1[1]+"+"+s2[0],s1[2]+"+"+s2[1]]}if(JXG.GeogebraReader.isGGBVector(s2)&&JXG.isArray(s1)){return[s2[1]+"+"+s1[0],s2[2]+"+"+s1[1]]}if(JXG.isArray(s1)&&JXG.isArray(s2)){return[s1[0]+" + "+s2[0],s1[1]+" + "+s2[1]]}else{if((JXG.isNumber(s1)||JXG.isString(s1))&&(JXG.isNumber(s2)||JXG.isString(s2))){return s1+" + "+s2}else{if((JXG.isNumber(s1)||JXG.isString(s1))&&JXG.isArray(s2)){return[s1+" + "+s2[0],s1+" + "+s2[1]]}else{if(JXG.isArray(s1)&&(JXG.isNumber(s2)||JXG.isString(s2))){return[s1[0]+" + "+s2,s1[1]+" + "+s2]}else{return s1+" + "+s2}}}}break;case"sub":if(JXG.GeogebraReader.isGGBVector(v1)&&JXG.GeogebraReader.isGGBVector(v2)){return[1,v1[1]+"-"+v2[1],v1[2]+"-"+v2[2]]}if(JXG.isString(v1)&&!v1.match(/JXG\.getRef\(JXG\.GeogebraReader\.board, "(.+?)"\)\./)&&v1.match(/JXG\.getRef/)){s1=[v1+".X()",v1+".Y()"]}else{s1=v1}if(JXG.isString(v2)&&!v2.match(/JXG\.getRef\(JXG\.GeogebraReader\.board, "(.+?)"\)\./)&&v2.match(/JXG\.getRef/)){s2=[v2+".X()",v2+".Y()"]}else{s2=v2}if(JXG.GeogebraReader.isGGBVector(s1)&&JXG.isArray(s2)){return[s1[1]+"-"+s2[0],s1[2]+"-"+s2[1]]}if(JXG.isArray(s1)&&JXG.GeogebraReader.isGGBVector(s2)){return[s1[0]+"-("+s2[1]+")",s1[1]+"-("+s2[2]+")"]}if(JXG.isArray(s1)&&JXG.isArray(s2)){return[s1[0]+" - "+s2[0],s1[1]+" - "+s2[1]]}else{if((JXG.isNumber(s1)||JXG.isString(s1))&&(JXG.isNumber(s2)||JXG.isString(s2))){return s1+" - "+s2}else{if((JXG.isNumber(s1)||JXG.isString(s1))&&JXG.isArray(s2)){return[s1+" - "+s2[0],s1+" - "+s2[1]]}else{if(JXG.isArray(s1)&&(JXG.isNumber(s2)||JXG.isString(s2))){return[s1[0]+" - "+s2,s1[1]+" - "+s2]}else{return s1+" - "+s2}}}}break;case"neg":return"!("+v1+")";break;case"pow":return"Math.pow("+v1+", "+v2+")";break;case"or":return"("+v1+"||"+v2+")";break;case"and":return"("+v1+"&&"+v2+")";break;case"mul":if(JXG.GeogebraReader.isGGBVector(v1)&&!JXG.isArray(v2)){return[1,"("+v1[1]+")*"+v2,"("+v1[2]+")*"+v2]}else{if(!JXG.isArray(v1)&&JXG.GeogebraReader.isGGBVector(v2)){return new Array(1,"("+v2[1]+")*"+v1,"("+v2[2]+")*"+v1)}else{if(JXG.GeogebraReader.isGGBVector(v1)&&JXG.GeogebraReader.isGGBVector(v2)){return"(("+v1[1]+")*("+v2[1]+")+("+v1[2]+")*("+v2[2]+"))"}else{if(JXG.isString(v1)&&!v1.match(/JXG\.getRef\(JXG\.GeogebraReader\.board, "(.+?)"\)\./)&&v1.match(/JXG\.getRef/)){s1=[v1+".X()",v1+".Y()"]}else{s1=v1}if(JXG.isString(v2)&&!v2.match(/JXG\.getRef\(JXG\.GeogebraReader\.board, "(.+?)"\)\./)&&v2.match(/JXG\.getRef/)){s2=[v2+".X()",v2+".Y()"]}else{s2=v2}if(JXG.isArray(s1)&&JXG.isArray(s2)){return[s1[0]+" * "+s2[0],s1[1]+" * "+s2[1]]}else{if((JXG.isNumber(s1)||JXG.isString(s1))&&(JXG.isNumber(s2)||JXG.isString(s2))){return s1+" * "+s2}else{if((JXG.isNumber(s1)||JXG.isString(s1))&&JXG.isArray(s2)){return[s1+" * "+s2[0],s1+" * "+s2[1]]}else{if(JXG.isArray(s1)&&(JXG.isNumber(s2)||JXG.isString(s2))){return[s1[0]+" * "+s2,s1[1]+" * "+s2]}else{return s1+" * "+s2}}}}}}}break;case"div":if(JXG.isString(v1)&&!v1.match(/JXG\.getRef\(JXG\.GeogebraReader\.board, "(.+?)"\)\./)&&v1.match(/JXG\.getRef/)){s1=[v1+".X()",v1+".Y()"]}else{s1=v1}if(JXG.isString(v2)&&!v2.match(/JXG\.getRef\(JXG\.GeogebraReader\.board, "(.+?)"\)\./)&&v2.match(/JXG\.getRef/)){s2=[v2+".X()",v2+".Y()"]}else{s2=v2}if(JXG.isArray(s1)&&JXG.isArray(s2)){return[s1[0]+" / "+s2[0],s1[1]+" / "+s2[1]]}else{if((JXG.isNumber(s1)||JXG.isString(s1))&&(JXG.isNumber(s2)||JXG.isString(s2))){return s1+" / "+s2}else{if((JXG.isNumber(s1)||JXG.isString(s1))&&JXG.isArray(s2)){return[s1+" / "+s2[0],s1+" / "+s2[1]]}else{if(JXG.isArray(s1)&&(JXG.isNumber(s2)||JXG.isString(s2))){return[s1[0]+" / "+s2,s1[1]+" / "+s2]}else{return s1+" / "+s2}}}}break;case"negmult":if(JXG.GeogebraReader.isGGBVector(v1)){return new Array(1,-1+"*"+v1[1],-1+"*"+v1[2])}return -1+"*"+v1;break;case"bra":if(JXG.GeogebraReader.isGGBVector(v1)){return new Array(1,"("+v1[1]+")","("+v1[2]+")")}return"("+v1+")";break;case"int":return parseInt(v1);break;case"float":return parseFloat(v1);break;case"param":return v1;break;case"html":return v1;break;case"string":if(v2){return[v1,v2]}else{return v1}break;case"command":v2=v1.split("[");s1=v2[0];s2=(v2[1].split("]"))[0];switch(s1.toLowerCase()){case"name":return'JXG.getRef(JXG.GeogebraReader.board, "'+s2+'").getName()';break}break;case"var":if(v2){switch(v1.toLowerCase()){case"x":return v2+".X()";break;case"y":return v2+".Y()";break;case"abs":case"acos":case"asin":case"atan":case"ceil":case"cos":case"exp":case"floor":case"log":case"max":case"min":case"pow":case"random":case"round":case"sin":case"sqrt":case"tan":return"Math."+v1.toLowerCase()+"("+v2+")";break;default:return v1.toLowerCase()+"*("+v2+")";break}}else{if(v1=="PI"){return"Math.PI"}else{a=JXG.GeogebraReader.checkElement(v1);if(typeof JXG.GeogebraReader.board.ggb[v1]!="undefined"){return'JXG.GeogebraReader.board.ggb["'+v1+'"]()'}else{if(typeof a.Value!="undefined"){return'JXG.getRef(JXG.GeogebraReader.board, "'+v1+'").Value()'}else{if(typeof a.Area!="undefined"){return'JXG.getRef(JXG.GeogebraReader.board, "'+v1+'").Area()'}else{if(typeof a.plaintextStr!="undefined"){return'1.0*JXG.getRef(JXG.GeogebraReader.board, "'+v1+'").plaintextStr'}else{if(a.type==JXG.OBJECT_TYPE_VECTOR){return new Array(1,'JXG.getRef(JXG.GeogebraReader.board, "'+v1+'").point2.X()-JXG.getRef(JXG.GeogebraReader.board, "'+v1+'").point1.X()','JXG.getRef(JXG.GeogebraReader.board, "'+v1+'").point2.Y()-JXG.getRef(JXG.GeogebraReader.board, "'+v1+'").point1.Y()')}else{if(a.elementClass==JXG.OBJECT_CLASS_LINE){return'JXG.getRef(JXG.GeogebraReader.board, "'+v1+'").point1.Dist(JXG.getRef(JXG.GeogebraReader.board, "'+v1+'").point2)'}else{return'JXG.getRef(JXG.GeogebraReader.board, "'+v1+'")'}}}}}}}}break}};this.ggbParse=function(exp,element){var element=(element)?JXG.getRef(JXG.GeogebraReader.board,JXG.GeogebraReader.board.ggbElements[element].id):false;if(element){JXG.debug("Zu aktualisierendes Element: "+element.name+"("+element.id+")")}var _dbg_withtrace=false;var _dbg_string=new String();function __dbg_print(text){_dbg_string+=text+"\n"}function __lex(info){var state=0;var match=-1;var match_pos=0;var start=0;var pos=info.offset+1;do{pos--;state=0;match=-2;start=pos;if(info.src.length<=start){return 28}do{switch(state){case 0:if(info.src.charCodeAt(pos)==9||info.src.charCodeAt(pos)==32){state=1}else{if(info.src.charCodeAt(pos)==33){state=2}else{if(info.src.charCodeAt(pos)==40){state=3}else{if(info.src.charCodeAt(pos)==41){state=4}else{if(info.src.charCodeAt(pos)==42){state=5}else{if(info.src.charCodeAt(pos)==43){state=6}else{if(info.src.charCodeAt(pos)==44){state=7}else{if(info.src.charCodeAt(pos)==45){state=8}else{if(info.src.charCodeAt(pos)==47){state=9}else{if((info.src.charCodeAt(pos)>=48&&info.src.charCodeAt(pos)<=57)){state=10}else{if(info.src.charCodeAt(pos)==60){state=11}else{if(info.src.charCodeAt(pos)==62){state=12}else{if((info.src.charCodeAt(pos)>=65&&info.src.charCodeAt(pos)<=90)||(info.src.charCodeAt(pos)>=97&&info.src.charCodeAt(pos)<=122)){state=13}else{if(info.src.charCodeAt(pos)==94){state=14}else{if(info.src.charCodeAt(pos)==34){state=26}else{if(info.src.charCodeAt(pos)==38){state=28}else{if(info.src.charCodeAt(pos)==46){state=29}else{if(info.src.charCodeAt(pos)==61){state=30}else{if(info.src.charCodeAt(pos)==95){state=31}else{if(info.src.charCodeAt(pos)==124){state=32}else{state=-1}}}}}}}}}}}}}}}}}}}}break;case 1:state=-1;match=1;match_pos=pos;break;case 2:if(info.src.charCodeAt(pos)==61){state=15}else{state=-1}match=23;match_pos=pos;break;case 3:state=-1;match=2;match_pos=pos;break;case 4:state=-1;match=3;match_pos=pos;break;case 5:state=-1;match=13;match_pos=pos;break;case 6:state=-1;match=11;match_pos=pos;break;case 7:state=-1;match=16;match_pos=pos;break;case 8:state=-1;match=12;match_pos=pos;break;case 9:state=-1;match=14;match_pos=pos;break;case 10:if((info.src.charCodeAt(pos)>=48&&info.src.charCodeAt(pos)<=57)){state=10}else{if(info.src.charCodeAt(pos)==46){state=18}else{state=-1}}match=4;match_pos=pos;break;case 11:if(info.src.charCodeAt(pos)==61){state=19}else{state=-1}match=21;match_pos=pos;break;case 12:if(info.src.charCodeAt(pos)==61){state=21}else{state=-1}match=22;match_pos=pos;break;case 13:if((info.src.charCodeAt(pos)>=65&&info.src.charCodeAt(pos)<=90)||(info.src.charCodeAt(pos)>=97&&info.src.charCodeAt(pos)<=122)){state=13}else{if((info.src.charCodeAt(pos)>=48&&info.src.charCodeAt(pos)<=57)){state=27}else{if(info.src.charCodeAt(pos)==91){state=34}else{if(info.src.charCodeAt(pos)==95){state=35}else{state=-1}}}}match=7;match_pos=pos;break;case 14:state=-1;match=15;match_pos=pos;break;case 15:state=-1;match=20;match_pos=pos;break;case 16:state=-1;match=9;match_pos=pos;break;case 17:state=-1;match=25;match_pos=pos;break;case 18:if((info.src.charCodeAt(pos)>=48&&info.src.charCodeAt(pos)<=57)){state=18}else{state=-1}match=5;match_pos=pos;break;case 19:state=-1;match=17;match_pos=pos;break;case 20:state=-1;match=19;match_pos=pos;break;case 21:state=-1;match=18;match_pos=pos;break;case 22:state=-1;match=24;match_pos=pos;break;case 23:state=-1;match=8;match_pos=pos;break;case 24:if((info.src.charCodeAt(pos)>=48&&info.src.charCodeAt(pos)<=57)||(info.src.charCodeAt(pos)>=65&&info.src.charCodeAt(pos)<=90)||(info.src.charCodeAt(pos)>=97&&info.src.charCodeAt(pos)<=122)){state=24}else{state=-1}match=6;match_pos=pos;break;case 25:state=-1;match=10;match_pos=pos;break;case 26:if(info.src.charCodeAt(pos)==34){state=16}else{if(info.src.charCodeAt(pos)==32||info.src.charCodeAt(pos)==46||(info.src.charCodeAt(pos)>=48&&info.src.charCodeAt(pos)<=57)||info.src.charCodeAt(pos)==61||(info.src.charCodeAt(pos)>=65&&info.src.charCodeAt(pos)<=90)||(info.src.charCodeAt(pos)>=97&&info.src.charCodeAt(pos)<=122)||info.src.charCodeAt(pos)==223||info.src.charCodeAt(pos)==228||info.src.charCodeAt(pos)==246||info.src.charCodeAt(pos)==252){state=26}else{state=-1}}break;case 27:if((info.src.charCodeAt(pos)>=48&&info.src.charCodeAt(pos)<=57)||(info.src.charCodeAt(pos)>=65&&info.src.charCodeAt(pos)<=90)||(info.src.charCodeAt(pos)>=97&&info.src.charCodeAt(pos)<=122)){state=27}else{if(info.src.charCodeAt(pos)==95){state=35}else{state=-1}}match=7;match_pos=pos;break;case 28:if(info.src.charCodeAt(pos)==38){state=17}else{if((info.src.charCodeAt(pos)>=65&&info.src.charCodeAt(pos)<=90)||(info.src.charCodeAt(pos)>=97&&info.src.charCodeAt(pos)<=122)){state=33}else{state=-1}}break;case 29:if((info.src.charCodeAt(pos)>=48&&info.src.charCodeAt(pos)<=57)){state=18}else{state=-1}break;case 30:if(info.src.charCodeAt(pos)==61){state=20}else{state=-1}break;case 31:if(info.src.charCodeAt(pos)==95){state=36}else{state=-1}break;case 32:if(info.src.charCodeAt(pos)==124){state=22}else{state=-1}break;case 33:if(info.src.charCodeAt(pos)==59){state=23}else{if((info.src.charCodeAt(pos)>=65&&info.src.charCodeAt(pos)<=90)||(info.src.charCodeAt(pos)>=97&&info.src.charCodeAt(pos)<=122)){state=33}else{state=-1}}break;case 34:if((info.src.charCodeAt(pos)>=65&&info.src.charCodeAt(pos)<=90)||(info.src.charCodeAt(pos)>=97&&info.src.charCodeAt(pos)<=122)){state=37}else{state=-1}break;case 35:if((info.src.charCodeAt(pos)>=48&&info.src.charCodeAt(pos)<=57)||(info.src.charCodeAt(pos)>=65&&info.src.charCodeAt(pos)<=90)||(info.src.charCodeAt(pos)>=97&&info.src.charCodeAt(pos)<=122)){state=27}else{if(info.src.charCodeAt(pos)==95){state=35}else{state=-1}}break;case 36:if((info.src.charCodeAt(pos)>=48&&info.src.charCodeAt(pos)<=57)||(info.src.charCodeAt(pos)>=65&&info.src.charCodeAt(pos)<=90)||(info.src.charCodeAt(pos)>=97&&info.src.charCodeAt(pos)<=122)){state=24}else{state=-1}break;case 37:if(info.src.charCodeAt(pos)==93){state=25}else{if((info.src.charCodeAt(pos)>=65&&info.src.charCodeAt(pos)<=90)||(info.src.charCodeAt(pos)>=97&&info.src.charCodeAt(pos)<=122)){state=37}else{state=-1}}break}pos++}while(state>-1)}while(1>-1&&match==1);if(match>-1){info.att=info.src.substr(start,match_pos-start);info.offset=match_pos}else{info.att=new String();match=-1}return match}function __parse(src,err_off,err_la){var sstack=new Array();var vstack=new Array();var err_cnt=0;var act;var go;var la;var rval;var parseinfo=new Function("","var offset; var src; var att;");var info=new parseinfo();var pop_tab=new Array(new Array(0,1),new Array(27,1),new Array(26,5),new Array(26,3),new Array(26,3),new Array(26,3),new Array(26,3),new Array(26,3),new Array(26,3),new Array(26,3),new Array(26,3),new Array(26,2),new Array(26,3),new Array(26,3),new Array(26,3),new Array(26,3),new Array(26,3),new Array(26,2),new Array(26,3),new Array(26,3),new Array(26,1),new Array(26,1),new Array(26,1),new Array(26,1),new Array(26,1),new Array(26,1),new Array(26,4),new Array(26,1));var act_tab=new Array(new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(28,0),new Array(14,13,13,14,25,15,24,16,15,17,12,18,11,19,22,20,21,21,20,22,19,23,18,24,17,25,28,-1),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(11,29,28,-24,17,-24,18,-24,19,-24,20,-24,21,-24,22,-24,12,-24,15,-24,24,-24,25,-24,13,-24,14,-24,16,-24,3,-24),new Array(28,-20,17,-20,18,-20,19,-20,20,-20,21,-20,22,-20,11,-20,12,-20,15,-20,24,-20,25,-20,13,-20,14,-20,16,-20,3,-20),new Array(28,-21,17,-21,18,-21,19,-21,20,-21,21,-21,22,-21,11,-21,12,-21,15,-21,24,-21,25,-21,13,-21,14,-21,16,-21,3,-21),new Array(28,-22,17,-22,18,-22,19,-22,20,-22,21,-22,22,-22,11,-22,12,-22,15,-22,24,-22,25,-22,13,-22,14,-22,16,-22,3,-22),new Array(28,-23,17,-23,18,-23,19,-23,20,-23,21,-23,22,-23,11,-23,12,-23,15,-23,24,-23,25,-23,13,-23,14,-23,16,-23,3,-23),new Array(28,-25,17,-25,18,-25,19,-25,20,-25,21,-25,22,-25,11,-25,12,-25,15,-25,24,-25,25,-25,13,-25,14,-25,16,-25,3,-25),new Array(2,30,28,-27,17,-27,18,-27,19,-27,20,-27,21,-27,22,-27,11,-27,12,-27,15,-27,24,-27,25,-27,13,-27,14,-27,16,-27,3,-27),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(14,13,13,14,25,15,24,16,15,17,12,18,11,19,22,20,21,21,20,22,19,23,18,24,17,25,16,44,3,45),new Array(14,-11,13,-11,25,15,24,16,15,-11,12,-11,11,-11,22,-11,21,-11,20,-11,19,-11,18,-11,17,-11,28,-11,16,-11,3,-11),new Array(14,-17,13,-17,25,15,24,16,15,17,12,-17,11,-17,22,20,21,21,20,22,19,23,18,24,17,25,28,-17,16,-17,3,-17),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(14,-16,13,-16,25,15,24,16,15,17,12,-16,11,-16,22,20,21,21,20,22,19,23,18,24,17,25,28,-16,16,-16,3,-16),new Array(14,-15,13,-15,25,15,24,16,15,17,12,-15,11,-15,22,20,21,21,20,22,19,23,18,24,17,25,28,-15,16,-15,3,-15),new Array(14,-14,13,-14,25,-14,24,-14,15,-14,12,-14,11,-14,22,-14,21,-14,20,-14,19,-14,18,-14,17,-14,28,-14,16,-14,3,-14),new Array(14,-13,13,-13,25,-13,24,-13,15,-13,12,-13,11,-13,22,-13,21,-13,20,-13,19,-13,18,-13,17,-13,28,-13,16,-13,3,-13),new Array(14,-12,13,-12,25,15,24,16,15,-12,12,-12,11,-12,22,20,21,21,20,22,19,23,18,24,17,25,28,-12,16,-12,3,-12),new Array(14,13,13,14,25,15,24,16,15,17,12,-10,11,-10,22,20,21,21,20,22,19,23,18,24,17,25,28,-10,16,-10,3,-10),new Array(14,13,13,14,25,15,24,16,15,17,12,-9,11,-9,22,20,21,21,20,22,19,23,18,24,17,25,28,-9,16,-9,3,-9),new Array(14,-8,13,-8,25,15,24,16,15,-8,12,-8,11,-8,22,-8,21,-8,20,-8,19,-8,18,-8,17,-8,28,-8,16,-8,3,-8),new Array(14,-7,13,-7,25,15,24,16,15,-7,12,-7,11,-7,22,-7,21,-7,20,-7,19,-7,18,-7,17,-7,28,-7,16,-7,3,-7),new Array(14,-6,13,-6,25,15,24,16,15,-6,12,-6,11,-6,22,-6,21,-6,20,-6,19,-6,18,-6,17,-6,28,-6,16,-6,3,-6),new Array(14,-5,13,-5,25,15,24,16,15,-5,12,-5,11,-5,22,-5,21,-5,20,-5,19,-5,18,-5,17,-5,28,-5,16,-5,3,-5),new Array(14,-4,13,-4,25,15,24,16,15,-4,12,-4,11,-4,22,-4,21,-4,20,-4,19,-4,18,-4,17,-4,28,-4,16,-4,3,-4),new Array(14,-3,13,-3,25,15,24,16,15,-3,12,-3,11,-3,22,-3,21,-3,20,-3,19,-3,18,-3,17,-3,28,-3,16,-3,3,-3),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(28,-18,17,-18,18,-18,19,-18,20,-18,21,-18,22,-18,11,-18,12,-18,15,-18,24,-18,25,-18,13,-18,14,-18,16,-18,3,-18),new Array(14,13,13,14,25,15,24,16,15,17,12,-19,11,-19,22,20,21,21,20,22,19,23,18,24,17,25,28,-19,16,-19,3,-19),new Array(14,13,13,14,25,15,24,16,15,17,12,18,11,19,22,20,21,21,20,22,19,23,18,24,17,25,3,49),new Array(14,13,13,14,25,15,24,16,15,17,12,18,11,19,22,20,21,21,20,22,19,23,18,24,17,25,3,50),new Array(28,-26,17,-26,18,-26,19,-26,20,-26,21,-26,22,-26,11,-26,12,-26,15,-26,24,-26,25,-26,13,-26,14,-26,16,-26,3,-26),new Array(28,-2,17,-2,18,-2,19,-2,20,-2,21,-2,22,-2,11,-2,12,-2,15,-2,24,-2,25,-2,13,-2,14,-2,16,-2,3,-2));var goto_tab=new Array(new Array(27,1,26,2),new Array(),new Array(),new Array(26,26),new Array(26,27),new Array(26,28),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(26,31),new Array(26,32),new Array(26,33),new Array(26,34),new Array(26,35),new Array(26,36),new Array(26,37),new Array(26,38),new Array(26,39),new Array(26,40),new Array(26,41),new Array(26,42),new Array(26,43),new Array(),new Array(),new Array(),new Array(26,46),new Array(26,47),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(26,48),new Array(),new Array(),new Array(),new Array(),new Array(),new Array());var labels=new Array("p'","WHITESPACE","(",")","INT","FLOAT","PARAM","VAR","HTML","STRING","COMMAND","+","-","*","/","^",",","<=",">=","==","!=","<",">","!","||","&&","e","p","$");info.offset=0;info.src=src;info.att=new String();if(!err_off){err_off=new Array()}if(!err_la){err_la=new Array()}sstack.push(0);vstack.push(0);la=__lex(info);while(true){act=52;for(var i=0;i0){__dbg_print("\nState "+sstack[sstack.length-1]+"\n\tLookahead: "+labels[la]+' ("'+info.att+'")\n\tAction: '+act+'\n\tSource: "'+info.src.substr(info.offset,30)+((info.offset+300){sstack.pop();vstack.pop();if(sstack.length==0){break}act=52;for(var i=0;i0){if(_dbg_withtrace){__dbg_print("Shifting symbol: "+labels[la]+" ("+info.att+")")}sstack.push(act);vstack.push(info.att);la=__lex(info);if(_dbg_withtrace){__dbg_print("\tNew lookahead symbol: "+labels[la]+" ("+info.att+")")}}else{act*=-1;if(_dbg_withtrace){__dbg_print("Reducing by producution: "+act)}rval=void (0);if(_dbg_withtrace){__dbg_print("\tPerforming semantic action...")}switch(act){case 0:rval=vstack[vstack.length-1];break;case 1:rval=JXG.GeogebraReader.ggbAct("end",vstack[vstack.length-1]);break;case 2:rval=JXG.GeogebraReader.ggbAct("coord",vstack[vstack.length-4],vstack[vstack.length-2],element);break;case 3:rval=JXG.GeogebraReader.ggbAct("le",vstack[vstack.length-3],vstack[vstack.length-1]);break;case 4:rval=JXG.GeogebraReader.ggbAct("ge",vstack[vstack.length-3],vstack[vstack.length-1]);break;case 5:rval=JXG.GeogebraReader.ggbAct("eq",vstack[vstack.length-3],vstack[vstack.length-1]);break;case 6:rval=JXG.GeogebraReader.ggbAct("neq",vstack[vstack.length-3],vstack[vstack.length-1]);break;case 7:rval=JXG.GeogebraReader.ggbAct("lt",vstack[vstack.length-3],vstack[vstack.length-1]);break;case 8:rval=JXG.GeogebraReader.ggbAct("gt",vstack[vstack.length-3],vstack[vstack.length-1]);break;case 9:rval=JXG.GeogebraReader.ggbAct("add",vstack[vstack.length-3],vstack[vstack.length-1]);break;case 10:rval=JXG.GeogebraReader.ggbAct("sub",vstack[vstack.length-3],vstack[vstack.length-1]);break;case 11:rval=JXG.GeogebraReader.ggbAct("neg",vstack[vstack.length-1]);break;case 12:rval=JXG.GeogebraReader.ggbAct("pow",vstack[vstack.length-3],vstack[vstack.length-1]);break;case 13:rval=JXG.GeogebraReader.ggbAct("or",vstack[vstack.length-3],vstack[vstack.length-1]);break;case 14:rval=JXG.GeogebraReader.ggbAct("and",vstack[vstack.length-3],vstack[vstack.length-1]);break;case 15:rval=JXG.GeogebraReader.ggbAct("mul",vstack[vstack.length-3],vstack[vstack.length-1]);break;case 16:rval=JXG.GeogebraReader.ggbAct("div",vstack[vstack.length-3],vstack[vstack.length-1]);break;case 17:rval=JXG.GeogebraReader.ggbAct("negmult",vstack[vstack.length-1]);break;case 18:rval=JXG.GeogebraReader.ggbAct("bra",vstack[vstack.length-2]);break;case 19:rval=JXG.GeogebraReader.ggbAct("string",vstack[vstack.length-3],vstack[vstack.length-1]);break;case 20:rval=JXG.GeogebraReader.ggbAct("int",vstack[vstack.length-1]);break;case 21:rval=JXG.GeogebraReader.ggbAct("float",vstack[vstack.length-1]);break;case 22:rval=JXG.GeogebraReader.ggbAct("param",vstack[vstack.length-1]);break;case 23:rval=JXG.GeogebraReader.ggbAct("html",vstack[vstack.length-1]);break;case 24:rval=JXG.GeogebraReader.ggbAct("string",vstack[vstack.length-1]);break;case 25:rval=JXG.GeogebraReader.ggbAct("command",vstack[vstack.length-1]);break;case 26:rval=JXG.GeogebraReader.ggbAct("var",vstack[vstack.length-4],vstack[vstack.length-2]);break;case 27:rval=JXG.GeogebraReader.ggbAct("var",vstack[vstack.length-1]);break}if(_dbg_withtrace){__dbg_print("\tPopping "+pop_tab[act][1]+" off the stack...")}for(var i=0;i0){var errstr=new String();for(var i=0;i0&&Data.getElementsByTagName("objColor")[0].getAttribute("alpha"))?parseFloat(Data.getElementsByTagName("objColor")[0].getAttribute("alpha")):0;r=(Data.getElementsByTagName("objColor").length>0&&Data.getElementsByTagName("objColor")[0].getAttribute("r"))?parseInt(Data.getElementsByTagName("objColor")[0].getAttribute("r")).toString(16):0;g=(Data.getElementsByTagName("objColor").length>0&&Data.getElementsByTagName("objColor")[0].getAttribute("g"))?parseInt(Data.getElementsByTagName("objColor")[0].getAttribute("g")).toString(16):0;b=(Data.getElementsByTagName("objColor").length>0&&Data.getElementsByTagName("objColor")[0].getAttribute("b"))?parseInt(Data.getElementsByTagName("objColor")[0].getAttribute("b")).toString(16):0;if(r.length==1){r="0"+r}if(g.length==1){g="0"+g}if(b.length==1){b="0"+b}attr.fillColor="#"+r+g+b;attr.strokeColor=attr.fillColor;attr.highlightFillColor=attr.fillColor;attr.highlightStrokeColor=attr.strokeColor;attr.fillOpacity=a;attr.highlightFillOpacity=a;attr.labelColor=attr.fillColor;return attr};this.boardProperties=function(gxtEl,Data,attr){return attr};this.coordinates=function(gxtEl,Data){var labelOffset={},tmp;labelOffset.x=0;labelOffset.y=0;labelOffset.z=0;if(Data.getElementsByTagName("labelOffset")[0]){labelOffset.x=parseFloat(Data.getElementsByTagName("labelOffset")[0].getAttribute("x"))/JXG.GeogebraReader.board.unitX;labelOffset.y=parseFloat(Data.getElementsByTagName("labelOffset")[0].getAttribute("y"))/JXG.GeogebraReader.board.unitY}if(Data.getElementsByTagName("coords")[0]){gxtEl.x=parseFloat(Data.getElementsByTagName("coords")[0].getAttribute("x"));gxtEl.y=parseFloat(Data.getElementsByTagName("coords")[0].getAttribute("y"));gxtEl.z=parseFloat(Data.getElementsByTagName("coords")[0].getAttribute("z"))}else{if(Data.getElementsByTagName("startPoint")[0]){if(Data.getElementsByTagName("startPoint")[0].getAttribute("exp")){var a=JXG.getRef(JXG.GeogebraReader.board,Data.getElementsByTagName("startPoint")[0].getAttribute("exp"));gxtEl.x=function(){return a.X()+labelOffset.x};gxtEl.y=function(){return a.Y()-labelOffset.y};gxtEl.z=false}else{gxtEl.x=parseFloat(Data.getElementsByTagName("startPoint")[0].getAttribute("x"));gxtEl.y=parseFloat(Data.getElementsByTagName("startPoint")[0].getAttribute("y"));gxtEl.z=parseFloat(Data.getElementsByTagName("startPoint")[0].getAttribute("z"))}}else{if(Data.getElementsByTagName("absoluteScreenLocation")[0]){var tmp=new JXG.Coords(JXG.COORDS_BY_SCREEN,[parseFloat(Data.getElementsByTagName("absoluteScreenLocation")[0].getAttribute("x")),parseFloat(Data.getElementsByTagName("absoluteScreenLocation")[0].getAttribute("y"))],JXG.GeogebraReader.board);gxtEl.x=tmp.usrCoords[1]+labelOffset.x;gxtEl.y=tmp.usrCoords[2]+labelOffset.y;gxtEl.z=false}else{return false}}}return gxtEl};this.visualProperties=function(Data,attr){(Data.getElementsByTagName("show").length!=0&&Data.getElementsByTagName("show")[0].getAttribute("object"))?attr.visible=Data.getElementsByTagName("show")[0].getAttribute("object"):false;(Data.getElementsByTagName("show").length!=0&&Data.getElementsByTagName("show")[0].getAttribute("label"))?attr.withLabel=Data.getElementsByTagName("show")[0].getAttribute("label"):true;if(attr.withLabel=="true"){attr.withLabel=true}else{if(attr.withLabel=="false"){attr.withLabel=false}}(Data.getElementsByTagName("pointSize")[0])?attr.size=Data.getElementsByTagName("pointSize")[0].getAttribute("val"):false;(Data.getElementsByTagName("pointStyle")[0])?attr.styleGGB=Data.getElementsByTagName("pointStyle")[0].getAttribute("val"):false;if(attr.styleGGB==0||attr.styleGGB==2){attr.face="circle";if(attr.styleGGB==0){attr.fillColor=attr.strokeColor;attr.fillOpacity=1;attr.highlightFillColor=attr.strokeColor;attr.highlightFillOpacity=1;attr.strokeColor="black";attr.strokeWidth="1px"}else{if(attr.styleGGB==2){attr.fillColor="none"}}}else{if(attr.styleGGB==1){attr.face="x"}else{if(attr.styleGGB==3){attr.face="+";attr.strokeOpacity=1}else{if(attr.styleGGB==4||attr.styleGGB==5){attr.face="diamond";if(attr.styleGGB==4){attr.fillColor=attr.strokeColor;attr.fillOpacity=1}else{if(attr.styleGGB==5){attr.fillColor="none"}}}else{if(attr.styleGGB==6){attr.face="triangleUp";attr.fillColor=attr.strokeColor;attr.fillOpacity=1}else{if(attr.styleGGB==7){attr.face="triangleDown";attr.fillColor=attr.strokeColor;attr.fillOpacity=1}else{if(attr.styleGGB==8){attr.face="triangleRight";attr.fillColor=attr.strokeColor;attr.fillOpacity=1}else{if(attr.styleGGB==9){attr.face="triangleLeft";attr.fillColor=attr.strokeColor;attr.fillOpacity=1}}}}}}}}(Data.getElementsByTagName("slopeTriangleSize")[0])?attr.slopeWidth=Data.getElementsByTagName("slopeTriangleSize")[0].getAttribute("val"):false;(Data.getElementsByTagName("lineStyle")[0])?attr.strokeWidth=(Data.getElementsByTagName("lineStyle")[0].getAttribute("thickness")/2)+"px":false;if(attr.strokeWidth){attr.highlightStrokeWidth=(1*attr.strokeWidth.substr(0,attr.strokeWidth.length-2)+1)+"px"}(Data.getElementsByTagName("lineStyle")[0])?attr.dashGGB=Data.getElementsByTagName("lineStyle")[0].getAttribute("type"):false;if(attr.dashGGB==0){attr.dash=0}else{if(attr.dashGGB==10){attr.dash=2}else{if(attr.dashGGB==15){attr.dash=3}else{if(attr.dashGGB==20){attr.dash=1}else{if(attr.dashGGB==30){attr.dash=6}}}}}(Data.getElementsByTagName("labelOffset")[0])?attr.labelX=1*Data.getElementsByTagName("labelOffset")[0].getAttribute("x"):false;(Data.getElementsByTagName("labelOffset")[0])?attr.labelY=1*Data.getElementsByTagName("labelOffset")[0].getAttribute("y"):false;(Data.getElementsByTagName("trace")[0])?attr.trace=Data.getElementsByTagName("trace")[0].getAttribute("val"):false;(Data.getElementsByTagName("fix")[0])?attr.fixed=Data.getElementsByTagName("fix")[0].getAttribute("val"):false;return attr};this.getElement=function(name,expr){var Data,i,j;expr=expr||false;for(i=0;i-1||s[i].search(/[0-9]+$/)>-1||s[i].search(/[a-zA-Z]+(\_*[a-zA-Z0-9]+)*$/)>-1){if(s[i+1].search(/^\(/)>-1||s[i+1].search(/^[0-9]+/)>-1||s[i+1].search(/^[a-zA-Z]+(\_*[a-zA-Z0-9]+)*/)>-1||s[i+1].search(/\_\_[a-zA-Z0-9]+/)>-1){s[i]=s[i]+"*"}}}o+=s[i]}expr=o}output.push(expr);return output}else{return exp}break;case"s":exp=exp.replace(/(?![e])x(?!\()(?![p])/g,"__x");return["__x",exp];break;default:if(JXG.GeogebraReader.format<=3.01){s=exp.split(" ");o="";for(i=0;i-1||s[i].search(/[0-9]+$/)>-1||s[i].search(/[a-zA-Z]+(\_*[a-zA-Z0-9]+)*$/)>-1){if(s[i+1].search(/^\(/)>-1||s[i+1].search(/^[0-9]+/)>-1||s[i+1].search(/^[a-zA-Z]+(\_*[a-zA-Z0-9]+)*/)>-1||s[i+1].search(/\_\_[a-zA-Z0-9]+/)>-1){s[i]=s[i]+"*"}}}o+=s[i]}exp=o}return exp;break}};this.writeBoard=function(board){var boardData=JXG.GeogebraReader.tree.getElementsByTagName("euclidianView")[0];board.origin={};board.origin.usrCoords=[1,0,0];board.origin.scrCoords=[1,1*boardData.getElementsByTagName("coordSystem")[0].getAttribute("xZero"),1*boardData.getElementsByTagName("coordSystem")[0].getAttribute("yZero")];board.unitX=(boardData.getElementsByTagName("coordSystem")[0].getAttribute("scale"))?1*boardData.getElementsByTagName("coordSystem")[0].getAttribute("scale"):1;board.unitY=(boardData.getElementsByTagName("coordSystem")[0].getAttribute("yscale"))?1*boardData.getElementsByTagName("coordSystem")[0].getAttribute("yscale"):board.unitX;board.fontSize=(JXG.GeogebraReader.tree.getElementsByTagName("gui")[0]&&JXG.GeogebraReader.tree.getElementsByTagName("gui")[0].getElementsByTagName("font")[0])?1*JXG.GeogebraReader.tree.getElementsByTagName("gui")[0].getElementsByTagName("font")[0].getAttribute("size"):"12px";JXG.JSXGraph.boards[board.id]=board;board.renderer.enhancedRendering=true;var snapToPoint=(boardData.getElementsByTagName("evSettings")[0].getAttribute("pointCapturing")=="true");var grid=(boardData.getElementsByTagName("evSettings")[0].getAttribute("grid")=="true")?board.create("grid"):null;if(boardData.getElementsByTagName("evSettings")[0].getAttribute("axes")&&boardData.getElementsByTagName("evSettings")[0].getAttribute("axes")=="true"){board.ggbElements.xAxis=board.create("axis",[[0,0],[1,0]],{strokeColor:"black",minorTicks:0});board.ggbElements.yAxis=board.create("axis",[[0,0],[0,1]],{strokeColor:"black",minorTicks:0})}};this.writeElement=function(board,output,input,cmd){var element,gxtEl,attr,p,exp,coord,type,points,border,length,m,s,e,sx,sy,ex,ey,func,range;element=(JXG.isArray(output))?output[0]:output;gxtEl={};attr={};JXG.debug(element);gxtEl.type=(element&&element.attributes&&typeof cmd==="undefined")?element.getAttribute("type").toLowerCase():cmd;gxtEl.label=element.getAttribute("label");attr.name=gxtEl.label;JXG.debug("
Konstruiere "+attr.name+"("+gxtEl.type+"):");switch(gxtEl.type){case"point":attr=JXG.GeogebraReader.boardProperties(gxtEl,element,attr);attr=JXG.GeogebraReader.colorProperties(element,attr);attr=JXG.GeogebraReader.visualProperties(element,attr);if(JXG.GeogebraReader.getElement(attr.name,true)){exp=JXG.GeogebraReader.getElement(attr.name,true).getAttribute("exp");coord=JXG.GeogebraReader.ggbParse(exp);gxtEl.x=new Function("return "+coord[0]+";");gxtEl.y=new Function("return "+coord[1]+";")}else{gxtEl=JXG.GeogebraReader.coordinates(gxtEl,element)}if(!JXG.exists(attr.styleGGB)){attr.face="circle";attr.fillColor=attr.strokeColor;attr.fillOpacity=1;attr.highlightFillColor=attr.strokeColor;attr.highlightFillOpacity=1;attr.strokeColor="black";attr.strokeWidth="1px"}JXG.debug(gxtEl);JXG.debug(input);try{var ma=/Circle\[\s*(\w+)\s*,\s*([\d\.]+)\s*\]/.exec(input);if(typeof input!="undefined"){if(ma!=null&&ma.length==3){var q=JXG.GeogebraReader.checkElement(ma[1]);var c=board.create("circle",[q,parseFloat(ma[2])],{fillColor:"none",visible:false,name:""});p=board.create("glider",[gxtEl.x,gxtEl.y,c],attr)}else{if(JXG.isArray(input)){p=board.create("glider",[gxtEl.x,gxtEl.y,input[0]],attr)}else{p=board.create("glider",[gxtEl.x,gxtEl.y,input],attr)}}}else{p=board.create("point",[gxtEl.x,gxtEl.y],attr)}return p}catch(e){JXG.debug("* Err: Point "+attr.name+"
\n");return false}break;case"segment":attr=JXG.GeogebraReader.boardProperties(gxtEl,element,attr);attr=JXG.GeogebraReader.colorProperties(element,attr);gxtEl=JXG.GeogebraReader.coordinates(gxtEl,element);attr=JXG.GeogebraReader.visualProperties(element,attr);try{JXG.debug("* Segment: ("+attr.name+") First: "+input[0].name+", Last: "+input[1].name+"
\n");attr.straightFirst=false;attr.straightLast=false;p=board.create("line",input,attr);return p}catch(e){JXG.debug("* Err: Segment "+attr.name+" First: "+input[0].name+", Last: "+input[1].name+"
\n");return false}break;case"line":attr=JXG.GeogebraReader.boardProperties(gxtEl,element,attr);attr=JXG.GeogebraReader.colorProperties(element,attr);gxtEl=JXG.GeogebraReader.coordinates(gxtEl,element);attr=JXG.GeogebraReader.visualProperties(element,attr);type="line";if(!input){input=[parseFloat(element.getElementsByTagName("coords")[0].getAttribute("z")),parseFloat(element.getElementsByTagName("coords")[0].getAttribute("x")),parseFloat(element.getElementsByTagName("coords")[0].getAttribute("y"))]}else{if(JXG.getRef(board,input[1].id).elementClass==JXG.OBJECT_CLASS_LINE){type="parallel"}}try{p=board.create(type,input,attr);return p}catch(e){JXG.debug("* Err: Line "+attr.label+"
\n");return false}break;case"orthogonalline":attr=JXG.GeogebraReader.boardProperties(gxtEl,element,attr);attr=JXG.GeogebraReader.colorProperties(element,attr);gxtEl=JXG.GeogebraReader.coordinates(gxtEl,element);attr=JXG.GeogebraReader.visualProperties(element,attr);try{JXG.debug("* Orthogonalline: First: "+input[0].id+", Last: "+input[1].id+"
\n");p=board.create("normal",input,attr);return p}catch(e){JXG.debug("* Err: Orthogonalline "+attr.label+"
\n");return false}break;case"polygon":attr=JXG.GeogebraReader.boardProperties(gxtEl,element,attr);attr=JXG.GeogebraReader.colorProperties(element,attr);gxtEl=JXG.GeogebraReader.coordinates(gxtEl,element);attr=JXG.GeogebraReader.visualProperties(element,attr);if(input.length==3&&output.length!=4){input[2]=parseInt(input[2]);type="regular"}try{JXG.debug("* Polygon: First: "+input[0].name+", Second: "+input[1].name+", Third: "+input[2]+"
\n");var borders=[];var borderatts=[];length=(type=="regular")?output.length-input[2]+2:output.length;for(var i=1;iErr: Polygon "+attr.name+"
\n");return false}break;case"intersect":attr=JXG.GeogebraReader.boardProperties(gxtEl,element,attr);attr=JXG.GeogebraReader.colorProperties(element,attr);gxtEl=JXG.GeogebraReader.coordinates(gxtEl,element);attr=JXG.GeogebraReader.visualProperties(element,attr);try{JXG.debug("* Intersection: First: "+input[0].name+", Second: "+input[1].name+"
\n");if(!JXG.exists(attr.styleGGB)){attr.face="circle";attr.fillColor=attr.strokeColor;attr.fillOpacity=1;attr.highlightFillColor=attr.strokeColor;attr.highlightFillOpacity=1;attr.strokeColor="black";attr.strokeWidth="1px"}if(output.length==1){p=board.create("intersection",[input[0],input[1],0],attr)}else{p=board.create("intersection",[input[0],input[1],1],attr);var attr2={};attr2=JXG.GeogebraReader.colorProperties(output[1],attr2);attr2=JXG.GeogebraReader.visualProperties(output[1],attr2);attr2.name=output[1].getAttribute("label");var p2=board.create("otherintersection",[input[0],input[1],p],attr2);board.ggbElements[attr2.name]=p2}return p}catch(e){JXG.debug("* Err: Intersection "+attr.name+"
\n");return false}break;case"distance":attr=JXG.GeogebraReader.boardProperties(gxtEl,element,attr);attr=JXG.GeogebraReader.colorProperties(element,attr);gxtEl=JXG.GeogebraReader.coordinates(gxtEl,element);attr=JXG.GeogebraReader.visualProperties(element,attr);try{JXG.debug("* Distance: First: "+input[0].name+", Second: "+input[1].name+"
\n");if(false&&output[0].getAtribute("type")&&output[0].getAttribute("type")=="numeric"){input[1].Value=function(){return this.X()};p=input[1];board.elementsByName[attr.name]=p}else{m=board.create("midpoint",input,{visible:"false"});attr.visible="true";p=board.create("text",[function(){return m.X()},function(){return m.Y()},function(){return""+input[0].name+input[1].name+" = "+JXG.trimNumber(JXG.getRef(board,input[0].id).Dist(JXG.getRef(board,input[1].id)).toFixed(JXG.GeogebraReader.decimals))}],attr);p.Value=function(){return(JXG.getRef(board,input[0].id).Dist(JXG.getRef(board,input[1].id)))}}return p}catch(e){JXG.debug("* Err: Distance "+attr.name+"
\n");return false}break;case"vector":attr=JXG.GeogebraReader.boardProperties(gxtEl,element,attr);attr=JXG.GeogebraReader.colorProperties(element,attr);gxtEl=JXG.GeogebraReader.coordinates(gxtEl,element);attr=JXG.GeogebraReader.visualProperties(element,attr);if(element.getElementsByTagName("startPoint")[0]){if(input&&input.length==2){e=JXG.GeogebraReader.checkElement(input[1].name)}else{e=[parseFloat(element.getElementsByTagName("coords")[0].getAttribute("x")),parseFloat(element.getElementsByTagName("coords")[0].getAttribute("y"))]}if(element.getElementsByTagName("startPoint")[0].getAttribute("x")&&element.getElementsByTagName("startPoint")[0].getAttribute("y")){s=[parseFloat(element.getElementsByTagName("startPoint")[0].getAttribute("x")),parseFloat(element.getElementsByTagName("startPoint")[0].getAttribute("y"))]}else{if(element.getElementsByTagName("startPoint")[0].getAttribute("exp")){var startpoint=element.getElementsByTagName("startPoint")[0].getAttribute("exp");s=JXG.GeogebraReader.checkElement(startpoint)}}}else{if(input&&input.length!=0){s=input[0];e=input[1]}else{exp=JXG.GeogebraReader.getElement(element.getAttribute("label"),true);if(exp){exp=exp.getAttribute("exp");exp=JXG.GeogebraReader.ggbParse(exp);if(JXG.isArray(exp)){exp=new Array(new Function("return "+exp[1]+";"),new Function("return "+exp[2]+";"))}else{exp=new Function("return "+exp+";")}JXG.debug("exp: "+exp);p=board.create("arrow",[[0,0],[exp[0],exp[1]]],attr);return p}}}try{JXG.debug("* Vector: First: "+attr.name);p=board.create("arrow",[s,e],attr);return p}catch(e){JXG.debug("* Err: Vector "+attr.name+e+"
\n");return false}break;case"rotate":attr=JXG.GeogebraReader.boardProperties(gxtEl,element,attr);attr=JXG.GeogebraReader.colorProperties(element,attr);gxtEl=JXG.GeogebraReader.coordinates(gxtEl,element);attr=JXG.GeogebraReader.visualProperties(element,attr);try{JXG.debug("* Rotate: First: "+input[0].name+", Second: "+input[1]+"
\n");attr.type="rotate";if(!JXG.exists(attr.styleGGB)){attr.face="circle";attr.fillColor=attr.strokeColor;attr.fillOpacity=1;attr.highlightFillColor=attr.strokeColor;attr.highlightFillOpacity=1;attr.strokeColor="black";attr.strokeWidth="1px"}t=board.create("transform",[parseInt(input[1])*Math.PI/180,input[2]],{type:"rotate"});p=board.create("point",[input[0],t],attr);return p}catch(e){JXG.debug("* Err: Rotate "+attr.name+"
\n");return false}break;case"dilate":attr=JXG.GeogebraReader.boardProperties(gxtEl,element,attr);attr=JXG.GeogebraReader.colorProperties(element,attr);gxtEl=JXG.GeogebraReader.coordinates(gxtEl,element);attr=JXG.GeogebraReader.visualProperties(element,attr);try{JXG.debug("* Dilate: First: "+input[0].name+", Second: "+input[1]+"
\n");attr.type="rotate";var d=parseInt(input[1]);var d1=board.create("transform",[d,d],{type:"scale"});var d2=board.create("transform",[function(){return(1-d)*input[2].X()},function(){return(1-d)*input[2].Y()}],{type:"translate"});if(!JXG.exists(attr.styleGGB)){attr.face="circle";attr.fillColor=attr.strokeColor;attr.fillOpacity=1;attr.highlightFillColor=attr.strokeColor;attr.highlightFillOpacity=1;attr.strokeColor="black";attr.strokeWidth="1px"}p=board.create("point",[input[0],[d1,d2]],attr);return p}catch(e){JXG.debug("* Err: Dilate "+attr.name+"
\n");return false}break;case"translate":attr=JXG.GeogebraReader.boardProperties(gxtEl,element,attr);attr=JXG.GeogebraReader.colorProperties(element,attr);gxtEl=JXG.GeogebraReader.coordinates(gxtEl,element);attr=JXG.GeogebraReader.visualProperties(element,attr);try{t=board.create("transform",[function(){return input[1].point2.X()-input[1].point1.X()},function(){return input[1].point2.Y()-input[1].point1.Y()}],{type:"translate"});if(!JXG.exists(attr.styleGGB)){attr.face="circle";attr.fillColor=attr.strokeColor;attr.fillOpacity=1;attr.highlightFillColor=attr.strokeColor;attr.highlightFillOpacity=1;attr.strokeColor="black";attr.strokeWidth="1px"}p=board.create("point",[input[0],t],attr);return p}catch(e){JXG.debug("* Err: Translate "+attr.name+"
\n");return false}break;case"mirror":attr=JXG.GeogebraReader.boardProperties(gxtEl,element,attr);attr=JXG.GeogebraReader.colorProperties(element,attr);gxtEl=JXG.GeogebraReader.coordinates(gxtEl,element);attr=JXG.GeogebraReader.visualProperties(element,attr);if(JXG.isPoint(JXG.getRef(board,input[1].id))){var type="mirrorpoint"}else{if(JXG.getRef(board,input[1].id).elementClass==JXG.OBJECT_CLASS_LINE){var type="reflection"}}try{JXG.debug("* Mirror: First: "+input[0].name+", Second: "+input[1].name+"
\n");p=board.create(type,[input[1],input[0]],attr);return p}catch(e){JXG.debug("* Err: Mirror "+attr.name+"
\n");return false}break;case"circle":attr=JXG.GeogebraReader.boardProperties(gxtEl,element,attr);attr=JXG.GeogebraReader.colorProperties(element,attr);gxtEl=JXG.GeogebraReader.coordinates(gxtEl,element);attr=JXG.GeogebraReader.visualProperties(element,attr);try{JXG.debug("* Circle: First: "+input[0].name+", Second: "+input[1]+"
\n");p=board.create("circle",input,attr);return p}catch(e){JXG.debug("* Err: Circle "+attr.name+"
\n");return false}break;case"circlearc":attr=JXG.GeogebraReader.boardProperties(gxtEl,element,attr);attr=JXG.GeogebraReader.colorProperties(element,attr);gxtEl=JXG.GeogebraReader.coordinates(gxtEl,element);attr=JXG.GeogebraReader.visualProperties(element,attr);try{JXG.debug("* CircleArc: First: "+input[0].name+", Second: "+input[1].name+"
\n");p=board.create("arc",input,attr);return p}catch(e){JXG.debug("* Err: CircleArc "+attr.name+"
\n");return false}break;case"ellipse":attr=JXG.GeogebraReader.boardProperties(gxtEl,element,attr);attr=JXG.GeogebraReader.colorProperties(element,attr);gxtEl=JXG.GeogebraReader.coordinates(gxtEl,element);attr=JXG.GeogebraReader.visualProperties(element,attr);try{JXG.debug("* Ellipse: First: "+input[0].name+", Second: "+input[1].name+", Third: "+input[2]+"
\n");if(parseInt(input[2])==input[2]){input[2]=parseInt(input[2]*2)}p=board.create("ellipse",input,attr);return p}catch(e){JXG.debug("* Err: Ellipse "+attr.name+"
\n");return false}break;case"conic":attr=JXG.GeogebraReader.boardProperties(gxtEl,element,attr);attr=JXG.GeogebraReader.colorProperties(element,attr);gxtEl=JXG.GeogebraReader.coordinates(gxtEl,element);attr=JXG.GeogebraReader.visualProperties(element,attr);if(input&&input.length==5){p=board.create("conic",input,attr)}else{if(element.getElementsByTagName("matrix")){m=[];for(var i=0;iCircleSector: First: "+input[0].name+", Second: "+input[1].name+", Third: "+input[2].name+"
\n");p=board.create("sector",[input[0],input[1],input[2]],attr);return p}catch(e){JXG.debug("* Err: CircleSector "+attr.name+"
\n");return false}break;case"linebisector":attr=JXG.GeogebraReader.boardProperties(gxtEl,element,attr);attr=JXG.GeogebraReader.colorProperties(element,attr);gxtEl=JXG.GeogebraReader.coordinates(gxtEl,element);attr=JXG.GeogebraReader.visualProperties(element,attr);try{JXG.debug("* LineBiSector (Mittelsenkrechte): First: "+input[0].name+"
\n");m=board.create("midpoint",input,{visible:false});if(JXG.isPoint(JXG.getRef(board,input[0].id))&&JXG.isPoint(JXG.getRef(board,input[1].id))){t=board.create("line",input,{visible:"false"});p=board.create("perpendicular",[m,t],attr)}else{p=board.create("perpendicular",[m,input[0]],attr)}return p}catch(e){JXG.debug("* Err: LineBiSector (Mittelsenkrechte) "+attr.name+"
\n");return false}break;case"ray":attr=JXG.GeogebraReader.boardProperties(gxtEl,element,attr);attr=JXG.GeogebraReader.colorProperties(element,attr);gxtEl=JXG.GeogebraReader.coordinates(gxtEl,element);attr=JXG.GeogebraReader.visualProperties(element,attr);try{JXG.debug("* Ray: First: "+input[0].name+"
\n");attr.straightFirst=true;attr.straightLast=false;p=board.create("line",[input[1],input[0]],attr);return p}catch(e){JXG.debug("* Err: Ray "+attr.name+"
\n");return false}break;case"tangent":attr=JXG.GeogebraReader.boardProperties(gxtEl,element,attr);attr=JXG.GeogebraReader.colorProperties(element,attr);gxtEl=JXG.GeogebraReader.coordinates(gxtEl,element);attr=JXG.GeogebraReader.visualProperties(element,attr);try{JXG.debug("* Tangent: First: "+input[0].name+", Sec.: "+input[1].name+"("+input[1].type+")
\n");switch(input[1].type){case 1330923344:input[0].makeGlider(input[1]);p=board.create("tangent",[input[0]],attr);return p;break;case 1330922316:case 1330922319:var pol=board.create("polar",[input[1],input[0]],{visible:false});var i1=board.create("intersection",[input[1],pol,0],{visible:false});var i2=board.create("intersection",[input[1],pol,1],{visible:false});var t1=board.create("line",[input[0],i1],attr);var attr2={};attr2=JXG.GeogebraReader.colorProperties(output[1],attr2);attr2=JXG.GeogebraReader.visualProperties(output[1],attr2);attr2.name=output[1].getAttribute("label");var t2=board.create("line",[input[0],i2],attr2);board.ggbElements[attr2.name]=t2;return[t1,t2];break}}catch(e){JXG.debug("* Err: Tangent "+attr.name+" "+attr2.name+"
\n");return false}break;case"circumcirclearc":attr=JXG.GeogebraReader.boardProperties(gxtEl,element,attr);attr=JXG.GeogebraReader.colorProperties(element,attr);gxtEl=JXG.GeogebraReader.coordinates(gxtEl,element);attr=JXG.GeogebraReader.visualProperties(element,attr);try{JXG.debug("* CircumcircleArc: First: "+input[0].name+"
\n");p=board.create("circumcirclearc",input,attr);return p}catch(e){JXG.debug("* Err: CircumcircleArc "+attr.name+"
\n");return false}break;case"circumcirclesector":attr=JXG.GeogebraReader.boardProperties(gxtEl,element,attr);attr=JXG.GeogebraReader.colorProperties(element,attr);gxtEl=JXG.GeogebraReader.coordinates(gxtEl,element);attr=JXG.GeogebraReader.visualProperties(element,attr);try{JXG.debug("* CircumcircleSector: First: "+input[0].name+"
\n");p=board.create("circumcirclesector",[input[0],input[1],input[2]],attr);return p}catch(e){JXG.debug("* Err: CircumcircleSector "+attr.name+"
\n");return false}break;case"semicircle":attr=JXG.GeogebraReader.boardProperties(gxtEl,element,attr);attr=JXG.GeogebraReader.colorProperties(element,attr);gxtEl=JXG.GeogebraReader.coordinates(gxtEl,element);attr=JXG.GeogebraReader.visualProperties(element,attr);try{JXG.debug("* Semicircle: First: "+input[0].name+"
\n");p=board.create("semicircle",[input[0],input[1]],attr);return p}catch(e){JXG.debug("* Err: Semicircle "+attr.name+"
\n");return false}break;case"angle":attr=JXG.GeogebraReader.boardProperties(gxtEl,element,attr);attr=JXG.GeogebraReader.colorProperties(element,attr);gxtEl=JXG.GeogebraReader.coordinates(gxtEl,element);attr=JXG.GeogebraReader.visualProperties(element,attr);try{JXG.debug("* Angle: First: "+input[0].name+"
\n");p=board.create("angle",input,attr);return p}catch(e){JXG.debug("* Err: Angle "+attr.name+"
\n");return false}break;case"angularbisector":attr=JXG.GeogebraReader.boardProperties(gxtEl,element,attr);attr=JXG.GeogebraReader.colorProperties(element,attr);gxtEl=JXG.GeogebraReader.coordinates(gxtEl,element);attr=JXG.GeogebraReader.visualProperties(element,attr);attr.straightFirst=true;attr.straightLast=true;try{JXG.debug("* Angularbisector: First: "+input[0].name+"
\n");p=board.create("bisector",input,attr);return p}catch(e){JXG.debug("* Err: Angularbisector "+attr.name+"
\n");return false}break;case"numeric":if(element.getElementsByTagName("slider").length==0){exp=JXG.GeogebraReader.getElement(element.getAttribute("label"),true);if(exp){exp=exp.getAttribute("exp");exp=JXG.GeogebraReader.functionParse("",exp);exp=JXG.GeogebraReader.ggbParse(exp)}board.ggb[attr.name]=new Function("return "+exp+";");JXG.debug("value: "+board.ggb[attr.name]());return board.ggb[attr.name]}else{attr=JXG.GeogebraReader.boardProperties(gxtEl,element,attr);attr=JXG.GeogebraReader.colorProperties(element,attr);attr=JXG.GeogebraReader.visualProperties(element,attr);if(element.getElementsByTagName("slider").length==1){sx=parseFloat(element.getElementsByTagName("slider")[0].getAttribute("x"));sy=parseFloat(element.getElementsByTagName("slider")[0].getAttribute("y"));length=parseFloat(element.getElementsByTagName("slider")[0].getAttribute("width"));if(element.getElementsByTagName("slider")[0].getAttribute("absoluteScreenLocation")&&element.getElementsByTagName("slider")[0].getAttribute("absoluteScreenLocation")=="true"){var tmp=new JXG.Coords(JXG.COORDS_BY_SCREEN,[sx,sy],board);sx=tmp.usrCoords[1];sy=tmp.usrCoords[2]}if(element.getElementsByTagName("slider")[0].getAttribute("horizontal")=="true"){if(element.getElementsByTagName("slider")[0].getAttribute("absoluteScreenLocation")&&element.getElementsByTagName("slider")[0].getAttribute("absoluteScreenLocation")=="true"){length/=(board.unitX)}ex=sx+length;ey=sy}else{if(element.getElementsByTagName("slider")[0].getAttribute("absoluteScreenLocation")&&element.getElementsByTagName("slider")[0].getAttribute("absoluteScreenLocation")=="true"){length/=(board.unitY)}ex=sx;ey=sy+length}(element.getElementsByTagName("animation")[0])?attr.snapWidth=parseFloat(element.getElementsByTagName("animation")[0].getAttribute("step")):false;try{JXG.debug("* Numeric: First: "+attr.name+"
\n");attr.withTicks=false;p=board.create("slider",[[sx,sy],[ex,ey],[parseFloat(element.getElementsByTagName("slider")[0].getAttribute("min")),parseFloat(element.getElementsByTagName("value")[0].getAttribute("val")),parseFloat(element.getElementsByTagName("slider")[0].getAttribute("max"))]],attr);p.setProperty({withLabel:false});return p}catch(e){JXG.debug("* Err: Numeric "+attr.name+"
\n");return false}}}break;case"midpoint":attr=JXG.GeogebraReader.boardProperties(gxtEl,element,attr);attr=JXG.GeogebraReader.colorProperties(element,attr);gxtEl=JXG.GeogebraReader.coordinates(gxtEl,element);attr=JXG.GeogebraReader.visualProperties(element,attr);try{if(!JXG.exists(attr.styleGGB)){attr.face="circle";attr.fillColor=attr.strokeColor;attr.fillOpacity=1;attr.highlightFillColor=attr.strokeColor;attr.highlightFillOpacity=1;attr.strokeColor="black";attr.strokeWidth="1px"}p=board.create("midpoint",input,attr);JXG.debug("* Midpoint ("+p.id+"): "+attr.name+"("+gxtEl.x+", "+gxtEl.y+")
\n");return p}catch(e){JXG.debug("* Err: Midpoint "+attr.name+"
\n");return false}break;case"center":attr=JXG.GeogebraReader.boardProperties(gxtEl,element,attr);attr=JXG.GeogebraReader.colorProperties(element,attr);gxtEl=JXG.GeogebraReader.coordinates(gxtEl,element);attr=JXG.GeogebraReader.visualProperties(element,attr);try{if(!JXG.exists(attr.styleGGB)){attr.face="circle";attr.fillColor=attr.strokeColor;attr.fillOpacity=1;attr.highlightFillColor=attr.strokeColor;attr.highlightFillOpacity=1;attr.strokeColor="black";attr.strokeWidth="1px"}p=board.create("point",[function(){return JXG.getRef(board,input[0].id).center.X()},function(){return JXG.getRef(board,input[0].id).center.Y()}],attr);JXG.debug("* Center ("+p.id+"): "+attr.name+"("+gxtEl.x+", "+gxtEl.y+")
\n");return p}catch(e){JXG.debug("* Err: Center "+attr.name+"
\n");return false}break;case"function":attr=JXG.GeogebraReader.boardProperties(gxtEl,element,attr);attr=JXG.GeogebraReader.colorProperties(element,attr);gxtEl=JXG.GeogebraReader.coordinates(gxtEl,element);attr=JXG.GeogebraReader.visualProperties(element,attr);if(JXG.GeogebraReader.getElement(attr.name,true)){func=JXG.GeogebraReader.getElement(attr.name,true).getAttribute("exp");func=JXG.GeogebraReader.functionParse("c",func)}else{func=input[0];func=JXG.GeogebraReader.functionParse("s",func)}JXG.debug(func);length=func.length;func[func.length-1]="return "+JXG.GeogebraReader.ggbParse(func[func.length-1])+";";JXG.debug(func);range=[(input&&input[1])?input[1]:null,(input&&input[2])?input[2]:null];try{if(length==1){p=board.create("functiongraph",[new Function(func[0]),range[0],range[1]],attr)}else{if(length==2){p=board.create("functiongraph",[new Function(func[0],func[1]),range[0],range[1]],attr)}else{if(length==3){p=board.create("functiongraph",[new Function(func[0],func[1],func[2]),range[0],range[1]],attr)}else{if(length==4){p=board.create("functiongraph",[new Function(func[0],func[1],func[2],func[3]),range[0],range[1]],attr)}else{if(length==5){p=board.create("functiongraph",[new Function(func[0],func[1],func[2],func[3],func[4]),range[0],range[1]],attr)}}}}}return p}catch(e){JXG.debug("* Err: Functiongraph "+attr.name+"
\n");return false}break;case"polar":attr=JXG.GeogebraReader.boardProperties(gxtEl,element,attr);attr=JXG.GeogebraReader.colorProperties(element,attr);gxtEl=JXG.GeogebraReader.coordinates(gxtEl,element);attr=JXG.GeogebraReader.visualProperties(element,attr);try{JXG.debug("* Polar: First: "+input[0].name+", Sec.: "+input[1].name+"
\n");p=board.create("polar",input,attr);return p}catch(e){JXG.debug("* Err: Polar "+attr.name+"
\n");return false}break;case"slope":attr=JXG.GeogebraReader.boardProperties(gxtEl,element,attr);attr=JXG.GeogebraReader.colorProperties(element,attr);gxtEl=JXG.GeogebraReader.coordinates(gxtEl,element);attr=JXG.GeogebraReader.visualProperties(element,attr);try{JXG.debug("* Slope ("+attr.name+"): First: "+input[0].name+"
\n");var slopeWidth=parseInt(attr.slopeWidth)||1;var p1=input[0].glider||input[0].point1;var p2=board.create("point",[function(){return(slopeWidth+p1.X())},function(){return p1.Y()}],{visible:false});var l1=board.create("segment",[p1,p2],{visible:false});var l2=board.create("normal",[l1,l1.point2],{visible:false});var i=board.create("intersection",[input[0],l2,0],{visible:false});var m=board.create("midpoint",[l1.point2,i],{visible:false});var t=board.create("text",[function(){return m.X()},function(){return m.Y()},function(){return"  "+(slopeWidth>1?slopeWidth.toString():"")+" "+this.name+" = "+JXG.trimNumber((slopeWidth*input[0].getSlope()).toFixed(JXG.GeogebraReader.decimals))}],attr);attr.name="";var t2=board.create("text",[function(){return(p1.X()+p2.X())/2},function(){return p1.Y()},function(){return"
"+slopeWidth}],attr);t.Value=(function(){return function(){return input[0].getSlope()}})();var poly=board.create("polygon",[p1,p2,i],attr);poly.borders[2].setProperty({visible:false});poly.borders[0].setProperty({strokeColor:attr.fillColor,strokeWidth:attr.strokeWidth,highlightStrokeColor:attr.fillColor,dash:attr.dash});poly.borders[1].setProperty({strokeColor:attr.fillColor,strokeWidth:attr.strokeWidth,highlightStrokeColor:attr.fillColor,dash:attr.dash});return t}catch(e){JXG.debug("* Err: Slope "+attr.name+"
\n");return false}break;case"text":attr=JXG.GeogebraReader.boardProperties(gxtEl,element,attr);attr=JXG.GeogebraReader.colorProperties(element,attr);gxtEl=JXG.GeogebraReader.coordinates(gxtEl,element);attr=JXG.GeogebraReader.visualProperties(element,attr);var rx,res="";try{if(element.getElementsByTagName("isLaTeX")[0]&&element.getElementsByTagName("isLaTeX")[0].getAttribute("val")=="true"){JXG.GeogebraReader.board.options.text.useASCIIMathML=true;t=JXG.GeogebraReader.getElement(attr.name,true).getAttribute("exp");while(rx=t.match(/(.*?)" \+ (.+) \+ "(.*)/)){var re2=JXG.GeogebraReader.ggbParse(RegExp.$2);if(typeof re2=="string"){res=res+RegExp.$1+re2}else{res=res+RegExp.$1+'" + JXG.trimNumber(('+re2+').toFixed(JXG.GeogebraReader.decimals)) + "'}t=RegExp.$3}if(rx=t.match(/(.*?)" \+ (.+)/)){res=res+RegExp.$1+'" + JXG.trimNumber(('+JXG.GeogebraReader.ggbParse(RegExp.$2)+").toFixed(JXG.GeogebraReader.decimals))"}else{res=res+t}JXG.debug("Text: "+res);p=board.create("text",[gxtEl.x,gxtEl.y,new Function("return "+res+";")],attr)}else{JXG.debug(JXG.GeogebraReader.getElement(attr.name,true).getAttribute("exp"));t=JXG.GeogebraReader.ggbParse(JXG.GeogebraReader.functionParse(false,JXG.GeogebraReader.getElement(attr.name,true).getAttribute("exp")));JXG.debug(t[1]);p=board.create("text",[gxtEl.x,gxtEl.y,new Function("return "+t[0]+' + " " + JXG.trimNumber(parseFloat('+t[1]+").toFixed(JXG.GeogebraReader.decimals));")],attr)}JXG.debug("* Text: "+t+"
\n");return p}catch(e){JXG.debug("* Err: Text: "+t+"
\n");return false}break;case"root":attr=JXG.GeogebraReader.boardProperties(gxtEl,element,attr);attr=JXG.GeogebraReader.colorProperties(element,attr);gxtEl=JXG.GeogebraReader.coordinates(gxtEl,element);attr=JXG.GeogebraReader.visualProperties(element,attr);for(var i=0;iIntegral: First: "+input[0].name+", Sec.: "+input[1].name+", Thir.: "+input[2].name+"
\n");JXG.debug([input[1](),input[2]()]);var p=board.create("integral",[JXG.getRef(board,input[0]),[input[1],input[2]]],attr);return p}catch(e){JXG.debug("* Err: Integral "+attr.name+e+"
\n");return false}break;default:return false;break}};this.readGeogebra=function(tree,board){var el,Data,i,els=[],expr;board.ggbElements=[];board.ggb={};JXG.GeogebraReader.tree=tree;JXG.GeogebraReader.board=board;JXG.GeogebraReader.format=parseFloat(JXG.GeogebraReader.tree.getElementsByTagName("geogebra")[0].getAttribute("format"));JXG.GeogebraReader.decimals=parseInt(JXG.GeogebraReader.tree.getElementsByTagName("geogebra")[0].getElementsByTagName("kernel")[0].getElementsByTagName("decimals")[0].getAttribute("val"));JXG.GeogebraReader.writeBoard(board);board=JXG.GeogebraReader.setDefaultOptions(board);var constructions=JXG.GeogebraReader.tree.getElementsByTagName("construction");for(var t=0;t="):exp;exp=(exp.match(/\u2227/))?exp.replace(/\u2227/g,"&&"):exp;exp=(exp.match(/\u2228/))?exp.replace(/\u2228/g,"//"):exp;return exp};this.prepareString=function(fileStr,isString){var i,bA,len,fstr;if(isString){fstr=JXG.Util.Base64.decode(fileStr);if(fstr.slice(0,2)!=="PK"){fstr=JXG.Util.Base64.decode(fileStr,true)}fileStr=fstr}if(fileStr.indexOf("<")!=0){bA=[];len=fileStr.length;for(i=0;i. +*/ + JXG.debug=function(){};JXG.GeonextReader={changeOriginIds:function(a,b){if((b=="gOOe0")||(b=="gXOe0")||(b=="gYOe0")||(b=="gXLe0")||(b=="gYLe0")){return a.id+b}else{return b}},gEBTN:function(e,b,a,d){var c;if(!JXG.exists(e||!e.getElementsByTagName)){return""}if(!JXG.exists(d)){d=true}a=a||0;c=e.getElementsByTagName(b);if(c.length>0){c=c[a];if(d&&c.firstChild){c=c.firstChild.data}}return c},colorProperties:function(d,c){var b=this.gEBTN(c,"color",0,false),a;a=JXG.rgba2rgbo(this.gEBTN(b,"stroke"));d.strokeColor=a[0];d.strokeOpacity=a[1];a=JXG.rgba2rgbo(this.gEBTN(b,"lighting"));d.highlightStrokeColor=a[0];d.highlightStrokeOpacity=a[1];a=JXG.rgba2rgbo(this.gEBTN(b,"fill"));d.fillColor=a[0];d.fillOpacity=a[1];d.highlightFillColor=d.fillColor;d.highlightFillOpacity=d.fillOpacity;d.labelColor=JXG.rgba2rgbo(this.gEBTN(b,"label"))[0];d.colorDraft=JXG.rgba2rgbo(this.gEBTN(b,"draft"))[0];if(JXG.rgba2rgbo(this.gEBTN(b,"label"))[1]==0){d.withLabel=false}else{d.withLabel=true}d.colorStroke=d.strokeColor;d.colorFill=d.fillColor;d.colorLabel=d.labelColor;return d},firstLevelProperties:function(e,c){if(!JXG.exists(c)||!JXG.exists(c.childNodes)){return e}var a=c.childNodes,d,b;for(d=0;d\n")},readGeonext:function(m,g){var j,n,l,i,d,c,b,a,h,e,k="true",f=this;g.options.layer.sector=g.options.layer.angle;g.options.layer.circle=g.options.layer.angle;g.options.line.label.position="top";c=this.gEBTN(m,"board",0,false);h=this.readConditions(c.getElementsByTagName("conditions")[0]);j=this.gEBTN(c,"coordinates",0,false);e=this.gEBTN(j,"origin",0,false);g.origin={usrCoords:[1,0,0],scrCoords:[1,parseFloat(this.gEBTN(e,"x")),parseFloat(this.gEBTN(e,"y"))]};e=this.gEBTN(j,"zoom",0,false);g.zoomX=parseFloat(this.gEBTN(e,"x"));g.zoomY=parseFloat(this.gEBTN(e,"y"));e=this.gEBTN(j,"unit",0,false);g.unitX=parseFloat(this.gEBTN(e,"x"));g.unitY=parseFloat(this.gEBTN(e,"y"));if(g.options.takeSizeFromFile){g.resizeContainer(this.gEBTN(c,"width"),this.gEBTN(c,"height"))}if(!(parseFloat(g.options.text.fontSize)>0)){g.options.text.fontSize=12}g.geonextCompatibilityMode=true;delete (JXG.JSXGraph.boards[g.id]);g.id=this.gEBTN(c,"id");JXG.JSXGraph.boards[g.id]=g;g.initGeonextBoard();g.renderer.enhancedRendering=true;this.parseImage(g,this.gEBTN(c,"file",0,false),g.options.layer.image);g.options.point.snapToGrid=(this.gEBTN(this.gEBTN(c,"coordinates",0,false),"snap")==k);if(g.options.point.snapToGrid&&this.gEBTN(this.gEBTN(c,"grid",1,false),"pointsnap")==k){g.options.point.snapToGrid=false;g.options.point.snapToPoints=true;g.options.point.attractorDistance=0.5}j=this.gEBTN(c,"grid",1,false);e=this.gEBTN(j,"x");if(e){g.options.grid.gridX=1/parseFloat(e);g.options.point.snapSizeX=parseFloat(e)}e=this.gEBTN(j,"y");if(e){g.options.grid.gridY=1/parseFloat(e);g.options.point.snapSizeY=parseFloat(e)}g.options.grid.gridDash=JXG.str2Bool(this.gEBTN(j,"dash"));e=JXG.rgba2rgbo(this.gEBTN(j,"color"));g.options.grid.gridColor=e[0];g.options.grid.gridOpacity=e[1];j=this.gEBTN(c,"coordinates",0,false);if(this.gEBTN(j,"grid")==k){g.create("grid",[])}if(this.gEBTN(j,"coord")==k){g.options.axis.ticks.majorHeight=10;g.options.axis.ticks.minorHeight=4;g.create("axis",[[0,0],[1,0]]);g.create("axis",[[0,0],[0,1]])}e=this.gEBTN(this.gEBTN(c,"background",0,false),"color");if(e.length==8){e="#"+e}g.containerObj.style.backgroundColor=JXG.rgba2rgbo(e)[0];n=m.getElementsByTagName("elements")[0].childNodes;for(l=0;l0){r.radius=f.changeOriginIds(g,f.gEBTN(w,"radius"))}else{if(w.getElementsByTagName("radiusvalue").length>0){r.radius=f.gEBTN(w,"radiusvalue")}}r=f.transformProperties(r);D=g.create("circle",[r.center,r.radius],r);f.parseImage(g,i,g.options.layer.image,0,0,0,0,D);f.printDebugMessage("debug",r,i.nodeName,"OK");break;case"slider":r.strokewidth=1;r=f.colorProperties(r,i);r=f.visualProperties(r,i);r=f.firstLevelProperties(r,i);r=f.readNodes(r,i,"data");r.fixed=JXG.str2Bool(f.gEBTN(i,"fix"));r=f.readNodes(r,i,"animate","animate");r=f.transformProperties(r,"point");try{r.parent=f.changeOriginIds(g,r.parent);o=g.create("glider",[parseFloat(r.x),parseFloat(r.y),r.parent],r);o.onPolygon=JXG.exists(r.onpolygon)&&JXG.str2Bool(r.onpolygon);f.parseImage(g,i,g.options.layer.point,0,0,0,0,o);f.printDebugMessage("debug",r,i.nodeName,"OK")}catch(C){JXG.debug("* Err: Slider "+r.name+" "+r.id+": "+r.parent+"
\n")}break;case"cas":r=f.colorProperties(r,i);r=f.visualProperties(r,i);r=f.firstLevelProperties(r,i);r.fixed=JXG.str2Bool(i.getElementsByTagName("fix")[0].firstChild.data);r=f.readNodes(r,i,"data");r=f.transformProperties(r,"point");if(false){r.x=JXG.GeonextParser.gxt2jc(r.x,g);r.y=JXG.GeonextParser.gxt2jc(r.y,g)}else{r.x=JXG.GeonextParser.geonext2JS(r.x,g);r.x=new Function("return "+r.x+";");r.y=JXG.GeonextParser.geonext2JS(r.y,g);r.y=new Function("return "+r.y+";")}o=g.create("point",[r.x,r.y],r);f.parseImage(g,i,g.options.layer.point,0,0,0,0,o);f.printDebugMessage("debug",r,i.nodeName,"OK");break;case"intersection":r.strokewidth=1;r=f.readNodes(r,i,"data");j=i.getElementsByTagName("first")[1];r.outFirst={};r.outFirst=f.colorProperties(r.outFirst,j);r.outFirst=f.visualProperties(r.outFirst,j);r.outFirst=f.firstLevelProperties(r.outFirst,j);r.outFirst.fixed=JXG.str2Bool(j.getElementsByTagName("fix")[0].firstChild.data);r.outFirst=f.transformProperties(r.outFirst,"point");r.first=f.changeOriginIds(g,r.first);r.last=f.changeOriginIds(g,r.last);if((JXG.getReference(g,r.first).elementClass==JXG.OBJECT_CLASS_LINE)&&(JXG.getReference(g,r.last).elementClass==JXG.OBJECT_CLASS_LINE)){t=g.create("intersection",[g.objects[r.first],g.objects[r.last],0],r.outFirst);if(r.outFirst.visible=="false"){t.hideElement()}}else{j=i.getElementsByTagName("last")[1];if(JXG.exists(j)){r.outLast={};r.outLast=f.colorProperties(r.outLast,j);r.outLast=f.visualProperties(r.outLast,j);r.outLast=f.firstLevelProperties(r.outLast,j);r.outLast.fixed=JXG.str2Bool(j.getElementsByTagName("fix")[0].firstChild.data);r.outLast=f.transformProperties(r.outLast,"point");t=g.create("intersection",[g.objects[r.first],g.objects[r.last],0],r.outFirst);t=g.create("intersection",[g.objects[r.first],g.objects[r.last],1],r.outLast)}}f.printDebugMessage("debug",r,i.nodeName,"OK");break;case"composition":r=f.readNodes(r,i,"data");r=f.firstLevelProperties(r,i);r.defEl=[];B=0;j=i.getElementsByTagName("data")[0].getElementsByTagName("input");for(z=0;z/g,"")}catch(C){r.mpStr=f.subtreeToString(i.getElementsByTagName("data")[0].getElementsByTagName("content")[0]);r.mpStr=r.mpStr.replace(/<\/?content>/g,"")}r.fixed=false;try{if(i.getElementsByTagName("data")[0].getElementsByTagName("parent")[0].firstChild){r.parent=i.getElementsByTagName("data")[0].getElementsByTagName("parent")[0].firstChild.data;r.fixed=true}}catch(C){}try{r.condition=i.getElementsByTagName("condition")[0].firstChild.data}catch(C){r.condition=""}r.content=i.getElementsByTagName("content")[0].firstChild.data;try{r.fixed=i.getElementsByTagName("fix")[0].firstChild.data}catch(C){r.fixed=false}try{r.autodigits=i.getElementsByTagName("digits")[0].firstChild.data}catch(C){r.autodigits=2}r.parent=f.changeOriginIds(g,r.parent);D=g.create("text",[r.x,r.y,r.mpStr],{anchor:r.parent,id:r.id,name:r.name,digits:r.autodigits,isLabel:false,strokeColor:r.colorLabel,fixed:r.fixed,visible:JXG.str2Bool(r.visible)});break;case"parametercurve":r=f.colorProperties(r,i);r=f.visualProperties(r,i);r=f.firstLevelProperties(r,i);r=f.transformProperties(r);r.functionx=i.getElementsByTagName("functionx")[0].firstChild.data;r.functiony=i.getElementsByTagName("functiony")[0].firstChild.data;r.min=i.getElementsByTagName("min")[0].firstChild.data;r.max=i.getElementsByTagName("max")[0].firstChild.data;r.fillColor="none";r.highlightFillColor="none";g.create("curve",[new Function("t","return "+JXG.GeonextParser.geonext2JS(r.functionx,g)+";"),new Function("t","return "+JXG.GeonextParser.geonext2JS(r.functiony,g)+";"),new Function("return "+JXG.GeonextParser.geonext2JS(r.min,g)+";"),new Function("return "+JXG.GeonextParser.geonext2JS(r.max,g)+";")],r);f.printDebugMessage("debug",r,i.nodeName,"OK");break;case"tracecurve":r.tracepoint=i.getElementsByTagName("tracepoint")[0].firstChild.data;r.traceslider=i.getElementsByTagName("traceslider")[0].firstChild.data;g.create("tracecurve",[r.traceslider,r.tracepoint],r);f.printDebugMessage("debug",r,i.nodeName,"OK");break;case"group":r=f.colorProperties(r,i);r=f.firstLevelProperties(r,i);r.members=[];for(z=0;zErr: "+i.nodeName+" not yet implemented
\n")}delete (r)})(l)}g.addConditions(h)},decodeString:function(b){var a;if(b.indexOf("")<0){a=(new JXG.Util.Unzip(JXG.Util.Base64.decodeAsArray(b))).unzip();if(a==""){return b}else{return a}}else{return b}},prepareString:function(a){try{if(a.indexOf("GEONEXT")<0){a=(this.decodeString(a))[0][0]}a=this.fixXML(a)}catch(b){a=""}return a},fixXML:function(e){var a=["active","angle","animate","animated","arc","area","arrow","author","autodigits","axis","back","background","board","border","bottom","buttonsize","cas","circle","color","comment","composition","condition","conditions","content","continuous","control","coord","coordinates","cross","cs","dash","data","description","digits","direction","draft","editable","elements","event","file","fill","first","firstarrow","fix","fontsize","free","full","function","functionx","functiony","GEONEXT","graph","grid","group","height","id","image","info","information","input","intersection","item","jsf","label","last","lastarrow","left","lefttoolbar","lighting","line","loop","max","maximized","member","middle","midpoint","min","modifier","modus","mp","mpx","multi","name","onpolygon","order","origin","output","overline","parametercurve","parent","point","pointsnap","polygon","position","radius","radiusnum","radiusvalue","right","section","selectedlefttoolbar","showconstruction","showcoord","showinfo","showunit","showx","showy","size","slider","snap","speed","src","start","stop","straight","stroke","strokewidth","style","term","text","top","trace","tracecurve","tracepoint","traceslider","type","unit","value","VERSION","vertex","viewport","visible","width","wot","x","xooy","xval","y","yval","zoom"],c=a.join("|"),b="<(/?("+c+"))>",d=new RegExp(b,"g");e=JXG.escapeHTML(e);e=e.replace(d,"<$1>");e=e.replace(/(.*)(.*<\/content>)/g,"$1<arc>$2");e=e.replace(/(.*)(.*<\/mpx>)/g,"$1<arc>$2");e=e.replace(/(.*)(.*<\/mpx>)/g,"$1<arc>$2");return e}}; \ No newline at end of file diff --git a/ajax/libs/jsxgraph/0.95/IntergeoReader.min.js b/ajax/libs/jsxgraph/0.95/IntergeoReader.min.js new file mode 100644 index 000000000..2f6724131 --- /dev/null +++ b/ajax/libs/jsxgraph/0.95/IntergeoReader.min.js @@ -0,0 +1,27 @@ +/* Version 0.95 */ +/* Version 0.95 */ +/* + Copyright 2008-2012 + Matthias Ehmann, + Michael Gerhaeuser, + Carsten Miller, + Bianca Valentin, + Alfred Wassermann, + Peter Wilfahrt + + This file is part of JSXGraph. + + JSXGraph is free software: 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. + + 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 + along with JSXGraph. If not, see . +*/ + JXG.IntergeoReader=new function(){this.board=null;this.objects={};this.readIntergeo=function(a,b){this.board=b;this.board.origin={};this.board.origin.usrCoords=[1,0,0];this.board.origin.scrCoords=[1,400,300];this.board.unitX=30;this.board.unitY=30;this.readElements(a.getElementsByTagName("elements"));this.readConstraints(a.getElementsByTagName("constraints"));this.cleanUp();this.board.fullUpdate();this.readDisplay(a.getElementsByTagName("display"));this.board.fullUpdate()};this.readElements=function(a){var b;for(var b=0;b1){return}if(d.nodeName=="point"){JXG.IntergeoReader.storePoint(d)}else{if(d.nodeName=="line"||d.nodeName=="line_segment"||d.nodeName=="ray"||d.nodeName=="vector"){JXG.IntergeoReader.storeLine(d)}else{if(d.nodeName=="circle"){JXG.IntergeoReader.storeConic(d)}else{if(d.nodeName=="conic"){JXG.IntergeoReader.storeConic(d)}else{if(d.nodeName=="polygon"){}else{JXG.debug("Not implemented: "+d.nodeName+" "+d.getAttribute("id"))}}}}}})(b)}};this.addPointOld=function(d){var h=0,f=0,e=0,b,a=d.childNodes[h],k=[],g={strokeColor:"red",fillColor:"red",withLabel:true},m=[];while(a.nodeType>1){h++;a=d.childNodes[h]}g.name=d.getAttribute("id");if(a.nodeName=="homogeneous_coordinates"){for(f=0;f1){e++;g=f.childNodes[e]}if(g.nodeName=="homogeneous_coordinates"){for(d=0;d1){b++;e=d.childNodes[b]}if(e.nodeName=="homogeneous_coordinates"){f=[];for(a=0;a1){b++;e=d.childNodes[b]}if(e.nodeName=="matrix"){f=[];for(a=0;a1){return}if(e.nodeName=="line_through_two_points"){JXG.IntergeoReader.addLineThroughTwoPoints(e,false)}else{if(e.nodeName=="ray_from_point_through_point"){JXG.IntergeoReader.addLineThroughTwoPoints(e,true)}else{if(e.nodeName=="line_through_point"){JXG.IntergeoReader.addLineThroughPoint(e)}else{if(e.nodeName=="line_parallel_to_line_through_point"){JXG.IntergeoReader.addLineParallelToLineThroughPoint(e,false)}else{if(e.nodeName=="ray_from_point_and_vector"){JXG.IntergeoReader.addLineParallelToLineThroughPoint(e,true)}else{if(e.nodeName=="line_perpendicular_to_line_through_point"){JXG.IntergeoReader.addLinePerpendicularToLineThroughPoint(e)}else{if(e.nodeName=="line_segment_by_points"){JXG.IntergeoReader.addLineSegmentByTwoPoints(e)}else{if(e.nodeName=="vector_from_point_to_point"){JXG.IntergeoReader.addVectorFromPointToPoint(e)}else{if(e.nodeName=="endpoints_of_line_segment"){JXG.IntergeoReader.addEndpointsOfLineSegment(e)}else{if(e.nodeName=="free_point"){}else{if(e.nodeName=="free_line"){JXG.IntergeoReader.addFreeLine(e)}else{if(e.nodeName=="point_on_line"){JXG.IntergeoReader.addPointOnLine(e)}else{if(e.nodeName=="point_on_line_segment"){JXG.IntergeoReader.addPointOnLine(e)}else{if(e.nodeName=="point_on_circle"){JXG.IntergeoReader.addPointOnCircle(e)}else{if(e.nodeName=="angular_bisector_of_three_points"){JXG.IntergeoReader.addAngularBisectorOfThreePoints(e,false)}else{if(e.nodeName=="angular_bisectors_of_two_lines"){JXG.IntergeoReader.addAngularBisectorsOfTwoLines(e,false)}else{if(e.nodeName=="line_angular_bisector_of_three_points"){JXG.IntergeoReader.addAngularBisectorOfThreePoints(e,true)}else{if(e.nodeName=="line_angular_bisectors_of_two_lines"){JXG.IntergeoReader.addAngularBisectorsOfTwoLines(e,true)}else{if(e.nodeName=="midpoint_of_two_points"){JXG.IntergeoReader.addMidpointOfTwoPoints(e)}else{if(e.nodeName=="midpoint"){JXG.IntergeoReader.addMidpointOfTwoPoints(e)}else{if(e.nodeName=="midpoint_of_line_segment"||e.nodeName=="midpoint_line_segment"){JXG.IntergeoReader.addMidpointOfLineSegment(e)}else{if(e.nodeName=="point_intersection_of_two_lines"){JXG.IntergeoReader.addPointIntersectionOfTwoLines(e)}else{if(e.nodeName=="locus_defined_by_point"){JXG.IntergeoReader.addLocusDefinedByPoint(e)}else{if(e.nodeName=="locus_defined_by_point_on_line"){JXG.IntergeoReader.addLocusDefinedByPointOnLine(e)}else{if(e.nodeName=="locus_defined_by_point_on_line_segment"){JXG.IntergeoReader.addLocusDefinedByPointOnLine(e)}else{if(e.nodeName=="locus_defined_by_line_through_point"){JXG.IntergeoReader.addLocusDefinedByLineThroughPoint(e)}else{if(e.nodeName=="locus_defined_by_point_on_circle"){JXG.IntergeoReader.addLocusDefinedByPointOnCircle(e)}else{if(e.nodeName=="circle_by_three_points"){JXG.IntergeoReader.addCircleByThreePoints(e)}else{if(e.nodeName=="circle_by_center_and_point"){JXG.IntergeoReader.addCircleByCenterAndPoint(e)}else{if(e.nodeName=="center_of_circle"){JXG.IntergeoReader.addCenterOfCircle(e)}else{if(e.nodeName=="intersection_points_of_two_circles"){JXG.IntergeoReader.addIntersectionPointsOfTwoCircles(e)}else{if(e.nodeName=="intersection_points_of_circle_and_line"){JXG.IntergeoReader.addIntersectionPointsOfCircleAndLine(e)}else{if(e.nodeName=="other_intersection_point_of_two_circles"){JXG.IntergeoReader.addOtherIntersectionPointOfTwoCircles(e)}else{if(e.nodeName=="other_intersection_point_of_circle_and_line"){JXG.IntergeoReader.addOtherIntersectionPointOfCircleAndLine(e)}else{if(e.nodeName=="circle_tangent_lines_by_point"){JXG.IntergeoReader.addCircleTangentLinesByPoint(e)}else{if(e.nodeName=="polygon_by_vertices"){JXG.IntergeoReader.addPolygonByVertices(e)}else{c=JXG.IntergeoReader.readParams(e);JXG.debug("readConstraints: not implemented: "+e.nodeName+": "+c[0])}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}})(b)}};this.setAttributes=function(a){a.setProperty({strokecolor:this.board.options.point.strokeColor,fillColor:this.board.options.point.fillColor})};this.readParams=function(b){var c=[],a;for(a=0;a1){return}if(h.nodeName=="background-color"){this.board.containerObj.style.backgroundColor=h.firstChild.data}else{if(h.nodeName=="style"){f=JXG.getReference(this.board,h.getAttribute("ref"));var i=[],d;for(d=0;d. +*/ + var JXG={};(function(){var d,e;JXG.countDrawings=0;JXG.countTime=0;JXG.require=function(f){};JXG.rendererFiles={};JXG.rendererFiles.svg="SVGRenderer";JXG.rendererFiles.vml="VMLRenderer";JXG.rendererFiles.canvas="CanvasRenderer";JXG.baseFiles=null;JXG.requirePath="";if(typeof document!=="undefined"){for(d=0;d-1},isWebkitAndroid:function(){return this.isAndroid()&&navigator.userAgent.search(" AppleWebKit/")>-1},isApple:function(){return(navigator.userAgent.search(/iPad/)!=-1||navigator.userAgent.search(/iPhone/)!=-1)},isWebkitApple:function(){return this.isApple()&&(navigator.userAgent.search(/Mobile *.*Safari/)>-1)},clearVisPropOld:function(d){d.visPropOld={strokecolor:"",strokeopacity:"",strokewidth:"",fillcolor:"",fillopacity:"",shadow:false,firstarrow:false,lastarrow:false,cssclass:"",fontsize:-1}},ieVersion:(function(){var f;if(typeof document=="undefined"){return f}var d=3,g=document.createElement("div"),e=g.getElementsByTagName("i");while(g.innerHTML="",e[0]){}return d>4?d:f}()),getReference:function(e,d){if(typeof(d)=="string"){if(JXG.exists(e.objects[d])){d=e.objects[d]}else{if(JXG.exists(e.elementsByName[d])){d=e.elementsByName[d]}else{if(JXG.exists(e.groups[d])){d=e.groups[d]}}}}return d},getRef:JXG.shortcut(JXG,"getReference"),isId:function(e,d){return typeof(d)=="string"&&!!e.objects[d]},isName:function(e,d){return typeof(d)=="string"&&!!e.elementsByName[d]},isGroup:function(e,d){return typeof(d)=="string"&&!!e.groups[d]},isString:function(d){return typeof d==="string"},isNumber:function(d){return typeof d==="number"},isFunction:function(d){return typeof d==="function"},isArray:function(d){return d!==null&&typeof d==="object"&&"splice" in d&&"join" in d},isPoint:function(d){if(typeof d=="object"){return(d.elementClass==JXG.OBJECT_CLASS_POINT)}return false},exists:(function(d){return function(e){return !(e===d||e===null)}})(),def:function(e,f){if(JXG.exists(e)){return e}else{return f}},str2Bool:function(d){if(!JXG.exists(d)){return true}if(typeof d=="boolean"){return d}if(JXG.isString(d)){return(d.toLowerCase()=="true")}else{return false}},_board:function(e,d){return JXG.JSXGraph.initBoard(e,d)},createEvalFunction:function(e,j,k){var g=[],d,h;for(d=0;d=n[g].length;e++){d=0;while(d=0;f--){JXG.removeEvent(h,g,e["x_internal"+g][f].origin,e)}if(e["x_internal"+g].length>0){JXG.debug("removeAllEvents: Not all events could be removed.")}}},bind:function(e,d){return function(){return e.apply(d,arguments)}},removeElementFromArray:function(d,f){var e;for(e=0;e=9){d=f.currentStyle[e]}else{if(f.style){e=e.replace(/-([a-z]|[0-9])/ig,function(g,h){return(h+"").toUpperCase()});d=f.style[e]}}}return d},keys:function(d,e){var f=[],g;for(g in d){if(e){if(d.hasOwnProperty(g)){f.push(g)}}else{f.push(g)}}return f},indexOf:function(h,g,f){var d,e=JXG.exists(f);if(Array.indexOf&&!e){return h.indexOf(g)}for(d=0;d/g,">")},unescapeHTML:function(d){return d.replace(/<\/?[^>]+>/gi,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")},clone:function(e){var d={};d.prototype=e;return d},cloneAndCopy:function(g,f){var d=function(){},e;d.prototype=g;for(e in f){d[e]=f[e]}return d},deepCopy:function(k,h,g){var m,e,l,d,f;g=g||false;if(typeof k!=="object"||k==null){return k}if(this.isArray(k)){m=[];for(e=0;e0&&(+new Date()-i<300));if(d.length>0){setTimeout(arguments.callee,1)}else{h(e)}},1)},trimNumber:function(d){d=d.replace(/^0+/,"");d=d.replace(/0+$/,"");if(d[d.length-1]=="."||d[d.length-1]==","){d=d.slice(0,-1)}if(d[0]=="."||d[0]==","){d="0"+d}return d},trim:function(d){d=d.replace(/^\s+/,"");d=d.replace(/\s+$/,"");return d},evaluate:function(d){if(JXG.isFunction(d)){return d()}else{return d}},eliminateDuplicates:function(f){var g,e=f.length,d=[],h={};for(g=0;g0.1){d=e.toFixed(2)}else{if(d>=0.01){d=e.toFixed(4)}else{if(d>=0.0001){d=e.toFixed(6)}else{d=e}}}return d},debug:function(e){var d;for(d=0;d"}}}},debugWST:function(d){var f;JXG.debug(d);if(window.console&&console.log){f=new Error();if(f&&f.stack){console.log("stacktrace");console.log(f.stack.split("\n").slice(1).join("\n"))}}}});if(typeof window!=="undefined"&&typeof document!=="undefined"){JXG.addEvent(window,"load",function(){var l=document.getElementsByTagName("script"),q,n,m,f,p,h,s,r,k,d,g;for(n=0;n/g,"");l[n].innerHTML=g;if(q.toLowerCase().indexOf("script")>-1){p.construct(g)}else{try{p.jc.parse(g)}catch(o){JXG.debug(o)}}}else{JXG.debug("JSXGraph: Apparently the div injection failed. Can't create a board, sorry.")}}}},window)}JXG.Math=(function(e,d,f){var g=function(i){var h,j;if(i.memo){return i.memo}h={};j=Array.prototype.join;return(i.memo=function(){var k=j.call(arguments);return(h[k]!==f)?h[k]:h[k]=i.apply(this,arguments)})};return{eps:0.000001,mod:function(i,h){return i-d.floor(i/h)*h},vector:function(l,k){var j,h;k=k||0;j=new Array(d.ceil(l));for(h=0;h0?h[0].length:0,v=h.length,u=this.matrix(p,o),t,r,w,q;for(t=0;t0?q[0].length:0;l=this.matrix(p,h);for(o=0;oB){B=d.abs(m[u][t]);h=u}}if(B<=e.Math.eps){return false}if(h>t){for(q=0;qm||j<0){return NaN}j=d.round(j);m=d.round(m);if(j===0||j===m){return 1}h=1;for(l=0;l0){return d.exp(h*d.log(d.abs(i)))}else{return NaN}}},squampow:function(j,i){var h;if(d.floor(i)===i){h=1;if(i<0){j=1/j;i*=-1}while(i!=0){if(i&1){h*=j}i>>=1;j*=j}return h}else{return this.pow(j,i)}},normalize:function(j){var h=2*j[3],k=j[4]/(h),l,i;j[5]=k;j[6]=-j[1]/h;j[7]=-j[2]/h;if(k===Infinity||isNaN(k)){l=d.sqrt(j[1]*j[1]+j[2]*j[2]);j[0]/=l;j[1]/=l;j[2]/=l;j[3]=0;j[4]=1}else{if(d.abs(k)>=1){j[0]=(j[6]*j[6]+j[7]*j[7]-k*k)/(2*k);j[1]=-j[6]/k;j[2]=-j[7]/k;j[3]=1/(2*k);j[4]=1}else{i=(k<=0)?(-1):(1);j[0]=i*(j[6]*j[6]+j[7]*j[7]-k*k)*0.5;j[1]=-i*j[6];j[2]=-i*j[7];j[3]=i/2;j[4]=i*k}}return j},toGL:function(h){var k,n,l;if(typeof Float32Array!=="undefined"){k=new Float32Array(16)}else{k=new Array(16)}if(h.length!==4&&h[0].length!==4){return k}for(n=0;n<4;n++){for(l=0;l<4;l++){k[n+4*l]=h[n][l]}}return k}}})(JXG,Math);JXG.Math.Numerics=(function(e,d){var f={rk4:{s:4,A:[[0,0,0,0],[0.5,0,0,0],[0,0.5,0,0],[0,0,1,0]],b:[1/6,1/3,1/3,1/6],c:[0,0.5,0.5,1]},heun:{s:2,A:[[0,0],[1,0]],b:[0.5,0.5],c:[0,1]},euler:{s:1,A:[[0]],b:[1],c:[0]}};return{Gauss:function(g,r){var t=e.Math.eps,h=g.length>0?g[0].length:0,p,s,q,o,m,l=function(u,n){var k=this[u];this[u]=this[n];this[n]=k};if((h!==r.length)||(h!==g.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.")}p=new Array(h);s=r.slice(0,h);for(q=0;qo;q--){if(d.abs(p[q][o])>t){if(d.abs(p[o][o])0?q[0].length:0;for(o=g-1;o>=0;o--){for(l=r-1;l>o;l--){h[o]-=q[o][l]*h[l]}h[o]/=q[o][o]}return h},gaussBareiss:function(u){var l,r,z,o,m,g,h,q,v,w=e.Math.eps;h=u.length;if(h<=0){return 0}if(u[0].length=w){break}}if(o==h){return 0}for(m=l;mq){q=g}u+=g;if(g>=C){g=d.atan2(2*h[r][p],h[r][r]-h[p][p])*0.5;s=d.sin(g);z=d.cos(g);for(o=0;oC&&t<2000);return[h,m]},NewtonCotes:function(g,k,h){var l=0,p=h&&typeof h.number_of_nodes==="number"?h.number_of_nodes:28,n={trapez:true,simpson:true,milne:true},q=h&&h.integration_type&&n.hasOwnProperty(h.integration_type)&&n[h.integration_type]?h.integration_type:"milne",o=(g[1]-g[0])/p,m,j,r;switch(q){case"trapez":l=(k(g[0])+k(g[1]))*0.5;m=g[0];for(j=0;j0){throw new Error("JSXGraph: INT_SIMPSON requires config.number_of_nodes dividable by 2.")}r=p/2;l=k(g[0])+k(g[1]);m=g[0];for(j=0;j0){throw new Error("JSXGraph: Error in INT_MILNE: config.number_of_nodes must be a multiple of 4")}r=p*0.25;l=7*(k(g[0])+k(g[1]));m=g[0];for(j=0;jm){p=this.D(o,j)(g);l+=2;if(d.abs(p)>m){g-=n/p}else{g+=(d.random()*0.2-1)}n=o.apply(j,[g]);l++;k++}return g},root:function(i,g,h){return this.fzero(i,g,h)},Neville:function(k){var h=[],g=function(l){return function(v,m){var o,u,w,z=e.Math.binomial,r=k.length,n=r-1,p=0,q=0;if(!m){w=1;for(o=0;o=0;m--){t[m]=(p[m]-(u[m+1]*t[m+1]))/o[m]}for(m=g-3;m>=0;m--){t[m+1]=t[m]}t[0]=0;t[g-1]=0;return t},splineEval:function(h,w,u,A){var k=d.min(w.length,u.length),o=1,m=false,z=[],q,p,v,t,s,r,g;if(e.isArray(h)){o=h.length;m=true}else{h=[h]}for(q=0;qw[k-1])){return NaN}for(p=1;p=0;k--){l=l.concat(["(",g[k].toPrecision(j),")"]);if(k>1){l=l.concat(["*",h,"",k,"<","/sup> + "])}else{if(k===1){l=l.concat(["*",h," + "])}}}return l.join("")},lagrangePolynomial:function(i){var g=[],h=function(v,l){var o,m,r,u,w,p=0,q=0,t,n;r=i.length;if(!l){for(o=0;o=n-3){return k[n-2][m]()}}q=d.floor(p);if(q==p){return k[q][m]()}p-=q;r=h[m][q];return 0.5*(((r[3]*p+r[2])*p+r[1])*p+r[0])}};return[g("X"),g("Y"),0,function(){return i.length-1}]},regressionPolynomial:function(k,o,n){var g,h,m,l,i,p,j="";if(e.isPoint(k)&&typeof k.Value=="function"){h=function(){return k.Value()}}else{if(e.isFunction(k)){h=k}else{if(e.isNumber(k)){h=function(){return k}}else{throw new Error("JSXGraph: Can't create regressionPolynomial from degree of type'"+(typeof k)+"'.")}}}if(arguments.length==3&&e.isArray(o)&&e.isArray(n)){i=0}else{if(arguments.length==2&&e.isArray(o)&&o.length>0&&e.isPoint(o[0])){i=1}else{throw new Error("JSXGraph: Can't create regressionPolynomial. Wrong parameters.")}}p=function(E,q){var u,t,A,w,D,r,C,F,z,v=o.length;z=d.floor(h());if(!q){if(i===1){m=[];l=[];for(u=0;u=0;u--){F=(F*E+g[u])}return F};p.getTerm=function(){return j};return p},bezier:function(i){var g,h=function(j){return function(l,k){var o=d.floor(l)*3,n=l%1,m=1-n;if(!k){g=d.floor(i.length/3)}if(l<0){return i[0][j]()}if(l>=g){return i[i.length-1][j]()}if(isNaN(l)){return NaN}return m*m*(m*i[o][j]()+3*n*i[o+1][j]())+(3*m*i[o+2][j]()+n*i[o+3][j]())*n*n}};return[h("X"),h("Y"),0,function(){return d.floor(i.length/3)}]},bspline:function(j,g){var k,m=[],l=function(r,o){var p,q=[];for(p=0;p=B){v=0}else{v=u[q+1]}z=C[q+r-1]-C[q];if(z==0){u[q]=0}else{u[q]=(A-C[q])/z*w}z=C[q+r]-C[q+1];if(z!=0){u[q]+=(C[q+r]-A)/z*v}}}return u},h=function(n){return function(u,p){var o=j.length,z,r,v,w=o-1,q=g;if(w<=0){return NaN}if(w+2<=q){q=w+1}if(u<=0){return j[0][n]()}if(u>=w-q+2){return j[w][n]()}k=l(w,q);v=d.floor(u)+q-1;m=i(u,k,w,q,v);z=0;for(r=v-q+1;r<=v;r++){if(r=0){z+=j[r][n]()*m[r]}}return z}};return[h("X"),h("Y"),0,function(){return j.length-1}]},D:function(j,k){var i=0.00001,g=1/(i*2);if(arguments.length==1||(arguments.length>1&&!e.exists(arguments[1]))){return function(h,l){return(j(h+i,l)-j(h-i,l))*g}}else{return function(h,l){return(j.apply(k,[h+i,l])-j.apply(k,[h-i,l]))*g}}},riemann:function(r,m,s,k,o){var l=[],z=[],q,p=0,w,v=k,t,h,u,g;m=d.round(m);l[p]=v;z[p]=0;if(m>0){w=(o-k)/m;g=w*0.01;for(q=0;qt){t=u}}}}}}p++;l[p]=v;z[p]=t;p++;v+=w;if(s==="trapezodial"){t=r(v)}l[p]=v;z[p]=t;p++;l[p]=v;z[p]=0}}return[l,z]},riemannsum:function(o,k,q,j,l){var p=0,m,u,t=j,r,h,s,g;k=d.floor(k);if(k>0){u=(l-j)/k;g=u*0.01;for(m=0;mr){r=s}}}}}}}p+=u*r;t+=u}}return p},rungeKutta:function(g,G,o,m,F){var p=[],n=[],E=(o[1]-o[0])/m,u=o[0],H,D,C,A,z,B=G.length,v,q=[],w=0;if(e.isString(g)){g=f[g]||f.euler}v=g.s;for(H=0;H0){if(e.isArray(I)){return this.fminbr(H,[L,K],N)}else{return this.Newton(H,L,N)}}J=L;v=B;while(z=G&&d.abs(B)>d.abs(w)){s=J-K;if(L==J){l=w/B;t=s*l;r=1-l}else{r=B/v;l=w/v;k=w/B;t=k*(s*r*(r-l)-(K-L)*(l-1));r=(r-1)*(l-1)*(k-1)}if(t>0){r=-r}else{t=-t}if(t<(0.75*s*r-d.abs(G*r)*0.5)&&t0){m=G}else{m=-G}}L=K;B=w;K+=m;w=H.apply(N,[K]);C++;if((w>0&&v>0)||(w<0&&v<0)){J=L;v=B}z++}return K},fminbr:function(H,I,M){var L,J,l,o,n,h,j,i,z=(3-d.sqrt(5))*0.5,E=e.Math.eps,B=d.sqrt(e.Math.eps),g=this.maxIterationsMinimize,D=0,u,K,G,m,C,A,s,k,F=0;if(!e.isArray(I)||I.length<2){throw new Error("JXG.Math.Numerics.fminbr: length of array x0 has to be at least two.")}L=I[0];J=I[1];o=L+z*(J-L);j=H.apply(M,[o]);F++;l=o;n=o;h=j;i=j;while(D=G){s=(l-n)*(h-j);A=(l-o)*(h-i);C=(l-o)*A-(l-n)*s;A=2*(A-s);if(A>0){C=-C}else{A=-A}if(d.abs(C)A*(L-l+2*G)&&C0){m=G}else{m=-G}}s=l+m;k=H.apply(M,[s]);F++;if(k<=h){if(sq){j(u,t,k[1],q,r);j(u,k[1],s,q,r)}else{r.push(u[s])}},n=function(G,v,u){var A=0,w=v,z,t,H,F,E,s,D,r,B,C,q;if(u-v<2){return[-1,0]}H=G[v].scrCoords;F=G[u].scrCoords;if(isNaN(H[1]+H[2]+F[1]+F[2])){return[NaN,u]}for(t=v+1;t=e.Math.eps){q=(s*r+D*B)/C;if(q<0){q=0}else{if(q>1){q=1}}s=s-q*r;D=D-q*B;z=s*s+D*D}else{q=0;z=s*s+D*D}if(z>A){A=z;w=t}}return[d.sqrt(A),w]};g=p.length;o=0;while(oo&&isNaN(p[l].scrCoords[1]+p[l].scrCoords[2])){l--}if(!(o>l||o==g)){m[0]=p[o];j(p,o,l,h,m)}return m}}})(JXG,Math);JXG.Math.Statistics={sum:function(e){var g,d=e.length,f=0;for(g=0;g0){return this.sum(d)/d.length}else{return 0}},median:function(e){var f,d;if(e.length>0){f=e.slice(0);f.sort(function(h,g){return h-g});d=f.length;if(d%2==1){return f[parseInt(d*0.5)]}else{return(f[d*0.5-1]+f[d*0.5])*0.5}}else{return 0}},variance:function(f){var e,h,g,d=f.length;if(d>1){e=this.mean(f);h=0;for(g=0;g0){return this.mean(this.multiply(d,e))}else{return 0}},max:function(d){return Math.max.apply(this,d)},min:function(d){return Math.min.apply(this,d)},range:function(d){return[this.min(d),this.max(d)]},abs:function(e){var g,d,f;if(JXG.isArray(e)){d=e.length;f=[];for(g=0;g0){l=m[p].generatePolynomial();for(g=0;g0)){if((z.toOrigin!==e)&&(z.toOrigin!=null)&&D(z.toOrigin.id,n.listOfFreePoints)){k=z.toOrigin}else{k=n.listOfFreePoints[0]}u=k.symbolic.x;r=k.symbolic.y;for(E=0;E1)){if((z.to10!==e)&&(z.to10!=null)&&(z.to10.id!=z.toOrigin.id)&&D(z.to10.id,n.listOfFreePoints)){j=z.to10}else{if(n.listOfFreePoints[0].id==k.id){j=n.listOfFreePoints[1]}else{j=n.listOfFreePoints[0]}}o=d.Math.Geometry.rad([1,0],[0,0],[j.symbolic.x,j.symbolic.y]);F=Math.cos(-o);w=Math.sin(-o);for(E=0;Ed.Math.eps)){H=j.symbolic.x;for(E=0;Eq){k+=Math.PI}p=Math.cos(k)+o[1];n=Math.sin(k)+o[2];return new JXG.Coords(JXG.COORDS_BY_USER,[p,n],l)},reflection:function(o,l,f){var h=l.coords.usrCoords,p=o.point1.coords.usrCoords,g=o.point2.coords.usrCoords,e,k,d,i,m,j,n;if(!JXG.exists(f)){f=l.board}m=g[1]-p[1];j=g[2]-p[2];e=h[1]-p[1];k=h[2]-p[2];n=(m*k-j*e)/(m*m+j*j);d=h[1]+2*n*j;i=h[2]-2*n*m;return new JXG.Coords(JXG.COORDS_BY_USER,[d,i],f)},rotation:function(d,n,h,i){var k=n.coords.usrCoords,e=d.coords.usrCoords,g,m,j,o,f,l;if(!JXG.exists(i)){i=n.board}g=k[1]-e[1];m=k[2]-e[2];j=Math.cos(h);o=Math.sin(h);f=g*j-m*o+e[1];l=g*o+m*j+e[2];return new JXG.Coords(JXG.COORDS_BY_USER,[f,l],i)},perpendicular:function(q,o,i){var h=q.point1.coords.usrCoords,g=q.point2.coords.usrCoords,e=o.coords.usrCoords,m,l,k,p,j,f,d,n;if(!JXG.exists(i)){i=o.board}if(o==q.point1){m=h[1]+g[2]-h[2];l=h[2]-g[1]+h[1];k=true}else{if(o==q.point2){m=g[1]+h[2]-g[2];l=g[2]-h[1]+g[1];k=false}else{if(((Math.abs(h[1]-g[1])>JXG.Math.eps)&&(Math.abs(e[2]-(h[2]-g[2])*(e[1]-h[1])/(h[1]-g[1])-h[2])JXG.Math.eps&&(Math.abs(f[0])JXG.Math.eps){for(k=2;k>0;k--){v[m][k]/=v[m][0]}v[m][0]=1}}e=false;d=false;if(!q&&Math.abs(r.usrCoords[0])>=JXG.Math.eps&&r.scrCoords[1]>=0&&r.scrCoords[1]<=g.board.canvasWidth&&r.scrCoords[2]>=0&&r.scrCoords[2]<=g.board.canvasHeight){e=true}if(!f&&Math.abs(p.usrCoords[0])>=JXG.Math.eps&&p.scrCoords[1]>=0&&p.scrCoords[1]<=g.board.canvasWidth&&p.scrCoords[2]>=0&&p.scrCoords[2]<=g.board.canvasHeight){d=true}if(Math.abs(v[1][0])g.board.canvasHeight){l=v[2]}else{l=v[3]}}else{if(v[1][2]>g.board.canvasHeight){n=v[2];if(v[3][2]<0){l=v[0]}else{l=v[3]}}else{n=v[1];if(v[3][2]<0){l=v[0]}else{if(v[3][2]>g.board.canvasHeight){l=v[2]}else{l=v[3]}}}}}}n=new JXG.Coords(JXG.COORDS_BY_SCREEN,n.slice(1),g.board);l=new JXG.Coords(JXG.COORDS_BY_SCREEN,l.slice(1),g.board);if(!e&&!d){if(!q&&f&&!this.isSameDirection(r,p,n)&&!this.isSameDirection(r,p,l)){return}else{if(q&&!f&&!this.isSameDirection(p,r,n)&&!this.isSameDirection(p,r,l)){return}}}if(!e){if(!d){if(this.isSameDir(r,p,n,l)){u=n;t=l}else{t=n;u=l}}else{if(this.isSameDir(r,p,n,l)){u=n}else{u=l}}}else{if(!d){if(this.isSameDir(r,p,n,l)){t=l}else{t=n}}}if(u){r.setCoordinates(JXG.COORDS_BY_USER,u.usrCoords.slice(1))}if(t){p.setCoordinates(JXG.COORDS_BY_USER,t.usrCoords.slice(1))}},isSameDir:function(j,i,f,e){var d=i.usrCoords[1]-j.usrCoords[1],k=i.usrCoords[2]-j.usrCoords[2],h=e.usrCoords[1]-f.usrCoords[1],g=e.usrCoords[2]-f.usrCoords[2];if(Math.abs(i.usrCoords[0])=0},isSameDirection:function(k,h,f){var e,d,j,i,g=false;e=h.usrCoords[1]-k.usrCoords[1];d=h.usrCoords[2]-k.usrCoords[2];j=f.usrCoords[1]-k.usrCoords[1];i=f.usrCoords[2]-k.usrCoords[2];if(Math.abs(e)=0&&j>=0){if((d>=0&&i>=0)||(d<=0&&i<=0)){g=true}}else{if(e<=0&&j<=0){if((d>=0&&i>=0)||(d<=0&&i<=0)){g=true}}}return g},intersectLineLine:function(o,n,j){var i=o.point1.coords.usrCoords,g=o.point2.coords.usrCoords,f=n.point1.coords.usrCoords,d=n.point2.coords.usrCoords,h,e,m,l,k;if(!JXG.exists(j)){j=o.board}h=i[1]*g[2]-i[2]*g[1];e=f[1]*d[2]-f[2]*d[1];m=(g[2]-i[2])*(f[1]-d[1])-(i[1]-g[1])*(d[2]-f[2]);if(Math.abs(m)0){e=k.center.Dist(u.point1);I=k.center.Dist(u.point2);G=((e*e)+(B*B)-(I*I))/(2*B);z=(e*e)-(G*G);z=(z<0)?0:z;E=Math.sqrt(z);C=k.Radius();n=Math.sqrt((C*C)-E*E);A=H[1]-J[1];v=H[2]-J[2];j=g[1]+(E/B)*v;i=g[2]-(E/B)*A;e=(H[1]*v)-(H[2]*A);I=(j*A)+(i*v);D=(v*v)+(A*A);if(Math.abs(D)p){return[0]}else{if(t=d&&Math.abs(e[3])=d){return this.meetLineCircle(g,e,f,h)}else{return this.meetCircleCircle(g,e,f,h)}}}},meetLineLine:function(e,d,f,h){var g=JXG.Math.crossProduct(e,d);if(Math.abs(g[0])>JXG.Math.eps){g[1]/=g[0];g[2]/=g[0];g[0]=1}return new JXG.Coords(JXG.COORDS_BY_USER,g,h)},meetLineCircle:function(j,e,o,p){var u,s,r,q,l,h,g,f,m,v;if(e[4]=0){m=Math.sqrt(m);v=[(-g+m)/(2*h),(-g-m)/(2*h)];return((o==0)?new JXG.Coords(JXG.COORDS_BY_USER,[-v[0]*(-l[1])-q*l[0],-v[0]*l[0]-q*l[1]],p):new JXG.Coords(JXG.COORDS_BY_USER,[-v[1]*(-l[1])-q*l[0],-v[1]*l[0]-q*l[1]],p))}else{return new JXG.Coords(JXG.COORDS_BY_USER,[0,0,0],p)}},meetCircleCircle:function(f,d,e,g){var h;if(f[4]JXG.Math.eps&&l<10){B=A(o);z=-w(n);v=j(o);u=-i(n);g=B*u-z*v;o-=(u*t-z*s)/g;n-=(B*s-v*t)/g;t=r.X(o)-q.X(n);s=r.Y(o)-q.Y(n);p=t*t+s*s;l++}arguments.callee.t1memo=o;arguments.callee.t2memo=n;if(Math.abs(o)0.1&&Math.abs(f-g.X(l))>0.1&&Math.abs(d-g.Y(l))>0.1)){u=20;v=(g.maxX()-g.minX())/u;w=g.minX();for(s=0;s0.1&&Math.abs(f-g.X(l))>0.1&&Math.abs(d-g.Y(l))>0.1){break}w+=v}}o=l;arguments.callee.t2memo=o}if(Math.abs(h(o))>JXG.Math.eps){k=0}else{k=1}return(new JXG.Coords(JXG.COORDS_BY_USER,[k,g.X(o),g.Y(o)],j))},projectPointToCircle:function(l,d,f){var i=l.coords.distance(JXG.COORDS_BY_USER,d.center.coords),e=l.coords.usrCoords,g=d.center.coords.usrCoords,k,j,h;if(!JXG.exists(f)){f=l.board}if(Math.abs(i)r.maxX()){p=r.minX()+p-r.maxX()}E=new JXG.Coords(JXG.COORDS_BY_USER,[r.X(p),r.Y(p)],j)}else{if(r.visProp.curvetype=="plot"){p=0;C=o;if(r.numberPoints==0){E=new JXG.Coords(JXG.COORDS_BY_USER,[0,1,1],j)}else{if(r.numberPoints==1){E=new JXG.Coords(JXG.COORDS_BY_USER,[r.Z(0),r.X(0),r.Y(0)],j)}else{for(w=0;wJXG.Math.eps){B=u.usrCoords[1]-r.X(w);h=B/A}else{if(Math.abs(e)>JXG.Math.eps){f=u.usrCoords[1]-r.Y(w);h=f/e}else{h=0;u=new JXG.Coords(JXG.COORDS_BY_USER,[r.Z(w),r.X(w),r.Y(w)],j)}}if(0<=h&&h<=1){s=this.distance(u.usrCoords,[1,m,k]);D=w+h}else{if(h<0){u=new JXG.Coords(JXG.COORDS_BY_USER,[r.Z(w),r.X(w),r.Y(w)],j);s=this.distance(u.usrCoords,[1,m,k]);D=w}else{if(h>1&&w+1==r.numberPoints-1){u=new JXG.Coords(JXG.COORDS_BY_USER,[r.Z(w+1),r.X(w+1),r.Y(w+1)],j);s=this.distance(u.usrCoords,[1,m,k]);D=r.numberPoints-1}}}if(s-1){this.monomials[e].coefficient+=f*d.coefficient}else{d.coefficient*=f;this.monomials.push(d)}},add:function(e){var d;if(JXG.exists(e)&&e.ring===this.ring){if(JXG.isArray(e.exponents)){this.addSubMonomial(e,1)}else{for(d=0;d0&&Math.abs(e.center.coords.usrCoords[0])>JXG.Math.eps&&!isNaN(d+e.center.coords.scrCoords[1]+e.center.coords.scrCoords[2])&&d*e.board.unitX<2000000){this.updateEllipsePrim(e.rendNode,e.center.coords.scrCoords[1],e.center.coords.scrCoords[2],(d*e.board.unitX),(d*e.board.unitY))}},drawPolygon:function(d){this.appendChildPrim(this.createPrim("polygon",d.id),d.visProp.layer);this.appendNodesToElement(d,"polygon");this.updatePolygon(d)},updatePolygon:function(d){this._updateVisual(d,{stroke:true,dash:true});this.updatePolygonPrim(d.rendNode,d)},displayCopyright:function(d,e){},drawInternalText:function(d){},updateInternalText:function(d){},drawText:function(d){var e,f;if(d.visProp.display==="html"){e=this.container.ownerDocument.createElement("div");e.style.position="absolute";e.className=d.visProp.cssclass;if(this.container.style.zIndex==""){f=0}else{f=parseInt(this.container.style.zIndex)}e.style.zIndex=f+d.board.options.layer.text;this.container.appendChild(e);e.setAttribute("id",this.container.id+"_"+d.id)}else{e=this.drawInternalText(d)}d.rendNode=e;d.htmlStr="";this.updateText(d)},updateText:function(d){var e=d.plaintext;if(d.visProp.visible){this.updateTextStyle(d,false);if(d.visProp.display==="html"){if(!isNaN(d.coords.scrCoords[1]+d.coords.scrCoords[2])){if(d.visProp.anchorx==="right"){d.rendNode.style.right=parseInt(d.board.canvasWidth-d.coords.scrCoords[1])+"px"}else{if(d.visProp.anchorx==="middle"){d.rendNode.style.left=parseInt(d.coords.scrCoords[1]-0.5*d.size[0])+"px"}else{d.rendNode.style.left=parseInt(d.coords.scrCoords[1])+"px"}}if(d.visProp.anchory==="top"){d.rendNode.style.top=parseInt(d.coords.scrCoords[2]+this.vOffsetText)+"px"}else{if(d.visProp.anchory==="middle"){d.rendNode.style.top=parseInt(d.coords.scrCoords[2]-0.5*d.size[1]+this.vOffsetText)+"px"}else{d.rendNode.style.top=parseInt(d.coords.scrCoords[2]-d.size[1]+this.vOffsetText)+"px"}}}if(d.htmlStr!==e){d.rendNode.innerHTML=e;d.htmlStr=e;if(d.visProp.usemathjax){MathJax.Hub.Queue(["Typeset",MathJax.Hub,d.rendNode])}else{if(d.visProp.useasciimathml){AMprocessNode(d.rendNode,false)}}}this.transformImage(d,d.transformations)}else{this.updateInternalText(d)}}},updateTextStyle:function(g,i){var d,k,l,f,h=g.visProp;if(i){l=h.highlightstrokecolor;k=h.highlightstrokeopacity;f=h.highlightcssclass}else{l=h.strokecolor;k=h.strokeopacity;f=h.cssclass}if(g.visProp.display==="html"||this.type!="canvas"){d=JXG.evaluate(g.visProp.fontsize);if(g.visPropOld.fontsize!=d){try{g.rendNode.style.fontSize=d+"px"}catch(j){g.rendNode.style.fontSize=d}g.visPropOld.fontsize=d}if(g.visPropOld.cssclass!=f){g.rendNode.className=f;g.visPropOld.cssclass=f}}if(g.visProp.display==="html"){this.setObjectStrokeColor(g,l,k)}else{this.updateInternalTextStyle(g,l,k)}return this},updateInternalTextStyle:function(e,f,d){this.setObjectStrokeColor(e,f,d)},drawImage:function(d){},updateImage:function(d){this.updateRectPrim(d.rendNode,d.coords.scrCoords[1],d.coords.scrCoords[2]-d.size[1],d.size[0],d.size[1]);this.updateImageURL(d);this.transformImage(d,d.transformations);this._updateVisual(d,{stroke:true,dash:true},true)},joinTransforms:function(n,o){var k=[[1,0,0],[0,1,0],[0,0,1]],g=n.board.origin.scrCoords[1],f=n.board.origin.scrCoords[2],e=n.board.unitX,d=n.board.unitY,r=[[1,0,0],[-g,1,0],[-f,0,1]],q=[[1,0,0],[0,1/e,0],[0,0,-1/d]],h=[[1,0,0],[0,e,0],[0,0,-d]],j=[[1,0,0],[g,1,0],[f,0,1]],l,p=o.length;for(l=0;l\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 BinFileReader(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 BinFileReader = b64String\nEnd Function\n<\/script>\n')}JXG.GeonextParser={};JXG.GeonextParser.replacePow=function(f){var k,n,l,j,m,g,d,e,h,q,o;f=f.replace(/(\s*)\^(\s*)/g,"^");h=f.indexOf("^");while(h>=0){e=f.slice(0,h);q=f.slice(h+1);if(e.charAt(e.length-1)==")"){k=1;n=e.length-2;while(n>=0&&k>0){l=e.charAt(n);if(l==")"){k++}else{if(l=="("){k--}}n--}if(k==0){j="";g=e.substring(0,n+1);d=n;while(d>=0&&g.substr(d,1).match(/([\w\.]+)/)){j=RegExp.$1+j;d--}j+=e.substring(n+1,e.length);j=j.replace(/([\(\)\+\*\%\^\-\/\]\[])/g,"\\$1")}else{throw new Error("JSXGraph: Missing '(' in expression")}}else{j="[\\w\\.]+"}if(q.match(/^([\w\.]*\()/)){k=1;n=RegExp.$1.length;while(n0){l=q.charAt(n);if(l==")"){k--}else{if(l=="("){k++}}n++}if(k==0){m=q.substring(0,n);m=m.replace(/([\(\)\+\*\%\^\-\/\[\]])/g,"\\$1")}else{throw new Error("JSXGraph: Missing ')' in expression")}}else{m="[\\w\\.]+"}o=new RegExp("("+j+")\\^("+m+")");f=f.replace(o,"JXG.Math.pow($1,$2)");h=f.indexOf("^")}return f};JXG.GeonextParser.replaceIf=function(e){var r="",f,q,h=null,d=null,l=null,g,p,j,m,k,n,o;g=e.indexOf("If(");if(g<0){return e}e=e.replace(/""/g,"0");while(g>=0){f=e.slice(0,g);q=e.slice(g+3);j=1;p=0;m=-1;k=-1;while(p0){n=q.charAt(p);if(n==")"){j--}else{if(n=="("){j++}else{if(n==","&&j==1){if(m<0){m=p}else{k=p}}}}p++}o=q.slice(0,p-1);q=q.slice(p);if(m<0){return""}if(k<0){return""}h=o.slice(0,m);d=o.slice(m+1,k);l=o.slice(k+1);h=this.replaceIf(h);d=this.replaceIf(d);l=this.replaceIf(l);r+=f+"(("+h+")?("+d+"):("+l+"))";e=q;h=null;d=null;g=e.indexOf("If(")}r+=q;return r};JXG.GeonextParser.replaceSub=function(f){if(f.indexOf){}else{return f}var e=f.indexOf("_{"),d;while(e>=0){f=f.substr(0,e)+f.substr(e).replace(/_\{/,"");d=f.substr(e).indexOf("}");if(d>=0){f=f.substr(0,d)+f.substr(d).replace(/\}/,"")}e=f.indexOf("_{")}e=f.indexOf("_");while(e>=0){f=f.substr(0,e)+f.substr(e).replace(/_(.?)/,"$1");e=f.indexOf("_")}return f};JXG.GeonextParser.replaceSup=function(f){if(f.indexOf){}else{return f}var e=f.indexOf("^{"),d;while(e>=0){f=f.substr(0,e)+f.substr(e).replace(/\^\{/,"");d=f.substr(e).indexOf("}");if(d>=0){f=f.substr(0,d)+f.substr(d).replace(/\}/,"")}e=f.indexOf("^{")}e=f.indexOf("^");while(e>=0){f=f.substr(0,e)+f.substr(e).replace(/\^(.?)/,"$1");e=f.indexOf("^")}return f};JXG.GeonextParser.replaceNameById=function(g,j){var l=0,d,k,h,f,e=["X","Y","L","V"];for(f=0;f=0){if(l>=0){d=g.indexOf(")",l+2);if(d>=0){k=g.slice(l+2,d);k=k.replace(/\\(['"])?/g,"$1");h=j.elementsByName[k];g=g.slice(0,l+2)+h.id+g.slice(d)}}d=g.indexOf(")",l+2);l=g.indexOf(e[f]+"(",d)}}l=g.indexOf("Dist(");while(l>=0){if(l>=0){d=g.indexOf(",",l+5);if(d>=0){k=g.slice(l+5,d);k=k.replace(/\\(['"])?/g,"$1");h=j.elementsByName[k];g=g.slice(0,l+5)+h.id+g.slice(d)}}d=g.indexOf(",",l+5);l=g.indexOf(",",d);d=g.indexOf(")",l+1);if(d>=0){k=g.slice(l+1,d);k=k.replace(/\\(['"])?/g,"$1");h=j.elementsByName[k];g=g.slice(0,l+1)+h.id+g.slice(d)}d=g.indexOf(")",l+1);l=g.indexOf("Dist(",d)}e=["Deg","Rad"];for(f=0;f=0){if(l>=0){d=g.indexOf(",",l+4);if(d>=0){k=g.slice(l+4,d);k=k.replace(/\\(['"])?/g,"$1");h=j.elementsByName[k];g=g.slice(0,l+4)+h.id+g.slice(d)}}d=g.indexOf(",",l+4);l=g.indexOf(",",d);d=g.indexOf(",",l+1);if(d>=0){k=g.slice(l+1,d);k=k.replace(/\\(['"])?/g,"$1");h=j.elementsByName[k];g=g.slice(0,l+1)+h.id+g.slice(d)}d=g.indexOf(",",l+1);l=g.indexOf(",",d);d=g.indexOf(")",l+1);if(d>=0){k=g.slice(l+1,d);k=k.replace(/\\(['"])?/g,"$1");h=j.elementsByName[k];g=g.slice(0,l+1)+h.id+g.slice(d)}d=g.indexOf(")",l+1);l=g.indexOf(e[f]+"(",d)}}return g};JXG.GeonextParser.replaceIdByObj=function(d){var e=/(X|Y|L)\(([\w_]+)\)/g;d=d.replace(e,'this.board.objects["$2"].$1()');e=/(V)\(([\w_]+)\)/g;d=d.replace(e,'this.board.objects["$2"].Value()');e=/(Dist)\(([\w_]+),([\w_]+)\)/g;d=d.replace(e,'this.board.objects["$2"].Dist(this.board.objects["$3"])');e=/(Deg)\(([\w_]+),([ \w\[\w_]+),([\w_]+)\)/g;d=d.replace(e,'JXG.Math.Geometry.trueAngle(this.board.objects["$2"],this.board.objects["$3"],this.board.objects["$4"])');e=/Rad\(([\w_]+),([\w_]+),([\w_]+)\)/g;d=d.replace(e,'JXG.Math.Geometry.rad(this.board.objects["$1"],this.board.objects["$2"],this.board.objects["$3"])');e=/N\((.+)\)/g;d=d.replace(e,"($1)");return d};JXG.GeonextParser.geonext2JS=function(e,g){var h,f,d,k=["Abs","ACos","ASin","ATan","Ceil","Cos","Exp","Factorial","Floor","Log","Max","Min","Random","Round","Sin","Sqrt","Tan","Trunc"],j=["Math.abs","Math.acos","Math.asin","Math.atan","Math.ceil","Math.cos","Math.exp","JXG.Math.factorial","Math.floor","Math.log","Math.max","Math.min","Math.random","this.board.round","Math.sin","Math.sqrt","Math.tan","Math.ceil"];e=e.replace(/</g,"<");e=e.replace(/>/g,">");e=e.replace(/&/g,"&");f=e;f=this.replaceNameById(f,g);f=this.replaceIf(f);f=this.replacePow(f);f=this.replaceIdByObj(f);for(d=0;d=0){i[f].addChild(h)}}}else{d=f.replace(/\[/g,"\\[");d=d.replace(/\]/g,"\\]");j=new RegExp("\\(([\\w\\[\\]'_ ]+,)*("+d+")(,[\\w\\[\\]'_ ]+)*\\)","g");if(e.search(j)>=0){i[f].addChild(h)}}}}};JXG.GeonextParser.gxt2jc=function(d,f){var e,h=["Sqrt"],g=["sqrt"];d=d.replace(/</g,"<");d=d.replace(/>/g,">");d=d.replace(/&/g,"&");e=d;e=this.replaceNameById2(e,f);e=e.replace(/True/g,"true");e=e.replace(/False/g,"false");e=e.replace(/fasle/g,"false");return e};JXG.GeonextParser.replaceNameById2=function(g,j){var l=0,d,k,h,f,e=["X","Y","L","V"];for(f=0;f=0){if(l>=0){d=g.indexOf(")",l+2);if(d>=0){k=g.slice(l+2,d);k=k.replace(/\\(['"])?/g,"$1");h=j.elementsByName[k];g=g.slice(0,l+2)+"$('"+h.id+"')"+g.slice(d)}}d=g.indexOf(")",l+2);l=g.indexOf(e[f]+"(",d)}}l=g.indexOf("Dist(");while(l>=0){if(l>=0){d=g.indexOf(",",l+5);if(d>=0){k=g.slice(l+5,d);k=k.replace(/\\(['"])?/g,"$1");h=j.elementsByName[k];g=g.slice(0,l+5)+"$('"+h.id+"')"+g.slice(d)}}d=g.indexOf(",",l+5);l=g.indexOf(",",d);d=g.indexOf(")",l+1);if(d>=0){k=g.slice(l+1,d);k=k.replace(/\\(['"])?/g,"$1");h=j.elementsByName[k];g=g.slice(0,l+1)+"$('"+h.id+"')"+g.slice(d)}d=g.indexOf(")",l+1);l=g.indexOf("Dist(",d)}e=["Deg","Rad"];for(f=0;f=0){if(l>=0){d=g.indexOf(",",l+4);if(d>=0){k=g.slice(l+4,d);k=k.replace(/\\(['"])?/g,"$1");h=j.elementsByName[k];g=g.slice(0,l+4)+"$('"+h.id+"')"+g.slice(d)}}d=g.indexOf(",",l+4);l=g.indexOf(",",d);d=g.indexOf(",",l+1);if(d>=0){k=g.slice(l+1,d);k=k.replace(/\\(['"])?/g,"$1");h=j.elementsByName[k];g=g.slice(0,l+1)+"$('"+h.id+"')"+g.slice(d)}d=g.indexOf(",",l+1);l=g.indexOf(",",d);d=g.indexOf(")",l+1);if(d>=0){k=g.slice(l+1,d);k=k.replace(/\\(['"])?/g,"$1");h=j.elementsByName[k];g=g.slice(0,l+1)+"$('"+h.id+"')"+g.slice(d)}d=g.indexOf(")",l+1);l=g.indexOf(e[f]+"(",d)}}return g};JXG.Board=function(d,i,e,n,m,l,k,j,f,g,h){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;this.BOARD_MODE_CONSTRUCT=16;this.CONSTRUCTION_TYPE_POINT=1129599060;this.CONSTRUCTION_TYPE_CIRCLE=1129595724;this.CONSTRUCTION_TYPE_LINE=1129598030;this.CONSTRUCTION_TYPE_GLIDER=1129596740;this.CONSTRUCTION_TYPE_MIDPOINT=1129598288;this.CONSTRUCTION_TYPE_PERPENDICULAR=1129599044;this.CONSTRUCTION_TYPE_PARALLEL=1129599052;this.CONSTRUCTION_TYPE_INTERSECTION=1129597267;this.container=d;this.containerObj=typeof document!="undefined"?document.getElementById(this.container):null;if(typeof document!="undefined"&&this.containerObj==null){throw new Error("\nJSXGraph: HTML container element '"+(d)+"' not found.")}this.renderer=i;this.grids=[];this.options=JXG.deepCopy(JXG.Options);this.dimension=2;this.jc=new JXG.JessieCode();this.jc.use(this);this.origin={};this.origin.usrCoords=[1,0,0];this.origin.scrCoords=[1,n[0],n[1]];this.zoomX=m;this.zoomY=l;this.unitX=k*this.zoomX;this.unitY=j*this.zoomY;this.canvasWidth=f;this.canvasHeight=g;if(JXG.exists(e)&&e!==""&&typeof document!="undefined"&&!JXG.exists(document.getElementById(e))){this.id=e}else{this.id=this.generateId()}this.eventHandlers={};this.hooks=[];this.dependentBoards=[];this.inUpdate=false;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=false;this.calculateSnapSizes();this.drag_dx=0;this.drag_dy=0;this.mouse=null;this.touches=[];this.xmlString="";this.cPos=[];this.touchMoveLast=0;this.downObjects=[];this.showCopyright=false;if((h!=null&&h)||(h==null&&this.options.showCopyright)){this.showCopyright=true;this.renderer.displayCopyright(JXG.JSXGraph.licenseText,this.options.text.fontSize)}this.needsFullUpdate=false;this.reducedUpdate=false;this.currentCBDef="none";this.geonextCompatibilityMode=false;if(this.options.text.useASCIIMathML&&translateASCIIMath){init()}else{this.options.text.useASCIIMathML=false}this.hasMouseHandlers=false;this.hasTouchHandlers=false;this.hasMouseUp=false;this.hasTouchEnd=false;this.addEventHandlers();this.methodMap={update:"update",on:"on",off:"off",setView:"setBoundingBox",setBoundingBox:"setBoundingBox",migratePoint:"migratePoint",colorblind:"emulateColorblindness"}};JXG.extend(JXG.Board.prototype,{generateName:function(f){if(f.type==JXG.OBJECT_TYPE_TICKS){return""}var l,h=2,e="",m="",n=[],d="",k,g;if(f.elementClass==JXG.OBJECT_CLASS_POINT){l=["","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"]}else{if(f.type==JXG.OBJECT_TYPE_ANGLE){if(false){l=["","α","β","γ","δ","ε","ζ","η","θ","ι","κ","λ","μ","ν","ξ","ο","π","ρ","σ","τ","υ","φ","χ","ψ","ω"]}else{l=["","α","β","γ","δ","ε","ζ","η","θ","ι","κ","λ","μ","ν","ξ","ο","π","ρ","σ","τ","υ","φ","χ","ψ","ω"]}}else{l=["","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"]}}if(f.elementClass!==JXG.OBJECT_CLASS_POINT&&f.elementClass!=JXG.OBJECT_CLASS_LINE&&f.type!=JXG.OBJECT_TYPE_ANGLE){if(f.type===JXG.OBJECT_TYPE_POLYGON){e="P_{"}else{if(f.elementClass===JXG.OBJECT_CLASS_CIRCLE){e="k_{"}else{if(f.type===JXG.OBJECT_TYPE_TEXT){e="t_{"}else{e="s_{"}}}m="}"}for(k=0;k0;k--){d+=l[n[k-1]]}if(this.elementsByName[d+m]==null){return d+m}}n[0]=l.length;for(k=1;k0&&(this.mode===JXG.BOARD_MODE_DRAG||this.mode===JXG.BOARD_MODE_MOVE_ORIGIN)){return this.cPos}if(!g.currentStyle&&f.defaultView){g=document.documentElement;e[0]+=d("margin-left");e[1]+=d("margin-top");e[0]+=d("border-left-width");e[1]+=d("border-top-width");e[0]+=d("padding-left");e[1]+=d("padding-top");g=this.containerObj}e[0]+=d("border-left-width");e[1]+=d("border-top-width");if(this.renderer.type!=="vml"){e[0]+=d("padding-left");e[1]+=d("padding-top")}this.cPos=e;return e},getMousePosition:function(h,f){var g=this.getCoordsTopLeftCorner(),d;d=JXG.getPosition(h,f);return[d[0]-g[0],d[1]-g[1]]},initMoveOrigin:function(d,e){this.drag_dx=d-this.origin.scrCoords[1];this.drag_dy=e-this.origin.scrCoords[2];this.mode=this.BOARD_MODE_MOVE_ORIGIN},initMoveObject:function(l,k,m,j){var h,e,i=[],f,g=this.objectsList.length,d={visProp:{layer:-10000}};for(e=0;e=d.visProp.layer){if(JXG.exists(d.label)&&h==d.label.content){continue}d=h;i[0]=d}}}if(i.length>0){this.mode=this.BOARD_MODE_DRAG}if(this.options.takeFirst){i.length=1}return i},moveObject:function(d,k,j,e,h){var f=new JXG.Coords(JXG.COORDS_BY_SCREEN,this.getScrCoordsOfMouse(d,k),this),g=j.obj,i;if(g.type!=JXG.OBJECT_TYPE_GLIDER){if(!isNaN(j.targets[0].Xprev+j.targets[0].Yprev)){g.setPositionDirectly(JXG.COORDS_BY_SCREEN,f.scrCoords.slice(1),[j.targets[0].Xprev,j.targets[0].Yprev])}j.targets[0].Xprev=f.scrCoords[1];j.targets[0].Yprev=f.scrCoords[2];this.update(g)}else{if(g.type==JXG.OBJECT_TYPE_GLIDER){i=g.coords;g.setPositionDirectly(JXG.COORDS_BY_USER,f.usrCoords.slice(1));if(g.slideObject.elementClass==JXG.OBJECT_CLASS_CIRCLE){g.coords=JXG.Math.Geometry.projectPointToCircle(g,g.slideObject,this)}else{if(g.slideObject.elementClass==JXG.OBJECT_CLASS_LINE){g.coords=JXG.Math.Geometry.projectPointToLine(g,g.slideObject,this)}}if(g.group.length!=0){g.group[g.group.length-1].dX=g.coords.scrCoords[1]-i.scrCoords[1];g.group[g.group.length-1].dY=g.coords.scrCoords[2]-i.scrCoords[2];g.group[g.group.length-1].update(this)}else{this.update(g)}}}g.triggerEventHandlers([h+"drag","drag"],e);this.updateInfobox(g);this.update();g.highlight(true)},twoFingerMove:function(j,h,i,e){var d,f,g;if(JXG.exists(i)&&JXG.exists(i.obj)){g=i.obj}else{return}d=new JXG.Coords(JXG.COORDS_BY_SCREEN,this.getScrCoordsOfMouse(j[0],j[1]),this);f=new JXG.Coords(JXG.COORDS_BY_SCREEN,this.getScrCoordsOfMouse(h[0],h[1]),this);if(g.elementClass===JXG.OBJECT_CLASS_LINE){this.moveLine(d,f,i,g)}else{if(g.elementClass===JXG.OBJECT_CLASS_CIRCLE){this.moveCircle(d,f,i,g)}}g.triggerEventHandlers(["touchdrag","drag"],e);i.targets[0].Xprev=d.scrCoords[1];i.targets[0].Yprev=d.scrCoords[2];i.targets[1].Xprev=f.scrCoords[1];i.targets[1].Yprev=f.scrCoords[2]},moveLine:function(z,g,s,u){var A,w,r,q,h,n,i,t,v,e,f,p,m,l,k,j;if(JXG.exists(s.targets[0])&&JXG.exists(s.targets[1])&&!isNaN(s.targets[0].Xprev+s.targets[0].Yprev+s.targets[1].Xprev+s.targets[1].Yprev)){A=z.usrCoords;w=g.usrCoords;r=(new JXG.Coords(JXG.COORDS_BY_SCREEN,[s.targets[0].Xprev,s.targets[0].Yprev],this)).usrCoords;q=(new JXG.Coords(JXG.COORDS_BY_SCREEN,[s.targets[1].Xprev,s.targets[1].Yprev],this)).usrCoords;n=[1,(r[1]+q[1])*0.5,(r[2]+q[2])*0.5];h=[1,(A[1]+w[1])*0.5,(A[2]+w[2])*0.5];t=JXG.Math.crossProduct(r,q);i=JXG.Math.crossProduct(A,w);e=JXG.Math.crossProduct(t,i);if(Math.abs(e[0])0){s.preventDefault();s.stopPropagation()}if(JXG.isWebkitAndroid()){var e=new Date();this.touchMoveLast=e.getTime()-200}this.options.precision.hasPoint=this.options.precision.mouse;this.triggerEventHandlers(["touchstart","down"],s);return this.touches.length>0},touchMoveListener:function(d){var e,g=0,j,h=d[JXG.touchProperty];if(this.mode!==this.BOARD_MODE_NONE){d.preventDefault();d.stopPropagation()}if(JXG.isWebkitAndroid()){var f=new Date();f=f.getTime();if(f-this.touchMoveLast<80){this.updateQuality=this.BOARD_QUALITY_HIGH;this.triggerEventHandlers(["touchmove","move"],d,this.mode);return false}else{this.touchMoveLast=f}}if(this.mode!=this.BOARD_MODE_DRAG){this.renderer.hide(this.infobox)}this.options.precision.hasPoint=this.options.precision.touch;if(!this.touchOriginMove(d)){if(this.mode==this.BOARD_MODE_DRAG){for(e=0;e-1&&this.touches[e].targets[1].num>-1){if(h[this.touches[e].targets[0].num]&&h[this.touches[e].targets[1].num]){this.touches[e].targets[0].X=h[this.touches[e].targets[0].num].screenX;this.touches[e].targets[0].Y=h[this.touches[e].targets[0].num].screenY;this.touches[e].targets[1].X=h[this.touches[e].targets[1].num].screenX;this.touches[e].targets[1].Y=h[this.touches[e].targets[1].num].screenY;this.twoFingerMove(this.getMousePosition(d,this.touches[e].targets[0].num),this.getMousePosition(d,this.touches[e].targets[1].num),this.touches[e],d)}}}}}}if(this.mode!=this.BOARD_MODE_DRAG){this.renderer.hide(this.infobox)}this.options.precision.hasPoint=this.options.precision.mouse;this.triggerEventHandlers(["touchmove","move"],d,this.mode);return this.mode===this.BOARD_MODE_NONE},touchEndListener:function(m){var f,e,d,o=this.options.precision.touch,l=[],n,g,h=m[JXG.touchProperty];this.triggerEventHandlers(["touchend","up"],m);this.renderer.hide(this.infobox);if(h.length>0){for(f=0;f0){this.zoomIn(f.usrCoords[1],f.usrCoords[2])}else{this.zoomOut(f.usrCoords[1],f.usrCoords[2])}d.preventDefault();return false},updateInfobox:function(e){var d,h,f,g;if(!e.visProp.showinfobox){return this}if(e.elementClass==JXG.OBJECT_CLASS_POINT){f=e.coords.usrCoords[1];g=e.coords.usrCoords[2];this.infobox.setCoords(f+this.infobox.distanceX/(this.unitX),g+this.infobox.distanceY/(this.unitY));if(typeof(e.infoboxText)!="string"){if(e.visProp.infoboxdigits==="auto"){d=JXG.autoDigits(f);h=JXG.autoDigits(g)}else{if(JXG.isNumber(e.visProp.infoboxdigits)){d=f.toFixed(e.visProp.infoboxdigits);h=g.toFixed(e.visProp.infoboxdigits)}else{d=f;h=g}}this.highlightInfobox(d,h,e)}else{this.highlightCustomInfobox(e.infoboxText,e)}this.renderer.show(this.infobox)}return this},highlightCustomInfobox:function(d){this.infobox.setText(d);return this},highlightInfobox:function(d,f,e){this.highlightCustomInfobox("("+d+", "+f+")");return this},dehighlightAll:function(){var e,f,d=false;for(e in this.highlightedObjects){f=this.highlightedObjects[e];if(this.hasMouseHandlers){f.noHighlight()}d=true}this.highlightedObjects={};if(this.options.renderer=="canvas"&&d){this.prepareUpdate();this.renderer.suspendRedraw(this);this.updateRenderer();this.renderer.unsuspendRedraw()}return this},getScrCoordsOfMouse:function(d,e){return[d,e]},getUsrCoordsOfMouse:function(f){var g=this.getCoordsTopLeftCorner(),e=JXG.getPosition(f),d=e[0]-g[0],i=e[1]-g[1],h=new JXG.Coords(JXG.COORDS_BY_SCREEN,[d,i],this);return h.usrCoords.slice(1)},getAllUnderMouse:function(d){var e=this.getAllObjectsUnderMouse(d);e.push(this.getUsrCoordsOfMouse(d));return e},getAllObjectsUnderMouse:function(i){var j=this.getCoordsTopLeftCorner(),d=JXG.getPosition(i),l=d[0]-j[0],k=d[1]-j[1],g=[],e,h,f=this.objectsList.length;for(e=0;e"),l=o.indexOf(""),k,h,g,q,d,f;if(n<0){return}while(n>=0){k=o.slice(n+6,l);h=k.indexOf("=");g=k.slice(0,h);q=k.slice(h+1);h=g.indexOf(".");d=g.slice(0,h);f=this.elementsByName[JXG.unescapeHTML(d)];var p=g.slice(h+1).replace(/\s+/g,"").toLowerCase();q=JXG.GeonextParser.geonext2JS(q,this);q=q.replace(/this\.board\./g,"this.");if(!JXG.exists(this.elementsByName[d])){JXG.debug("debug conditions: |"+d+"| undefined")}e+='el = this.objects["'+f.id+'"];\n';switch(p){case"x":e+="var y=el.coords.usrCoords[2];\n";e+="el.setPositionDirectly(JXG.COORDS_BY_USER,["+(q)+",y]);\n";e+="el.prepareUpdate().update();\n";break;case"y":e+="var x=el.coords.usrCoords[1];\n";e+="el.coords=new JXG.Coords(JXG.COORDS_BY_USER,[x,"+(q)+"],this);\n";e+="el.setPositionDirectly(JXG.COORDS_BY_USER,[x,"+(q)+"]);\n";e+="el.prepareUpdate().update();\n";break;case"visible":e+="var c="+(q)+";\n";e+="el.visProp.visible = c;\n";e+="if (c) {el.showElement();} else {el.hideElement();}\n";break;case"position":e+="el.position = "+(q)+";\n";e+="el.prepareUpdate().update(true);\n";break;case"stroke":e+="rgbo = JXG.rgba2rgbo("+(q)+");\n";e+="el.visProp.strokecolor = rgbo[0];\n";e+="el.visProp.strokeopacity = rgbo[1];\n";break;case"style":e+="el.setStyle("+(q)+");\n";break;case"strokewidth":e+="el.strokeWidth = "+(q)+";\n";break;case"fill":e+="var rgbo = JXG.rgba2rgbo("+(q)+");\n";e+="el.visProp.fillcolor = rgbo[0];\n";e+="el.visProp.fillopacity = rgbo[1];\n";break;case"label":break;default:JXG.debug("property '"+p+"' in conditions not yet implemented:"+q);break}o=o.slice(l+7);n=o.indexOf("");l=o.indexOf("")}e+="this.prepareUpdate().updateElements();\n";e+="return true;\n";e=e.replace(/</g,"<");e=e.replace(/>/g,">");e=e.replace(/&/g,"&");this.updateConditions=new Function(e);this.updateConditions()},updateConditions:function(){return false},calculateSnapSizes:function(){var f=new JXG.Coords(JXG.COORDS_BY_USER,[0,0],this),e=new JXG.Coords(JXG.COORDS_BY_USER,[this.options.grid.gridX,this.options.grid.gridY],this),d=f.scrCoords[1]-e.scrCoords[1],g=f.scrCoords[2]-e.scrCoords[2];this.options.grid.snapSizeX=this.options.grid.gridX;while(Math.abs(d)>25){this.options.grid.snapSizeX*=2;d/=2}this.options.grid.snapSizeY=this.options.grid.gridY;while(Math.abs(g)>25){this.options.grid.snapSizeY*=2;g/=2}return this},applyZoom:function(){var f,e,d=this.objectsList.length;for(e=0;ee){e=k.coords.usrCoords[1]}}if(k.coords.usrCoords[2]>d){d=k.coords.usrCoords[2]}else{if(k.coords.usrCoords[2]-1){this.objectsList.splice(d._pos,1);for(g=d._pos;g=0){e+=""+this.objects[g].id+": "}for(j in this.objects[g].childElements){e+=this.objects[g].childElements[j].id+"("+this.objects[g].childElements[j].name+"), "}e+="

\n"}e+="

\n";h=window.open();h.document.open();h.document.write(e);h.document.close();return this},showXML:function(){var d=window.open("");d.document.open();d.document.write("
"+JXG.escapeHTML(this.xmlString)+"
");d.document.close();return this},prepareUpdate:function(){var e,f,d=this.objectsList.length;for(e=0;en&&f[e]-1){this.eventHandlers[f].splice(d,1)}}else{this.eventHandlers[f].length=0}return this},removeEvent:JXG.shortcut(JXG.Board.prototype,"off"),updateHooks:function(d){arguments[0]=JXG.def(arguments[0],"update");this.triggerEventHandlers.apply(this,arguments);return this},triggerEventHandlers:function(l){var g,f,k,d,e=Array.prototype.slice.call(arguments,1);if(!JXG.isArray(l)){l=[l]}for(f=0;f=0;d--){if(this.dependentBoards[d]==e){this.dependentBoards.splice(d,1)}}return this},update:function(g){var f,e,h,d;if(this.inUpdate||this.isSuspendedUpdate){return this}this.inUpdate=true;this.prepareUpdate(g).updateElements(g).updateConditions();this.renderer.suspendRedraw(this);this.updateRenderer(g);this.renderer.unsuspendRedraw();this.triggerEventHandlers("update");e=this.dependentBoards.length;for(f=0;f-n){s=-A;o.applyOnce(j)}else{if(s>A&&s0){q=setInterval(this.rolling,e)}return this};this.stop=function(){clearInterval(q);return this};return this};return new d()}});JXG.Options={showCopyright:true,showNavigation:true,takeSizeFromFile:false,renderer:"svg",takeFirst:false,pan:true,animationDelay:35,zoom:{factorX:1.25,factorY:1.25,wheel:false},jc:{enabled:true,compile:true},navbar:{strokeColor:"#aaaaaa",fillColor:"#f5f5f5",padding:"2px",position:"absolute",fontSize:"10px",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,strokeWidth:2,highlightStrokeWidth:2,fixed:false,frozen:false,withLabel:false,visible:true,priv:false,layer:0,dash:0,shadow:false,trace:false,traceAttributes:{},highlight:true,needsRegularUpdate:true,snapToGrid:false,draft:{draft:false,strokeColor:"#565656",fillColor:"#565656",strokeOpacity:0.8,fillOpacity:0.8,strokeWidth:1}},ticks:{drawLabels:false,label:{},drawZero:false,insertTicks:false,minTicksDistance:50,minorHeight:4,majorHeight:10,minorTicks:4,scale:1,scaleSymbol:"",labels:[],ticksDistance:1,strokeOpacity:1,strokeWidth:1,strokeColor:"black",highlightStrokeColor:"#888888"},precision:{touch:30,touchMax:100,mouse:4,epsilon:0.0001,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,grid:1,image:0,trace:0},angle:{withLabel:true,radius:0.5,type:"sector",orthoType:"square",orthoSensitivity:1,fillColor:"#FF7F00",highlightFillColor:"#FF7F00",strokeColor:"#FF7F00",fillOpacity:0.3,highlightFillOpacity:0.3,radiuspoint:{withLabel:false,visible:false,name:""},pointsquare:{withLabel:false,visible:false,name:""},dot:{visible:false,strokeColor:"none",fillColor:"black",size:2,face:"o",withLabel:false,name:""},label:{position:"top",offset:[0,0],strokeColor:"#0000FF"}},arc:{label:{},firstArrow:false,lastArrow:false,fillColor:"none",highlightFillColor:"none",strokeColor:"#0000ff",highlightStrokeColor:"#C3D9FF",useDirection:false},axis:{needsRegularUpdate:false,strokeWidth:1,strokeColor:"#666666",highlightStrokeWidth:1,highlightStrokeColor:"#888888",withTicks:true,straightFirst:true,straightLast:true,lastArrow:true,withLabel:false,ticks:{label:{offset:[4,-12+3]},needsRegularUpdate:false,strokeWidth:1,strokeColor:"#666666",highlightStrokeColor:"#888888",drawLabels:true,drawZero:false,insertTicks:true,minTicksDistance:10,minorHeight:4,majorHeight:-1,minorTicks:4,ticksDistance:1,strokeOpacity:0.25},point1:{needsRegularUpdate:false},point2:{needsRegularUpdate:false},label:{position:"lft",offset:[10,-20]}},bisector:{strokeColor:"#000000",point:{visible:false,fixed:false,withLabel:false,name:""}},bisectorlines:{line1:{strokeColor:"black"},line2:{strokeColor:"black"}},chart:{chartStyle:"line",colors:["#B02B2C","#3F4C6B","#C79810","#D15600","#FFFF88","#C3D9FF","#4096EE","#008C00"],highlightcolors:null,fillcolor:null,highlightonsector:false,highlightbysize:false},circle:{fillColor:"none",highlightFillColor:"none",strokeColor:"#0000ff",highlightStrokeColor:"#C3D9FF",center:{visible:false,withLabel:false,fixed:false,name:""},label:{position:"urt"}},circumcircle:{fillColor:"none",highlightFillColor:"none",strokeColor:"#0000ff",highlightStrokeColor:"#C3D9FF",center:{visible:false,fixed:false,withLabel:false,name:""}},circumcirclearc:{fillColor:"none",highlightFillColor:"none",strokeColor:"#0000ff",highlightStrokeColor:"#C3D9FF",center:{visible:false,withLabel:false,fixed:false,name:""}},circumcirclesector:{useDirection:true,fillColor:"#00FF00",highlightFillColor:"#00FF00",fillOpacity:0.3,highlightFillOpacity:0.3,strokeColor:"#0000ff",highlightStrokeColor:"#C3D9FF",point:{visible:false,fixed:false,withLabel:false,name:""}},conic:{fillColor:"none",highlightFillColor:"none",strokeColor:"#0000ff",highlightStrokeColor:"#C3D9FF",foci:{fixed:false,visible:false,withLabel:false,name:""}},curve:{strokeWidth:1,strokeColor:"#0000ff",fillColor:"none",handDrawing:false,curveType:null,RDPsmoothing:false,numberPointsHigh:1600,numberPointsLow:400,doAdvancedPlot:true,label:{position:"lft"}},glider:{label:{}},grid:{needsRegularUpdate:false,hasGrid:false,gridX:1,gridY:1,strokeColor:"#C0C0C0",strokeOpacity:"0.5",strokeWidth:1,dash:0,snapToGrid:false,snapSizeX:10,snapSizeY:10},image:{imageString:null,fillOpacity:1,rotate:0},incircle:{fillColor:"none",highlightFillColor:"none",strokeColor:"#0000ff",highlightStrokeColor:"#C3D9FF",center:{visible:false,fixed:false,withLabel:false,name:""}},infobox:{fontSize:12,isLabel:false,strokeColor:"#bbbbbb",display:"html",anchorX:"left",anchorY:"middle",cssClass:"JXGinfobox",rotate:0,visible:true},integral:{withLabel:true,strokeWidth:0,strokeOpacity:0,fillOpacity:0.8,curveLeft:{visible:true,layer:9},baseLeft:{visible:false,fixed:false,withLabel:false,name:""},curveRight:{visible:true,layer:9},baseRight:{visible:false,fixed:false,withLabel:false,name:""},label:{fontSize:20}},label:{strokeColor:"black",fixed:true,position:"urt",offset:[10,10]},legend:{style:"vertical",labels:["1","2","3","4","5","6","7","8"],colors:["#B02B2C","#3F4C6B","#C79810","#D15600","#FFFF88","#C3D9FF","#4096EE","#008C00"]},line:{firstArrow:false,lastArrow:false,straightFirst:true,straightLast:true,fillColor:"none",highlightFillColor:"none",strokeColor:"#0000ff",highlightStrokeColor:"#888888",withTicks:false,point1:{visible:false,withLabel:false,fixed:false,name:""},point2:{visible:false,withLabel:false,fixed:false,name:""},ticks:{drawLabels:true,label:{offset:[4,-12+3]},drawZero:false,insertTicks:false,minTicksDistance:50,maxTicksDistance:300,minorHeight:4,majorHeight:-1,minorTicks:4,defaultDistance:1,strokeOpacity:0.3},label:{position:"llft"}},locus:{translateToOrigin:false,translateTo10:false,stretch:false,toOrigin:null,to10:null},normal:{strokeColor:"#000000",point:{visible:false,fixed:false,withLabel:false,name:""}},orthogonalprojection:{},parallel:{strokeColor:"#000000",point:{visible:false,fixed:false,withLabel:false,name:""}},perpendicular:{strokeColor:"#000000",straightFirst:true,straightLast:true},perpendicularsegment:{strokeColor:"#000000",straightFirst:false,straightLast:false,point:{visible:false,fixed:true,withLabel:false,name:""}},point:{withLabel:true,label:{},style:5,face:"o",size:3,fillColor:"#ff0000",highlightFillColor:"#EEEEEE",strokeWidth:2,strokeColor:"#ff0000",highlightStrokeColor:"#C3D9FF",zoom:false,showInfobox:true,infoboxDigits:"auto",draft:false,attractors:[],attractorDistance:0,snatchDistance:0,snapToGrid:false,snapSizeX:1,snapSizeY:1,snapToPoints:false},polygon:{hasInnerPoints:false,fillColor:"#00FF00",highlightFillColor:"#00FF00",fillOpacity:0.3,highlightFillOpacity:0.3,withLines:true,borders:{withLabel:false,strokeWidth:1,highlightStrokeWidth:1,layer:5},vertices:{withLabel:true,strokeColor:"#ff0000",fillColor:"#ff0000",fixed:true},label:{offset:[0,0]}},riemannsum:{withLabel:false,fillOpacity:0.3,fillColor:"#ffff00"},sector:{fillColor:"#00FF00",highlightFillColor:"#00FF00",fillOpacity:0.3,highlightFillOpacity:0.3,label:{offset:[0,0]}},semicircle:{midpoint:{visible:false,withLabel:false,fixed:false,name:""}},slider:{snapWidth:-1,precision:2,firstArrow:false,lastArrow:false,withTicks:true,withLabel:true,layer:9,showInfobox:false,name:"",visible:true,strokeColor:"#000000",highlightStrokeColor:"#888888",fillColor:"#ffffff",highlightFillColor:"none",size:6,point1:{needsRegularUpdate:false,showInfobox:false,withLabel:false,visible:false,fixed:true,name:""},point2:{needsRegularUpdate:false,showInfobox:false,withLabel:false,visible:false,fixed:true,name:""},baseline:{needsRegularUpdate:false,name:"",strokeWidth:1,strokeColor:"#000000",highlightStrokeColor:"#888888"},ticks:{needsRegularUpdate:false,drawLabels:false,drawZero:true,insertTicks:true,minorHeight:4,majorHeight:10,minorTicks:0,defaultDistance:1,strokeOpacity:1,strokeWidth:1,strokeColor:"#000000"},highline:{strokeWidth:3,name:"",strokeColor:"#000000",highlightStrokeColor:"#888888"},label:{strokeColor:"#000000"}},text:{fontSize:12,digits:2,isLabel:false,strokeColor:"#000000",useASCIIMathML:false,useMathJax:false,display:"html",anchorX:"left",anchorY:"middle",cssClass:"JXGtext",highlightCssClass:"JXGtext",withLabel:false,rotate:0,visible:true},tracecurve:{strokeColor:"#000000",fillColor:"none",numberPoints:100},turtle:{strokeWidth:1,fillColor:"none",strokeColor:"#000000",arrow:{strokeWidth:2,withLabel:false,strokeColor:"#ff0000"}},shortcuts:{color:["strokeColor","fillColor"],opacity:["strokeOpacity","fillOpacity"],highlightColor:["highlightStrokeColor","highlightFillColor"],highlightOpacity:["highlightStrokeOpacity","highlightFillOpacity"],strokeWidth:["strokeWidth","highlightStrokeWidth"]}};JXG.Validator=(function(){var k=function(i){return/^[0-9]+px$/.test(i)},m=function(i){return(i in {html:0,internal:0})},n=function(i){return JXG.isString(i)},l=function(i){return JXG.exists(JXG.Point.prototype.normalizeFace.call(this,i))},p=function(i){return(Math.abs(i-Math.round(i))0},h=function(i){return i.length>=2&&p(i[0])&&p(i[1])},d=function(i){return(i in {vml:0,svg:0,canvas:0})},j=function(i){return i>0},g=function(i){return !(i<0)},f,o={},e={attractorDistance:g,color:n,defaultDistance:JXG.isNumber,display:m,doAdvancedPlot:false,draft:false,drawLabels:false,drawZero:false,face:l,factor:JXG.isNumber,fillColor:n,fillOpacity:JXG.isNumber,firstArrow:false,fontSize:p,dash:p,gridX:JXG.isNumber,gridY:JXG.isNumber,hasGrid:false,highlightFillColor:n,highlightFillOpacity:JXG.isNumber,highlightStrokeColor:n,highlightStrokeOpacity:JXG.isNumber,insertTicks:false,lastArrow:false,majorHeight:p,maxTicksDistance:q,minorHeight:p,minorTicks:q,minTicksDistance:q,numberPointsHigh:q,numberPointsLow:q,opacity:JXG.isNumber,radius:JXG.isNumber,RDPsmoothing:false,renderer:d,right:k,showCopyright:false,showInfobox:false,showNavigation:false,size:p,snapSizeX:j,snapSizeY:j,snapWidth:JXG.isNumber,snapToGrid:false,snatchDistance:g,straightFirst:false,straightLast:false,stretch:false,strokeColor:n,strokeOpacity:JXG.isNumber,strokeWidth:p,takeFirst:false,takeSizeFromFile:false,to10:false,toOrigin:false,translateTo10:false,translateToOrigin:false,useASCIIMathML:false,useDirection:false,useMathJax:false,withLabel:false,withTicks:false,zoom:false};for(f in e){o[f.toLowerCase()]=e[f]}return o})();JXG.useStandardOptions=function(h){var j=JXG.Options,g=h.hasGrid,f,e,i,d;h.options.grid.hasGrid=j.grid.hasGrid;h.options.grid.gridX=j.grid.gridX;h.options.grid.gridY=j.grid.gridY;h.options.grid.gridColor=j.grid.gridColor;h.options.grid.gridOpacity=j.grid.gridOpacity;h.options.grid.gridDash=j.grid.gridDash;h.options.grid.snapToGrid=j.grid.snapToGrid;h.options.grid.snapSizeX=j.grid.SnapSizeX;h.options.grid.snapSizeY=j.grid.SnapSizeY;h.takeSizeFromFile=j.takeSizeFromFile;d=function(k,l){k.visProp.fillcolor=l.fillColor;k.visProp.highlightfillcolor=l.highlightFillColor;k.visProp.strokecolor=l.strokeColor;k.visProp.highlightstrokecolor=l.highlightStrokeColor};for(f in h.objects){i=h.objects[f];if(i.elementClass==JXG.OBJECT_CLASS_POINT){d(i,j.point)}else{if(i.elementClass==JXG.OBJECT_CLASS_LINE){d(i,j.line);for(e in i.ticks){e.majorTicks=j.line.ticks.majorTicks;e.minTicksDistance=j.line.ticks.minTicksDistance;e.visProp.minorheight=j.line.ticks.minorHeight;e.visProp.majorheight=j.line.ticks.majorHeight}}else{if(i.elementClass==JXG.OBJECT_CLASS_CIRCLE){d(i,j.circle)}else{if(i.type==JXG.OBJECT_TYPE_ANGLE){d(i,j.angle)}else{if(i.type==JXG.OBJECT_TYPE_ARC){d(i,j.arc)}else{if(i.type==JXG.OBJECT_TYPE_POLYGON){d(i,j.polygon)}else{if(i.type==JXG.OBJECT_TYPE_CONIC){d(i,j.conic)}else{if(i.type==JXG.OBJECT_TYPE_CURVE){d(i,j.curve)}else{if(i.type==JXG.OBJECT_TYPE_SECTOR){i.arc.visProp.fillcolor=j.sector.fillColor;i.arc.visProp.highlightfillcolor=j.sector.highlightFillColor;i.arc.visProp.fillopacity=j.sector.fillOpacity;i.arc.visProp.highlightfillopacity=j.sector.highlightFillOpacity}}}}}}}}}}h.fullUpdate();if(g&&!h.hasGrid){h.removeGrids(h)}else{if(!g&&h.hasGrid){h.create("grid",[])}}};JXG.useBlackWhiteOptions=function(d){var e=JXG.Options;e.point.fillColor=JXG.rgb2bw(e.point.fillColor);e.point.highlightFillColor=JXG.rgb2bw(e.point.highlightFillColor);e.point.strokeColor=JXG.rgb2bw(e.point.strokeColor);e.point.highlightStrokeColor=JXG.rgb2bw(e.point.highlightStrokeColor);e.line.fillColor=JXG.rgb2bw(e.line.fillColor);e.line.highlightFillColor=JXG.rgb2bw(e.line.highlightFillColor);e.line.strokeColor=JXG.rgb2bw(e.line.strokeColor);e.line.highlightStrokeColor=JXG.rgb2bw(e.line.highlightStrokeColor);e.circle.fillColor=JXG.rgb2bw(e.circle.fillColor);e.circle.highlightFillColor=JXG.rgb2bw(e.circle.highlightFillColor);e.circle.strokeColor=JXG.rgb2bw(e.circle.strokeColor);e.circle.highlightStrokeColor=JXG.rgb2bw(e.circle.highlightStrokeColor);e.arc.fillColor=JXG.rgb2bw(e.arc.fillColor);e.arc.highlightFillColor=JXG.rgb2bw(e.arc.highlightFillColor);e.arc.strokeColor=JXG.rgb2bw(e.arc.strokeColor);e.arc.highlightStrokeColor=JXG.rgb2bw(e.arc.highlightStrokeColor);e.polygon.fillColor=JXG.rgb2bw(e.polygon.fillColor);e.polygon.highlightFillColor=JXG.rgb2bw(e.polygon.highlightFillColor);e.sector.fillColor=JXG.rgb2bw(e.sector.fillColor);e.sector.highlightFillColor=JXG.rgb2bw(e.sector.highlightFillColor);e.curve.strokeColor=JXG.rgb2bw(e.curve.strokeColor);e.grid.gridColor=JXG.rgb2bw(e.grid.gridColor);JXG.useStandardOptions(d)};JXG.JSXGraph={licenseText:"JSXGraph v0.95 Copyright (C) see http://jsxgraph.org",boards:{},elements:{},rendererType:(function(){var e=function(h){var f,g;if(JXG.rendererFiles[h]){f=JXG.rendererFiles[h].split(",");for(g=0;g0){this.board=h;this.type=g;this.elementClass=i||JXG.OBJECT_CLASS_OTHER;this.id=d.id;e=d.name;if(!JXG.exists(e)){e=this.board.generateName(this)}this.board.elementsByName[e]=this;this.name=e;this.needsRegularUpdate=d.needsregularupdate;JXG.clearVisPropOld(this);d=this.resolveShortcuts(d);for(f in d){this._set(f,d[f])}this.visProp.draft=d.draft&&d.draft.draft;this.visProp.gradientangle="270";this.visProp.gradientsecondopacity=this.visProp.fillopacity;this.visProp.gradientpositionx=0.5;this.visProp.gradientpositiony=0.5}};JXG.extend(JXG.GeometryElement.prototype,{addChild:function(f){var e,d;this.childElements[f.id]=f;this.addDescendants(f);f.ancestors[this.id]=this;for(e in this.descendants){this.descendants[e].ancestors[this.id]=this;for(d in this.ancestors){this.descendants[e].ancestors[this.ancestors[d].id]=this.ancestors[d]}}for(e in this.ancestors){for(d in this.descendants){this.ancestors[e].descendants[this.descendants[d].id]=this.descendants[d]}}return this},addDescendants:function(e){var d;this.descendants[e.id]=e;for(d in e.childElements){this.addDescendants(e.childElements[d])}return this},countChildren:function(){var g,e=0,f;f=this.childElements;for(g in f){if(f.hasOwnProperty(g)&&g.indexOf("Label")<0){e++}}return e},getName:function(){return this.name},addTransform:function(){},draggable:function(){return this.isDraggable&&!this.visProp.fixed&&!this.visProp.frozen&&this.type!=JXG.OBJECT_TYPE_GLIDER},generatePolynomial:function(){return[]},animate:function(g,f,q){q=q||{};var d,e,j=this.board.options.animationDelay,k=Math.ceil(f/(j*1)),h,n=this,m=false;this.animationData={};var o=function(w,v,t){var u,s,r,p,i;u=JXG.rgb2hsv(w);s=JXG.rgb2hsv(v);r=(s[0]-u[0])/(1*k);p=(s[1]-u[1])/(1*k);i=(s[2]-u[2])/(1*k);n.animationData[t]=new Array(k);for(h=0;h=0&&JXG.isString(d)&&d.length==9&&d.charAt(0)==="#"){d=JXG.rgba2rgbo(d);this.visProp[e]=d[0];this.visProp[e.replace("color","opacity")]=d[1]}else{this.visProp[e]=d}},resolveShortcuts:function(f){var e,d;for(e in JXG.Options.shortcuts){if(JXG.exists(f[e])){for(d=0;d/g,">");if(this.label!==null){this.label.content.setText(d)}return this},setAttribute:JXG.shortcut(JXG.GeometryElement.prototype,"setProperty"),setProperty:function(){var h,g,j,d,e,k,f={};for(h=0;h-1){this.eventHandlers[f].splice(d,1)}}else{this.eventHandlers[f].length=0}},removeEvent:JXG.shortcut(JXG.GeometryElement.prototype,"off")});JXG.COORDS_BY_USER=1;JXG.COORDS_BY_SCREEN=2;JXG.Coords=function(f,e,d){this.board=d;this.usrCoords=[];this.scrCoords=[];this.setCoordinates(f,e)};JXG.extend(JXG.Coords.prototype,{normalizeUsrCoords:function(){var d=JXG.Math.eps;if(Math.abs(this.usrCoords[0])>d){this.usrCoords[1]/=this.usrCoords[0];this.usrCoords[2]/=this.usrCoords[0];this.usrCoords[0]=1}},usr2screen:function(h){var g=Math.round,d=this.board,f=this.usrCoords,e=d.origin.scrCoords;if(h===null||h){this.scrCoords[0]=g(f[0]);this.scrCoords[1]=g(f[0]*e[1]+f[1]*d.unitX);this.scrCoords[2]=g(f[0]*e[2]-f[2]*d.unitY)}else{this.scrCoords[0]=f[0];this.scrCoords[1]=f[0]*e[1]+f[1]*d.unitX;this.scrCoords[2]=f[0]*e[2]-f[2]*d.unitY}},screen2usr:function(){var f=this.board.origin.scrCoords,e=this.scrCoords,d=this.board;this.usrCoords[0]=1;this.usrCoords[1]=(e[1]-f[1])/d.unitX;this.usrCoords[2]=(f[2]-e[2])/d.unitY},distance:function(e,j){var g=0,k,d=this.usrCoords,i=this.scrCoords,h;if(e===JXG.COORDS_BY_USER){k=j.usrCoords;h=d[0]-k[0];g=h*h;if(g>JXG.Math.eps){return Number.POSITIVE_INFINITY}h=d[1]-k[1];g+=h*h;h=d[2]-k[2];g+=h*h}else{k=j.scrCoords;h=i[1]-k[1];g+=h*h;h=i[2]-k[2];g+=h*h}return Math.sqrt(g)},setCoordinates:function(e,h,f){var d=this.usrCoords,g=this.scrCoords;if(e===JXG.COORDS_BY_USER){if(h.length===2){d[0]=1;d[1]=h[0];d[2]=h[1]}else{d[0]=h[0];d[1]=h[1];d[2]=h[2];this.normalizeUsrCoords()}this.usr2screen(f)}else{g[1]=h[0];g[2]=h[1];this.screen2usr()}return this}});JXG.Point=function(e,f,d){this.constructor(e,d,JXG.OBJECT_TYPE_POINT,JXG.OBJECT_CLASS_POINT);if(f==null){f=[0,0]}this.coords=new JXG.Coords(JXG.COORDS_BY_USER,f,this.board);this.initialCoords=new JXG.Coords(JXG.COORDS_BY_USER,f,this.board);this.position=null;this.onPolygon=false;this.slideObject=null;this.Xjc=null;this.Yjc=null;this.methodMap=JXG.deepCopy(this.methodMap,{move:"moveTo",glide:"makeGlider",X:"X",Y:"Y",free:"free",setPosition:"setGliderPosition"});this.group=[];this.elType="point";this.id=this.board.setId(this,"P");this.board.renderer.drawPoint(this);this.board.finalizeAdding(this);this.createLabel()};JXG.Point.prototype=new JXG.GeometryElement();JXG.extend(JXG.Point.prototype,{hasPoint:function(e,g){var d=this.coords.scrCoords,f;f=parseFloat(this.visProp.size)+parseFloat(this.visProp.strokewidth)*0.5;if(f1){for(k=0;k=0)?1:-1;m=Math.abs(m);this.position=j*m/(m+1)}else{if(Math.abs(r[0])0&&Math.abs(this._smax-this._smin)>=JXG.Math.eps){if(this.position<0){this.position=0}if(this.position>1){this.position=1}q=this.position*(this._smax-this._smin)+this._smin;q=Math.round(q/this.visProp.snapwidth)*this.visProp.snapwidth;this.position=(q-this._smin)/(this._smax-this._smin);this.update(true)}r=l.point1.coords.usrCoords;if(!l.visProp.straightfirst&&Math.abs(r[0])>JXG.Math.eps&&this.position<0){this.coords.setCoordinates(JXG.COORDS_BY_USER,r);this.position=0}n=l.point2.coords.usrCoords;if(!l.visProp.straightlast&&Math.abs(n[0])>JXG.Math.eps&&this.position>1){this.coords.setCoordinates(JXG.COORDS_BY_USER,n);this.position=1}}else{if(l.type==JXG.OBJECT_TYPE_TURTLE){this.updateConstraint();this.coords=JXG.Math.Geometry.projectPointToTurtle(this,l,this.board)}else{if(l.elementClass==JXG.OBJECT_CLASS_CURVE){if(l.type==JXG.OBJECT_TYPE_ARC||l.type==JXG.OBJECT_TYPE_SECTOR){this.coords=JXG.Math.Geometry.projectPointToCircle(this,l,this.board);g=JXG.Math.Geometry.rad(l.radiuspoint,l.center,this);h=0;p=JXG.Math.Geometry.rad(l.radiuspoint,l.center,l.anglepoint);this.position=g;if((l.visProp.type=="minor"&&p>Math.PI)||(l.visProp.type=="major"&&pp){this.position=p;if((gh*0.5)||(g>p&&g>p*0.5+Math.PI)){this.position=h}this.updateGliderFromParent()}}else{this.updateConstraint();this.coords=JXG.Math.Geometry.projectPointToCurve(this,l,this.board)}}else{if(l.elementClass==JXG.OBJECT_CLASS_POINT){this.coords=JXG.Math.Geometry.projectPointToPoint(this,l,this.board)}}}}}},updateGliderFromParent:function(){var e,g,h,f,d=this.slideObject,i;if(d.elementClass==JXG.OBJECT_CLASS_CIRCLE){h=d.Radius();this.coords.setCoordinates(JXG.COORDS_BY_USER,[d.center.X()+h*Math.cos(this.position),d.center.Y()+h*Math.sin(this.position)])}else{if(d.elementClass==JXG.OBJECT_CLASS_LINE){e=d.point1.coords.usrCoords;g=d.point2.coords.usrCoords;if(Math.abs(g[0])1){f=(f-1)/(f-2)}else{f=(1-f)/f}this.coords.setCoordinates(JXG.COORDS_BY_USER,[g[0]+f*e[0],g[1]+f*e[1],g[2]+f*e[2]])}else{f=this.position;this.coords.setCoordinates(JXG.COORDS_BY_USER,[e[0]+f*(g[0]-e[0]),e[1]+f*(g[1]-e[1]),e[2]+f*(g[2]-e[2])])}}}else{if(d.type==JXG.OBJECT_TYPE_TURTLE){this.coords.setCoordinates(JXG.COORDS_BY_USER,[d.Z(this.position),d.X(this.position),d.Y(this.position)]);this.updateConstraint();this.coords=JXG.Math.Geometry.projectPointToTurtle(this,d,this.board)}else{if(d.elementClass==JXG.OBJECT_CLASS_CURVE){this.coords.setCoordinates(JXG.COORDS_BY_USER,[d.Z(this.position),d.X(this.position),d.Y(this.position)]);if(d.type==JXG.OBJECT_TYPE_ARC||d.type==JXG.OBJECT_TYPE_SECTOR){i=JXG.Math.Geometry.rad([d.center.X()+1,d.center.Y()],d.center,d.radiuspoint);h=d.Radius();this.coords.setCoordinates(JXG.COORDS_BY_USER,[d.center.X()+h*Math.cos(this.position+i),d.center.Y()+h*Math.sin(this.position+i)])}else{this.updateConstraint();this.coords=JXG.Math.Geometry.projectPointToCurve(this,d,this.board)}}else{if(d.elementClass==JXG.OBJECT_CLASS_POINT){this.coords=JXG.Math.Geometry.projectPointToPoint(this,d,this.board)}}}}}},updateRenderer:function(){if(!this.needsUpdate){return this}if(this.visProp.visible&&this.visProp.size>0){var d=this.isReal;this.isReal=(!isNaN(this.coords.usrCoords[1]+this.coords.usrCoords[2]));this.isReal=(Math.abs(this.coords.usrCoords[0])>JXG.Math.eps)?this.isReal:false;if(this.isReal){if(d!=this.isReal){this.board.renderer.show(this);if(this.hasLabel&&this.label.content.visProp.visible){this.board.renderer.show(this.label.content)}}this.board.renderer.updatePoint(this)}else{if(d!=this.isReal){this.board.renderer.hide(this);if(this.hasLabel&&this.label.content.visProp.visible){this.board.renderer.hide(this.label.content)}}}}if(this.hasLabel&&this.visProp.visible&&this.label.content&&this.label.content.visProp.visible&&this.isReal){this.label.content.update();this.board.renderer.updateText(this.label.content)}this.needsUpdate=false;return 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]},bounds:function(){return this.coords.usrCoords.slice(1).concat(this.coords.usrCoords.slice(1))},Dist:function(e){var g,i=e.coords.usrCoords,d=this.coords.usrCoords,h;h=d[0]-i[0];g=h*h;h=d[1]-i[1];g+=h*h;h=d[2]-i[2];g+=h*h;return Math.sqrt(g)},snapToGrid:function(){return this.handleSnapToGrid()},handleSnapToGrid:function(){var d,g,f=this.visProp.snapsizex,e=this.visProp.snapsizey;if(this.visProp.snaptogrid){d=this.coords.usrCoords[1];g=this.coords.usrCoords[2];if(f<=0&&this.board.defaultAxes&&this.board.defaultAxes.x.defaultTicks){f=this.board.defaultAxes.x.defaultTicks.ticksDelta*(this.board.defaultAxes.x.defaultTicks.visProp.minorticks+1)}if(e<=0&&this.board.defaultAxes&&this.board.defaultAxes.y.defaultTicks){e=this.board.defaultAxes.y.defaultTicks.ticksDelta*(this.board.defaultAxes.y.defaultTicks.visProp.minorticks+1)}if(f>0&&e>0){this.coords=new JXG.Coords(JXG.COORDS_BY_USER,[Math.round(d/f)*f,Math.round(g/e)*e],this.board)}}return this},handleSnapToPoints:function(){var g,j,e,h=0,f=Infinity,i=null;if(this.visProp.snaptopoints){for(g in this.board.objects){j=this.board.objects[g];if(j.elementClass==JXG.OBJECT_CLASS_POINT&&j!==this&&j.visProp.visible){e=JXG.Math.Geometry.projectPointToPoint(this,j,this.board);h=e.distance(JXG.COORDS_BY_USER,this.coords);if(h=this.visProp.snatchdistance){this.type=JXG.OBJECT_TYPE_POINT}}}return this},setPositionDirectly:function(d,j){var g,n,m,l,f,e,h=this.coords,k;this.coords=new JXG.Coords(d,j,this.board);this.handleSnapToGrid();this.handleSnapToPoints();this.handleAttractors();if(this.group.length!=0){n=this.coords.usrCoords[1]-h.usrCoords[1];m=this.coords.usrCoords[2]-h.usrCoords[2];l=this.coords.usrCoords[0]=h.usrCoords[0];for(g=0;g=0;g--){if(d===JXG.COORDS_BY_SCREEN){k=(new JXG.Coords(d,j,this.board)).usrCoords}else{if(j.length===2){j=[1].concat(j)}k=j}this.initialCoords=new JXG.Coords(JXG.COORDS_BY_USER,JXG.Math.matVecMult(JXG.Math.inverse(this.transformations[g].matrix),k),this.board)}this.update()}return this},setPositionByTransform:function(f,d){var e;d=new JXG.Coords(f,d,this.board);e=this.board.create("transform",d.usrCoords.slice(1),{type:"translate"});if(this.transformations.length>0&&this.transformations[this.transformations.length-1].isNumericMatrix){this.transformations[this.transformations.length-1].melt(e)}else{this.addTransform(this,e)}if(this.group.length==0){this.update()}return this},setPosition:function(e,d){return this.setPositionDirectly(e,d)},setGliderPosition:function(d){if(this.type=JXG.OBJECT_TYPE_GLIDER){this.position=d;this.board.update()}return this},makeGlider:function(d){this.slideObject=JXG.getRef(this.board,d);this.type=JXG.OBJECT_TYPE_GLIDER;this.elType="glider";this.visProp.snapwidth=-1;this.slideObject.addChild(this);this.isDraggable=true;this.generatePolynomial=function(){return this.slideObject.generatePolynomial(this)};this.updateGlider();return this},free:function(){var d;if(this.type!==JXG.OBJECT_TYPE_GLIDER){if(!this.isDraggable){this.isDraggable=true;this.type=JXG.OBJECT_TYPE_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}else{return}}for(d in this.ancestors){delete this.ancestors[d].descendants[this.id];delete this.ancestors[d].childElements[this.id]}this.ancestors=[];this.slideObject=null;this.elType="point";this.type=JXG.OBJECT_TYPE_POINT},addConstraint:function(h){this.type=JXG.OBJECT_TYPE_CAS;var k=[],d,g,e,f,j=["X","Y"];this.isDraggable=false;for(g=0;gJXG.Math.eps)){this.setPosition(JXG.COORDS_BY_USER,k.usrCoords);return this.board.update(this)}p=p||{};var l=this.board.options.animationDelay,m=Math.ceil(f/(l*1)),n=new Array(m+1),e=this.coords.usrCoords[1],d=this.coords.usrCoords[2],h=(k.usrCoords[1]-e),g=(k.usrCoords[2]-d),j,o=function(q){if(p.effect&&p.effect=="<>"){return Math.pow(Math.sin((q/(m*1))*Math.PI/2),2)}return q/m};if(Math.abs(h)=0;j--){n[m-j]=[k.usrCoords[0],e+h*o(j),d+g*o(j)]}this.animationPath=n;this.animationCallback=p.callback;this.board.addAnimation(this);return this},visit:function(m,f,r){if(typeof r=="number"){r={repeat:r}}else{r=r||{};if(typeof r.repeat=="undefined"){r.repeat=1}}var n=this.board.options.animationDelay,o=Math.ceil(f/(n*r.repeat)),p=new Array(r.repeat*(o+1)),e=this.coords.usrCoords[1],d=this.coords.usrCoords[2],k=(m[0]-e),g=(m[1]-d),l,h,q=function(s){var j=(s"){return Math.pow(Math.sin((j)*Math.PI/2),2)}return j};for(h=0;h=0;l--){p[h*(o+1)+o-l]=[m[0],e+k*q(l),d+g*q(l)]}}this.animationPath=p;this.animationCallback=r.callback;this.board.addAnimation(this);return this},_anim:function(n,i){var e,l,j,h,g,f,m=1,d,k;this.intervalCount++;if(this.intervalCount>i){this.intervalCount=0}if(this.slideObject.elementClass==JXG.OBJECT_CLASS_LINE){e=this.slideObject.point1.coords.distance(JXG.COORDS_BY_SCREEN,this.slideObject.point2.coords);l=this.slideObject.getSlope();if(l!="INF"){g=Math.atan(l);j=Math.round((this.intervalCount/i)*e*Math.cos(g));h=Math.round((this.intervalCount/i)*e*Math.sin(g))}else{j=0;h=Math.round((this.intervalCount/i)*e)}if(n<0){f=this.slideObject.point2;if(this.slideObject.point2.coords.scrCoords[1]-this.slideObject.point1.coords.scrCoords[1]>0){m=-1}else{if(this.slideObject.point2.coords.scrCoords[1]-this.slideObject.point1.coords.scrCoords[1]==0){if(this.slideObject.point2.coords.scrCoords[2]-this.slideObject.point1.coords.scrCoords[2]>0){m=-1}}}}else{f=this.slideObject.point1;if(this.slideObject.point1.coords.scrCoords[1]-this.slideObject.point2.coords.scrCoords[1]>0){m=-1}else{if(this.slideObject.point1.coords.scrCoords[1]-this.slideObject.point2.coords.scrCoords[1]==0){if(this.slideObject.point1.coords.scrCoords[2]-this.slideObject.point2.coords.scrCoords[2]>0){m=-1}}}}this.coords.setCoordinates(JXG.COORDS_BY_SCREEN,[f.coords.scrCoords[1]+m*j,f.coords.scrCoords[2]+m*h])}else{if(this.slideObject.elementClass==JXG.OBJECT_CLASS_CURVE){if(n>0){d=Math.round(this.intervalCount/i*this.board.canvasWidth)}else{d=Math.round((i-this.intervalCount)/i*this.board.canvasWidth)}this.coords.setCoordinates(JXG.COORDS_BY_SCREEN,[d,0]);this.coords=JXG.Math.Geometry.projectPointToCurve(this,this.slideObject,this.board)}else{if(this.slideObject.elementClass==JXG.OBJECT_CLASS_CIRCLE){if(n<0){g=this.intervalCount/i*2*Math.PI}else{g=(i-this.intervalCount)/i*2*Math.PI}k=this.slideObject.Radius();this.coords.setCoordinates(JXG.COORDS_BY_USER,[this.slideObject.center.coords.usrCoords[1]+k*Math.cos(g),this.slideObject.center.coords.usrCoords[2]+k*Math.sin(g)])}}}this.board.update(this);return this},setStyle:function(d){var e=["cross","cross","cross","circle","circle","circle","circle","square","square","square","plus","plus","plus"],f=[2,3,4,1,2,3,4,2,3,4,2,3,4];this.visProp.face=e[d];this.visProp.size=f[d];this.board.renderer.changePointStyle(this);return this},normalizeFace:function(d){var e={cross:"x",x:"x",circle:"o",o:"o",square:"[]","[]":"[]",plus:"+","+":"+",diamond:"<>","<>":"<>",triangleup:"^",a:"^","^":"^",triangledown:"v",v:"v",triangleleft:"<","<":"<",triangleright:">",">":">"};return e[d]},remove:function(){if(this.hasLabel){this.board.renderer.remove(this.board.renderer.getElementById(this.label.content.id))}this.board.renderer.remove(this.board.renderer.getElementById(this.id))},getTextAnchor:function(){return this.coords},getLabelAnchor:function(){return this.coords},face:function(d){this.setProperty({face:d})},size:function(d){this.setProperty({size:d})},cloneToBackground:function(){var d={};d.id=this.id+"T"+this.numTraces;this.numTraces++;d.coords=this.coords;d.visProp=JXG.deepCopy(this.visProp,this.visProp.traceattributes,true);d.visProp.layer=this.board.options.layer.trace;d.elementClass=JXG.OBJECT_CLASS_POINT;d.board=this.board;JXG.clearVisPropOld(d);this.board.renderer.drawPoint(d);this.traces[d.id]=d.rendNode;return this},getParents:function(){var d=[this.Z(),this.X(),this.Y()];if(this.parents){d=this.parents}if(this.type==JXG.OBJECT_TYPE_GLIDER){d=[this.X(),this.Y(),this.slideObject.id]}return d}});JXG.createPoint=function(k,g,f){var j,e=false,h,d;d=JXG.copyAttributes(f,k.options,"point");for(h=0;hthis.board.options.precision.hasPoint*this.board.options.precision.hasPoint){return false}if(this.visProp.straightfirst&&this.visProp.straightlast){return true}else{p=this.point1.coords;g=this.point2.coords;m=(new JXG.Coords(JXG.COORDS_BY_SCREEN,m.slice(1),this.board)).usrCoords;f=p.distance(JXG.COORDS_BY_USER,g);p=p.usrCoords.slice(0);g=g.usrCoords.slice(0);if(f1){return false}return true}},update:function(){var d;if(!this.needsUpdate){return this}if(this.constrained){if(typeof this.funps!="undefined"){d=this.funps();if(d&&d.length&&d.length===2){this.point1=d[0];this.point2=d[1]}}else{if(typeof this.funp1==="function"){d=this.funp1();if(JXG.isPoint(d)){this.point1=d}else{if(d&&d.length&&d.length===2){this.point1.setPositionDirectly(JXG.COORDS_BY_USER,d)}}}if(typeof this.funp2==="function"){d=this.funp2();if(JXG.isPoint(d)){this.point2=d}else{if(d&&d.length&&d.length===2){this.point2.setPositionDirectly(JXG.COORDS_BY_USER,d)}}}}}this.updateSegmentFixedLength();this.updateStdform();if(this.visProp.trace){this.cloneToBackground(true)}return this},updateSegmentFixedLength:function(){var k,f,j,i,h,g,e,l;if(!this.hasFixedLength){return this}k=this.point1.Dist(this.point2);f=this.fixedLength();j=this.fixedLengthOldCoords[0].distance(JXG.COORDS_BY_USER,this.point1.coords);i=this.fixedLengthOldCoords[1].distance(JXG.COORDS_BY_USER,this.point2.coords);if(j>JXG.Math.eps||i>JXG.Math.eps||k!=f){h=this.point1.isDraggable&&(this.point1.type!=JXG.OBJECT_TYPE_GLIDER)&&!this.point1.visProp.fixed;g=this.point2.isDraggable&&(this.point2.type!=JXG.OBJECT_TYPE_GLIDER)&&!this.point2.visProp.fixed;if(k>JXG.Math.eps){if((j>i&&g)||(j<=i&&g&&!h)){this.point2.setPositionDirectly(JXG.COORDS_BY_USER,[this.point1.X()+(this.point2.X()-this.point1.X())*f/k,this.point1.Y()+(this.point2.Y()-this.point1.Y())*f/k]);this.point2.prepareUpdate().updateRenderer()}else{if((j<=i&&h)||(j>i&&h&&!g)){this.point1.setPositionDirectly(JXG.COORDS_BY_USER,[this.point2.X()+(this.point1.X()-this.point2.X())*f/k,this.point2.Y()+(this.point1.Y()-this.point2.Y())*f/k]);this.point1.prepareUpdate().updateRenderer()}}}else{e=Math.random()-0.5;l=Math.random()-0.5;k=Math.sqrt(e*e+l*l);if(g){this.point2.setPositionDirectly(JXG.COORDS_BY_USER,[this.point1.X()+e*f/k,this.point1.Y()+l*f/k]);this.point2.prepareUpdate().updateRenderer()}else{if(h){this.point1.setPositionDirectly(JXG.COORDS_BY_USER,[this.point2.X()+e*f/k,this.point2.Y()+l*f/k]);this.point1.prepareUpdate().updateRenderer()}}}this.fixedLengthOldCoords[0].setCoordinates(JXG.COORDS_BY_USER,this.point1.coords.usrCoords);this.fixedLengthOldCoords[1].setCoordinates(JXG.COORDS_BY_USER,this.point2.coords.usrCoords)}return this},updateStdform:function(){var d=JXG.Math.crossProduct(this.point1.coords.usrCoords,this.point2.coords.usrCoords);this.stdform[0]=d[0];this.stdform[1]=d[1];this.stdform[2]=d[2];this.stdform[3]=0;this.normalize()},updateRenderer:function(){var d;if(this.needsUpdate&&this.visProp.visible){d=this.isReal;this.isReal=(!isNaN(this.point1.coords.usrCoords[1]+this.point1.coords.usrCoords[2]+this.point2.coords.usrCoords[1]+this.point2.coords.usrCoords[2])&&(JXG.Math.innerProduct(this.stdform,this.stdform,3)>=JXG.Math.eps*JXG.Math.eps));if(this.isReal){if(d!=this.isReal){this.board.renderer.show(this);if(this.hasLabel&&this.label.content.visProp.visible){this.board.renderer.show(this.label.content)}}this.board.renderer.updateLine(this)}else{if(d!=this.isReal){this.board.renderer.hide(this);if(this.hasLabel&&this.label.content.visProp.visible){this.board.renderer.hide(this.label.content)}}}this.needsUpdate=false}if(this.hasLabel&&this.label.content.visProp.visible&&this.isReal){this.label.content.update();this.board.renderer.updateText(this.label.content)}return this},generatePolynomial:function(h){var g=this.point1.symbolic.x,f=this.point1.symbolic.y,j=this.point2.symbolic.x,i=this.point2.symbolic.y,e=h.symbolic.x,d=h.symbolic.y;return[["(",f,")*(",e,")-(",f,")*(",j,")+(",d,")*(",j,")-(",g,")*(",d,")+(",g,")*(",i,")-(",e,")*(",i,")"].join("")]},getRise:function(){if(Math.abs(this.stdform[2])>=JXG.Math.eps){return -this.stdform[0]/this.stdform[2]}else{return Infinity}},getSlope:function(){if(Math.abs(this.stdform[2])>=JXG.Math.eps){return -this.stdform[1]/this.stdform[2]}else{return Infinity}},getAngle:function(){return Math.atan2(this.point2.Y()-this.point1.Y(),this.point2.X()-this.point1.X())},setStraight:function(d,e){this.visProp.straightfirst=d;this.visProp.straightlast=e;this.board.renderer.updateLine(this);return this},getTextAnchor:function(){return new JXG.Coords(JXG.COORDS_BY_USER,[0.5*(this.point2.X()+this.point1.X()),0.5*(this.point2.Y()+this.point1.Y())],this.board)},setLabelRelativeCoords:function(d){if(JXG.exists(this.label.content)){this.label.content.relativeCoords=new JXG.Coords(JXG.COORDS_BY_SCREEN,[d[0],-d[1]],this.board)}},getLabelAnchor:function(){var e,j,d=0,i=0,h=0,g=new JXG.Coords(JXG.COORDS_BY_USER,this.point1.coords.usrCoords,this.board),f=new JXG.Coords(JXG.COORDS_BY_USER,this.point2.coords.usrCoords,this.board);if(this.visProp.straightfirst||this.visProp.straightlast){JXG.Math.Geometry.calcStraight(this,g,f,0)}g=g.scrCoords;f=f.scrCoords;switch(this.label.content.visProp.position){case"lft":case"llft":case"ulft":if(g[1]<=f[1]){e=g[1];j=g[2]}else{e=f[1];j=f[2]}break;case"rt":case"lrt":case"urt":if(g[1]>f[1]){e=g[1];j=g[2]}else{e=f[1];j=f[2]}break;default:e=0.5*(g[1]+f[1]);j=0.5*(g[2]+f[2])}if(this.visProp.straightfirst||this.visProp.straightlast){if(JXG.exists(this.label.content)){i=parseFloat(this.label.content.visProp.offset[0]);h=parseFloat(this.label.content.visProp.offset[1]);d=this.label.content.visProp.fontsize}if(Math.abs(e)e&&e>this.board.canvasWidth-d-JXG.Math.eps){e=this.board.canvasWidth-i-d}else{e+=i}}if(JXG.Math.eps+d>j&&j>-JXG.Math.eps){j=h+d}else{if(this.board.canvasHeight+JXG.Math.eps>j&&j>this.board.canvasHeight-d-JXG.Math.eps){j=this.board.canvasHeight-h}else{j+=h}}}return new JXG.Coords(JXG.COORDS_BY_SCREEN,[e,j],this.board)},cloneToBackground:function(){var g={},e,d,f;g.id=this.id+"T"+this.numTraces;g.elementClass=JXG.OBJECT_CLASS_LINE;this.numTraces++;g.point1=this.point1;g.point2=this.point2;g.stdform=this.stdform;g.board=this.board;g.visProp=JXG.deepCopy(this.visProp,this.visProp.traceattributes,true);g.visProp.layer=this.board.options.layer.trace;JXG.clearVisPropOld(g);d=this.getSlope();e=this.getRise();g.getSlope=function(){return d};g.getRise=function(){return e};f=this.board.renderer.enhancedRendering;this.board.renderer.enhancedRendering=true;this.board.renderer.drawLine(g);this.board.renderer.enhancedRendering=f;this.traces[g.id]=g.rendNode;delete g;return this},addTransform:function(e){var f,g=JXG.isArray(e)?e:[e],d=g.length;for(f=0;f0&&this.point1.transformations[this.point1.transformations.length-1].isNumericMatrix){this.point1.transformations[this.point1.transformations.length-1].melt(e)}else{this.point1.addTransform(this.point1,e)}if(this.point2.transformations.length>0&&this.point2.transformations[this.point2.transformations.length-1].isNumericMatrix){this.point2.transformations[this.point2.transformations.length-1].melt(e)}else{this.point2.addTransform(this.point2,e)}return this},setPositionDirectly:function(j,h,g){var d,e,i=new JXG.Coords(j,h,this.board),f=new JXG.Coords(j,g,this.board);if(!this.point1.draggable()||!this.point2.draggable()){return this}d=JXG.Math.Statistics.subtract(i.usrCoords,f.usrCoords);e=this.board.create("transform",d.slice(1),{type:"translate"});e.applyOnce([this.point1,this.point2]);return this},snapToGrid:function(){if(this.visProp.snaptogrid){this.point1.snapToGrid();this.point2.snapToGrid()}return this},X:function(f){var e=this.stdform[2],d;d=(Math.abs(this.point1.coords.usrCoords[0])>JXG.Math.eps)?this.point1.coords.usrCoords[1]:this.point2.coords.usrCoords[1];f=(f-0.5)*2;if(f<0){f*=(-1);return(1-f)*d+f*e}else{return(1-f)*d-f*e}},Y:function(e){var d=this.stdform[1],f;f=(Math.abs(this.point1.coords.usrCoords[0])>JXG.Math.eps)?this.point1.coords.usrCoords[2]:this.point2.coords.usrCoords[2];e=(e-0.5)*2;if(e<0){e*=(-1);return(1-e)*f-e*d}else{return(1-e)*f+e*d}},Z:function(d){var e=(Math.abs(this.point1.coords.usrCoords[0])>JXG.Math.eps)?this.point1.coords.usrCoords[0]:this.point2.coords.usrCoords[0];d=(d-0.5)*2;if(d<0){d*=(-1)}return(1-d)*e},L:function(){return this.point1.Dist(this.point2)},minX:function(){return 0},maxX:function(){return 1},bounds:function(){var d=this.point1.coords.usrCoords,e=this.point2.coords.usrCoords;return[Math.min(d[1],e[1]),Math.max(d[2],e[2]),Math.max(d[1],e[1]),Math.min(d[2],e[2])]},addTicks:function(d){if(d.id==""||typeof d.id=="undefined"){d.id=this.id+"_ticks_"+(this.ticks.length+1)}this.board.renderer.drawTicks(d);this.ticks.push(d);return d.id},remove:function(){this.removeAllTicks();JXG.GeometryElement.prototype.remove.call(this)},removeAllTicks:function(){var e,d;for(d=this.ticks.length;d>0;d--){this.removeTicks(this.ticks[d-1])}this.ticks=new Array();this.board.update()},removeTicks:function(f){var e,d;if(this.defaultTicks!=null&&this.defaultTicks==f){this.defaultTicks=null}for(e=this.ticks.length;e>0;e--){if(this.ticks[e-1]==f){this.board.removeObject(this.ticks[e-1]);for(d=0;d1){l=JXG.copyAttributes(h,k.options,"line","point1");p=k.create("point",n[0],l)}else{if(JXG.isString(n[0])||n[0].elementClass==JXG.OBJECT_CLASS_POINT){p=JXG.getReference(k,n[0])}else{if((typeof n[0]=="function")&&(n[0]().elementClass==JXG.OBJECT_CLASS_POINT)){p=n[0]();g=true}else{if((typeof n[0]=="function")&&(n[0]().length&&n[0]().length===2)){l=JXG.copyAttributes(h,k.options,"line","point1");p=JXG.createPoint(k,n[0](),l);g=true}else{throw new Error("JSXGraph: Can't create line with parent types '"+(typeof n[0])+"' and '"+(typeof n[1])+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]")}}}}if(JXG.isArray(n[1])&&n[1].length>1){l=JXG.copyAttributes(h,k.options,"line","point2");o=k.create("point",n[1],l)}else{if(JXG.isString(n[1])||n[1].elementClass==JXG.OBJECT_CLASS_POINT){o=JXG.getReference(k,n[1])}else{if((typeof n[1]=="function")&&(n[1]().elementClass==JXG.OBJECT_CLASS_POINT)){o=n[1]();g=true}else{if((typeof n[1]=="function")&&(n[1]().length&&n[1]().length===2)){l=JXG.copyAttributes(h,k.options,"line","point2");o=JXG.createPoint(k,n[1](),l);g=true}else{throw new Error("JSXGraph: Can't create line with parent types '"+(typeof n[0])+"' and '"+(typeof n[1])+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]")}}}}l=JXG.copyAttributes(h,k.options,"line");f=new JXG.Line(k,p,o,l);if(g){f.constrained=true;f.funp1=n[0];f.funp2=n[1]}else{f.isDraggable=true}if(!f.constrained){f.parents=[p.id,o.id]}}else{if(n.length==3){e=true;for(j=0;j<3;j++){if(typeof n[j]=="number"){m[j]=function(i){return function(){return i}}(n[j])}else{if(typeof n[j]=="function"){m[j]=n[j];e=false}else{throw new Error("JSXGraph: Can't create line with parent types '"+(typeof n[0])+"' and '"+(typeof n[1])+"' and '"+(typeof n[2])+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]")}}}l=JXG.copyAttributes(h,k.options,"line","point1");if(e){p=k.create("point",[m[2]()*m[2]()+m[1]()*m[1](),m[2]()-m[1]()*m[0]()+m[2](),-m[1]()-m[2]()*m[0]()-m[1]()],l)}else{p=k.create("point",[function(){return(0+m[2]()*m[2]()+m[1]()*m[1]())*0.5},function(){return(m[2]()-m[1]()*m[0]()+m[2]())*0.5},function(){return(-m[1]()-m[2]()*m[0]()-m[1]())*0.5}],l)}l=JXG.copyAttributes(h,k.options,"line","point2");if(e){o=k.create("point",[m[2]()*m[2]()+m[1]()*m[1](),-m[1]()*m[0]()+m[2](),-m[2]()*m[0]()-m[1]()],l)}else{o=k.create("point",[function(){return m[2]()*m[2]()+m[1]()*m[1]()},function(){return -m[1]()*m[0]()+m[2]()},function(){return -m[2]()*m[0]()-m[1]()}],l)}p.prepareUpdate().update();o.prepareUpdate().update();l=JXG.copyAttributes(h,k.options,"line");f=new JXG.Line(k,p,o,l);f.isDraggable=e;if(e){f.parents=[m[0](),m[1](),m[2]()]}}else{if((n.length==1)&&(typeof n[0]=="function")&&(n[0]().length==2)&&(n[0]()[0].elementClass==JXG.OBJECT_CLASS_POINT)&&(n[0]()[1].elementClass==JXG.OBJECT_CLASS_POINT)){var d=n[0]();l=JXG.copyAttributes(h,k.options,"line");f=new JXG.Line(k,d[0],d[1],l);f.constrained=true;f.funps=n[0]}else{if((n.length==1)&&(typeof n[0]=="function")&&(n[0]().length==3)&&(typeof n[0]()[0]==="number")&&(typeof n[0]()[1]==="number")&&(typeof n[0]()[2]==="number")){d=n[0];l=JXG.copyAttributes(h,k.options,"line","point1");p=k.create("point",[function(){var i=d();return[(0+i[2]*i[2]+i[1]*i[1])*0.5,(i[2]-i[1]*i[0]+i[2])*0.5,(-i[1]-i[2]*i[0]-i[1])*0.5]}],l);l=JXG.copyAttributes(h,k.options,"line","point2");o=k.create("point",[function(){var i=d();return[i[2]*i[2]+i[1]*i[1],-i[1]*i[0]+i[2],-i[2]*i[0]-i[1]]}],l);l=JXG.copyAttributes(h,k.options,"line");f=new JXG.Line(k,p,o,l);f.constrained=true;f.funps=n[0]}else{throw new Error("JSXGraph: Can't create line with parent types '"+(typeof n[0])+"' and '"+(typeof n[1])+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]")}}}}return f};JXG.JSXGraph.registerElement("line",JXG.createLine);JXG.createSegment=function(h,e,d){var g,f;d.straightFirst=false;d.straightLast=false;g=h.create("line",e.slice(0,2),d);if(e.length==3){g.hasFixedLength=true;if(JXG.isNumber(e[2])){g.fixedLength=function(){return e[2]}}else{if(JXG.isFunction(e[2])){g.fixedLength=e[2]}else{throw new Error("JSXGraph: Can't create segment with third parent type '"+(typeof e[2])+"'.\nPossible third parent types: number or function")}}g.fixedLengthOldCoords=[];g.fixedLengthOldCoords[0]=new JXG.Coords(JXG.COORDS_BY_USER,g.point1.coords.usrCoords.slice(1,3),h);g.fixedLengthOldCoords[1]=new JXG.Coords(JXG.COORDS_BY_USER,g.point2.coords.usrCoords.slice(1,3),h)}g.elType="segment";return g};JXG.JSXGraph.registerElement("segment",JXG.createSegment);JXG.createArrow=function(g,e,d){var f;d.firstArrow=false;d.lastArrow=true;f=g.create("line",e,d).setStraight(false,false);f.type=JXG.OBJECT_TYPE_VECTOR;f.elType="arrow";return f};JXG.JSXGraph.registerElement("arrow",JXG.createArrow);JXG.createAxis=function(i,f,e){var d,h,j;if((JXG.isArray(f[0])||JXG.isPoint(f[0]))&&(JXG.isArray(f[1])||JXG.isPoint(f[1]))){d=JXG.copyAttributes(e,i.options,"axis");h=i.create("line",f,d);h.type=JXG.OBJECT_TYPE_AXIS;h.isDraggable=false;h.point1.isDraggable=false;h.point2.isDraggable=false;for(var g in h.ancestors){h.ancestors[g].type=JXG.OBJECT_TYPE_AXISPOINT}d=JXG.copyAttributes(e,i.options,"axis","ticks");if(JXG.exists(d.ticksdistance)){j=d.ticksdistance}else{if(JXG.isArray(d.ticks)){j=d.ticks}else{j=1}}h.defaultTicks=i.create("ticks",[h,j],d);h.defaultTicks.dump=false;h.elType="axis";h.subs={ticks:h.defaultTicks}}else{throw new Error("JSXGraph: Can't create point with parent types '"+(typeof f[0])+"' and '"+(typeof f[1])+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]]")}return h};JXG.JSXGraph.registerElement("axis",JXG.createAxis);JXG.createTangent=function(o,r,k){var d,q,m,n,l,h,e,s;if(r.length==1){d=r[0];q=d.slideObject}else{if(r.length==2){if(JXG.isPoint(r[0])){d=r[0];q=r[1]}else{if(JXG.isPoint(r[1])){q=r[0];d=r[1]}else{throw new Error("JSXGraph: Can't create tangent with parent types '"+(typeof r[0])+"' and '"+(typeof r[1])+"'.\nPossible parent types: [glider], [point,line|curve|circle|conic]")}}}else{throw new Error("JSXGraph: Can't create tangent with parent types '"+(typeof r[0])+"' and '"+(typeof r[1])+"'.\nPossible parent types: [glider], [point,line|curve|circle|conic]")}}if(q.elementClass==JXG.OBJECT_CLASS_LINE){s=o.create("line",[q.point1,q.point2],k)}else{if(q.elementClass==JXG.OBJECT_CLASS_CURVE&&!(q.type==JXG.OBJECT_TYPE_CONIC)){if(q.visProp.curvetype!="plot"){m=q.X;n=q.Y;s=o.create("line",[function(){return -d.X()*o.D(n)(d.position)+d.Y()*o.D(m)(d.position)},function(){return o.D(n)(d.position)},function(){return -o.D(m)(d.position)}],k);d.addChild(s);s.glider=d}else{s=o.create("line",[function(){l=Math.floor(d.position);if(l==q.numberPoints-1){l--}if(l<0){return 1}return q.Y(l)*q.X(l+1)-q.X(l)*q.Y(l+1)},function(){l=Math.floor(d.position);if(l==q.numberPoints-1){l--}if(l<0){return 0}return q.Y(l+1)-q.Y(l)},function(){l=Math.floor(d.position);if(l==q.numberPoints-1){l--}if(l<0){return 0}return q.X(l)-q.X(l+1)}],k);d.addChild(s);s.glider=d}}else{if(q.type==JXG.OBJECT_TYPE_TURTLE){s=o.create("line",[function(){l=Math.floor(d.position);for(h=0;h1){d=JXG.copyAttributes(e,k.options,"circle","center");l[h]=k.create("point",f[h],d)}else{l[h]=f[h]}}}d=JXG.copyAttributes(e,k.options,"circle");if(f.length==2&&JXG.isPoint(l[0])&&JXG.isPoint(l[1])){j=new JXG.Circle(k,"twoPoints",l[0],l[1],d)}else{if((JXG.isNumber(l[0])||JXG.isFunction(l[0])||JXG.isString(l[0]))&&JXG.isPoint(l[1])){j=new JXG.Circle(k,"pointRadius",l[1],l[0],d)}else{if((JXG.isNumber(l[1])||JXG.isFunction(l[1])||JXG.isString(l[1]))&&JXG.isPoint(l[0])){j=new JXG.Circle(k,"pointRadius",l[0],l[1],d)}else{if((l[0].elementClass==JXG.OBJECT_CLASS_CIRCLE)&&JXG.isPoint(l[1])){j=new JXG.Circle(k,"pointCircle",l[1],l[0],d)}else{if((l[1].elementClass==JXG.OBJECT_CLASS_CIRCLE)&&JXG.isPoint(l[0])){j=new JXG.Circle(k,"pointCircle",l[0],l[1],d)}else{if((l[0].elementClass==JXG.OBJECT_CLASS_LINE)&&JXG.isPoint(l[1])){j=new JXG.Circle(k,"pointLine",l[1],l[0],d)}else{if((l[1].elementClass==JXG.OBJECT_CLASS_LINE)&&JXG.isPoint(l[0])){j=new JXG.Circle(k,"pointLine",l[0],l[1],d)}else{if(f.length==3&&JXG.isPoint(l[0])&&JXG.isPoint(l[1])&&JXG.isPoint(l[2])){j=JXG.createCircumcircle(k,l,e)}else{throw new Error("JSXGraph: Can't create circle with parent types '"+(typeof f[0])+"' and '"+(typeof f[1])+"'.\nPossible parent types: [point,point], [point,number], [point,function], [point,circle], [point,point,point]")}}}}}}}}j.isDraggable=g;j.parents=[];for(h=0;h1){r[k]=n.create("point",p[k],j)}else{if(JXG.isPoint(p[k])){r[k]=JXG.getReference(n,p[k])}else{if((typeof p[k]=="function")&&(p[k]().elementClass===JXG.OBJECT_CLASS_POINT)){r[k]=p[k]()}else{if(JXG.isString(p[k])){r[k]=JXG.getReference(n,p[k])}else{throw new Error("JSXGraph: Can't create Ellipse with parent types '"+(typeof p[0])+"' and '"+(typeof p[1])+"'.\nPossible parent types: [point,point,point], [point,point,number|function]")}}}}}if(JXG.isNumber(p[2])){d=JXG.createFunction(p[2],n)}else{if((typeof p[2]=="function")&&(JXG.isNumber(p[2]()))){d=p[2]}else{if(JXG.isPoint(p[2])){e=JXG.getReference(n,p[2])}else{if(p[2].length>1){e=n.create("point",p[2],j)}else{if((typeof p[2]=="function")&&(p[2]().elementClass==JXG.OBJECT_CLASS_POINT)){e=p[2]()}else{if(JXG.isString(p[2])){e=JXG.getReference(n,p[2])}else{throw new Error("JSXGraph: Can't create Ellipse with parent types '"+(typeof p[0])+"' and '"+(typeof p[1])+"' and '"+(typeof p[2])+"'.\nPossible parent types: [point,point,point], [point,point,number|function]")}}}}d=function(){return e.Dist(r[0])+e.Dist(r[1])}}}if(typeof p[4]=="undefined"){p[4]=1.0001*Math.PI}if(typeof p[3]=="undefined"){p[3]=-1.0001*Math.PI}var o=n.create("point",[function(){return(r[0].X()+r[1].X())*0.5},function(){return(r[0].Y()+r[1].Y())*0.5}],j);var q=function(){var i=r[0].X(),B=r[0].Y(),w=r[1].X(),v=r[1].Y(),A,z,u;var t=(w-i>0)?1:-1;if(Math.abs(w-i)>1e-7){A=Math.atan2(v-B,w-i)+((t<0)?Math.PI:0)}else{A=((v-B>0)?0.5:-0.5)*Math.PI}z=Math.cos(A);u=Math.sin(A);var s=[[1,0,0],[o.X(),z,-u],[o.Y(),u,z]];return s};var f=n.create("curve",[function(i){return 0},function(i){return 0},p[3],p[4]],m);var g=function(u,s){var A=d()*0.5,i=A*A,t=r[1].Dist(r[0])*0.5,v=i-t*t,z=Math.sqrt(v),w=[[1,0,0],[0,1,0],[0,0,1]],C,B;if(!s){l=q();C=o.X();B=o.Y();w[0][0]=l[0][0];w[0][1]=0;w[0][2]=0;w[1][0]=C*(1-l[1][1])+B*l[1][2];w[1][1]=l[1][1];w[1][2]=l[2][1];w[2][0]=B*(1-l[1][1])-C*l[1][2];w[2][1]=l[1][2];w[2][2]=l[2][2];f.quadraticform=JXG.Math.matMatMult(JXG.Math.transpose(w),JXG.Math.matMatMult([[-1+C*C/(A*A)+B*B/v,-C/i,-C/v],[-C/i,1/i,0],[-B/v,0,1/v]],w))}return JXG.Math.matVecMult(l,[1,A*Math.cos(u),z*Math.sin(u)])};f.X=function(i,s){return g(i,s)[1]};f.Y=function(i,s){return g(i,s)[2]};f.midpoint=o;f.type=JXG.OBJECT_TYPE_CONIC;return f};JXG.createHyperbola=function(n,p,h){var r=[],e,d,k,l,j=JXG.copyAttributes(h,n.options,"conic","foci"),m=JXG.copyAttributes(h,n.options,"conic");for(k=0;k<2;k++){if(p[k].length>1){r[k]=n.create("point",p[k],attr_focu)}else{if(JXG.isPoint(p[k])){r[k]=JXG.getReference(n,p[k])}else{if((typeof p[k]=="function")&&(p[k]().elementClass==JXG.OBJECT_CLASS_POINT)){r[k]=p[k]()}else{if(JXG.isString(p[k])){r[k]=JXG.getReference(n,p[k])}else{throw new Error("JSXGraph: Can't create Hyperbola with parent types '"+(typeof p[0])+"' and '"+(typeof p[1])+"'.\nPossible parent types: [point,point,point], [point,point,number|function]")}}}}}if(JXG.isNumber(p[2])){d=JXG.createFunction(p[2],n)}else{if((typeof p[2]=="function")&&(JXG.isNumber(p[2]()))){d=p[2]}else{if(JXG.isPoint(p[2])){e=JXG.getReference(n,p[2])}else{if(p[2].length>1){e=n.create("point",p[2],j)}else{if((typeof p[2]=="function")&&(p[2]().elementClass==JXG.OBJECT_CLASS_POINT)){e=p[2]()}else{if(JXG.isString(p[2])){e=JXG.getReference(n,p[2])}else{throw new Error("JSXGraph: Can't create Hyperbola with parent types '"+(typeof p[0])+"' and '"+(typeof p[1])+"' and '"+(typeof p[2])+"'.\nPossible parent types: [point,point,point], [point,point,number|function]")}}}}d=function(){return e.Dist(r[0])-e.Dist(r[1])}}}if(typeof p[4]=="undefined"){p[4]=1.0001*Math.PI}if(typeof p[3]=="undefined"){p[3]=-1.0001*Math.PI}var o=n.create("point",[function(){return(r[0].X()+r[1].X())*0.5},function(){return(r[0].Y()+r[1].Y())*0.5}],j);var q=function(){var t=r[0].X(),s=r[0].Y(),z=r[1].X(),v=r[1].Y(),u;var w=(z-t>0)?1:-1;if(Math.abs(z-t)>1e-7){u=Math.atan2(v-s,z-t)+((w<0)?Math.PI:0)}else{u=((v-s>0)?0.5:-0.5)*Math.PI}var i=[[1,0,0],[o.X(),Math.cos(u),-Math.sin(u)],[o.Y(),Math.sin(u),Math.cos(u)]];return i};var f=n.create("curve",[function(i){return 0},function(i){return 0},p[3],p[4]],m);var g=function(u,s){var A=d()*0.5,i=A*A,t=r[1].Dist(r[0])*0.5,z=Math.sqrt(-A*A+t*t),v=z*z,w=[[1,0,0],[0,1,0],[0,0,1]],C,B;if(!s){l=q();C=o.X();B=o.Y();w[0][0]=l[0][0];w[0][1]=0;w[0][2]=0;w[1][0]=C*(1-l[1][1])+B*l[1][2];w[1][1]=l[1][1];w[1][2]=l[2][1];w[2][0]=B*(1-l[1][1])-C*l[1][2];w[2][1]=l[1][2];w[2][2]=l[2][2];f.quadraticform=JXG.Math.matMatMult(JXG.Math.transpose(w),JXG.Math.matMatMult([[-1+C*C/i+B*B/v,-C/i,B/v],[-C/i,1/i,0],[B/v,0,-1/v]],w))}return JXG.Math.matVecMult(l,[1,A/Math.cos(u),z*Math.tan(u)])};f.X=function(i,s){return g(i,s)[1]};f.Y=function(i,s){return g(i,s)[2]};f.midpoint=o;f.type=JXG.OBJECT_TYPE_CONIC;return f};JXG.createParabola=function(m,o,g){var k=o[0],e=o[1],i,h=JXG.copyAttributes(g,m.options,"conic","foci"),j=JXG.copyAttributes(g,m.options,"conic");if(o[0].length>1){k=m.create("point",o[0],h)}else{if(JXG.isPoint(o[0])){k=JXG.getReference(m,o[0])}else{if((typeof o[0]=="function")&&(o[0]().elementClass==JXG.OBJECT_CLASS_POINT)){k=o[0]()}else{if(JXG.isString(o[0])){k=JXG.getReference(m,o[0])}else{throw new Error("JSXGraph: Can't create Parabola with parent types '"+(typeof o[0])+"' and '"+(typeof o[1])+"'.\nPossible parent types: [point,line]")}}}}if(typeof o[3]=="undefined"){o[3]=10}if(typeof o[2]=="undefined"){o[2]=-10}var n=m.create("point",[function(){var l=[0,e.stdform[1],e.stdform[2]];l=JXG.Math.crossProduct(l,k.coords.usrCoords);return JXG.Math.Geometry.meetLineLine(l,e.stdform,0,m).usrCoords}],h);var p=function(){var r=Math.atan(e.getSlope()),q=(n.X()+k.X())*0.5,s=(n.Y()+k.Y())*0.5;r+=(k.Y()-n.Y()<0||(k.Y()==n.Y()&&k.X()>n.X()))?Math.PI:0;var l=[[1,0,0],[q*(1-Math.cos(r))+s*Math.sin(r),Math.cos(r),-Math.sin(r)],[s*(1-Math.cos(r))-q*Math.sin(r),Math.sin(r),Math.cos(r)]];return l};var d=m.create("curve",[function(l){return 0},function(l){return 0},o[2],o[3]],j);var f=function(s,u){var v=n.Dist(k)*0.5,r=[[1,0,0],[0,1,0],[0,0,1]],q=(n.X()+k.X())*0.5,l=(n.Y()+k.Y())*0.5;if(!u){i=p();r[0][0]=i[0][0];r[0][1]=0;r[0][2]=0;r[1][0]=q*(1-i[1][1])+l*i[1][2];r[1][1]=i[1][1];r[1][2]=i[2][1];r[2][0]=l*(1-i[1][1])-q*i[1][2];r[2][1]=i[1][2];r[2][2]=i[2][2];d.quadraticform=JXG.Math.matMatMult(JXG.Math.transpose(r),JXG.Math.matMatMult([[-l*4*v-q*q,q,2*v],[q,-1,0],[2*v,0,0]],r))}return JXG.Math.matVecMult(i,[1,s+q,s*s/(v*4)+l])};d.X=function(l,q){return f(l,q)[1]};d.Y=function(l,q){return f(l,q)[2]};d.type=JXG.OBJECT_TYPE_CONIC;return d};JXG.createConic=function(e,w,g){var j=[[1,0,0],[0,1,0],[0,0,1]],D,B,A,z,f=[[1,0,0],[0,1,0],[0,0,1]],o,n,t=[],u,r,C,m=[],s=JXG.copyAttributes(g,e.options,"conic","foci"),q=JXG.copyAttributes(g,e.options,"conic");if(w.length==5){C=true}else{if(w.length==6){C=false}else{throw new Error("JSXGraph: Can't create generic Conic with "+parent.length+" parameters.")}}if(C){for(u=0;u<5;u++){if(w[u].length>1){t[u]=e.create("point",w[u],s)}else{if(JXG.isPoint(w[u])){t[u]=JXG.getReference(e,w[u])}else{if((typeof w[u]=="function")&&(w[u]().elementClass==JXG.OBJECT_CLASS_POINT)){t[u]=w[u]()}else{if(JXG.isString(w[u])){t[u]=JXG.getReference(e,w[u])}else{throw new Error("JSXGraph: Can't create Conic section with parent types '"+(typeof w[u])+"'.\nPossible parent types: [point,point,point,point,point], [a00,a11,a22,a01,a02,a12]")}}}}}}else{r=[[0,0,0],[0,0,0],[0,0,0]];r[0][0]=(JXG.isFunction(w[2]))?function(){return w[2]()}:function(){return w[2]};r[0][1]=(JXG.isFunction(w[4]))?function(){return w[4]()}:function(){return w[4]};r[0][2]=(JXG.isFunction(w[5]))?function(){return w[5]()}:function(){return w[5]};r[1][1]=(JXG.isFunction(w[0]))?function(){return w[0]()}:function(){return w[0]};r[1][2]=(JXG.isFunction(w[3]))?function(){return w[3]()}:function(){return w[3]};r[2][2]=(JXG.isFunction(w[1]))?function(){return w[1]()}:function(){return w[1]}}var h=function(p){var F,E;for(F=0;F<3;F++){for(E=F;E<3;E++){p[F][E]+=p[E][F]}}for(F=0;F<3;F++){for(E=0;EG){f[F][G]=f[G][F]}}}}k.quadraticform=f;D=JXG.Math.Numerics.Jacobi(f);if(D[0][0][0]<0){D[0][0][0]*=(-1);D[0][1][1]*=(-1);D[0][2][2]*=(-1)}for(G=0;G<3;G++){p=0;for(F=0;F<3;F++){p+=D[1][F][G]*D[1][F][G]}p=Math.sqrt(p);for(F=0;F<3;F++){}}j=D[1];z=Math.sqrt(Math.abs(D[0][0][0]));B=Math.sqrt(Math.abs(D[0][1][1]));A=Math.sqrt(Math.abs(D[0][2][2]))}if(D[0][1][1]<=0&&D[0][2][2]<=0){E=JXG.Math.matVecMult(j,[1/z,Math.cos(H)/B,Math.sin(H)/A])}else{if(D[0][1][1]<=0&&D[0][2][2]>0){E=JXG.Math.matVecMult(j,[Math.cos(H)/z,1/B,Math.sin(H)/A])}else{if(D[0][2][2]<0){E=JXG.Math.matVecMult(j,[Math.sin(H)/z,Math.cos(H)/B,1/A])}}}E[1]/=E[0];E[2]/=E[0];E[0]=1;return E};k.X=function(i,p){return d(i,p)[1]};k.Y=function(i,p){return d(i,p)[2]};k.midpoint=e.create("point",[function(){var i=k.quadraticform;return[i[1][1]*i[2][2]-i[1][2]*i[1][2],i[1][2]*i[0][2]-i[2][2]*i[0][1],i[0][1]*i[1][2]-i[1][1]*i[0][2]]}],s);k.type=JXG.OBJECT_TYPE_CONIC;return k};JXG.JSXGraph.registerElement("ellipse",JXG.createEllipse);JXG.JSXGraph.registerElement("hyperbola",JXG.createHyperbola);JXG.JSXGraph.registerElement("parabola",JXG.createParabola);JXG.JSXGraph.registerElement("conic",JXG.createConic);JXG.Polygon=function(h,f,e){this.constructor(h,e,JXG.OBJECT_TYPE_POLYGON,JXG.OBJECT_CLASS_AREA);var g,k,d,j=JXG.copyAttributes(e,h.options,"polygon","borders");this.withLines=e.withlines;this.attr_line=j;this.vertices=[];for(g=0;gk)!=(this.vertices[f].coords.scrCoords[2]>k))&&(e<(this.vertices[f].coords.scrCoords[1]-this.vertices[g].coords.scrCoords[1])*(k-this.vertices[g].coords.scrCoords[2])/(this.vertices[f].coords.scrCoords[2]-this.vertices[g].coords.scrCoords[2])+this.vertices[g].coords.scrCoords[1])){h=!h}}}else{d=this.borders.length;for(g=0;gd){d=this.vertices[g].X()}if(this.vertices[g].Y()>e){e=this.vertices[g].Y()}if(this.vertices[g].Y()this.vertices.length-2){return this}for(f=1;f-1&&e-1;k--){h[d[k]]=-1;if(this.withLines&&(d[k]-1>d[k-1])){f[f.length-1][1]=d[k];f.push([d[k-1]])}}if(this.withLines){f[f.length-1][1]=d[0]}this.vertices=[];for(k=0;kl.length-1){g=l.length-1}}this.board.removeObject(this.borders[g]);l[g]=-1}if(f[k][1]!==0&&f[k][0]!==h.length-1){l[f[k][0]-1]=JXG.createSegment(this.board,[h[Math.max(f[k][1]-1,0)],h[Math.min(f[k][0]+1,this.vertices.length-1)]],this.attr_line)}}this.borders=[];for(k=0;k=g-2){l.id=l.ids[j-2]}d[j]=m.create("point",[d[j-2],e],l);d[j].type=JXG.OBJECT_TYPE_CAS}}l=JXG.copyAttributes(h,m.options,"polygon");f=m.create("polygon",d,l);f.elType="regularpolygon";return f};JXG.JSXGraph.registerElement("polygon",JXG.createPolygon);JXG.JSXGraph.registerElement("regularpolygon",JXG.createRegularPolygon);JXG.Curve=function(f,e,d){this.constructor(f,d,JXG.OBJECT_TYPE_CURVE,JXG.OBJECT_CLASS_CURVE);this.points=[];this.numberPoints=this.visProp.numberpointshigh;this.bezierDegree=1;this.dataX=null;this.dataY=null;if(e[0]!=null){this.varname=e[0]}else{this.varname="x"}this.xterm=e[1];this.yterm=e[2];this.generateTerm(this.varname,this.xterm,this.yterm,e[3],e[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();if(typeof this.xterm=="string"){this.notifyParents(this.xterm)}if(typeof this.yterm=="string"){this.notifyParents(this.yterm)}};JXG.Curve.prototype=new JXG.GeometryElement;JXG.extend(JXG.Curve.prototype,{minX:function(){if(this.visProp.curvetype=="polar"){return 0}else{var d=new JXG.Coords(JXG.COORDS_BY_SCREEN,[0,0],this.board);return d.usrCoords[1]}},maxX:function(){var d;if(this.visProp.curvetype=="polar"){return 2*Math.PI}else{d=new JXG.Coords(JXG.COORDS_BY_SCREEN,[this.board.canvasWidth,0],this.board);return d.usrCoords[1]}},Z:function(d){return 1},hasPoint:function(s,r,n){var u,B=Infinity,J,m,D,C,w,v,z,f,K,A,p,H,l,G,h,o,q,F=this.visProp.numberpointslow,I=(this.maxX()-this.minX())/F,e=this.board.options.precision.hasPoint/this.board.unitX,g,E,k=true;e=e*e;g=new JXG.Coords(JXG.COORDS_BY_SCREEN,[s,r],this.board);s=g.usrCoords[1];r=g.usrCoords[2];if(this.visProp.curvetype=="parameter"||this.visProp.curvetype=="polar"||this.visProp.curvetype=="functiongraph"){E=this.transformations.length;for(D=0,u=this.minX();D=JXG.Math.eps){o=H*G+l*h;p=o/q;B=H*H+l*l-p*o}else{p=0;B=H*H+l*l}if(p>=0&&p<=1&&B=JXG.Math.eps){i=(t*j+K*I)/J;if(i>0){if(i<=1){t-=i*j;K-=i*I}else{t-=j;K-=I}}}H=t*t+K*K;return Math.sqrt(H)};if(this.board.updateQuality==this.board.BOARD_QUALITY_LOW){F=15;s=10;k=10}else{F=21;s=0.7;k=0.7}A[0]=e-E;for(v=1;v1){C=l(this.points[u-2].scrCoords,[n,m],this.points[u-1].scrCoords);if(C<0.015){u--}}this.points[u]=new JXG.Coords(JXG.COORDS_BY_SCREEN,[n,m],this.board);this.updateTransform(this.points[u]);u++;B=n;f=m;o=p;q--;n=D[q][0];m=D[q][1];G=h[q]+1;v=w[q]*2}while(q>0&&u<500000);this.numberPoints=this.points.length;return this},isSegmentOutside:function(e,g,d,f){return(g<0&&f<0)||(g>this.board.canvasHeight&&f>this.board.canvasHeight)||(e<0&&d<0)||(e>this.board.canvasWidth&&d>this.board.canvasWidth)},isDistOK:function(f,d,g,e){return(Math.abs(f)0&&this.transformations[this.transformations.length-1].isNumericMatrix){this.transformations[this.transformations.length-1].melt(d)}else{this.addTransform(d)}return this},generateTerm:function(e,i,f,d,j){var h,g;if(JXG.isArray(i)){this.dataX=i;this.X=function(m){var l=parseInt(Math.floor(m)),k,n;if(m<0){l=0}else{if(m>this.dataX.length-2){l=this.dataX.length-2}}if(l==m){return this.dataX[l]}else{k=this.dataX[l];n=this.dataX[l+1];return k+(n-k)*(m-l)}};this.visProp.curvetype="plot";this.numberPoints=this.dataX.length}else{this.X=JXG.createFunction(i,this.board,e);if(JXG.isString(i)){this.visProp.curvetype="functiongraph"}else{if(JXG.isFunction(i)||JXG.isNumber(i)){this.visProp.curvetype="parameter"}}}if(JXG.isArray(f)){this.dataY=f;this.Y=function(m){var l=parseInt(Math.floor(m)),k,n;if(m<0){l=0}else{if(m>this.dataY.length-2){l=this.dataY.length-2}}if(l==m){if(JXG.isFunction(this.dataY[l])){return this.dataY[l]()}else{return this.dataY[l]}}else{if(JXG.isFunction(this.dataY[l])){k=this.dataY[l]()}else{k=this.dataY[l]}if(JXG.isFunction(this.dataY[l+1])){n=this.dataY[l+1]()}else{n=this.dataY[l+1]}return k+(n-k)*(m-l)}}}else{this.Y=JXG.createFunction(f,this.board,e)}if(JXG.isFunction(i)&&JXG.isArray(f)){h=JXG.createFunction(f[0],this.board,"");g=JXG.createFunction(f[1],this.board,"");this.X=function(k){return(i)(k)*Math.cos(k)+h()};this.Y=function(k){return(i)(k)*Math.sin(k)+g()};this.visProp.curvetype="polar"}if(d!=null){this.minX=JXG.createFunction(d,this.board,"")}if(j!=null){this.maxX=JXG.createFunction(j,this.board,"")}},notifyParents:function(d){JXG.GeonextParser.findDependencies(this,d,this.board)},getLabelAnchor:function(){var j,d,i,f=0.05*this.board.canvasWidth,e=0.05*this.board.canvasHeight,h=0.95*this.board.canvasWidth,g=0.95*this.board.canvasHeight;switch(this.visProp.label.position){case"ulft":d=f;i=e;break;case"llft":d=f;i=g;break;case"rt":d=h;i=0.5*g;break;case"lrt":d=h;i=g;break;case"urt":d=h;i=e;break;case"top":d=0.5*h;i=e;break;case"bot":d=0.5*h;i=g;break;case"lft":default:d=f;i=0.5*g;break}j=new JXG.Coords(JXG.COORDS_BY_SCREEN,[d,i],this.board);return JXG.Math.Geometry.projectCoordsToCurve(j.usrCoords[1],j.usrCoords[2],0,this,this.board)[0]},cloneToBackground:function(){var e={},d;e.id=this.id+"T"+this.numTraces;e.elementClass=JXG.OBJECT_CLASS_CURVE;this.numTraces++;e.points=this.points.slice(0);e.numberPoints=this.numberPoints;e.board=this.board;e.visProp=JXG.deepCopy(this.visProp,this.visProp.traceattributes,true);e.visProp.layer=this.board.options.layer.trace;e.visProp.curvetype=this.visProp.curvetype;JXG.clearVisPropOld(e);d=this.board.renderer.enhancedRendering;this.board.renderer.enhancedRendering=true;this.board.renderer.drawCurve(e);this.board.renderer.enhancedRendering=d;this.traces[e.id]=e.rendNode;return this},bounds:function(){var d=Infinity,h=-Infinity,j=Infinity,g=-Infinity,e=this.points.length,f;for(f=0;fthis.points[f].usrCoords[1]){d=this.points[f].usrCoords[1]}if(hthis.points[f].usrCoords[2]){j=this.points[f].usrCoords[2]}if(gMath.PI)||(this.visProp.type=="major"&&qJXG.Math.eps){if(q>=m){V=m;q-=m}else{V=q;q=0}w=Math.cos(u*V);W=Math.sin(u*V);P=[[1,0,0],[G*(1-w)+E*W,w,-W],[E*(1-w)-G*W,W,w]];I=JXG.Math.matVecMult(P,p);l=[I[0]/I[0],I[1]/I[0],I[2]/I[0]];H=p[1]-G;F=p[2]-E;S=l[1]-G;R=l[2]-E;T=Math.sqrt((H+S)*(H+S)+(F+R)*(F+R));if(Math.abs(R-F)>JXG.Math.eps){O=(H+S)*(K/T-0.5)/(R-F)*8/3}else{O=(F+R)*(K/T-0.5)/(H-S)*8/3}o=[1,p[1]-O*F,p[2]+O*H];n=[1,l[1]+O*R,l[2]-O*S];this.dataX=this.dataX.concat([o[1],n[1],l[1]]);this.dataY=this.dataY.concat([o[2],n[2],l[2]]);p=l.slice(0)}this.bezierDegree=3;this.updateStdform();this.updateQuadraticform()};h.Radius=function(){return this.radiuspoint.Dist(this.center)};h.getRadius=function(){return this.Radius()};h.hasPoint=function(q,p){var k=this.board.options.precision.hasPoint/(this.board.unitX),n=new JXG.Coords(JXG.COORDS_BY_SCREEN,[q,p],this.board),i=this.Radius(),o=this.center.coords.distance(JXG.COORDS_BY_USER,n),t=(Math.abs(o-i)Math.PI)||(this.visProp.type=="major"&&ss){t=false}}return t};h.hasPointSector=function(p,o){var m=new JXG.Coords(JXG.COORDS_BY_SCREEN,[p,o],this.board),i=this.Radius(),n=this.center.coords.distance(JXG.COORDS_BY_USER,m),s=(nMath.PI)||(this.visProp.type=="major"&&qq){s=false}}return s};h.getTextAnchor=function(){return this.center.coords};h.getLabelAnchor=function(){var l,t=10/(this.board.unitX),r=10/(this.board.unitY),p=this.point2.coords.usrCoords,i=this.center.coords.usrCoords,k=p[1]-i[1],s=p[2]-i[2],q,n,m,o;if(this.label.content!=null){this.label.content.relativeCoords=new JXG.Coords(JXG.COORDS_BY_SCREEN,[0,0],this.board)}l=JXG.Math.Geometry.rad(this.radiuspoint,this.center,this.anglepoint);if((this.visProp.type=="minor"&&l>Math.PI)||(this.visProp.type=="major"&&lJXG.Math.eps){if(p>=l){T=l;p-=l}else{T=p;p=0}t=Math.cos(T);U=Math.sin(T);N=[[1,0,0],[E*(1-t)+w*U,t,-U],[w*(1-t)-E*U,U,t]];G=JXG.Math.matVecMult(N,o);j=[G[0]/G[0],G[1]/G[0],G[2]/G[0]];F=o[1]-E;D=o[2]-w;Q=j[1]-E;P=j[2]-w;R=Math.sqrt((F+Q)*(F+Q)+(D+P)*(D+P));if(Math.abs(P-D)>JXG.Math.eps){M=(F+Q)*(I/R-0.5)/(P-D)*8/3}else{M=(D+P)*(I/R-0.5)/(F-Q)*8/3}n=[1,o[1]-M*D,o[2]+M*F];m=[1,j[1]+M*P,j[2]-M*Q];this.dataX=this.dataX.concat([n[1],m[1],j[1]]);this.dataY=this.dataY.concat([n[2],m[2],j[2]]);o=j.slice(0)}this.dataX=this.dataX.concat([j[1]+0.333*(E-j[1]),j[1]+0.666*(E-j[1]),E]);this.dataY=this.dataY.concat([j[2]+0.333*(w-j[2]),j[2]+0.666*(w-j[2]),w]);this.bezierDegree=3};g.Radius=function(){return this.point2.Dist(this.point1)};g.getRadius=function(){return this.Radius()};g.hasPoint=function(p,o){var j=this.board.options.precision.hasPoint/(this.board.unitX),m=new JXG.Coords(JXG.COORDS_BY_SCREEN,[p,o],this.board),i=this.Radius(),n=this.center.coords.distance(JXG.COORDS_BY_USER,m),s=(Math.abs(n-i)q){s=false}}return s};g.hasPointSector=function(i,o){var n=new JXG.Coords(JXG.COORDS_BY_SCREEN,[i,o],this.board),k=this.Radius(),m=this.point1.coords.distance(JXG.COORDS_BY_USER,n),j=(mJXG.Math.Geometry.rad(this.point2,this.point1,this.point3)){j=false}}return j};g.getTextAnchor=function(){return this.point1.coords};g.getLabelAnchor=function(){var k=JXG.Math.Geometry.rad(this.point2,this.point1,this.point3),s=13/(this.board.unitX),q=13/(this.board.unitY),o=this.point2.coords.usrCoords,i=this.point1.coords.usrCoords,j=o[1]-i[1],r=o[2]-i[2],p,m,l,n;if(this.label.content!=null){this.label.content.relativeCoords=new JXG.Coords(JXG.COORDS_BY_SCREEN,[0,0],this.board)}p=new JXG.Coords(JXG.COORDS_BY_USER,[i[1]+Math.cos(k*0.5)*j-Math.sin(k*0.5)*r,i[2]+Math.sin(k*0.5)*j+Math.cos(k*0.5)*r],this.board);m=p.usrCoords[1]-i[1];l=p.usrCoords[2]-i[2];n=Math.sqrt(m*m+l*l);m=m*(n+s)/n;l=l*(n+q)/n;return new JXG.Coords(JXG.COORDS_BY_USER,[i[1]+m,i[2]+l],this.board)};g.prepareUpdate().update();return g};JXG.JSXGraph.registerElement("sector",JXG.createSector);JXG.createCircumcircleSector=function(h,f,e){var g,i,d;if((JXG.isPoint(f[0]))&&(JXG.isPoint(f[1]))&&(JXG.isPoint(f[2]))){d=JXG.copyAttributes(e,h.options,"circumcirclesector","center");i=h.create("circumcenter",[f[0],f[1],f[2]],d);i.dump=false;d=JXG.copyAttributes(e,h.options,"circumcirclesector");g=h.create("sector",[i,f[0],f[2],f[1]],d);g.elType="circumcirclesector";g.parents=[f[0].id,f[1].id,f[2].id];g.center=i;g.subs={center:i}}else{throw new Error("JSXGraph: Can't create circumcircle sector with parent types '"+(typeof f[0])+"' and '"+(typeof f[1])+"' and '"+(typeof f[2])+"'.")}return g};JXG.JSXGraph.registerElement("circumcirclesector",JXG.createCircumcircleSector);JXG.createAngle=function(l,n,j){var g,f,e,o,m,h,k,d;if((JXG.isPoint(n[0]))&&(JXG.isPoint(n[1]))&&(JXG.isPoint(n[2]))){m=JXG.copyAttributes(j,l.options,"angle");o=m.name;if(typeof o=="undefined"||o==""){o=l.generateName({type:JXG.OBJECT_TYPE_ANGLE});m.name=o}h=JXG.copyAttributes(j,l.options,"angle","radiuspoint");f=l.create("point",[0,1,0],h);f.dump=false;h=JXG.copyAttributes(j,l.options,"angle","pointsquare");e=l.create("point",[0,1,1],h);e.dump=false;g=l.create("sector",[n[1],f,n[2]],m);g.elType="angle";g.parents=[n[0].id,n[1].id,n[2].id];g.subs={point:f,pointsquare:e};g.updateDataArraySquare=function(){var s=n[1],q,p,i,t;q=JXG.Math.crossProduct(e.coords.usrCoords,s.coords.usrCoords);p=[-f.X()*q[1]-f.Y()*q[2],f.Z()*q[1],f.Z()*q[2]];q=JXG.Math.crossProduct(f.coords.usrCoords,s.coords.usrCoords);i=[-e.X()*q[1]-e.Y()*q[2],e.Z()*q[1],e.Z()*q[2]];t=JXG.Math.crossProduct(p,i);t[1]/=t[0];t[2]/=t[0];this.dataX=[s.X(),f.X(),t[1],e.X(),s.X()];this.dataY=[s.Y(),f.Y(),t[2],e.Y(),s.Y()];this.bezierDegree=1};g.updateDataArrayNone=function(){this.dataX=[NaN];this.dataY=[NaN];this.bezierDegree=1};g.updateDataArraySector=g.updateDataArray;g.updateDataArray=function(){var i=this.visProp.type,p=JXG.Math.Geometry.trueAngle(n[0],n[1],n[2]);if(Math.abs(p-90)=3&&JXG.isPoint(f[0])&&JXG.isPoint(f[1])&&JXG.isPoint(f[2])){d=f[0];j=f[1];i=f[2];h=g.create("point",[function(){var m,l,n;m=Math.sqrt((j.X()-i.X())*(j.X()-i.X())+(j.Y()-i.Y())*(j.Y()-i.Y()));l=Math.sqrt((d.X()-i.X())*(d.X()-i.X())+(d.Y()-i.Y())*(d.Y()-i.Y()));n=Math.sqrt((j.X()-d.X())*(j.X()-d.X())+(j.Y()-d.Y())*(j.Y()-d.Y()));return new JXG.Coords(JXG.COORDS_BY_USER,[(m*d.X()+l*j.X()+n*i.X())/(m+l+n),(m*d.Y()+l*j.Y()+n*i.Y())/(m+l+n)],g)}],e);h.elType="incenter";h.parents=[f[0].id,f[1].id,f[2].id]}else{throw new Error("JSXGraph: Can't create incenter with parent types '"+(typeof f[0])+"', '"+(typeof f[1])+"' and '"+(typeof f[2])+"'.\nPossible parent types: [point,point,point]")}return h};JXG.createCircumcircle=function(h,g,f){var j,k,d;try{d=JXG.copyAttributes(f,h.options,"circumcircle","center");j=JXG.createCircumcircleMidpoint(h,g,d);j.dump=false;if(!JXG.exists(f.layer)){f.layer=h.options.layer.circle}d=JXG.copyAttributes(f,h.options,"circumcircle");k=JXG.createCircle(h,[j,g[0]],d);k.elType="circumcircle";k.parents=[g[0].id,g[1].id,g[2].id];k.subs={center:j}}catch(i){throw new Error("JSXGraph: Can't create circumcircle with parent types '"+(typeof g[0])+"', '"+(typeof g[1])+"' and '"+(typeof g[2])+"'.\nPossible parent types: [point,point,point]")}return k};JXG.createIncircle=function(i,h,f){var k,l,d,g;try{d=JXG.copyAttributes(f,i.options,"incircle","center");k=JXG.createIncenter(i,h,d);k.dump=false;if(!JXG.exists(f.layer)){f.layer=i.options.layer.circle}d=JXG.copyAttributes(f,i.options,"incircle");l=JXG.createCircle(i,[k,function(){var m=Math.sqrt((h[1].X()-h[2].X())*(h[1].X()-h[2].X())+(h[1].Y()-h[2].Y())*(h[1].Y()-h[2].Y())),e=Math.sqrt((h[0].X()-h[2].X())*(h[0].X()-h[2].X())+(h[0].Y()-h[2].Y())*(h[0].Y()-h[2].Y())),o=Math.sqrt((h[1].X()-h[0].X())*(h[1].X()-h[0].X())+(h[1].Y()-h[0].Y())*(h[1].Y()-h[0].Y())),n=(m+e+o)/2;return Math.sqrt(((n-m)*(n-e)*(n-o))/n)}],d);l.elType="incircle";l.parents=[h[0].id,h[1].id,h[2].id];l.center=k;l.subs={center:k}}catch(j){throw new Error("JSXGraph: Can't create circumcircle with parent types '"+(typeof h[0])+"', '"+(typeof h[1])+"' and '"+(typeof h[2])+"'.\nPossible parent types: [point,point,point]")}return l};JXG.createReflection=function(h,f,e){var d,j,i,g;if(f[0].elementClass==JXG.OBJECT_CLASS_POINT&&f[1].elementClass==JXG.OBJECT_CLASS_LINE){j=f[0];d=f[1]}else{if(f[1].elementClass==JXG.OBJECT_CLASS_POINT&&f[0].elementClass==JXG.OBJECT_CLASS_LINE){j=f[1];d=f[0]}else{throw new Error("JSXGraph: Can't create reflection point with parent types '"+(typeof f[0])+"' and '"+(typeof f[1])+"'.\nPossible parent types: [line,point]")}}g=JXG.createTransform(h,[d],{type:"reflect"});i=JXG.createPoint(h,[j,g],e);j.addChild(i);d.addChild(i);i.elType="reflection";i.parents=[f[0].id,f[1].id];i.prepareUpdate().update();i.generatePolynomial=function(){var l=d.point1.symbolic.x;var k=d.point1.symbolic.y;var r=d.point2.symbolic.x;var q=d.point2.symbolic.y;var t=j.symbolic.x;var s=j.symbolic.y;var n=i.symbolic.x;var m=i.symbolic.y;var p=["((",m,")-(",s,"))*((",k,")-(",q,"))+((",l,")-(",r,"))*((",n,")-(",t,"))"].join("");var o=["((",n,")-(",l,"))^2+((",m,")-(",k,"))^2-((",t,")-(",l,"))^2-((",s,")-(",k,"))^2"].join("");return[p,o]};return i};JXG.createMirrorPoint=function(g,e,d){var h,f;if(JXG.isPoint(e[0])&&JXG.isPoint(e[1])){h=JXG.createPoint(g,[function(){return JXG.Math.Geometry.rotation(e[0],e[1],Math.PI,g)}],d);for(f=0;f<2;f++){e[f].addChild(h)}h.elType="mirrorpoint";h.parents=[e[0].id,e[1].id]}else{throw new Error("JSXGraph: Can't create mirror point with parent types '"+(typeof e[0])+"' and '"+(typeof e[1])+"'.\nPossible parent types: [point,point]")}h.prepareUpdate().update();return h};JXG.createIntegral=function(i,z,m){var w,r,u,g=0,f=0,e,d,l,k,q=1,v,n,h,A,j,o,s;if(JXG.isArray(z[0])&&z[1].elementClass==JXG.OBJECT_CLASS_CURVE){w=z[0];r=z[1]}else{if(JXG.isArray(z[1])&&z[0].elementClass==JXG.OBJECT_CLASS_CURVE){w=z[1];r=z[0]}else{throw new Error("JSXGraph: Can't create integral with parent types '"+(typeof z[0])+"' and '"+(typeof z[1])+"'.\nPossible parent types: [[number|function,number|function],curve]")}}g=w[0];f=w[1];if(JXG.isFunction(g)){e=g;d=function(){return r.Y(e())};g=e()}else{e=g;d=r.Y(g)}if(JXG.isFunction(g)){l=f;k=function(){return r.Y(l())};f=l()}else{l=f;k=r.Y(f)}if(f0){return}var j=JXG.Math.Symbolic.generatePolynomials(f,g,true).join("|");if(j===h.spe){return}h.spe=j;var i=function(m,o,l,n){h.dataX=m;h.dataY=o;h.eq=l;h.ctime=n;h.generatePolynomial=(function(p){return function(r){var q="("+r.symbolic.x+")",u="("+r.symbolic.y+")",t=[],s;for(s=0;sl.usrCoords[2]-n;k-=n){h.dataX.push(m.usrCoords[1],l.usrCoords[1],NaN);h.dataY.push(k,k,NaN)}for(k=m.usrCoords[1];k=h-f&&j<=i+f)&&((d>=g-f&&d<=g+2*f)||(d>=e-2*f&&d<=e+f))},setTextJessieCode:function(e){var d;this.visProp.castext=e;if(typeof e==="function"){d=function(){return e().replace(//g,">")}}else{if(JXG.isNumber(e)){d=e}else{d=e.replace(//g,">")}}return this.setText(d)},setText:function(d){if(typeof d==="function"){this.updateText=function(){this.plaintext=d()}}else{if(JXG.isNumber(d)){this.content=(d).toFixed(this.visProp.digits)}else{if(this.visProp.useasciimathml){this.content="'`"+d+"`'"}else{this.content=this.generateTerm(d)}}this.updateText=new Function("this.plaintext = "+this.content+"; ")}this.updateText();this.prepareUpdate().update().updateRenderer();return this},updateSize:function(){var d;if(typeof document==="undefined"){return this}if(this.visProp.display=="html"&&this.board.renderer.type!="vml"){this.size=[this.rendNode.offsetWidth,this.rendNode.offsetHeight]}else{if(this.visProp.display=="internal"&&this.board.renderer.type=="svg"){try{d=this.rendNode.getBBox();this.size=[d.width,d.height]}catch(f){}}else{if(this.board.renderer.type=="vml"||(this.visProp.display=="internal"&&this.board.renderer.type=="canvas")){this.size=[parseFloat(this.visProp.fontsize)*this.plaintext.length*0.45,parseFloat(this.visProp.fontsize)*0.9]}}}return this},getSize:function(){return this.size},setCoords:function(d,e){if(JXG.isArray(d)&&d.length>1){e=d[1];d=d[0]}this.X=function(){return d};this.Y=function(){return e};this.coords=new JXG.Coords(JXG.COORDS_BY_USER,[d,e],this.board);this.prepareUpdate().update().updateRenderer();return this},free:function(){this.X=JXG.createFunction(this.X(),this.board,"");this.Y=JXG.createFunction(this.Y(),this.board,"");this.isDraggable=true},update:function(){var d,f,e;if(this.needsUpdate){if(this.relativeCoords){if(this.visProp.islabel){f=parseFloat(this.visProp.offset[0]);e=-parseFloat(this.visProp.offset[1]);d=this.element.getLabelAnchor();this.coords.setCoordinates(JXG.COORDS_BY_SCREEN,[f+this.relativeCoords.scrCoords[1]+d.scrCoords[1],e+this.relativeCoords.scrCoords[2]+d.scrCoords[2]])}else{d=this.element.getTextAnchor();this.coords.setCoordinates(JXG.COORDS_BY_USER,[this.relativeCoords.usrCoords[1]+d.usrCoords[1],this.relativeCoords.usrCoords[2]+d.usrCoords[2]])}}else{this.updateCoords()}this.updateText();if(this.needsSizeUpdate){this.updateSize()}this.updateTransform()}return this},updateRenderer:function(){if(this.needsUpdate){this.board.renderer.updateText(this);this.needsUpdate=false}return this},updateTransform:function(){var d;if(this.transformations.length==0){return}for(d=0;d/g,"∠");h=h.replace(//g,"√");var e;e=h.indexOf("");var d=h.indexOf("");if(e>=0){this.needsSizeUpdate=true;while(e>=0){k+=' + "'+JXG.GeonextParser.replaceSub(JXG.GeonextParser.replaceSup(h.slice(0,e)))+'"';f=h.slice(e+7,d);g=JXG.GeonextParser.geonext2JS(f,this.board);g=g.replace(/\\"/g,'"');g=g.replace(/\\'/g,"'");if(g.indexOf("toFixed")<0){if(JXG.isNumber((JXG.bind(new Function("return "+g+";"),this))())){k+="+("+g+").toFixed("+(this.visProp.digits)+")"}else{k+="+("+g+")"}}else{k+="+("+g+")"}h=h.slice(d+8);e=h.indexOf("");d=h.indexOf("")}}k+=' + "'+JXG.GeonextParser.replaceSub(JXG.GeonextParser.replaceSup(h))+'"';k=k.replace(//g,"");k=k.replace(/<\/overline>/g,"");k=k.replace(//g,"");k=k.replace(/<\/arrow>/g,"");k=k.replace(/&/g,"&");return k},notifyParents:function(f){var e=null;do{var d=/([\w\s\*\/\^\-\+\(\)\[\],<>=!]+)<\/value>/;e=d.exec(f);if(e!=null){JXG.GeonextParser.findDependencies(this,e[1],this.board);f=f.substr(e.index);f=f.replace(d,"")}}while(e!=null);return this},bounds:function(){var d=this.coords.usrCoords;return this.visProp.islabel?[0,0,0,0]:[d[1],d[2]+this.size[1],d[1]+this.size[0],d[2]]},setPositionDirectly:function(j,h,g){var e,d,i,f;if(this.relativeCoords){if(this.visProp.islabel){f=new JXG.Coords(j,g,this.board);i=new JXG.Coords(j,h,this.board);e=i.scrCoords[1]-f.scrCoords[1];d=i.scrCoords[2]-f.scrCoords[2];this.relativeCoords.scrCoords[1]+=e;this.relativeCoords.scrCoords[2]+=d}else{f=new JXG.Coords(j,g,this.board);i=new JXG.Coords(j,h,this.board);e=i.usrCoords[1]-f.usrCoords[1];d=i.usrCoords[2]-f.usrCoords[2];this.relativeCoords.usrCoords[1]+=e;this.relativeCoords.usrCoords[2]+=d}}else{i=new JXG.Coords(j,h,this.board);this.X=JXG.createFunction(i.usrCoords[1],this.board,"");this.Y=JXG.createFunction(i.usrCoords[2],this.board,"")}return this}});JXG.createText=function(h,f,e){var d,g,d=JXG.copyAttributes(e,h.options,"text");d.anchor=d.parent||d.anchor;g=new JXG.Text(h,f[f.length-1],f,d);if(typeof f[f.length-1]!=="function"){g.parents=f}if(JXG.evaluate(d.rotate)!=0&&d.display=="internal"){g.addRotation(JXG.evaluate(d.rotate))}return g};JXG.JSXGraph.registerElement("text",JXG.createText);JXG.Image=function(g,e,h,f,d){this.constructor(g,d,JXG.OBJECT_TYPE_IMAGE,JXG.OBJECT_CLASS_OTHER);this.initialCoords=new JXG.Coords(JXG.COORDS_BY_USER,h,this.board);if(!JXG.isFunction(h[0])&&!JXG.isFunction(h[1])){this.isDraggable=true}this.X=JXG.createFunction(h[0],this.board,"");this.Y=JXG.createFunction(h[1],this.board,"");this.W=JXG.createFunction(f[0],this.board,"");this.H=JXG.createFunction(f[1],this.board,"");this.coords=new JXG.Coords(JXG.COORDS_BY_USER,[this.X(),this.Y()],this.board);this.updateCoords=new Function("","this.coords.setCoordinates(JXG.COORDS_BY_USER,[this.X(),this.Y()]);");this.updateSize=new Function("","this.coords.setCoordinates(JXG.COORDS_BY_USER,[this.W(),this.H()]);");this.usrSize=[this.W(),this.H()];this.size=[this.usrSize[0]*g.unitX,this.usrSize[1]*g.unitY];this.url=e;this.parent=JXG.getRef(d.anchor);this.id=this.board.setId(this,"Im");this.board.renderer.drawImage(this);if(!this.visProp.visible){this.board.renderer.hide(this)}};JXG.Image.prototype=new JXG.GeometryElement;JXG.extend(JXG.Image.prototype,{hasPoint:function(d,h){var f=d-this.coords.scrCoords[1],e=this.coords.scrCoords[2]-h,g=this.board.options.precision.hasPoint;if(f>=-g&&f<=2*g&&e>=-g&&e<=g){return true}else{return false}},update:function(){if(this.needsUpdate){this.updateCoords();this.usrSize=[this.W(),this.H()];this.size=[this.usrSize[0]*this.board.unitX,this.usrSize[1]*this.board.unitY];this.updateTransform()}return this},updateRenderer:function(){if(this.needsUpdate){this.board.renderer.updateImage(this);this.needsUpdate=false}return this},updateTransform:function(){if(this.transformations.length==0){return}for(var d=0;d=0){v+=d*0.5/e.unitX}else{v-=d*r/e.unitX}m-=d*0.2/e.unitY;q=e.create("text",[v,m,f.labels[u]],f)}}else{s[0]=e.create("point",[o,0],z);s[1]=e.create("point",[o,v],z);s[2]=e.create("point",[k,v],z);s[3]=e.create("point",[k,0],z);if(JXG.exists(f.labels)&&JXG.exists(f.labels[u])){r=f.labels[u].toString().length;r=0.6*r*d/e.unitX;if(v>=0){v+=d*0.5/e.unitY}else{v-=d*1/e.unitY}q=e.create("text",[m-r*0.5,v,f.labels[u]],f)}}f.withlines=false;if(JXG.exists(f.colors)&&JXG.isArray(f.colors)){j=f.colors;f.fillcolor=j[u%j.length]}g[u]=e.create("polygon",s,f);if(JXG.exists(f.labels)&&JXG.exists(f.labels[u])){g[u].text=q}}return g},drawPoints:function(j,d,k,f){var g,h=[],e=f.infoboxarray;f.fixed=true;f.name="";for(g=0;gad[Y]){ad[Y]=R[aa][Y]}if(R[aa][Y]1){if(g.length==3){h=this.evalParam(1);l=this.evalParam(2)}else{h=g[1].X();l=g[1].Y()}this.matrix[1][0]=h*(1-k)+l*i;this.matrix[2][0]=l*(1-k)-h*i}}}else{if(e=="shear"){this.evalParam=JXG.createEvalFunction(f,g,1);this.update=function(){var h=this.evalParam(0);this.matrix[1][1]=Math.tan(h)}}else{if(e=="generic"){this.evalParam=JXG.createEvalFunction(f,g,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(d){this.update();if(arguments[1]!=null){return JXG.Math.matVecMult(this.matrix,d.initialCoords.usrCoords)}else{return JXG.Math.matVecMult(this.matrix,d.coords.usrCoords)}},applyOnce:function(f){var g,d,e;if(!JXG.isArray(f)){this.update();g=JXG.Math.matVecMult(this.matrix,f.coords.usrCoords);f.coords.setCoordinates(JXG.COORDS_BY_USER,g)}else{d=f.length;for(e=0;e=8192){this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this._attributes);this.objects.push(this.curve)}}this.pos[0]+=f;this.pos[1]+=e;if(this.isPenDown){this.curve.dataX.push(this.pos[0]);this.curve.dataY.push(this.pos[1])}this.board.update();return this},back:function(d){return this.forward(-d)},right:function(e){this.dir-=e;this.dir%=360;if(!this.turtleIsHidden){var d=this.board.create("transform",[-e*Math.PI/180,this.turtle],{type:"rotate"});d.applyOnce(this.turtle2)}this.board.update();return this},left:function(d){return this.right(-d)},penUp:function(){this.isPenDown=false;return this},penDown:function(){this.isPenDown=true;this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this._attributes);this.objects.push(this.curve);return this},clean:function(){for(var d=0;d=8192){this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this._attributes);this.objects.push(this.curve)}}this.pos[0]=g[0];this.pos[1]=g[1];if(this.isPenDown){this.curve.dataX.push(this.pos[0]);this.curve.dataY.push(this.pos[1])}this.board.update()}return this},fd:function(d){return this.forward(d)},bk:function(d){return this.back(d)},lt:function(d){return this.left(d)},rt:function(d){return this.right(d)},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(h,l){var g,f,k,e,d=this.objects.length;for(g=0,f=0;g=3){arguments[0]=[arguments[0],arguments[1],arguments[2]];arguments.length=1}n=arguments[0];if(JXG.isArray(n)){for(j=0;j<3;j++){e|=/\./.test(arguments[0][j].toString())}for(j=0;j<3;j++){e&=(arguments[0][j]>=0)&(arguments[0][j]<=1)}if(e){return[Math.ceil(arguments[0][0]*255),Math.ceil(arguments[0][1]*255),Math.ceil(arguments[0][2]*255)]}else{arguments[0].length=3;return arguments[0]}}else{if(typeof arguments[0]==="string"){n=arguments[0]}}if(n.charAt(0)=="#"){n=n.substr(1,6)}n=n.replace(/ /g,"").toLowerCase();var h={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"};n=h[n]||n;var m=[{re:/^\s*rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([\d\.]{1,3})\s*\)\s*$/,example:["rgba(123, 234, 45, 0.5)","rgba(255,234,245,1.0)"],process:function(g){return[parseInt(g[1]),parseInt(g[2]),parseInt(g[3])]}},{re:/^\s*rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)\s*$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(g){return[parseInt(g[1]),parseInt(g[2]),parseInt(g[3])]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(g){return[parseInt(g[1],16),parseInt(g[2],16),parseInt(g[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(g){return[parseInt(g[1]+g[1],16),parseInt(g[2]+g[2],16),parseInt(g[3]+g[3],16)]}}];for(j=0;j255)?255:d);l=(l<0||isNaN(l))?0:((l>255)?255:l);o=(o<0||isNaN(o))?0:((o>255)?255:o);return[d,l,o]};JXG.rgb2css=function(){var f,e,d;f=JXG.rgbParser.apply(JXG.rgbParser,arguments);e=f[1];d=f[2];f=f[0];return"rgb("+f+", "+e+", "+d+")"};JXG.rgb2hex=function(){var f,e,d;f=JXG.rgbParser.apply(JXG.rgbParser,arguments);e=f[1];d=f[2];f=f[0];f=f.toString(16);e=e.toString(16);d=d.toString(16);if(f.length==1){f="0"+f}if(e.length==1){e="0"+e}if(d.length==1){d="0"+d}return"#"+f+e+d};JXG.hex2rgb=function(h){var f,e,d;if(h.charAt(0)=="#"){h=h.slice(1)}f=parseInt(h.substr(0,2),16);e=parseInt(h.substr(2,2),16);d=parseInt(h.substr(4,2),16);return"rgb("+f+", "+e+", "+d+")"};JXG.hsv2rgb=function(o,k,j){var l,r,g,n,m,h,e,d,s;o=((o%360)+360)%360;if(k==0){if(isNaN(o)||o=360){h=0}else{h=o}h=h/60;m=Math.floor(h);n=h-m;e=j*(1-k);d=j*(1-(k*n));s=j*(1-(k*(1-n)));switch(m){case 0:l=j;r=s;g=e;break;case 1:l=d;r=j;g=e;break;case 2:l=e;r=j;g=s;break;case 3:l=e;r=d;g=j;break;case 4:l=s;r=e;g=j;break;case 5:l=j;r=e;g=d;break}}l=Math.round(l*255).toString(16);l=(l.length==2)?l:((l.length==1)?"0"+l:"00");r=Math.round(r*255).toString(16);r=(r.length==2)?r:((r.length==1)?"0"+r:"00");g=Math.round(g*255).toString(16);g=(g.length==2)?g:((g.length==1)?"0"+g:"00");return["#",l,r,g].join("")};JXG.rgb2hsv=function(){var d,m,p,n,e,i,f,q,l,u,t,o,j,k;d=JXG.rgbParser.apply(JXG.rgbParser,arguments);m=d[1];p=d[2];d=d[0];k=JXG.Math.Statistics;n=d/255;e=m/255;i=p/255;o=k.max([d,m,p]);j=k.min([d,m,p]);f=o/255;q=j/255;t=f;u=0;if(t>0){u=(t-q)/(t*1)}l=1/(f-q);if(u>0){if(o==d){l=(e-i)*l}else{if(o==m){l=2+(i-n)*l}else{l=4+(n-e)*l}}}l*=60;if(l<0){l+=360}if(o==j){l=0}return[l,u,t]};JXG.rgb2LMS=function(){var n,k,e,f,d,j,i,h=[[0.05059983,0.08585369,0.0095242],[0.01893033,0.08925308,0.01370054],[0.00292202,0.00975732,0.07145979]];n=JXG.rgbParser.apply(JXG.rgbParser,arguments);k=n[1];e=n[2];n=n[0];n=Math.pow(n,0.476190476);k=Math.pow(k,0.476190476);e=Math.pow(e,0.476190476);f=n*h[0][0]+k*h[0][1]+e*h[0][2];d=n*h[1][0]+k*h[1][1]+e*h[1][2];j=n*h[2][0]+k*h[2][1]+e*h[2][2];i=[f,d,j];i.l=f;i.m=d;i.s=j;return i};JXG.LMS2rgb=function(f,e,o){var d,h,j,i,k=[[30.830854,-29.832659,1.610474],[-6.481468,17.715578,-2.532642],[-0.37569,-1.199062,14.273846]];d=f*k[0][0]+e*k[0][1]+o*k[0][2];h=f*k[1][0]+e*k[1][1]+o*k[1][2];j=f*k[2][0]+e*k[2][1]+o*k[2][2];var n=function(l){var m=127,g=64;while(g>0){if(Math.pow(m,0.476190476)>l){m-=g}else{if(Math.pow(m+1,0.476190476)>l){return m}m+=g}g/=2}if(m==254&&13.994955247>4)&15)+h.charAt(e&15);f="#"+g+""+g+""+g;return f};JXG.rgb2cb=function(i,p){if(i=="none"){return i}var r,h,g,v,q,n,f,u,k,e,t,j,o;q=JXG.rgb2LMS(i);h=q.l;g=q.m;v=q.s;p=p.toLowerCase();switch(p){case"protanopia":f=-0.06150039994295001;u=0.08277001656812001;k=-0.013200141220000003;e=0.05858939668799999;t=-0.07934519995360001;j=0.013289415272000003;o=0.6903216543277437;n=v/g;if(n>4)&15)+d.charAt(r.r&15);i="#"+n;n=d.charAt((r.g>>4)&15)+d.charAt(r.g&15);i+=n;n=d.charAt((r.b>>4)&15)+d.charAt(r.b&15);i+=n;return i};JXG.extend(JXG.Board.prototype,{angle:function(d,f,e){return JXG.Math.Geometry.angle(d,f,e)},rad:function(d,f,e){return JXG.Math.Geometry.rad(d,f,e)},distance:function(e,d){return JXG.Math.Geometry.distance(e,d)},pow:function(e,d){return JXG.Math.pow(e,d)},round:function(d,e){return(d).toFixed(e)},cosh:function(d){return JXG.Math.cosh(d)},sinh:function(d){return JXG.Math.sinh(d)},sgn:function(d){return(d==0?0:d/(Math.abs(d)))},D:function(d,e){return JXG.Math.Numerics.D(d,e)},I:function(d,e){return JXG.Math.Numerics.I(d,e)},root:function(e,d,g){return JXG.Math.Numerics.root(e,d,g)},lagrangePolynomial:function(d){return JXG.Math.Numerics.lagrangePolynomial(d)},neville:function(d){return JXG.Math.Numerics.Neville(d)},riemannsum:function(g,i,e,h,d){return JXG.Math.Numerics.riemannsum(g,i,e,h,d)},abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,ceil:Math.ceil,cos:Math.cos,exp:Math.exp,floor:Math.floor,log:Math.log,max:Math.max,min:Math.min,random:Math.random,sin:Math.sin,sqrt:Math.sqrt,tan:Math.tan,trunc:Math.ceil,factorial:function(d){return JXG.Math.factorial(d)},binomial:function(e,d){return JXG.Math.binomial(e,d)},getElement:function(d){return JXG.getReference(this,d)},intersectionOptions:["point",[[JXG.OBJECT_CLASS_LINE,JXG.OBJECT_CLASS_LINE],[JXG.OBJECT_CLASS_LINE,JXG.OBJECT_CLASS_CIRCLE],[JXG.OBJECT_CLASS_CIRCLE,JXG.OBJECT_CLASS_CIRCLE]]],intersection:function(g,e,f,d){g=JXG.getReference(this,g);e=JXG.getReference(this,e);if(g.elementClass==JXG.OBJECT_CLASS_CURVE&&e.elementClass==JXG.OBJECT_CLASS_CURVE){return function(){return JXG.Math.Geometry.meetCurveCurve(g,e,f,d,g.board)}}else{if((g.type==JXG.OBJECT_TYPE_ARC&&e.elementClass==JXG.OBJECT_CLASS_LINE)||(e.type==JXG.OBJECT_TYPE_ARC&&g.elementClass==JXG.OBJECT_CLASS_LINE)){return function(){return JXG.Math.Geometry.meet(g.stdform,e.stdform,f,g.board)}}else{if((g.elementClass==JXG.OBJECT_CLASS_CURVE&&e.elementClass==JXG.OBJECT_CLASS_LINE)||(e.elementClass==JXG.OBJECT_CLASS_CURVE&&g.elementClass==JXG.OBJECT_CLASS_LINE)){return function(){return JXG.Math.Geometry.meetCurveLine(g,e,f,g.board)}}else{return function(){return JXG.Math.Geometry.meet(g.stdform,e.stdform,f,g.board)}}}}},intersectionFunc:function(g,e,f,d){return this.intersection(g,e,f,d)},otherIntersection:function(e,d,f){e=JXG.getReference(this,e);d=JXG.getReference(this,d);return function(){var g=JXG.Math.Geometry.meet(e.stdform,d.stdform,0,e.board);if(Math.abs(f.X()-g.usrCoords[1])>JXG.Math.eps||Math.abs(f.Y()-g.usrCoords[2])>JXG.Math.eps||Math.abs(f.Z()-g.usrCoords[0])>JXG.Math.eps){return g}else{return JXG.Math.Geometry.meet(e.stdform,d.stdform,1,e.board)}}},pointFunc:function(){return[null]},pointOptions:["point",[[JXG.OBJECT_CLASS_POINT]]],lineFunc:function(){return arguments},lineOptions:["line",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT]]],linesegmentFunc:function(){return arguments},linesegmentOptions:["line",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT]]],linesegmentAtts:{straightFirst:false,straightLast:false},arrowFunc:function(){return arguments},arrowOptions:["arrow",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT]]],circleFunc:function(){return arguments},circleOptions:["circle",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT],[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_LINE],[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_CIRCLE]]],arrowparallelOptions:["arrowparallel",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_LINE]]],arrowparallelFunc:function(){return arguments},bisectorOptions:["bisector",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT]]],bisectorFunc:function(){return arguments},circumcircleOptions:["circumcircle",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT]]],circumcircleFunc:function(){return arguments},circumcirclemidpointOptions:["circumcirclemidpoint",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT]]],circumcirclemidpointFunc:function(){return arguments},integralOptions:["integral",[[]]],integralFunc:function(){return arguments},midpointOptions:["midpoint",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT],[JXG.OBJECT_CLASS_LINE]]],midpointFunc:function(){return arguments},mirrorpointOptions:["mirrorpoint",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT]]],mirrorpointFunc:function(){return arguments},normalOptions:["normal",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_LINE]]],normalFunc:function(){return arguments},parallelOptions:["parallel",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_LINE]]],parallelFunc:function(){return arguments},parallelpointOptions:["parallelpoint",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT]]],parallelpointFunc:function(){return arguments},perpendicularOptions:["perpendicular",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_LINE]]],perpendicularFunc:function(){return arguments},perpendicularpointOptions:["perpendicularpoint",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_LINE]]],perpendicularpointFunc:function(){return arguments},reflectionOptions:["reflection",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_LINE]]],reflectionFunc:function(){return arguments}});JXG.Point.prototype.setPositionX=function(f,d){var e=(f==JXG.COORDS_BY_USER)?this.coords.usrCoords[2]:this.coords.scrCoords[2];this.setPosition(f,[d,e])};JXG.Point.prototype.setPositionY=function(f,e){var d=(f==JXG.COORDS_BY_USER)?this.coords.usrCoords[1]:this.coords.scrCoords[1];this.setPosition(f,[d,e])};JXG.Ticks=function(d,f,e){this.constructor(d.board,e,JXG.OBJECT_TYPE_TICKS,JXG.OBJECT_CLASS_OTHER);this.line=d;this.board=this.line.board;this.ticksFunction=null;this.fixedTicks=null;this.equidistant=false;if(JXG.isFunction(f)){this.ticksFunction=f;throw new Error("Function arguments are no longer supported.")}else{if(JXG.isArray(f)){this.fixedTicks=f}else{if(Math.abs(f)=C&&this.fixedTicks[K]JXG.Math.eps){N=this._adjustTickDistance(B,s,J,P.coords,p,o);B*=N;n*=N}if(!this.visProp.insertticks){B/=this.visProp.minorticks+1;n/=this.visProp.minorticks+1}this.ticksDelta=B;this.symbTicksDelta=n;T=this.board.getBoundingBox();H=(T[0]+T[2])*0.5;F=(T[1]+T[3])*0.5;M=[H*this.line.stdform[2]-F*this.line.stdform[1],-this.line.stdform[2],this.line.stdform[1]];e=JXG.Math.crossProduct(this.line.stdform,M);e[1]/=e[0];e[2]/=e[0];e[0]=1;w=new JXG.Coords(JXG.COORDS_BY_USER,e.slice(1),this.board);Q=P.coords.distance(JXG.COORDS_BY_USER,w);if((O.X()-P.X())*(e[1]-P.X())<0||(O.Y()-P.Y())*(e[2]-P.Y())<0){Q*=-1}D=Math.round(Q/B)*B;if(Math.abs(D)>JXG.Math.eps){R=Math.abs(D)/D}e[1]=P.coords.usrCoords[1]+p*D;e[2]=P.coords.usrCoords[2]+o*D;q=D;D=0;k=0;r=q/this.visProp.scale;H=e[1];F=e[2];K=0;I=0;do{w=new JXG.Coords(JXG.COORDS_BY_USER,[H,F],this.board);w.major=Math.round((R*D+q)/B)%(this.visProp.minorticks+1)===0;g=this._tickEndings(w,h,A,v,S,w.major);if(g.length==2){z=R*k+r;if((Math.abs(z)<=u&&this.visProp.drawzero)||(z>C&&z0);this.needsUpdate=true;this.updateRenderer()},_adjustTickDistance:function(e,l,k,m,g,d){var i,h,j=1;while(l>4*this.minTicksDistance){j/=10;i=m.usrCoords[1]+g*e*j;h=m.usrCoords[2]+d*e*j;l=m.distance(JXG.COORDS_BY_SCREEN,new JXG.Coords(JXG.COORDS_BY_USER,[i,h],this.board))}while(l=0&&o[1]<=f){j[g]=o[1];h[g]=0;g++}o=JXG.Math.crossProduct([0,1,0],[-d*z[1]-r*z[2],d,r]);o[2]/=o[0];if(o[2]>=0&&o[2]<=m){j[g]=0;h[g]=o[2];g++}if(g<2){o=JXG.Math.crossProduct([m*m,0,-m],[-d*z[1]-r*z[2],d,r]);o[1]/=o[0];if(o[1]>=0&&o[1]<=f){j[g]=o[1];h[g]=m;g++}}if(g<2){o=JXG.Math.crossProduct([f*f,-f,0],[-d*z[1]-r*z[2],d,r]);o[2]/=o[0];if(o[2]>=0&&o[2]<=m){j[g]=f;h[g]=o[2]}}}}if((j[0]>=0&&j[0]<=f&&h[0]>=0&&h[0]<=m)||(j[1]>=0&&j[1]<=f&&h[1]>=0&&h[1]<=m)){n=true}else{n=false}if(w=="finite"){j[0]=z[1]+l;h[0]=z[2]-k;j[1]=z[1]-l;h[1]=z[2]+k}if(n){return[j,h]}else{return[]}},_makeLabel:function(m,d,l,f,e,h){var g,n,k,j=typeof m==="number";if(!f){return null}g=m.toString();if(Math.abs(m)5||g.indexOf("e")!=-1)){g=m.toPrecision(3).toString()}if(j&&g.indexOf(".")>-1){g=g.replace(/0+$/,"");g=g.replace(/\.$/,"")}if(this.visProp.scalesymbol.length>0&&g==="1"){g=this.visProp.scalesymbol}else{if(this.visProp.scalesymbol.length>0&&g==="0"){g="0"}else{g=g+this.visProp.scalesymbol}}k={id:e+h+"Label",isLabel:true,layer:l.options.layer.line,highlightStrokeColor:l.options.text.strokeColor,highlightStrokeWidth:l.options.text.strokeWidth,highlightStrokeOpacity:l.options.text.strokeOpacity,visible:this.visProp.visible,priv:this.visProp.priv};k=JXG.deepCopy(k,this.visProp.label);n=JXG.createText(l,[d.usrCoords[1],d.usrCoords[2],g],k);n.isDraggable=false;n.dump=false;n.distanceX=this.visProp.label.offset[0];n.distanceY=this.visProp.label.offset[1];n.setCoords(d.usrCoords[1]+n.distanceX/(l.unitX),d.usrCoords[2]+n.distanceY/(l.unitY));n.visProp.visible=f;return n},removeTickLabels:function(){var d;if(this.labels!=null){if((this.board.needsFullUpdate||this.needsRegularUpdate)&&!(this.board.options.renderer=="canvas"&&this.board.options.text.display=="internal")){for(d=0;d>=1;if(ae==0){ae=g();ag=(ae&1);ae=(ae>>1)|128}return ag}function W(ag){var ai=0,ah=ag;while(ah--){ai=(ai<<1)|Y()}if(ag){ai=Z[ai]>>(8-ag)}return ai}function f(){aa=0}function A(ag){K++;k[aa++]=ag;p.push(String.fromCharCode(ag));if(aa==32768){aa=0}}function o(){this.b0=0;this.b1=0;this.jump=null;this.jumppos=-1}var h=288;var w=new Array(h);var Q=new Array(32);var L=0;var ab=null;var s=null;var P=new Array(64);var M=new Array(64);var B=0;var F=new Array(17);F[0]=0;var R;var v;function l(){while(1){if(F[B]>=v){return -1}if(R[F[B]]==B){return F[B]++}F[B]++}}function H(){var ah=ab[L];var ag;if(G){document.write("
len:"+B+" treepos:"+L)}if(B==17){return -1}L++;B++;ag=l();if(G){document.write("
IsPat "+ag)}if(ag>=0){ah.b0=ag;if(G){document.write("
b0 "+ah.b0)}}else{ah.b0=32768;if(G){document.write("
b0 "+ah.b0)}if(H()){return -1}}ag=l();if(ag>=0){ah.b1=ag;if(G){document.write("
b1 "+ah.b1)}ah.jump=null}else{ah.b1=32768;if(G){document.write("
b1 "+ah.b1)}ah.jump=ab[L];ah.jumppos=L;if(H()){return -1}}B--;return 0}function n(ak,ai,al,ah){var aj;if(G){document.write("currentTree "+ak+" numval "+ai+" lengths "+al+" show "+ah)}ab=ak;L=0;R=al;v=ai;for(aj=0;aj<17;aj++){F[aj]=0}B=0;if(H()){if(G){alert("invalid huffman tree\n")}return -1}if(G){document.write("
Tree: "+ab.length);for(var ag=0;ag<32;ag++){document.write("Places["+ag+"].b0="+ab[ag].b0+"
");document.write("Places["+ag+"].b1="+ab[ag].b1+"
")}}return 0}function E(aj){var ah,ai,al=0,ak=aj[al],ag;while(1){ag=Y();if(G){document.write("b="+ag)}if(ag){if(!(ak.b1&32768)){if(G){document.write("ret1")}return ak.b1}ak=ak.jump;ah=aj.length;for(ai=0;ai>1);if(au>23){au=(au<<1)|Y();if(au>199){au-=128;au=(au<<1)|Y()}else{au-=48;if(au>143){au=au+136}}}else{au+=256}if(au<256){A(au)}else{if(au==256){break}else{var aw,ap;au-=256+1;aw=W(U[au])+ad[au];au=Z[W(5)]>>3;if(C[au]>8){ap=W(8);ap|=(W(C[au]-8)<<8)}else{ap=W(C[au])}ap+=O[au];for(au=0;audistanceTree");for(var ay=0;ay"+Q[ay].b0+" "+Q[ay].b1+" "+Q[ay].jump+" "+Q[ay].jumppos)}}aq=ai+an;av=0;var aj=-1;if(G){document.write("
n="+aq+" bits: "+d+"
")}while(av"+aj+" i:"+av+" decode: "+au+" bits "+d+"
")}if(au<16){am[av++]=au}else{if(au==16){var ar;au=3+W(2);if(av+au>aq){f();return 1}ar=av?am[av-1]:0;while(au--){am[av++]=ar}}else{if(au==17){au=3+W(3)}else{au=11+W(7)}if(av+au>aq){f();return 1}while(au--){am[av++]=0}}}}aw=w.length;for(av=0;avliteralTree")}while(1){au=E(w);if(au>=256){var aw,ap;au-=256;if(au==0){break}au--;aw=W(U[au])+ad[au];au=E(Q);if(C[au]>8){ap=W(8);ap|=(W(C[au]-8)<<8)}else{ap=W(C[au])}ap+=O[au];while(aw--){var ax=k[(aa-ap)&32767];A(ax)}}else{A(au)}}}}}}while(!ak);f();r();return 0}JXG.Util.Unzip.prototype.unzipFile=function(ag){var ah;this.unzip();for(ah=0;ah>2;k=((n&3)<<4)|(l>>4);h=((l&15)<<2)|(j>>6);g=j&63;if(isNaN(l)){h=g=64}else{if(isNaN(j)){g=64}}d.push([this._keyStr.charAt(m),this._keyStr.charAt(k),this._keyStr.charAt(h),this._keyStr.charAt(g)].join(""))}return d.join("")},decode:function(g,f){var d=[],o,m,k,n,l,j,h,e=0;g=g.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(e>4);m=((l&15)<<4)|(j>>2);k=((j&3)<<6)|h;d.push(String.fromCharCode(o));if(j!=64){d.push(String.fromCharCode(m))}if(h!=64){d.push(String.fromCharCode(k))}}d=d.join("");if(f){d=JXG.Util.Base64._utf8_decode(d)}return d},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");var d="";for(var g=0;g127)&&(f<2048)){d+=String.fromCharCode((f>>6)|192);d+=String.fromCharCode((f&63)|128)}else{d+=String.fromCharCode((f>>12)|224);d+=String.fromCharCode(((f>>6)&63)|128);d+=String.fromCharCode((f&63)|128)}}}return d},_utf8_decode:function(d){var f=[],h=0,j=0,g=0,e=0;while(h191)&&(j<224)){g=d.charCodeAt(h+1);f.push(String.fromCharCode(((j&31)<<6)|(g&63)));h+=2}else{g=d.charCodeAt(h+1);e=d.charCodeAt(h+2);f.push(String.fromCharCode(((j&15)<<12)|((g&63)<<6)|(e&63)));h+=3}}}return f.join("")},_destrip:function(j,g){var e=[],h,f,d=[];if(g==null){g=76}j.replace(/ /g,"");h=j.length/g;for(f=0;f255){switch(f){case 8364:f=128;break;case 8218:f=130;break;case 402:f=131;break;case 8222:f=132;break;case 8230:f=133;break;case 8224:f=134;break;case 8225:f=135;break;case 710:f=136;break;case 8240:f=137;break;case 352:f=138;break;case 8249:f=139;break;case 338:f=140;break;case 381:f=142;break;case 8216:f=145;break;case 8217:f=146;break;case 8220:f=147;break;case 8221:f=148;break;case 8226:f=149;break;case 8211:f=150;break;case 8212:f=151;break;case 732:f=152;break;case 8482:f=153;break;case 353:f=154;break;case 8250:f=155;break;case 339:f=156;break;case 382:f=158;break;case 376:f=159;break;default:break}}return f};JXG.Util.utf8Decode=function(d){var f=[];var h=0;var k=0,j=0,g=0,e;if(!JXG.exists(d)){return""}while(h191)&&(k<224)){g=d.charCodeAt(h+1);f.push(String.fromCharCode(((k&31)<<6)|(g&63)));h+=2}else{g=d.charCodeAt(h+1);e=d.charCodeAt(h+2);f.push(String.fromCharCode(((k&15)<<12)|((g&63)<<6)|(e&63)));h+=3}}}return f.join("")};JXG.Util.genUUID=function(){var h="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),f=new Array(36),e=0,g;for(var d=0;d<36;d++){if(d==8||d==13||d==18||d==23){f[d]="-"}else{if(d==14){f[d]="4"}else{if(e<=2){e=33554432+(Math.random()*16777216)|0}g=e&15;e=e>>4;f[d]=h[(d==19)?(g&3)|8:g]}}}return f.join("")};JXG.PsTricks={convert:function(g){var h=new JXG.Coords(JXG.COORDS_BY_SCREEN,[0,0],g),j=new JXG.Coords(JXG.COORDS_BY_SCREEN,[g.canvasWidth,g.canvasHeight],g),e,f,d=[];d.push("\\begin{pspicture*}("+h.usrCoords[1]+","+j.usrCoords[2]+")("+j.usrCoords[1]+","+h.usrCoords[2]+")\n");for(e in g.objects){f=g.objects[e];if(f.visProp.visible){switch(f.elementClass){case JXG.OBJECT_CLASS_CIRCLE:d.push(this.addCircle(f));break;case JXG.OBJECT_CLASS_LINE:d.push(this.addLine(f));break;case JXG.OBJECT_CLASS_POINT:d.push(this.addPoint(f));break;default:switch(f.type){case JXG.OBJECT_TYPE_ARC:d.push(this.addArc(f));break;case JXG.OBJECT_TYPE_SECTOR:d.push(this.addArc(f));d.push(this.addSector(f));break;case JXG.OBJECT_TYPE_POLYGON:d.push(this.addPolygon(f));break;case JXG.OBJECT_TYPE_ANGLE:d.push(this.addAngle(f));break}break}}}d.push("\\end{pspicture*}");return d.join("\n")},setArrows:function(e){var d="";if(e.visProp.firstarrow&&e.visProp.lastarrow){d="{<->}"}else{if(e.visProp.firstarrow){d="{<-}"}else{if(e.visProp.lastarrow){d="{->}"}}}return d},drawWedge:function(f,g,h,e,j,i){var d="";if(f!="none"&&g>0){d+="\\pswedge[linestyle=none, fillstyle=solid, fillcolor="+this.parseColor(f)+", opacity="+g.toFixed(5)+"]";d+="("+h.join(",")+"){"+e+"}{"+j+"}{"+i+"}\n"}return d},addPoint:function(f){var d="\\psdot[linecolor="+this.parseColor(f.visProp.strokecolor)+",dotstyle=",g=f.normalizeFace(f.visProp.face)||"o",e=f.visProp.size>4?4:f.visProp.size,h=[0,0,"2pt 2","5pt 2","5pt 3"];if(g=="x"){d+="x, dotsize="+h[e]}else{if(g=="o"){d+="*, dotsize=";if(e==1){d+="2pt 2"}else{if(e==2){d+="4pt 2"}else{if(e==3){d+="6pt 2"}else{if(e==4){d+="6pt 3"}}}}}else{if(g=="[]"){d+="square*, dotsize="+h[e]}else{if(g=="+"){d+="+, dotsize="+h[e]}}}}d+="]("+f.coords.usrCoords.slice(1).join(",")+")\n";d+="\\rput("+(f.coords.usrCoords[1]+15/f.board.unitY)+","+(f.coords.usrCoords[2]+15/f.board.unitY)+"){\\small $"+f.name+"$}\n";return d},addLine:function(g){var f=new JXG.Coords(JXG.COORDS_BY_USER,g.point1.coords.usrCoords,g.board),e=new JXG.Coords(JXG.COORDS_BY_USER,g.point2.coords.usrCoords,g.board),d="\\psline[linecolor="+this.parseColor(g.visProp.strokecolor)+", linewidth="+g.visProp.strokewidth+"px]";if(g.visProp.straightfirst||g.visProp.straightlast){JXG.Math.Geometry.calcStraight(g,f,e)}d+=this.setArrows(g);d+="("+f.usrCoords.slice(1).join(",")+")("+e.usrCoords.slice(2).join(",")+")\n";return d},addCircle:function(f){var e=f.Radius(),d="\\pscircle[linecolor="+this.parseColor(f.visProp.strokecolor)+", linewidth="+f.visProp.strokewidth+"px";if(f.visProp.fillcolor!="none"&&f.visProp.fillopacity!=0){d+=", fillstyle=solid, fillcolor="+this.parseColor(f.visProp.fillcolor)+", opacity="+f.visProp.fillopacity.toFixed(5)}d+="]("+f.center.coords.usrCoords.slice(1).join("1")+"){"+e+"}\n";return d},addPolygon:function(f){var d="\\pspolygon[linestyle=none, fillstyle=solid, fillcolor="+this.parseColor(f.visProp.fillcolor)+", opacity="+f.visProp.fillopacity.toFixed(5)+"]",e;for(e=0;e0){w=w[0][0]}if(typeof w!="string"){return}q=window.JSON&&window.JSON.parse?window.JSON.parse(w):(new Function("return "+w))();if(q.type=="error"){this.handleError(q)}else{if(q.type=="response"){k=q.id;for(s=0;se){d[f]=parseFloat(this.data[f][e])}}return d},getRow:function(f){var d,e;if(typeof f=="string"){for(e=0;e-1;d--){if(JXG.exists(this.sstack[d][e])){return d}}return -1},isCreator:function(d){return !!JXG.JSXGraph.elements[d]},isMathMethod:function(d){return d!=="E"&&!!Math[d]},isBuiltIn:function(d){return !!this.builtIn[d]},getvar:function(g,d){var f,e;d=JXG.def(d,false);f=this.isLocalVariable(g);if(f>-1){return this.sstack[f][g]}if(this.isCreator(g)){return this.creator(g)}if(this.isMathMethod(g)){return Math[g]}if(this.isBuiltIn(g)){return this.builtIn[g]}if(!d){f=JXG.getRef(this.board,g);if(f!==g){return f}}return e},getvarJS:function(g,d,f){var e;d=JXG.def(d,false);f=JXG.def(f,false);if(JXG.indexOf(this.pstack[this.pscope],g)>-1){return g}e=this.isLocalVariable(g);if(e>-1){return"$jc$.sstack["+e+"]['"+g+"']"}if(this.isCreator(g)){return"(function () { var a = Array.prototype.slice.call(arguments, 0), props = "+(f?"a.pop()":"{}")+"; return $jc$.board.create.apply($jc$.board, ['"+g+"'].concat([a, props])); })"}if(this.isMathMethod(g)){return"Math."+g}if(this.isBuiltIn(g)){return this.builtIn[g].src||this.builtIn[g]}if(!d){if(JXG.isId(this.board,g)){return"$jc$.board.objects['"+g+"']"}else{if(JXG.isName(this.board,g)){return"$jc$.board.elementsByName['"+g+"']"}else{if(JXG.isGroup(this.board,g)){return"$jc$.board.groups['"+g+"']"}}}}return""},setProp:function(h,g,f){var e={},d,i;if(h.elementClass===JXG.OBJECT_CLASS_POINT&&(g==="X"||g==="Y")){g=g.toLowerCase();if(h.isDraggable&&typeof f==="number"){d=g==="x"?f:h.X();i=g==="y"?f:h.Y();h.setPosition(JXG.COORDS_BY_USER,[d,i])}else{if(h.isDraggable&&(typeof f==="function"||typeof f==="string")){d=g==="x"?f:h.coords.usrCoords[1];i=g==="y"?f:h.coords.usrCoords[2];h.addConstraint([d,i])}else{if(!h.isDraggable){d=g==="x"?f:h.XEval.origin;i=g==="y"?f:h.YEval.origin;h.addConstraint([d,i])}}}this.board.update()}else{if(h.type===JXG.OBJECT_TYPE_TEXT&&(g==="X"||g==="Y")){if(typeof f==="number"){h[g]=function(){return f}}else{if(typeof f==="function"){h.isDraggable=false;h[g]=f}else{if(typeof f==="string"){h.isDraggable=false;h[g]=JXG.createFunction(f,this.board,null,true);h[g+"jc"]=f}}}h[g].origin=f;this.board.update()}else{if(h.type&&h.elementClass&&h.visProp){e[g]=f;h.setProperty(e)}else{h[g]=f}}}},utf8_encode:function(e){var d=[],g,f;for(g=0;g0){for(h=0;h"+d.substr(p[h].offset,30)+'<, expecting "'+e[h].join()+'"')}}},snippet:function(i,f,e,h){var j,k,g,d;j="jxg__tmp__intern_"+JXG.Util.genUUID().replace(/\-/g,"");if(!JXG.exists(f)){f=true}if(!JXG.exists(e)){e=""}if(!JXG.exists(h)){h=false}g=this.sstack[0][j];this.countLines=false;k=j+" = "+(f?" function ("+e+") { return ":"")+i+(f?"; }":"")+";";this.parse(k,h);d=this.sstack[0][j];if(JXG.exists(g)){this.sstack[0][j]=g}else{delete this.sstack[0][j]}this.countLines=true;return d},replaceIDs:function(f){var e,d;if(f.replaced){d=this.board.objects[f.children[1].children[0].value];if(JXG.exists(d)&&JXG.exists(d)&&d.name!==""){f.type="node_var";f.value=d.name;f.children.length=0;delete f.replaced}}if(f.children){for(e=f.children.length;e>0;e--){if(JXG.exists(f.children[e-1])){f.children[e-1]=this.replaceIDs(f.children[e-1])}}}return f},replaceNames:function(f){var e,d;d=f.value;if(f.type=="node_op"&&d=="op_lhs"&&f.children.length===1){this.isLHS=true}else{if(f.type=="node_var"){if(this.isLHS){this.letvar(d,true)}else{if(!JXG.exists(this.getvar(d,true))&&JXG.exists(this.board.elementsByName[d])){f=this.createReplacementNode(f)}}}}if(f.children){for(e=f.children.length;e>0;e--){if(JXG.exists(f.children[e-1])){f.children[e-1]=this.replaceNames(f.children[e-1])}}}if(f.type=="node_op"&&f.value=="op_lhs"&&f.children.length===1){this.isLHS=false}return f},createReplacementNode:function(f){var d=f.value,e=this.board.elementsByName[d];f=this.createNode("node_op","op_execfun",this.createNode("node_var","$"),this.createNode("node_op","op_param",this.createNode("node_str",e.id)));f.replaced=true;return f},collectDependencies:function(h,d){var g,f,j;f=h.value;if(h.type=="node_var"){j=this.getvar(f);if(j&&j.visProp&&j.type&&j.elementClass&&j.id){d[j.id]=j}}if(h.type=="node_op"&&h.value=="op_execfun"&&h.children.length>1&&h.children[0].value=="$"&&h.children[1].children.length>0){j=h.children[1].children[0].value;d[j]=this.board.objects[j]}if(h.children){for(g=h.children.length;g>0;g--){if(JXG.exists(h.children[g-1])){this.collectDependencies(h.children[g-1],d)}}}},resolveProperty:function(g,d,f){f=JXG.def(f,false);if(g&&g.methodMap){if(d==="label"){g=g.label;d="content"}else{if(JXG.exists(g.subs)&&JXG.exists(g.subs[d])){g=g.subs}else{if(JXG.exists(g.methodMap[d])){d=g.methodMap[d]}else{g=g.visProp;d=d.toLowerCase()}}}}if(!JXG.exists(g)){this._error(g+" is not an object")}if(!JXG.exists(g[d])){this._error("unknown property "+d)}if(f&&typeof g[d]==="function"){return function(){return g[d].apply(g,arguments)}}return g[d]},execute:function(node){var ret,v,i,e,parents=[];ret=0;if(this.cancel){this._error("Max runtime exceeded")}if(!node){return ret}this.line=node.line;this.col=node.col;switch(node.type){case"node_op":switch(node.value){case"op_none":if(node.children[0]){this.execute(node.children[0])}if(node.children[1]){ret=this.execute(node.children[1])}break;case"op_assign":v=this.execute(node.children[0]);this.lhs[this.scope]=v[1];if(v[0].type&&v[0].elementClass&&v[0].methodMap&&v[1]==="label"){this._error("Left-hand side of assignment is read-only.")}if(v[0]!==this.sstack[this.scope]||(JXG.isArray(v[0])&&typeof v[1]==="number")){this.setProp(v[0],v[1],this.execute(node.children[1]))}else{this.letvar(v[1],this.execute(node.children[1]))}this.lhs[this.scope]=0;break;case"op_noassign":ret=this.execute(node.children[0]);break;case"op_if":if(this.execute(node.children[0])){ret=this.execute(node.children[1])}break;case"op_if_else":if(this.execute(node.children[0])){ret=this.execute(node.children[1])}else{ret=this.execute(node.children[2])}break;case"op_while":while(this.execute(node.children[0])){this.execute(node.children[1])}break;case"op_do":do{this.execute(node.children[0])}while(this.execute(node.children[1]));break;case"op_for":for(this.execute(node.children[0]);this.execute(node.children[1]);this.execute(node.children[2])){this.execute(node.children[3])}break;case"op_param":if(node.children[1]){this.execute(node.children[1])}ret=node.children[0];this.pstack[this.pscope].push(ret);if(this.dpstack[this.pscope]){this.dpstack[this.pscope].push({line:node.children[0].line,col:node.children[0].col})}break;case"op_paramdef":if(node.children[1]){this.execute(node.children[1])}ret=node.children[0];this.pstack[this.pscope].push(ret);break;case"op_proplst":if(node.children[0]){this.execute(node.children[0])}if(node.children[1]){this.execute(node.children[1])}break;case"op_proplst_val":this.propstack.push({});this.propscope++;this.execute(node.children[0]);ret=this.propstack[this.propscope];this.propstack.pop();this.propscope--;break;case"op_prop":this.propstack[this.propscope][node.children[0]]=this.execute(node.children[1]);break;case"op_array":var l;this.pstack.push([]);this.pscope++;this.execute(node.children[0]);ret=[];l=this.pstack[this.pscope].length;for(i=0;ithis.execute(node.children[1]);break;case"op_lot":ret=this.execute(node.children[0])=this.execute(node.children[1]);break;case"op_loe":ret=this.execute(node.children[0])<=this.execute(node.children[1]);break;case"op_or":ret=this.execute(node.children[0])||this.execute(node.children[1]);break;case"op_and":ret=this.execute(node.children[0])&&this.execute(node.children[1]);break;case"op_not":ret=!this.execute(node.children[0]);break;case"op_add":ret=JXG.Math.Statistics.add(this.execute(node.children[0]),this.execute(node.children[1]));break;case"op_sub":ret=JXG.Math.Statistics.subtract(this.execute(node.children[0]),this.execute(node.children[1]));break;case"op_div":ret=JXG.Math.Statistics.div(this.execute(node.children[0]),this.execute(node.children[1]));break;case"op_mod":ret=JXG.Math.Statistics.mod(this.execute(node.children[0]),this.execute(node.children[1]),true);break;case"op_mul":ret=this.mul(this.execute(node.children[0]),this.execute(node.children[1]));break;case"op_exp":ret=Math.pow(this.execute(node.children[0]),this.execute(node.children[1]));break;case"op_neg":ret=this.execute(node.children[0])*-1;break}break;case"node_var":ret=this.getvar(node.value);break;case"node_const":ret=Number(node.value);break;case"node_const_bool":ret=node.value.toLowerCase()!=="false";break;case"node_str":ret=node.value;break}return ret},compile:function(h,k){var f,g,j,d;f="";if(!JXG.exists(k)){k=false}if(!h){return f}switch(h.type){case"node_op":switch(h.value){case"op_none":if(h.children[0]){f=this.compile(h.children[0],k)}if(h.children[1]){f+=this.compile(h.children[1],k)}break;case"op_assign":j=this.compile(h.children[0],k);if(k){if(JXG.isArray(j)){f="$jc$.setProp("+j[0]+", '"+j[1]+"', "+this.compile(h.children[1],k)+");\n"}else{if(this.isLocalVariable(j)!==this.scope){this.sstack[this.scope][j]=true}f="$jc$.sstack["+this.scope+"]['"+j+"'] = "+this.compile(h.children[1],k)+";\n"}}else{f=j+" = "+this.compile(h.children[1],k)+";\n"}break;case"op_noassign":f=this.compile(h.children[0],k)+";\n";break;case"op_if":f=" if ("+this.compile(h.children[0],k)+") "+this.compile(h.children[1],k);break;case"op_if_else":f=" if ("+this.compile(h.children[0],k)+")"+this.compile(h.children[1],k);f+=" else "+this.compile(h.children[2],k);break;case"op_while":f=" while ("+this.compile(h.children[0],k)+") {\n"+this.compile(h.children[1],k)+"}\n";break;case"op_do":f=" do {\n"+this.compile(h.children[0],k)+"} while ("+this.compile(h.children[1],k)+");\n";break;case"op_for":f=" for ("+this.compile(h.children[0],k)+"; "+this.compile(h.children[1],k)+"; "+this.compile(h.children[2],k)+") {\n"+this.compile(h.children[3],k)+"\n}\n";break;case"op_param":if(h.children[1]){f=this.compile(h.children[1],k)+", "}f+=this.compile(h.children[0],k);break;case"op_paramdef":if(h.children[1]){f=this.compile(h.children[1],k)+", "}f+=h.children[0];break;case"op_proplst":if(h.children[0]){f=this.compile(h.children[0],k)+", "}f+=this.compile(h.children[1],k);break;case"op_prop":f=h.children[0]+": "+this.compile(h.children[1],k);break;case"op_proplst_val":f=this.compile(h.children[0],k);break;case"op_array":f="["+this.compile(h.children[0],k)+"]";break;case"op_extvalue":f=this.compile(h.children[0],k)+"["+this.compile(h.children[1],k)+"]";break;case"op_return":f=" return "+this.compile(h.children[0],k)+";\n";break;case"op_function":f=" function ("+this.compile(h.children[0],k)+") {\n"+this.compile(h.children[1],k)+"}";break;case"op_execfun":if(h.children[2]){j=(k?"{":"<<")+this.compile(h.children[2],k)+(k?"}":">>")}h.children[0].withProps=!!h.children[2];f=this.compile(h.children[0],k)+"("+this.compile(h.children[1],k)+(h.children[2]?", "+j:"")+")";if(k&&h.children[0].value==="$"){f="$jc$.board.objects["+this.compile(h.children[1],k)+"]"}break;case"op_property":if(k&&h.children[1]!=="X"&&h.children[1]!=="Y"){f="$jc$.resolveProperty("+this.compile(h.children[0],k)+", '"+h.children[1]+"', true)"}else{f=this.compile(h.children[0],k)+"."+h.children[1]}break;case"op_lhs":if(h.children.length===1){f=h.children[0]}else{if(h.children[2]==="dot"){if(k){f=[this.compile(h.children[1],k),h.children[0]]}else{f=this.compile(h.children[1],k)+"."+h.children[0]}}else{if(h.children[2]==="bracket"){if(k){f=[this.compile(h.children[1],k),this.compile(h.children[0],k)]}else{f=this.compile(h.children[1],k)+"["+this.compile(h.children[0],k)+"]"}}}}break;case"op_use":if(k){f="$jc$.use(JXG.JSXGraph.boards['"+h.children[0]+"'])"}else{f="use "+h.children[0]+";"}break;case"op_delete":f="delete "+h.children[0];break;case"op_equ":f="("+this.compile(h.children[0],k)+" == "+this.compile(h.children[1],k)+")";break;case"op_neq":f="("+this.compile(h.children[0],k)+" != "+this.compile(h.children[1],k)+")";break;case"op_approx":f="("+this.compile(h.children[0],k)+" ~= "+this.compile(h.children[1],k)+")";break;case"op_grt":f="("+this.compile(h.children[0],k)+" > "+this.compile(h.children[1],k)+")";break;case"op_lot":f="("+this.compile(h.children[0],k)+" < "+this.compile(h.children[1],k)+")";break;case"op_gre":f="("+this.compile(h.children[0],k)+" >= "+this.compile(h.children[1],k)+")";break;case"op_loe":f="("+this.compile(h.children[0],k)+" <= "+this.compile(h.children[1],k)+")";break;case"op_or":f="("+this.compile(h.children[0],k)+" || "+this.compile(h.children[1],k)+")";break;case"op_and":f="("+this.compile(h.children[0],k)+" && "+this.compile(h.children[1],k)+")";break;case"op_not":f="!("+this.compile(h.children[0],k)+")";break;case"op_add":if(k){f="JXG.Math.Statistics.add("+this.compile(h.children[0],k)+", "+this.compile(h.children[1],k)+")"}else{f="("+this.compile(h.children[0],k)+" + "+this.compile(h.children[1],k)+")"}break;case"op_sub":if(k){f="JXG.Math.Statistics.subtract("+this.compile(h.children[0],k)+", "+this.compile(h.children[1],k)+")"}else{f="("+this.compile(h.children[0],k)+" - "+this.compile(h.children[1],k)+")"}break;case"op_div":if(k){f="JXG.Math.Statistics.div("+this.compile(h.children[0],k)+", "+this.compile(h.children[1],k)+")"}else{f="("+this.compile(h.children[0],k)+" / "+this.compile(h.children[1],k)+")"}break;case"op_mod":if(k){f="JXG.Math.mod("+this.compile(h.children[0],k)+", "+this.compile(h.children[1],k)+", true)"}else{f="("+this.compile(h.children[0],k)+" % "+this.compile(h.children[1],k)+")"}break;case"op_mul":if(k){f="$jc$.mul("+this.compile(h.children[0],k)+", "+this.compile(h.children[1],k)+")"}else{f="("+this.compile(h.children[0],k)+" * "+this.compile(h.children[1],k)+")"}break;case"op_exp":if(k){f="Math.pow("+this.compile(h.children[0],k)+", "+this.compile(h.children[1],k)+")"}else{f="("+this.compile(h.children[0],k)+"^"+this.compile(h.children[1],k)+")"}break;case"op_neg":f="(-"+this.compile(h.children[0],k)+")";break}break;case"node_var":if(k){f=this.getvarJS(h.value,false,h.withProps)}else{f=h.value}break;case"node_const":f=h.value;break;case"node_const_bool":f=h.value;break;case"node_str":f="'"+h.value.replace(/'/g,"\\'")+"'";break}if(h.needsBrackets){f="{\n"+f+"}\n"}return f},X:function(d){return d.X()},Y:function(d){return d.Y()},V:function(d){return d.Value()},L:function(d){return d.L()},dist:function(e,d){if(!JXG.exists(e)||!JXG.exists(e.Dist)){this._error("Error: Can't calculate distance.")}return e.Dist(d)},mul:function(e,d){if(JXG.isArray(e)*JXG.isArray(d)){return JXG.Math.innerProduct(e,d,Math.min(e.length,d.length))}else{return JXG.Math.Statistics.multiply(e,d)}},use:function(d){this.board=d;this.builtIn["$board"]=d;this.builtIn["$board"].src="$jc$.board"},findSymbol:function(d,g){var f,e;g=JXG.def(g,-1);if(g===-1){g=this.scope}for(f=g;f>=0;f--){for(e in this.sstack[f]){if(this.sstack[f][e]===d){return[e,f]}}}return[]},defineBuiltIn:function(){var d=this,e={PI:Math.PI,EULER:Math.E,X:d.X,Y:d.Y,V:d.V,L:d.L,dist:d.dist,rad:JXG.Math.Geometry.rad,deg:JXG.Math.Geometry.trueAngle,factorial:JXG.Math.factorial,trunc:JXG.trunc,"$":d.getElementById,"$board":d.board};e.rad.sc=JXG.Math.Geometry;e.deg.sc=JXG.Math.Geometry;e.factorial.sc=JXG.Math;e.PI.src="Math.PI";e.EULER.src="Math.E";e.X.src="$jc$.X";e.Y.src="$jc$.Y";e.V.src="$jc$.V";e.L.src="$jc$.L";e.dist.src="$jc$.dist";e.rad.src="JXG.Math.Geometry.rad";e.deg.src="JXG.Math.Geometry.trueAngle";e.factorial.src="JXG.Math.factorial";e.trunc.src="JXG.trunc";e["$"].src="(function (n) { return JXG.getRef($jc$.board, n); })";if(e["$board"]){e["$board"].src="$jc$.board"}return e},_debug:function(d){if(typeof console!=="undefined"){console.log(d)}else{if(document&&document.getElementById("debug")!==null){document.getElementById("debug").innerHTML+=d+"
"}}},_error:function(f){var d=new Error("Error("+this.line+"): "+f);d.line=this.line;throw d},_warn:function(d){if(typeof console!=="undefined"){console.log("Warning("+this.line+"): "+d)}else{if(document&&document.getElementById(this.warnLog)!==null){document.getElementById(this.warnLog).innerHTML+="Warning("+this.line+"): "+d+"
"}}},_log:function(d){if(typeof window==="undefined"&&typeof self!=="undefined"&&self.postMessage){self.postMessage({type:"log",msg:"Log: "+d.toString()})}else{console.log("Log: ",arguments)}}});JXG.extend(JXG.JessieCode.prototype,{_lex:function(d){var h,e=-1,g=0,j=0,i,f;while(1){h=0;e=-1;g=0;j=0;i=d.offset+1+(g-j);do{i--;h=0;e=-2;j=i;if(d.src.length<=j){return 67}do{f=d.src.charCodeAt(i);switch(h){case 0:if((f>=9&&f<=10)||f==13||f==32){h=1}else{if(f==33){h=2}else{if(f==35){h=3}else{if(f==36||(f>=65&&f<=67)||(f>=71&&f<=72)||(f>=74&&f<=81)||f==83||f==86||(f>=88&&f<=90)||f==95||(f>=97&&f<=99)||(f>=103&&f<=104)||(f>=106&&f<=113)||f==115||f==118||(f>=120&&f<=122)){h=4}else{if(f==37){h=5}else{if(f==40){h=6}else{if(f==41){h=7}else{if(f==42){h=8}else{if(f==43){h=9}else{if(f==44){h=10}else{if(f==45){h=11}else{if(f==46){h=12}else{if(f==47){h=13}else{if((f>=48&&f<=57)){h=14}else{if(f==58){h=15}else{if(f==59){h=16}else{if(f==60){h=17}else{if(f==61){h=18}else{if(f==62){h=19}else{if(f==91){h=20}else{if(f==93){h=21}else{if(f==94){h=22}else{if(f==123){h=23}else{if(f==124){h=24}else{if(f==125){h=25}else{if(f==38){h=48}else{if(f==68||f==100){h=49}else{if(f==39){h=51}else{if(f==73||f==105){h=52}else{if(f==126){h=53}else{if(f==70||f==102){h=64}else{if(f==85||f==117){h=65}else{if(f==69||f==101){h=73}else{if(f==84||f==116){h=74}else{if(f==87||f==119){h=80}else{if(f==82||f==114){h=84}else{h=-1}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}break;case 1:h=-1;e=2;g=i;break;case 2:if(f==61){h=26}else{h=-1}e=31;g=i;break;case 3:h=-1;e=41;g=i;break;case 4:if((f>=48&&f<=57)||(f>=65&&f<=90)||f==95||(f>=97&&f<=122)){h=4}else{h=-1}e=45;g=i;break;case 5:h=-1;e=35;g=i;break;case 6:h=-1;e=38;g=i;break;case 7:h=-1;e=39;g=i;break;case 8:h=-1;e=36;g=i;break;case 9:h=-1;e=32;g=i;break;case 10:h=-1;e=40;g=i;break;case 11:h=-1;e=33;g=i;break;case 12:if((f>=48&&f<=57)){h=29}else{h=-1}e=44;g=i;break;case 13:h=-1;e=34;g=i;break;case 14:if((f>=48&&f<=57)){h=14}else{if(f==46){h=29}else{h=-1}}e=47;g=i;break;case 15:h=-1;e=42;g=i;break;case 16:h=-1;e=20;g=i;break;case 17:if(f==60){h=30}else{if(f==61){h=31}else{h=-1}}e=28;g=i;break;case 18:if(f==61){h=32}else{h=-1}e=21;g=i;break;case 19:if(f==61){h=33}else{if(f==62){h=34}else{h=-1}}e=27;g=i;break;case 20:h=-1;e=16;g=i;break;case 21:h=-1;e=17;g=i;break;case 22:h=-1;e=37;g=i;break;case 23:h=-1;e=18;g=i;break;case 24:if(f==124){h=37}else{h=-1}e=43;g=i;break;case 25:h=-1;e=19;g=i;break;case 26:h=-1;e=23;g=i;break;case 27:h=-1;e=30;g=i;break;case 28:h=-1;e=46;g=i;break;case 29:if((f>=48&&f<=57)){h=29}else{h=-1}e=48;g=i;break;case 30:h=-1;e=14;g=i;break;case 31:h=-1;e=25;g=i;break;case 32:h=-1;e=22;g=i;break;case 33:h=-1;e=26;g=i;break;case 34:h=-1;e=15;g=i;break;case 35:if((f>=48&&f<=57)||(f>=65&&f<=90)||f==95||(f>=97&&f<=122)){h=4}else{h=-1}e=6;g=i;break;case 36:if((f>=48&&f<=57)||(f>=65&&f<=90)||f==95||(f>=97&&f<=122)){h=4}else{h=-1}e=3;g=i;break;case 37:h=-1;e=29;g=i;break;case 38:h=-1;e=24;g=i;break;case 39:if((f>=48&&f<=57)||(f>=65&&f<=90)||f==95||(f>=97&&f<=122)){h=4}else{h=-1}e=7;g=i;break;case 40:if((f>=48&&f<=57)||(f>=65&&f<=90)||f==95||(f>=97&&f<=122)){h=4}else{h=-1}e=9;g=i;break;case 41:if((f>=48&&f<=57)||(f>=65&&f<=90)||f==95||(f>=97&&f<=122)){h=4}else{h=-1}e=4;g=i;break;case 42:if((f>=48&&f<=57)||(f>=65&&f<=90)||f==95||(f>=97&&f<=122)){h=4}else{h=-1}e=12;g=i;break;case 43:if((f>=48&&f<=57)||(f>=65&&f<=90)||f==95||(f>=97&&f<=122)){h=4}else{h=-1}e=13;g=i;break;case 44:if((f>=48&&f<=57)||(f>=65&&f<=90)||f==95||(f>=97&&f<=122)){h=4}else{h=-1}e=5;g=i;break;case 45:if((f>=48&&f<=57)||(f>=65&&f<=90)||f==95||(f>=97&&f<=122)){h=4}else{h=-1}e=11;g=i;break;case 46:if((f>=48&&f<=57)||(f>=65&&f<=90)||f==95||(f>=97&&f<=122)){h=4}else{h=-1}e=10;g=i;break;case 47:if((f>=48&&f<=57)||(f>=65&&f<=90)||f==95||(f>=97&&f<=122)){h=4}else{h=-1}e=8;g=i;break;case 48:if(f==38){h=27}else{h=-1}break;case 49:if((f>=48&&f<=57)||(f>=65&&f<=68)||(f>=70&&f<=78)||(f>=80&&f<=90)||f==95||(f>=97&&f<=100)||(f>=102&&f<=110)||(f>=112&&f<=122)){h=4}else{if(f==79||f==111){h=35}else{if(f==69||f==101){h=81}else{h=-1}}}e=45;g=i;break;case 50:if(f==39){h=28}else{if((f>=0&&f<=38)||(f>=40&&f<=91)||(f>=93&&f<=254)){h=51}else{if(f==92){h=55}else{h=-1}}}e=46;g=i;break;case 51:if(f==39){h=28}else{if((f>=0&&f<=38)||(f>=40&&f<=91)||(f>=93&&f<=254)){h=51}else{if(f==92){h=55}else{h=-1}}}break;case 52:if((f>=48&&f<=57)||(f>=65&&f<=69)||(f>=71&&f<=90)||f==95||(f>=97&&f<=101)||(f>=103&&f<=122)){h=4}else{if(f==70||f==102){h=36}else{h=-1}}e=45;g=i;break;case 53:if(f==61){h=38}else{h=-1}break;case 54:if((f>=48&&f<=57)||(f>=65&&f<=81)||(f>=83&&f<=90)||f==95||(f>=97&&f<=113)||(f>=115&&f<=122)){h=4}else{if(f==82||f==114){h=39}else{h=-1}}e=45;g=i;break;case 55:if(f==39){h=50}else{if((f>=0&&f<=38)||(f>=40&&f<=91)||(f>=93&&f<=254)){h=51}else{if(f==92){h=55}else{h=-1}}}break;case 56:if((f>=48&&f<=57)||(f>=65&&f<=68)||(f>=70&&f<=90)||f==95||(f>=97&&f<=100)||(f>=102&&f<=122)){h=4}else{if(f==69||f==101){h=40}else{h=-1}}e=45;g=i;break;case 57:if((f>=48&&f<=57)||(f>=65&&f<=68)||(f>=70&&f<=90)||f==95||(f>=97&&f<=100)||(f>=102&&f<=122)){h=4}else{if(f==69||f==101){h=41}else{h=-1}}e=45;g=i;break;case 58:if((f>=48&&f<=57)||(f>=65&&f<=68)||(f>=70&&f<=90)||f==95||(f>=97&&f<=100)||(f>=102&&f<=122)){h=4}else{if(f==69||f==101){h=42}else{h=-1}}e=45;g=i;break;case 59:if((f>=48&&f<=57)||(f>=65&&f<=68)||(f>=70&&f<=90)||f==95||(f>=97&&f<=100)||(f>=102&&f<=122)){h=4}else{if(f==69||f==101){h=43}else{h=-1}}e=45;g=i;break;case 60:if((f>=48&&f<=57)||(f>=65&&f<=68)||(f>=70&&f<=90)||f==95||(f>=97&&f<=100)||(f>=102&&f<=122)){h=4}else{if(f==69||f==101){h=44}else{h=-1}}e=45;g=i;break;case 61:if((f>=48&&f<=57)||(f>=65&&f<=68)||(f>=70&&f<=90)||f==95||(f>=97&&f<=100)||(f>=102&&f<=122)){h=4}else{if(f==69||f==101){h=45}else{h=-1}}e=45;g=i;break;case 62:if((f>=48&&f<=57)||(f>=65&&f<=77)||(f>=79&&f<=90)||f==95||(f>=97&&f<=109)||(f>=111&&f<=122)){h=4}else{if(f==78||f==110){h=46}else{h=-1}}e=45;g=i;break;case 63:if((f>=48&&f<=57)||(f>=65&&f<=77)||(f>=79&&f<=90)||f==95||(f>=97&&f<=109)||(f>=111&&f<=122)){h=4}else{if(f==78||f==110){h=47}else{h=-1}}e=45;g=i;break;case 64:if((f>=48&&f<=57)||(f>=66&&f<=78)||(f>=80&&f<=84)||(f>=86&&f<=90)||f==95||(f>=98&&f<=110)||(f>=112&&f<=116)||(f>=118&&f<=122)){h=4}else{if(f==79||f==111){h=54}else{if(f==65||f==97){h=75}else{if(f==85||f==117){h=86}else{h=-1}}}}e=45;g=i;break;case 65:if((f>=48&&f<=57)||(f>=65&&f<=82)||(f>=84&&f<=90)||f==95||(f>=97&&f<=114)||(f>=116&&f<=122)){h=4}else{if(f==83||f==115){h=56}else{h=-1}}e=45;g=i;break;case 66:if((f>=48&&f<=57)||(f>=65&&f<=82)||(f>=84&&f<=90)||f==95||(f>=97&&f<=114)||(f>=116&&f<=122)){h=4}else{if(f==83||f==115){h=57}else{h=-1}}e=45;g=i;break;case 67:if((f>=48&&f<=57)||(f>=65&&f<=84)||(f>=86&&f<=90)||f==95||(f>=97&&f<=116)||(f>=118&&f<=122)){h=4}else{if(f==85||f==117){h=58}else{h=-1}}e=45;g=i;break;case 68:if((f>=48&&f<=57)||(f>=65&&f<=82)||(f>=84&&f<=90)||f==95||(f>=97&&f<=114)||(f>=116&&f<=122)){h=4}else{if(f==83||f==115){h=59}else{h=-1}}e=45;g=i;break;case 69:if((f>=48&&f<=57)||(f>=65&&f<=75)||(f>=77&&f<=90)||f==95||(f>=97&&f<=107)||(f>=109&&f<=122)){h=4}else{if(f==76||f==108){h=60}else{h=-1}}e=45;g=i;break;case 70:if((f>=48&&f<=57)||(f>=65&&f<=83)||(f>=85&&f<=90)||f==95||(f>=97&&f<=115)||(f>=117&&f<=122)){h=4}else{if(f==84||f==116){h=61}else{h=-1}}e=45;g=i;break;case 71:if((f>=48&&f<=57)||(f>=65&&f<=81)||(f>=83&&f<=90)||f==95||(f>=97&&f<=113)||(f>=115&&f<=122)){h=4}else{if(f==82||f==114){h=62}else{h=-1}}e=45;g=i;break;case 72:if((f>=48&&f<=57)||(f>=65&&f<=78)||(f>=80&&f<=90)||f==95||(f>=97&&f<=110)||(f>=112&&f<=122)){h=4}else{if(f==79||f==111){h=63}else{h=-1}}e=45;g=i;break;case 73:if((f>=48&&f<=57)||(f>=65&&f<=75)||(f>=77&&f<=90)||f==95||(f>=97&&f<=107)||(f>=109&&f<=122)){h=4}else{if(f==76||f==108){h=66}else{h=-1}}e=45;g=i;break;case 74:if((f>=48&&f<=57)||(f>=65&&f<=81)||(f>=83&&f<=90)||f==95||(f>=97&&f<=113)||(f>=115&&f<=122)){h=4}else{if(f==82||f==114){h=67}else{h=-1}}e=45;g=i;break;case 75:if((f>=48&&f<=57)||(f>=65&&f<=75)||(f>=77&&f<=90)||f==95||(f>=97&&f<=107)||(f>=109&&f<=122)){h=4}else{if(f==76||f==108){h=68}else{h=-1}}e=45;g=i;break;case 76:if((f>=48&&f<=57)||(f>=65&&f<=72)||(f>=74&&f<=90)||f==95||(f>=97&&f<=104)||(f>=106&&f<=122)){h=4}else{if(f==73||f==105){h=69}else{h=-1}}e=45;g=i;break;case 77:if((f>=48&&f<=57)||(f>=65&&f<=68)||(f>=70&&f<=90)||f==95||(f>=97&&f<=100)||(f>=102&&f<=122)){h=4}else{if(f==69||f==101){h=70}else{h=-1}}e=45;g=i;break;case 78:if((f>=48&&f<=57)||(f>=65&&f<=84)||(f>=86&&f<=90)||f==95||(f>=97&&f<=116)||(f>=118&&f<=122)){h=4}else{if(f==85||f==117){h=71}else{h=-1}}e=45;g=i;break;case 79:if((f>=48&&f<=57)||(f>=65&&f<=72)||(f>=74&&f<=90)||f==95||(f>=97&&f<=104)||(f>=106&&f<=122)){h=4}else{if(f==73||f==105){h=72}else{h=-1}}e=45;g=i;break;case 80:if((f>=48&&f<=57)||(f>=65&&f<=71)||(f>=73&&f<=90)||f==95||(f>=97&&f<=103)||(f>=105&&f<=122)){h=4}else{if(f==72||f==104){h=76}else{h=-1}}e=45;g=i;break;case 81:if((f>=48&&f<=57)||(f>=65&&f<=75)||(f>=77&&f<=90)||f==95||(f>=97&&f<=107)||(f>=109&&f<=122)){h=4}else{if(f==76||f==108){h=77}else{h=-1}}e=45;g=i;break;case 82:if((f>=48&&f<=57)||(f>=65&&f<=83)||(f>=85&&f<=90)||f==95||(f>=97&&f<=115)||(f>=117&&f<=122)){h=4}else{if(f==84||f==116){h=78}else{h=-1}}e=45;g=i;break;case 83:if((f>=48&&f<=57)||(f>=65&&f<=83)||(f>=85&&f<=90)||f==95||(f>=97&&f<=115)||(f>=117&&f<=122)){h=4}else{if(f==84||f==116){h=79}else{h=-1}}e=45;g=i;break;case 84:if((f>=48&&f<=57)||(f>=65&&f<=68)||(f>=70&&f<=90)||f==95||(f>=97&&f<=100)||(f>=102&&f<=122)){h=4}else{if(f==69||f==101){h=82}else{h=-1}}e=45;g=i;break;case 85:if((f>=48&&f<=57)||(f>=65&&f<=66)||(f>=68&&f<=90)||f==95||(f>=97&&f<=98)||(f>=100&&f<=122)){h=4}else{if(f==67||f==99){h=83}else{h=-1}}e=45;g=i;break;case 86:if((f>=48&&f<=57)||(f>=65&&f<=77)||(f>=79&&f<=90)||f==95||(f>=97&&f<=109)||(f>=111&&f<=122)){h=4}else{if(f==78||f==110){h=85}else{h=-1}}e=45;g=i;break}if(h>-1){if(f==10){d.line++;d.column=0;if(this.countLines){this.parCurLine=d.line}}d.column++;if(this.countLines){this.parCurColumn=d.column}}i++}while(h>-1)}while(2>-1&&e==2);if(e>-1){d.att=d.src.substr(j,g-j);d.offset=g;if(e==46){d.att=d.att.substr(1,d.att.length-2);d.att=d.att.replace(/\\\'/g,"'")}}else{d.att=new String();e=-1}break}return e},_parse:function(d,j,g){var s=[],r=[],k=0,p,n,m,f={la:0,act:0,offset:0,src:d,att:"",line:1,column:1,error_step:0};var l=new Array(new Array(0,1),new Array(49,2),new Array(49,0),new Array(51,2),new Array(51,0),new Array(52,3),new Array(52,1),new Array(52,0),new Array(54,3),new Array(54,1),new Array(54,0),new Array(55,3),new Array(56,3),new Array(56,1),new Array(56,0),new Array(57,3),new Array(57,1),new Array(60,3),new Array(50,3),new Array(50,5),new Array(50,3),new Array(50,5),new Array(50,9),new Array(50,3),new Array(50,2),new Array(50,2),new Array(50,2),new Array(50,2),new Array(50,3),new Array(50,1),new Array(59,3),new Array(59,4),new Array(59,1),new Array(53,3),new Array(53,3),new Array(53,3),new Array(53,3),new Array(53,3),new Array(53,3),new Array(53,3),new Array(53,1),new Array(62,3),new Array(62,3),new Array(62,2),new Array(62,1),new Array(61,3),new Array(61,3),new Array(61,1),new Array(63,3),new Array(63,3),new Array(63,3),new Array(63,1),new Array(65,3),new Array(65,1),new Array(64,2),new Array(64,2),new Array(64,1),new Array(58,4),new Array(58,4),new Array(58,5),new Array(58,3),new Array(58,1),new Array(66,1),new Array(66,1),new Array(66,1),new Array(66,3),new Array(66,1),new Array(66,7),new Array(66,3),new Array(66,3),new Array(66,1),new Array(66,1));var h=new Array(new Array(),new Array(3,3,5,4,6,5,7,6,9,7,11,8,10,9,18,12,20,13,45,17,31,18,47,22,48,23,38,24,46,25,8,26,14,27,16,28,12,29,13,30,33,32,32,33),new Array(),new Array(31,18,33,32,32,33,47,22,48,23,45,37,38,24,46,25,8,26,14,27,16,28,12,29,13,30),new Array(31,18,33,32,32,33,47,22,48,23,45,37,38,24,46,25,8,26,14,27,16,28,12,29,13,30),new Array(3,3,5,4,6,5,7,6,9,7,11,8,10,9,18,12,20,13,45,17,31,18,47,22,48,23,38,24,46,25,8,26,14,27,16,28,12,29,13,30,33,32,32,33),new Array(38,40),new Array(45,41),new Array(45,42),new Array(3,3,5,4,6,5,7,6,9,7,11,8,10,9,18,12,20,13,45,17,31,18,47,22,48,23,38,24,46,25,8,26,14,27,16,28,12,29,13,30,33,32,32,33),new Array(20,44),new Array(24,45,23,46,26,47,25,48,27,49,28,50,22,51,20,52),new Array(),new Array(),new Array(21,54),new Array(30,55,29,56),new Array(44,57,38,58,16,59,37,60),new Array(21,-32),new Array(31,18,33,32,32,33,47,22,48,23,45,37,38,24,46,25,8,26,14,27,16,28,12,29,13,30),new Array(32,62,33,63),new Array(),new Array(35,64,34,65,36,66),new Array(),new Array(),new Array(31,18,33,32,32,33,47,22,48,23,45,37,38,24,46,25,8,26,14,27,16,28,12,29,13,30),new Array(),new Array(38,68),new Array(45,71),new Array(31,18,33,32,32,33,47,22,48,23,45,37,38,24,46,25,8,26,14,27,16,28,12,29,13,30),new Array(),new Array(),new Array(),new Array(47,22,48,23,45,37,38,24,46,25,8,26,14,27,16,28,12,29,13,30),new Array(47,22,48,23,45,37,38,24,46,25,8,26,14,27,16,28,12,29,13,30),new Array(),new Array(24,45,23,46,26,47,25,48,27,49,28,50,22,51,3,3,5,4,6,5,7,6,9,7,11,8,10,9,18,12,20,13,45,17,31,18,47,22,48,23,38,24,46,25,8,26,14,27,16,28,12,29,13,30,33,32,32,33),new Array(44,77,38,58,16,78,37,60),new Array(),new Array(24,45,23,46,26,47,25,48,27,49,28,50,22,51,3,3,5,4,6,5,7,6,9,7,11,8,10,9,18,12,20,13,45,17,31,18,47,22,48,23,38,24,46,25,8,26,14,27,16,28,12,29,13,30,33,32,32,33),new Array(5,80),new Array(45,17,47,22,48,23,38,24,46,25,8,26,14,27,16,28,12,29,13,30),new Array(20,83),new Array(),new Array(),new Array(),new Array(31,18,33,32,32,33,47,22,48,23,45,37,38,24,46,25,8,26,14,27,16,28,12,29,13,30),new Array(31,18,33,32,32,33,47,22,48,23,45,37,38,24,46,25,8,26,14,27,16,28,12,29,13,30),new Array(31,18,33,32,32,33,47,22,48,23,45,37,38,24,46,25,8,26,14,27,16,28,12,29,13,30),new Array(31,18,33,32,32,33,47,22,48,23,45,37,38,24,46,25,8,26,14,27,16,28,12,29,13,30),new Array(31,18,33,32,32,33,47,22,48,23,45,37,38,24,46,25,8,26,14,27,16,28,12,29,13,30),new Array(31,18,33,32,32,33,47,22,48,23,45,37,38,24,46,25,8,26,14,27,16,28,12,29,13,30),new Array(31,18,33,32,32,33,47,22,48,23,45,37,38,24,46,25,8,26,14,27,16,28,12,29,13,30),new Array(),new Array(19,91,3,3,5,4,6,5,7,6,9,7,11,8,10,9,18,12,20,13,45,17,31,18,47,22,48,23,38,24,46,25,8,26,14,27,16,28,12,29,13,30,33,32,32,33),new Array(31,18,33,32,32,33,47,22,48,23,45,37,38,24,46,25,8,26,14,27,16,28,12,29,13,30),new Array(33,32,32,33,47,22,48,23,45,37,38,24,46,25,8,26,14,27,16,28,12,29,13,30),new Array(33,32,32,33,47,22,48,23,45,37,38,24,46,25,8,26,14,27,16,28,12,29,13,30),new Array(45,96),new Array(31,18,33,32,32,33,47,22,48,23,45,37,38,24,46,25,8,26,14,27,16,28,12,29,13,30),new Array(33,32,32,33,47,22,48,23,45,37,38,24,46,25,8,26,14,27,16,28,12,29,13,30),new Array(47,22,48,23,45,37,38,24,46,25,8,26,14,27,16,28,12,29,13,30),new Array(30,55,29,56),new Array(33,32,32,33,47,22,48,23,45,37,38,24,46,25,8,26,14,27,16,28,12,29,13,30),new Array(33,32,32,33,47,22,48,23,45,37,38,24,46,25,8,26,14,27,16,28,12,29,13,30),new Array(33,32,32,33,47,22,48,23,45,37,38,24,46,25,8,26,14,27,16,28,12,29,13,30),new Array(33,32,32,33,47,22,48,23,45,37,38,24,46,25,8,26,14,27,16,28,12,29,13,30),new Array(33,32,32,33,47,22,48,23,45,37,38,24,46,25,8,26,14,27,16,28,12,29,13,30),new Array(39,105,24,45,23,46,26,47,25,48,27,49,28,50,22,51),new Array(45,107),new Array(15,108,40,109),new Array(),new Array(42,110),new Array(17,111,40,112),new Array(24,45,23,46,26,47,25,48,27,49,28,50,22,51),new Array(),new Array(),new Array(4,113),new Array(45,114),new Array(33,32,32,33,47,22,48,23,45,37,38,24,46,25,8,26,14,27,16,28,12,29,13,30),new Array(),new Array(31,18,33,32,32,33,47,22,48,23,45,37,38,24,46,25,8,26,14,27,16,28,12,29,13,30),new Array(20,117),new Array(44,57,38,58,16,59),new Array(),new Array(30,55,29,56),new Array(30,55,29,56),new Array(30,55,29,56),new Array(30,55,29,56),new Array(30,55,29,56),new Array(30,55,29,56),new Array(30,55,29,56),new Array(),new Array(),new Array(24,45,23,46,26,47,25,48,27,49,28,50,22,51),new Array(32,62,33,63),new Array(32,62,33,63),new Array(21,-30),new Array(39,118,40,112),new Array(17,119,32,62,33,63),new Array(),new Array(35,64,34,65,36,66),new Array(35,64,34,65,36,66),new Array(),new Array(),new Array(),new Array(),new Array(39,120,40,121),new Array(),new Array(),new Array(45,71),new Array(31,18,33,32,32,33,47,22,48,23,45,37,38,24,46,25,8,26,14,27,16,28,12,29,13,30),new Array(),new Array(31,18,33,32,32,33,47,22,48,23,45,37,38,24,46,25,8,26,14,27,16,28,12,29,13,30),new Array(3,3,5,4,6,5,7,6,9,7,11,8,10,9,18,12,20,13,45,17,31,18,47,22,48,23,38,24,46,25,8,26,14,27,16,28,12,29,13,30,33,32,32,33),new Array(),new Array(17,126,32,62,33,63),new Array(24,45,23,46,26,47,25,48,27,49,28,50,22,51,20,127),new Array(31,18,33,32,32,33,47,22,48,23,45,37,38,24,46,25,8,26,14,27,16,28,12,29,13,30),new Array(47,22,48,23,45,37,38,24,46,25,8,26,14,27,16,28,12,29,13,30),new Array(21,-31),new Array(18,131),new Array(45,132),new Array(),new Array(24,45,23,46,26,47,25,48,27,49,28,50,22,51),new Array(24,45,23,46,26,47,25,48,27,49,28,50,22,51),new Array(),new Array(),new Array(),new Array(24,45,23,46,26,47,25,48,27,49,28,50,22,51,20,133),new Array(40,134),new Array(44,77,38,58,16,78),new Array(),new Array(),new Array(45,17,47,22,48,23,38,24,46,25,8,26,14,27,16,28,12,29,13,30),new Array(47,22,48,23,45,37,38,24,46,25,8,26,14,27,16,28,12,29,13,30),new Array(19,138,3,3,5,4,6,5,7,6,9,7,11,8,10,9,18,12,20,13,45,17,31,18,47,22,48,23,38,24,46,25,8,26,14,27,16,28,12,29,13,30,33,32,32,33),new Array(39,139),new Array(44,77,38,58,16,78),new Array(),new Array(3,3,5,4,6,5,7,6,9,7,11,8,10,9,18,12,20,13,45,17,31,18,47,22,48,23,38,24,46,25,8,26,14,27,16,28,12,29,13,30,33,32,32,33),new Array());var e=new Array(new Array(49,1),new Array(50,2,60,10,53,11,59,14,62,15,58,16,61,19,66,20,63,21,64,31,65,34),new Array(),new Array(53,35,62,15,61,19,63,21,64,31,65,34,58,36,66,20),new Array(53,38,62,15,61,19,63,21,64,31,65,34,58,36,66,20),new Array(50,39,60,10,53,11,59,14,62,15,58,16,61,19,66,20,63,21,64,31,65,34),new Array(),new Array(),new Array(),new Array(50,43,60,10,53,11,59,14,62,15,58,16,61,19,66,20,63,21,64,31,65,34),new Array(),new Array(),new Array(51,53),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(62,61,61,19,63,21,64,31,65,34,58,36,66,20),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(53,67,62,15,61,19,63,21,64,31,65,34,58,36,66,20),new Array(),new Array(),new Array(54,69,55,70),new Array(52,72,53,73,62,15,61,19,63,21,64,31,65,34,58,36,66,20),new Array(),new Array(),new Array(),new Array(65,74,58,36,66,20),new Array(65,75,58,36,66,20),new Array(),new Array(50,76,60,10,53,11,59,14,62,15,58,16,61,19,66,20,63,21,64,31,65,34),new Array(),new Array(),new Array(50,79,60,10,53,11,59,14,62,15,58,16,61,19,66,20,63,21,64,31,65,34),new Array(),new Array(60,81,59,14,58,82,66,20),new Array(),new Array(),new Array(),new Array(),new Array(62,84,61,19,63,21,64,31,65,34,58,36,66,20),new Array(62,85,61,19,63,21,64,31,65,34,58,36,66,20),new Array(62,86,61,19,63,21,64,31,65,34,58,36,66,20),new Array(62,87,61,19,63,21,64,31,65,34,58,36,66,20),new Array(62,88,61,19,63,21,64,31,65,34,58,36,66,20),new Array(62,89,61,19,63,21,64,31,65,34,58,36,66,20),new Array(62,90,61,19,63,21,64,31,65,34,58,36,66,20),new Array(),new Array(50,92,60,10,53,11,59,14,62,15,58,16,61,19,66,20,63,21,64,31,65,34),new Array(53,93,62,15,61,19,63,21,64,31,65,34,58,36,66,20),new Array(61,94,63,21,64,31,65,34,58,36,66,20),new Array(61,95,63,21,64,31,65,34,58,36,66,20),new Array(),new Array(52,97,53,73,62,15,61,19,63,21,64,31,65,34,58,36,66,20),new Array(61,98,63,21,64,31,65,34,58,36,66,20),new Array(65,99,58,36,66,20),new Array(),new Array(63,100,64,31,65,34,58,36,66,20),new Array(63,101,64,31,65,34,58,36,66,20),new Array(64,102,65,34,58,36,66,20),new Array(64,103,65,34,58,36,66,20),new Array(64,104,65,34,58,36,66,20),new Array(),new Array(56,106),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(61,115,63,21,64,31,65,34,58,36,66,20),new Array(),new Array(53,116,62,15,61,19,63,21,64,31,65,34,58,36,66,20),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(55,122),new Array(53,123,62,15,61,19,63,21,64,31,65,34,58,36,66,20),new Array(),new Array(53,124,62,15,61,19,63,21,64,31,65,34,58,36,66,20),new Array(50,125,60,10,53,11,59,14,62,15,58,16,61,19,66,20,63,21,64,31,65,34),new Array(),new Array(),new Array(),new Array(53,128,62,15,61,19,63,21,64,31,65,34,58,36,66,20),new Array(57,129,58,130,66,20),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(51,135),new Array(),new Array(60,136,59,14,58,82,66,20),new Array(58,137,66,20),new Array(50,92,60,10,53,11,59,14,62,15,58,16,61,19,66,20,63,21,64,31,65,34),new Array(),new Array(),new Array(),new Array(50,140,60,10,53,11,59,14,62,15,58,16,61,19,66,20,63,21,64,31,65,34),new Array());var q=new Array(2,0,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,29,-1,40,53,64,-1,44,61,47,62,63,-1,66,-1,10,7,70,71,51,-1,-1,56,-1,53,64,-1,-1,-1,-1,24,25,26,-1,-1,-1,-1,-1,-1,-1,27,-1,-1,-1,-1,-1,7,-1,-1,43,-1,-1,-1,-1,-1,-1,14,-1,9,-1,-1,6,54,55,18,-1,-1,20,-1,-1,-1,23,39,38,37,36,35,34,33,28,3,17,42,41,60,-1,-1,52,46,45,50,49,48,65,-1,13,68,-1,-1,69,-1,-1,60,-1,-1,-1,58,57,-1,-1,8,11,5,19,57,21,-1,59,16,4,12,-1,-1,-1,-1,15,67,-1,22);var o=new Array("Program'","ERROR_RESYNC","WHITESPACE","IF","ELSE","WHILE","DO","FOR","FUNCTION","USE","RETURN","DELETE","TRUE","FALSE","<<",">>","[","]","{","}",";","=","==","!=","~=","<=",">=",">","<","||","&&","!","+","-","/","%","*","^","(",")",",","#",":","|",".","Identifier","String","Integer","Float","Program","Stmt","Stmt_List","Param_List","Expression","Prop_List","Prop","Param_Def_List","Attr_List","ExtValue","Lhs","Assign","AddSubExp","LogExp","MulDivExp","NegExp","ExpExp","Value","$");if(!j){j=[]}if(!g){g=[]}s.push(0);r.push(0);f.la=this._lex(f);while(true){f.act=142;for(m=0;m1&&f.act==142){s.pop();r.pop();for(m=0;m1&&f.act!=142){while(f.la!=67){f.act=142;for(m=0;m0){s.push(f.act);r.push(f.att);f.la=this._lex(f);if(f.error_step>0){f.error_step--}}else{p=f.act*-1;n=void (0);switch(p){case 0:n=r[r.length-1];break;case 1:this.execute(r[r.length-1]);break;case 2:n=r[r.length-0];break;case 3:n=this.createNode("node_op","op_none",r[r.length-2],r[r.length-1]);break;case 4:n=r[r.length-0];break;case 5:n=this.createNode("node_op","op_param",r[r.length-1],r[r.length-3]);break;case 6:n=this.createNode("node_op","op_param",r[r.length-1]);break;case 7:n=r[r.length-0];break;case 8:n=this.createNode("node_op","op_proplst",r[r.length-3],r[r.length-1]);break;case 9:n=r[r.length-1];break;case 10:n=r[r.length-0];break;case 11:n=this.createNode("node_op","op_prop",r[r.length-3],r[r.length-1]);break;case 12:n=this.createNode("node_op","op_paramdef",r[r.length-1],r[r.length-3]);break;case 13:n=this.createNode("node_op","op_paramdef",r[r.length-1]);break;case 14:n=r[r.length-0];break;case 15:n=this.createNode("node_op","op_param",r[r.length-1],r[r.length-3]);break;case 16:n=this.createNode("node_op","op_param",r[r.length-1]);break;case 17:n=this.createNode("node_op","op_assign",r[r.length-3],r[r.length-1]);break;case 18:n=this.createNode("node_op","op_if",r[r.length-2],r[r.length-1]);break;case 19:n=this.createNode("node_op","op_if_else",r[r.length-4],r[r.length-3],r[r.length-1]);break;case 20:n=this.createNode("node_op","op_while",r[r.length-2],r[r.length-1]);break;case 21:n=this.createNode("node_op","op_do",r[r.length-4],r[r.length-2]);break;case 22:n=this.createNode("node_op","op_for",r[r.length-7],r[r.length-5],r[r.length-3],r[r.length-1]);break;case 23:n=this.createNode("node_op","op_use",r[r.length-2]);break;case 24:n=this.createNode("node_op","op_delete",r[r.length-1]);break;case 25:n=this.createNode("node_op","op_return",r[r.length-1]);break;case 26:n=r[r.length-2];break;case 27:n=this.createNode("node_op","op_noassign",r[r.length-2]);break;case 28:n=r[r.length-2];n.needsBrackets=true;break;case 29:n=this.createNode("node_op","op_none");break;case 30:n=this.createNode("node_op","op_lhs",r[r.length-1],r[r.length-3],"dot");break;case 31:n=this.createNode("node_op","op_lhs",r[r.length-2],r[r.length-4],"bracket");break;case 32:n=this.createNode("node_op","op_lhs",r[r.length-1]);break;case 33:n=this.createNode("node_op","op_equ",r[r.length-3],r[r.length-1]);break;case 34:n=this.createNode("node_op","op_lot",r[r.length-3],r[r.length-1]);break;case 35:n=this.createNode("node_op","op_grt",r[r.length-3],r[r.length-1]);break;case 36:n=this.createNode("node_op","op_loe",r[r.length-3],r[r.length-1]);break;case 37:n=this.createNode("node_op","op_gre",r[r.length-3],r[r.length-1]);break;case 38:n=this.createNode("node_op","op_neq",r[r.length-3],r[r.length-1]);break;case 39:n=this.createNode("node_op","op_approx",r[r.length-3],r[r.length-1]);break;case 40:n=r[r.length-1];break;case 41:n=this.createNode("node_op","op_or",r[r.length-3],r[r.length-1]);break;case 42:n=this.createNode("node_op","op_and",r[r.length-3],r[r.length-1]);break;case 43:n=this.createNode("node_op","op_not",r[r.length-1]);break;case 44:n=r[r.length-1];break;case 45:n=this.createNode("node_op","op_sub",r[r.length-3],r[r.length-1]);break;case 46:n=this.createNode("node_op","op_add",r[r.length-3],r[r.length-1]);break;case 47:n=r[r.length-1];break;case 48:n=this.createNode("node_op","op_mul",r[r.length-3],r[r.length-1]);break;case 49:n=this.createNode("node_op","op_div",r[r.length-3],r[r.length-1]);break;case 50:n=this.createNode("node_op","op_mod",r[r.length-3],r[r.length-1]);break;case 51:n=r[r.length-1];break;case 52:n=this.createNode("node_op","op_exp",r[r.length-3],r[r.length-1]);break;case 53:n=r[r.length-1];break;case 54:n=this.createNode("node_op","op_neg",r[r.length-1]);break;case 55:n=r[r.length-1];break;case 56:n=r[r.length-1];break;case 57:n=this.createNode("node_op","op_extvalue",r[r.length-4],r[r.length-2]);break;case 58:n=this.createNode("node_op","op_execfun",r[r.length-4],r[r.length-2]);break;case 59:n=this.createNode("node_op","op_execfun",r[r.length-5],r[r.length-3],r[r.length-1],true);break;case 60:n=this.createNode("node_op","op_property",r[r.length-3],r[r.length-1]);break;case 61:n=r[r.length-1];break;case 62:n=this.createNode("node_const",r[r.length-1]);break;case 63:n=this.createNode("node_const",r[r.length-1]);break;case 64:n=this.createNode("node_var",r[r.length-1]);break;case 65:n=r[r.length-2];break;case 66:n=this.createNode("node_str",r[r.length-1]);break;case 67:n=this.createNode("node_op","op_function",r[r.length-5],r[r.length-2]);break;case 68:n=this.createNode("node_op","op_proplst_val",r[r.length-2]);break;case 69:n=this.createNode("node_op","op_array",r[r.length-2]);break;case 70:n=this.createNode("node_const_bool",r[r.length-1]);break;case 71:n=this.createNode("node_const_bool",r[r.length-1]);break}for(m=0;m> "}}else{return"null"}case"string":return"'"+g.replace(/(["'])/g,"\\$1")+"'";case"number":case"boolean":return new String(g);case"null":return"null"}},toJessie:function(f){var g=this.dump(f),d=[],e;for(e=0;e0){d.push("// "+g[e].attributes.name)}d.push("s"+e+" = "+g[e].type+"("+g[e].parents.join(", ")+") "+this.toJSAN(g[e].attributes).replace(/\n/,"\\n")+";");d.push("")}return d.join("\n")},toJavaScript:function(f){var g=this.dump(f),d=[],e;for(e=0;e0){e=this.joinTransforms(h,f);g=[e[1][1],e[2][1],e[1][2],e[2][2],e[1][0],e[2][0]].join(",");j+=" matrix("+g+") ";i.setAttributeNS(null,"transform",j)}},updateImageURL:function(e){var d=JXG.evaluate(e.url);e.rendNode.setAttributeNS(this.xlinkNamespace,"xlink:href",d)},appendChildPrim:function(d,e){if(!JXG.exists(e)){e=0}else{if(e>=JXG.Options.layer.numlayers){e=JXG.Options.layer.numlayers-1}}this.layer[e].appendChild(d)},appendNodesToElement:function(d){d.rendNode=this.getElementById(d.id)},createPrim:function(d,f){var e=this.container.ownerDocument.createElementNS(this.svgNamespace,d);e.setAttributeNS(null,"id",this.container.id+"_"+f);e.style.position="absolute";if(d==="path"){e.setAttributeNS(null,"stroke-linecap","butt");e.setAttributeNS(null,"stroke-linejoin","round")}return e},remove:function(d){if(JXG.exists(d)&&JXG.exists(d.parentNode)){d.parentNode.removeChild(d)}},makeArrows:function(e){var d;if(e.visPropOld.firstarrow===e.visProp.firstarrow&&e.visPropOld.lastarrow===e.visProp.lastarrow){return}if(e.visProp.firstarrow){d=e.rendNodeTriangleStart;if(!JXG.exists(d)){d=this._createArrowHead(e,"End");this.defs.appendChild(d);e.rendNodeTriangleStart=d;e.rendNode.setAttributeNS(null,"marker-start","url(#"+this.container.id+"_"+e.id+"TriangleEnd)")}else{this.defs.appendChild(d)}}else{d=e.rendNodeTriangleStart;if(JXG.exists(d)){this.remove(d)}}if(e.visProp.lastarrow){d=e.rendNodeTriangleEnd;if(!JXG.exists(d)){d=this._createArrowHead(e,"Start");this.defs.appendChild(d);e.rendNodeTriangleEnd=d;e.rendNode.setAttributeNS(null,"marker-end","url(#"+this.container.id+"_"+e.id+"TriangleStart)")}else{this.defs.appendChild(d)}}else{d=e.rendNodeTriangleEnd;if(JXG.exists(d)){this.remove(d)}}e.visPropOld.firstarrow=e.visProp.firstarrow;e.visPropOld.lastarrow=e.visProp.lastarrow},updateEllipsePrim:function(e,d,h,g,f){e.setAttributeNS(null,"cx",d);e.setAttributeNS(null,"cy",h);e.setAttributeNS(null,"rx",Math.abs(g));e.setAttributeNS(null,"ry",Math.abs(f))},updateLinePrim:function(h,e,d,g,f){if(!isNaN(e+d+g+f)){h.setAttributeNS(null,"x1",e);h.setAttributeNS(null,"y1",d);h.setAttributeNS(null,"x2",g);h.setAttributeNS(null,"y2",f)}},updatePathPrim:function(d,e){if(e==""){e="M 0 0"}d.setAttributeNS(null,"d",e)},updatePathStringPoint:function(h,e,g){var f="",j=h.coords.scrCoords,i=e*Math.sqrt(3)*0.5,d=e*0.5;if(g==="x"){f=" M "+(j[1]-e)+" "+(j[2]-e)+" L "+(j[1]+e)+" "+(j[2]+e)+" M "+(j[1]+e)+" "+(j[2]-e)+" L "+(j[1]-e)+" "+(j[2]+e)}else{if(g==="+"){f=" M "+(j[1]-e)+" "+(j[2])+" L "+(j[1]+e)+" "+(j[2])+" M "+(j[1])+" "+(j[2]-e)+" L "+(j[1])+" "+(j[2]+e)}else{if(g==="<>"){f=" M "+(j[1]-e)+" "+(j[2])+" L "+(j[1])+" "+(j[2]+e)+" L "+(j[1]+e)+" "+(j[2])+" L "+(j[1])+" "+(j[2]-e)+" Z "}else{if(g==="^"){f=" M "+(j[1])+" "+(j[2]-e)+" L "+(j[1]-i)+" "+(j[2]+d)+" L "+(j[1]+i)+" "+(j[2]+d)+" Z "}else{if(g==="v"){f=" M "+(j[1])+" "+(j[2]+e)+" L "+(j[1]-i)+" "+(j[2]-d)+" L "+(j[1]+i)+" "+(j[2]-d)+" Z "}else{if(g===">"){f=" M "+(j[1]+e)+" "+(j[2])+" L "+(j[1]-d)+" "+(j[2]-i)+" L "+(j[1]-d)+" "+(j[2]+i)+" Z "}else{if(g==="<"){f=" M "+(j[1]-e)+" "+(j[2])+" L "+(j[1]+d)+" "+(j[2]-i)+" L "+(j[1]+d)+" "+(j[2]+i)+" Z "}}}}}}}return f},updatePathStringPrim:function(d){var f=" M ",g=" L ",m=" C ",e=f,n=5000,j="",h,l,o=(d.visProp.curvetype!=="plot"),k;if(d.numberPoints<=0){return""}k=Math.min(d.points.length,d.numberPoints);if(d.bezierDegree==1){if(o&&d.board.options.curve.RDPsmoothing){d.points=JXG.Math.Numerics.RamerDouglasPeuker(d.points,0.5)}for(h=0;hn){l[1]=n}else{if(l[1]<-n){l[1]=-n}}if(l[2]>n){l[2]=n}else{if(l[2]<-n){l[2]=-n}}j+=e+l[1]+" "+l[2];e=g}}}else{if(d.bezierDegree==3){h=0;while(ht){r[1]=t}else{if(r[1]<-t){r[1]=-t}}if(r[2]>t){r[2]=t}else{if(r[2]<-t){r[2]=-t}}if(h==k){o+=[h,r[1]+0*q*(2*m*Math.random()-m)," ",r[2]+0*q*(2*m*Math.random()-m)].join("")}else{o+=[h,(g+(r[1]-g)*0.333+q*(2*m*Math.random()-m))," ",(d+(r[2]-d)*0.333+q*(2*m*Math.random()-m))," ",(g+2*(r[1]-g)*0.333+q*(2*m*Math.random()-m))," ",(d+2*(r[2]-d)*0.333+q*(2*m*Math.random()-m))," ",r[1]," ",r[2]].join("")}h=l;g=r[1];d=r[2]}}}return o},updatePolygonPrim:function(h,g){var j="",e,f,d=g.vertices.length;h.setAttributeNS(null,"stroke","none");for(f=0;f0){e.setAttributeNS(null,"stroke-dasharray",this.dashArray[f-1])}else{if(e.hasAttributeNS(null,"stroke-dasharray")){e.removeAttributeNS(null,"stroke-dasharray")}}},setGradient:function(f){var n=f.rendNode,g,i,h,m,l,e,d,k,j;i=JXG.evaluate(f.visProp.fillopacity);i=(i>0)?i:0;g=JXG.evaluate(f.visProp.fillcolor);if(f.visProp.gradient==="linear"){h=this.createPrim("linearGradient",f.id+"_gradient");e="0%";d="100%";k="0%";j="0%";h.setAttributeNS(null,"x1",e);h.setAttributeNS(null,"x2",d);h.setAttributeNS(null,"y1",k);h.setAttributeNS(null,"y2",j);m=this.createPrim("stop",f.id+"_gradient1");m.setAttributeNS(null,"offset","0%");m.setAttributeNS(null,"style","stop-color:"+g+";stop-opacity:"+i);l=this.createPrim("stop",f.id+"_gradient2");l.setAttributeNS(null,"offset","100%");l.setAttributeNS(null,"style","stop-color:"+f.visProp.gradientsecondcolor+";stop-opacity:"+f.visProp.gradientsecondopacity);h.appendChild(m);h.appendChild(l);this.defs.appendChild(h);n.setAttributeNS(null,"style","fill:url(#"+this.container.id+"_"+f.id+"_gradient)");f.gradNode1=m;f.gradNode2=l}else{if(f.visProp.gradient==="radial"){h=this.createPrim("radialGradient",f.id+"_gradient");h.setAttributeNS(null,"cx","50%");h.setAttributeNS(null,"cy","50%");h.setAttributeNS(null,"r","50%");h.setAttributeNS(null,"fx",f.visProp.gradientpositionx*100+"%");h.setAttributeNS(null,"fy",f.visProp.gradientpositiony*100+"%");m=this.createPrim("stop",f.id+"_gradient1");m.setAttributeNS(null,"offset","0%");m.setAttributeNS(null,"style","stop-color:"+f.visProp.gradientsecondcolor+";stop-opacity:"+f.visProp.gradientsecondopacity);l=this.createPrim("stop",f.id+"_gradient2");l.setAttributeNS(null,"offset","100%");l.setAttributeNS(null,"style","stop-color:"+g+";stop-opacity:"+i);h.appendChild(m);h.appendChild(l);this.defs.appendChild(h);n.setAttributeNS(null,"style","fill:url(#"+this.container.id+"_"+f.id+"_gradient)");f.gradNode1=m;f.gradNode2=l}else{n.removeAttributeNS(null,"style")}}},updateGradient:function(g){var e=g.gradNode1,d=g.gradNode2,f,h;if(!JXG.exists(e)||!JXG.exists(d)){return}h=JXG.evaluate(g.visProp.fillopacity);h=(h>0)?h:0;f=JXG.evaluate(g.visProp.fillcolor);if(g.visProp.gradient==="linear"){e.setAttributeNS(null,"style","stop-color:"+f+";stop-opacity:"+h);d.setAttributeNS(null,"style","stop-color:"+g.visProp.gradientsecondcolor+";stop-opacity:"+g.visProp.gradientsecondopacity)}else{if(g.visProp.gradient==="radial"){e.setAttributeNS(null,"style","stop-color:"+g.visProp.gradientsecondcolor+";stop-opacity:"+g.visProp.gradientsecondopacity);d.setAttributeNS(null,"style","stop-color:"+f+";stop-opacity:"+h)}}},setObjectFillColor:function(e,h,j){var f,g=JXG.evaluate(h),k,l,d=JXG.evaluate(j),i;d=(d>0)?d:0;if(e.visPropOld.fillcolor===g&&e.visPropOld.fillopacity===d){return}if(JXG.exists(g)&&g!==false){if(g.length!=9){k=g;i=d}else{l=JXG.rgba2rgbo(g);k=l[0];i=d*l[1]}f=e.rendNode;f.setAttributeNS(null,"fill",k);if(e.type===JXG.OBJECT_TYPE_IMAGE){f.setAttributeNS(null,"opacity",i)}else{f.setAttributeNS(null,"fill-opacity",i)}if(JXG.exists(e.visProp.gradient)){this.updateGradient(e)}}e.visPropOld.fillcolor=g;e.visPropOld.fillopacity=d},setObjectStrokeColor:function(e,h,i){var g=JXG.evaluate(h),k,l,d=JXG.evaluate(i),j,f;d=(d>0)?d:0;if(e.visPropOld.strokecolor===g&&e.visPropOld.strokeopacity===d){return}if(JXG.exists(g)&&g!==false){if(g.length!=9){k=g;j=d}else{l=JXG.rgba2rgbo(g);k=l[0];j=d*l[1]}f=e.rendNode;if(e.type===JXG.OBJECT_TYPE_TEXT){if(e.visProp.display==="html"){f.style.color=k;f.style.opacity=j}else{f.setAttributeNS(null,"style","fill:"+k);f.setAttributeNS(null,"style","fill-opacity:"+j)}}else{f.setAttributeNS(null,"stroke",k);f.setAttributeNS(null,"stroke-opacity",j)}if(e.type===JXG.OBJECT_TYPE_ARROW){this._setArrowAtts(e.rendNodeTriangle,k,j,e.visProp.strokewidth)}else{if(e.elementClass===JXG.OBJECT_CLASS_CURVE||e.elementClass===JXG.OBJECT_CLASS_LINE){if(e.visProp.firstarrow){this._setArrowAtts(e.rendNodeTriangleStart,k,j,e.visProp.strokewidth)}if(e.visProp.lastarrow){this._setArrowAtts(e.rendNodeTriangleEnd,k,j,e.visProp.strokewidth)}}}}e.visPropOld.strokecolor=g;e.visPropOld.strokeopacity=d},setObjectStrokeWidth:function(f,e){var d=JXG.evaluate(e),g;if(f.visPropOld.strokewidth===d){return}g=f.rendNode;this.setPropertyPrim(g,"stroked","true");if(JXG.exists(d)){this.setPropertyPrim(g,"stroke-width",d+"px");if(f.type===JXG.OBJECT_TYPE_ARROW){this._setArrowAtts(f.rendNodeTriangle,f.visProp.strokecolor,f.visProp.strokeopacity,d)}else{if(f.elementClass===JXG.OBJECT_CLASS_CURVE||f.elementClass===JXG.OBJECT_CLASS_LINE){if(f.visProp.firstarrow){this._setArrowAtts(f.rendNodeTriangleStart,f.visProp.strokecolor,f.visProp.strokeopacity,d)}if(f.visProp.lastarrow){this._setArrowAtts(f.rendNodeTriangleEnd,f.visProp.strokecolor,f.visProp.strokeopacity,d)}}}}f.visPropOld.strokewidth=d},setShadow:function(d){if(d.visPropOld.shadow===d.visProp.shadow){return}if(JXG.exists(d.rendNode)){if(d.visProp.shadow){d.rendNode.setAttributeNS(null,"filter","url(#"+this.container.id+"_f1)")}else{d.rendNode.removeAttributeNS(null,"filter")}}d.visPropOld.shadow=d.visProp.shadow},suspendRedraw:function(){},unsuspendRedraw:function(){},resize:function(d,e){this.svgRoot.style.width=parseFloat(d)+"px";this.svgRoot.style.height=parseFloat(e)+"px"}});JXG.VMLRenderer=function(d){this.type="vml";this.container=d;this.container.style.overflow="hidden";this.container.onselectstart=function(){return false};this.resolution=10;if(!JXG.exists(JXG.vmlStylesheet)){d.ownerDocument.namespaces.add("jxgvml","urn:schemas-microsoft-com:vml");JXG.vmlStylesheet=this.container.ownerDocument.createStyleSheet();JXG.vmlStylesheet.addRule(".jxgvml","behavior:url(#default#VML)")}try{!d.ownerDocument.namespaces.jxgvml&&d.ownerDocument.namespaces.add("jxgvml","urn:schemas-microsoft-com:vml");this.createNode=function(e){return d.ownerDocument.createElement("')}}catch(f){this.createNode=function(e){return d.ownerDocument.createElement("<"+e+' xmlns="urn:schemas-microsoft.com:vml" class="jxgvml">')}}this.dashArray=["Solid","1 1","ShortDash","Dash","LongDash","ShortDashDot","LongDashDot"]};JXG.VMLRenderer.prototype=new JXG.AbstractRenderer();JXG.extend(JXG.VMLRenderer.prototype,{_setAttr:function(g,f,i,d){try{if(document.documentMode===8){g[f]=i}else{g.setAttribute(f,i,d)}}catch(h){JXG.debug("_setAttr: "+f+" "+i+"
\n")}},updateTicks:function(h,j,e,k,g){var f=[],l,m,n,o,d=this.resolution;m=h.ticks.length;for(l=0;l0){q=g.rendNode.style.filter.toString();if(!q.match(/DXImageTransform/)){j.style.filter="progid:DXImageTransform.Microsoft.Matrix(M11='1.0', sizingMethod='auto expand') "+q}k=this.joinTransforms(g,r);f[0]=JXG.Math.matVecMult(k,g.coords.scrCoords);f[0][1]/=f[0][0];f[0][2]/=f[0][0];f[1]=JXG.Math.matVecMult(k,[1,g.coords.scrCoords[1]+g.size[0],g.coords.scrCoords[2]]);f[1][1]/=f[1][0];f[1][2]/=f[1][0];f[2]=JXG.Math.matVecMult(k,[1,g.coords.scrCoords[1]+g.size[0],g.coords.scrCoords[2]-g.size[1]]);f[2][1]/=f[2][0];f[2][2]/=f[2][0];f[3]=JXG.Math.matVecMult(k,[1,g.coords.scrCoords[1],g.coords.scrCoords[2]-g.size[1]]);f[3][1]/=f[3][0];f[3][2]/=f[3][0];e=f[0][1];l=f[0][1];d=f[0][2];h=f[0][2];for(n=1;n<4;n++){e=Math.max(e,f[n][1]);l=Math.min(l,f[n][1]);d=Math.max(d,f[n][2]);h=Math.min(h,f[n][2])}j.style.left=parseInt(l)+"px";j.style.top=parseInt(h)+"px";j.filters.item(0).M11=k[1][1];j.filters.item(0).M12=k[1][2];j.filters.item(0).M21=k[2][1];j.filters.item(0).M22=k[2][2]}},updateImageURL:function(e){var d=JXG.evaluate(e.url);this._setAttr(e.rendNode,"src",d)},appendChildPrim:function(d,e){if(!JXG.exists(e)){e=0}d.style.zIndex=e;this.container.appendChild(d)},appendNodesToElement:function(d,e){if(e==="shape"||e==="path"||e==="polygon"){d.rendNodePath=this.getElementById(d.id+"_path")}d.rendNodeFill=this.getElementById(d.id+"_fill");d.rendNodeStroke=this.getElementById(d.id+"_stroke");d.rendNodeShadow=this.getElementById(d.id+"_shadow");d.rendNode=this.getElementById(d.id)},createPrim:function(e,j){var f,d=this.createNode("fill"),i=this.createNode("stroke"),h=this.createNode("shadow"),g;this._setAttr(d,"id",this.container.id+"_"+j+"_fill");this._setAttr(i,"id",this.container.id+"_"+j+"_stroke");this._setAttr(h,"id",this.container.id+"_"+j+"_shadow");if(e==="circle"||e==="ellipse"){f=this.createNode("oval");f.appendChild(d);f.appendChild(i);f.appendChild(h)}else{if(e==="polygon"||e==="path"||e==="shape"||e==="line"){f=this.createNode("shape");f.appendChild(d);f.appendChild(i);f.appendChild(h);g=this.createNode("path");this._setAttr(g,"id",this.container.id+"_"+j+"_path");f.appendChild(g)}else{f=this.createNode(e);f.appendChild(d);f.appendChild(i);f.appendChild(h)}}f.style.position="absolute";f.style.left="0px";f.style.top="0px";this._setAttr(f,"id",this.container.id+"_"+j);return f},remove:function(d){if(JXG.exists(d)){d.removeNode(true)}},makeArrows:function(e){var d;if(e.visPropOld.firstarrow===e.visProp.firstarrow&&e.visPropOld.lastarrow===e.visProp.lastarrow){return}if(e.visProp.firstarrow){d=e.rendNodeStroke;this._setAttr(d,"startarrow","block");this._setAttr(d,"startarrowlength","long")}else{d=e.rendNodeStroke;if(JXG.exists(d)){this._setAttr(d,"startarrow","none")}}if(e.visProp.lastarrow){d=e.rendNodeStroke;this._setAttr(d,"id",this.container.id+"_"+e.id+"stroke");this._setAttr(d,"endarrow","block");this._setAttr(d,"endarrowlength","long")}else{d=e.rendNodeStroke;if(JXG.exists(d)){this._setAttr(d,"endarrow","none")}}e.visPropOld.firstarrow=e.visProp.firstarrow;e.visPropOld.lastarrow=e.visProp.lastarrow},updateEllipsePrim:function(e,d,h,g,f){e.style.left=parseInt(d-g)+"px";e.style.top=parseInt(h-f)+"px";e.style.width=parseInt(Math.abs(g)*2)+"px";e.style.height=parseInt(Math.abs(f)*2)+"px"},updateLinePrim:function(k,e,d,g,f,i){var h,j=this.resolution;if(!isNaN(e+d+g+f)){h=["m ",parseInt(j*e),", ",parseInt(j*d)," l ",parseInt(j*g),", ",parseInt(j*f)];this.updatePathPrim(k,h,i)}},updatePathPrim:function(f,g,e){var d=e.canvasWidth,h=e.canvasHeight;if(g.length<=0){g=["m 0,0"]}f.style.width=d;f.style.height=h;this._setAttr(f,"coordsize",[parseInt(this.resolution*d),parseInt(this.resolution*h)].join(","));this._setAttr(f,"path",g.join(""))},updatePathStringPoint:function(e,k,h){var j=[],f=Math.round,g=e.coords.scrCoords,i=k*Math.sqrt(3)*0.5,l=k*0.5,d=this.resolution;if(h==="x"){j.push([" m ",f(d*(g[1]-k)),", ",f(d*(g[2]-k))," l ",f(d*(g[1]+k)),", ",f(d*(g[2]+k))," m ",f(d*(g[1]+k)),", ",f(d*(g[2]-k))," l ",f(d*(g[1]-k)),", ",f(d*(g[2]+k))].join(""))}else{if(h==="+"){j.push([" m ",f(d*(g[1]-k)),", ",f(d*(g[2]))," l ",f(d*(g[1]+k)),", ",f(d*(g[2]))," m ",f(d*(g[1])),", ",f(d*(g[2]-k))," l ",f(d*(g[1])),", ",f(d*(g[2]+k))].join(""))}else{if(h==="<>"){j.push([" m ",f(d*(g[1]-k)),", ",f(d*(g[2]))," l ",f(d*(g[1])),", ",f(d*(g[2]+k))," l ",f(d*(g[1]+k)),", ",f(d*(g[2]))," l ",f(d*(g[1])),", ",f(d*(g[2]-k))," x e "].join(""))}else{if(h==="^"){j.push([" m ",f(d*(g[1])),", ",f(d*(g[2]-k))," l ",f(d*(g[1]-i)),", ",f(d*(g[2]+l))," l ",f(d*(g[1]+i)),", ",f(d*(g[2]+l))," x e "].join(""))}else{if(h==="v"){j.push([" m ",f(d*(g[1])),", ",f(d*(g[2]+k))," l ",f(d*(g[1]-i)),", ",f(d*(g[2]-l))," l ",f(d*(g[1]+i)),", ",f(d*(g[2]-l))," x e "].join(""))}else{if(h===">"){j.push([" m ",f(d*(g[1]+k)),", ",f(d*(g[2]))," l ",f(d*(g[1]-l)),", ",f(d*(g[2]-i))," l ",f(d*(g[1]-l)),", ",f(d*(g[2]+i))," l ",f(d*(g[1]+k)),", ",f(d*(g[2]))].join(""))}else{if(h==="<"){j.push([" m ",f(d*(g[1]-k)),", ",f(d*(g[2]))," l ",f(d*(g[1]+l)),", ",f(d*(g[2]-i))," l ",f(d*(g[1]+l)),", ",f(d*(g[2]+i))," x e "].join(""))}}}}}}}return j},updatePathStringPrim:function(e){var l=[],k,n,d=this.resolution,j=Math.round,g=" m ",h=" l ",o=" c ",f=g,p=(e.visProp.curvetype!=="plot"),m=Math.min(e.numberPoints,8192);if(e.numberPoints<=0){return""}m=Math.min(m,e.points.length);if(e.bezierDegree==1){if(p&&e.board.options.curve.RDPsmoothing){e.points=JXG.Math.Numerics.RamerDouglasPeuker(e.points,1)}for(k=0;k20000){n[1]=20000}else{if(n[1]<-20000){n[1]=-20000}}if(n[2]>20000){n[2]=20000}else{if(n[2]<-20000){n[2]=-20000}}l.push([f,j(d*n[1]),", ",j(d*n[2])].join(""));f=h}}}else{if(e.bezierDegree==3){k=0;while(k20000){u[1]=20000}else{if(u[1]<-20000){u[1]=-20000}}if(u[2]>20000){u[2]=20000}else{if(u[2]<-20000){u[2]=-20000}}if(h==l){q.push([h,n(d*(u[1]+0*t*(2*o*Math.random()-o)))," ",n(d*(u[2]+0*t*(2*o*Math.random()-o)))].join(""))}else{q.push([h,n(d*(k+(u[1]-k)*0.333+t*(2*o*Math.random()-o)))," ",n(d*(e+(u[2]-e)*0.333+t*(2*o*Math.random()-o)))," ",n(d*(k+2*(u[1]-k)*0.333+t*(2*o*Math.random()-o)))," ",n(d*(e+2*(u[2]-e)*0.333+t*(2*o*Math.random()-o)))," ",n(d*u[1])," ",n(d*u[2])].join(""))}h=m;k=u[1];e=u[2]}}}q.push(" e");return q},updatePolygonPrim:function(h,f){var e,d=f.vertices.length,g=this.resolution,j,k=[];this._setAttr(h,"stroked","false");j=f.vertices[0].coords.scrCoords;if(isNaN(j[1]+j[2])){return}k.push(["m ",parseInt(g*j[1]),",",parseInt(g*j[2])," l "].join(""));for(e=1;e=0){g.style.width=e+"px"}if(f>=0){g.style.height=f+"px"}},setPropertyPrim:function(g,f,h){var e="",d;switch(f){case"stroke":e="strokecolor";break;case"stroke-width":e="strokeweight";break;case"stroke-dasharray":e="dashstyle";break}if(e!==""){d=JXG.evaluate(h);this._setAttr(g,e,d)}},show:function(d){if(d&&d.rendNode){d.rendNode.style.visibility="inherit"}},hide:function(d){if(d&&d.rendNode){d.rendNode.style.visibility="hidden"}},setDashStyle:function(e,d){var f;if(d.dash>=0){f=e.rendNodeStroke;this._setAttr(f,"dashstyle",this.dashArray[d.dash])}},setGradient:function(e){var d=e.rendNodeFill;if(e.visProp.gradient==="linear"){this._setAttr(d,"type","gradient");this._setAttr(d,"color2",e.visProp.gradientsecondcolor);this._setAttr(d,"opacity2",e.visProp.gradientsecondopacity);this._setAttr(d,"angle",e.visProp.gradientangle)}else{if(e.visProp.gradient==="radial"){this._setAttr(d,"type","gradientradial");this._setAttr(d,"color2",e.visProp.gradientsecondcolor);this._setAttr(d,"opacity2",e.visProp.gradientsecondopacity);this._setAttr(d,"focusposition",e.visProp.gradientpositionx*100+"%,"+e.visProp.gradientpositiony*100+"%");this._setAttr(d,"focussize","0,0")}else{this._setAttr(d,"type","solid")}}},setObjectFillColor:function(e,h,i){var g=JXG.evaluate(h),k,l,d=JXG.evaluate(i),j,f=e.rendNode,m;d=(d>0)?d:0;if(e.visPropOld.fillcolor===g&&e.visPropOld.fillopacity===d){return}if(JXG.exists(g)&&g!==false){if(g.length!=9){k=g;j=d}else{l=JXG.rgba2rgbo(g);k=l[0];j=d*l[1]}if(k==="none"||k===false){this._setAttr(e.rendNode,"filled","false")}else{this._setAttr(e.rendNode,"filled","true");this._setAttr(e.rendNode,"fillcolor",k);if(JXG.exists(j)&&e.rendNodeFill){this._setAttr(e.rendNodeFill,"opacity",(j*100)+"%")}}if(e.type===JXG.OBJECT_TYPE_IMAGE){m=e.rendNode.style.filter.toString();if(m.match(/alpha/)){e.rendNode.style.filter=m.replace(/alpha\(opacity *= *[0-9\.]+\)/,"alpha(opacity = "+(j*100)+")")}else{e.rendNode.style.filter+=" alpha(opacity = "+(j*100)+")"}}}e.visPropOld.fillcolor=g;e.visPropOld.fillopacity=d},setObjectStrokeColor:function(f,i,j){var h=JXG.evaluate(i),l,m,e=JXG.evaluate(j),k,g=f.rendNode,d;e=(e>0)?e:0;if(f.visPropOld.strokecolor===h&&f.visPropOld.strokeopacity===e){return}if(JXG.exists(h)&&h!==false){if(h.length!=9){l=h;k=e}else{m=JXG.rgba2rgbo(h);l=m[0];k=e*m[1]}if(f.type===JXG.OBJECT_TYPE_TEXT){k=Math.round(k*100);g.style.filter=" alpha(opacity = "+k+")";g.style.color=l}else{if(l!==false){this._setAttr(g,"stroked","true");this._setAttr(g,"strokecolor",l)}d=f.rendNodeStroke;if(JXG.exists(k)&&f.type!==JXG.OBJECT_TYPE_IMAGE){this._setAttr(d,"opacity",(k*100)+"%")}}}f.visPropOld.strokecolor=h;f.visPropOld.strokeopacity=e},setObjectStrokeWidth:function(f,e){var d=JXG.evaluate(e),g;if(f.visPropOld.strokewidth===d){return}g=f.rendNode;this.setPropertyPrim(g,"stroked","true");if(JXG.exists(d)){this.setPropertyPrim(g,"stroke-width",d)}f.visPropOld.strokewidth=d},setShadow:function(d){var e=d.rendNodeShadow;if(!e||d.visPropOld.shadow===d.visProp.shadow){return}if(d.visProp.shadow){this._setAttr(e,"On","True");this._setAttr(e,"Offset","3pt,3pt");this._setAttr(e,"Opacity","60%");this._setAttr(e,"Color","#aaaaaa")}else{this._setAttr(e,"On","False")}d.visPropOld.shadow=d.visProp.shadow},suspendRedraw:function(){this.container.style.display="none"},unsuspendRedraw:function(){this.container.style.display=""}});JXG.CanvasRenderer=function(d){var e;this.type="canvas";this.canvasRoot=null;this.suspendHandle=null;this.canvasId=JXG.Util.genUUID();this.canvasNamespace=null;this.container=d;this.container.style.MozUserSelect="none";this.container.style.overflow="hidden";if(this.container.style.position===""){this.container.style.position="relative"}this.container.innerHTML=['<',"/canvas>"].join("");this.canvasRoot=document.getElementById(this.canvasId);this.context=this.canvasRoot.getContext("2d");this.dashArray=[[2,2],[5,5],[10,10],[20,20],[20,10,10,10],[20,5,10,5]]};JXG.CanvasRenderer.prototype=new JXG.AbstractRenderer();JXG.extend(JXG.CanvasRenderer.prototype,{_drawFilledPolygon:function(e){var g,d=e.length,f=this.context;if(d>0){f.beginPath();f.moveTo(e[0][0],e[0][1]);for(g=0;g0){f.lineTo(e[g][0],e[g][1])}}f.lineTo(e[0][0],e[0][1]);f.fill()}},_fill:function(e){var d=this.context;d.save();if(this._setColor(e,"fill")){d.fill()}d.restore()},_rotatePoint:function(e,d,f){return[(d*Math.cos(e))-(f*Math.sin(e)),(d*Math.sin(e))+(f*Math.cos(e))]},_rotateShape:function(e,g){var f,h=[],d=e.length;if(d<=0){return e}for(f=0;f0)?f:0;if(h.length!=9){l=h;k=f}else{n=JXG.rgba2rgbo(h);l=n[0];k=f*n[1]}this.context.globalAlpha=k;this.context[d+"Style"]=l}else{j=false}if(m==="stroke"){this.context.lineWidth=parseFloat(p.strokewidth)}return j},_stroke:function(e){var d=this.context;d.save();if(e.visProp.dash>0){if(d.setLineDash){d.setLineDash(this.dashArray[e.visProp.dash])}}else{this.context.lineDashArray=[]}if(this._setColor(e,"stroke")){d.stroke()}d.restore()},_translateShape:function(f,e,j){var g,h=[],d=f.length;if(d<=0){return f}for(g=0;g":g.beginPath();g.moveTo(l[1]-h,l[2]);g.lineTo(l[1],l[2]+h);g.lineTo(l[1]+h,l[2]);g.lineTo(l[1],l[2]-h);g.closePath();this._fill(i);this._stroke(i);break;case"triangleup":case"a":case"^":g.beginPath();g.moveTo(l[1],l[2]-h);g.lineTo(l[1]-k,l[2]+d);g.lineTo(l[1]+k,l[2]+d);g.closePath();this._fill(i);this._stroke(i);break;case"triangledown":case"v":g.beginPath();g.moveTo(l[1],l[2]+h);g.lineTo(l[1]-k,l[2]-d);g.lineTo(l[1]+k,l[2]-d);g.closePath();this._fill(i);this._stroke(i);break;case"triangleleft":case"<":g.beginPath();g.moveTo(l[1]-h,l[2]);g.lineTo(l[1]+d,l[2]-k);g.lineTo(l[1]+d,l[2]+k);g.closePath();this.fill(i);this._stroke(i);break;case"triangleright":case">":g.beginPath();g.moveTo(l[1]+h,l[2]);g.lineTo(l[1]-d,l[2]-k);g.lineTo(l[1]-d,l[2]+k);g.closePath();this._fill(i);this._stroke(i);break}},updatePoint:function(d){this.drawPoint(d)},drawLine:function(d){var f=new JXG.Coords(JXG.COORDS_BY_USER,d.point1.coords.usrCoords,d.board),e=new JXG.Coords(JXG.COORDS_BY_USER,d.point2.coords.usrCoords,d.board);JXG.Math.Geometry.calcStraight(d,f,e);this.context.beginPath();this.context.moveTo(f.scrCoords[1],f.scrCoords[2]);this.context.lineTo(e.scrCoords[1],e.scrCoords[2]);this._stroke(d);this.makeArrows(d,f,e)},updateLine:function(d){this.drawLine(d)},drawTicks:function(){},updateTicks:function(g,h,e,j,f){var k,m,l=g.ticks.length,d=this.context;d.beginPath();for(k=0;k0&&s>0&&!isNaN(e+d)){g.beginPath();g.moveTo(i,j);g.bezierCurveTo(i,j-r,k-u,h,k,h);g.bezierCurveTo(k+u,h,p,j-r,p,j);g.bezierCurveTo(p,j+r,k+u,o,k,o);g.bezierCurveTo(k-u,o,i,j+r,i,j);g.closePath();this._fill(f);this._stroke(f)}},updateEllipse:function(d){return this.drawEllipse(d)},displayCopyright:function(f,e){var d=this.context;d.save();d.font=e+"px Arial";d.fillStyle="#aaa";d.lineWidth=0.5;d.fillText(f,10,2+e);d.restore()},drawInternalText:function(f){var d,e=this.context;e.save();if(this._setColor(f,"stroke","fill")&&!isNaN(f.coords.scrCoords[1]+f.coords.scrCoords[2])){if(f.visProp.fontsize){if(typeof f.visProp.fontsize==="function"){d=f.visProp.fontsize();e.font=(d>0?d:0)+"px Arial"}else{e.font=(f.visProp.fontsize)+"px Arial"}}this.transformImage(f,f.transformations);if(f.visProp.anchorx==="right"){e.textAlign="right"}else{if(f.visProp.anchorx==="middle"){e.textAlign="center"}}if(f.visProp.anchory==="top"){e.textBaseline="top"}else{if(f.visProp.anchory==="middle"){e.textBaseline="middle"}}e.fillText(f.plaintext,f.coords.scrCoords[1],f.coords.scrCoords[2])}e.restore();return null},updateInternalText:function(d){this.drawInternalText(d)},setObjectStrokeColor:function(e,h,i){var g=JXG.evaluate(h),k,l,d=JXG.evaluate(i),j,f;d=(d>0)?d:0;if(e.visPropOld.strokecolor===g&&e.visPropOld.strokeopacity===d){return}if(JXG.exists(g)&&g!==false){if(g.length!=9){k=g;j=d}else{l=JXG.rgba2rgbo(g);k=l[0];j=d*l[1]}f=e.rendNode;if(e.type===JXG.OBJECT_TYPE_TEXT&&e.visProp.display==="html"){f.style.color=k;f.style.opacity=j}}e.visPropOld.strokecolor=g;e.visPropOld.strokeopacity=d},drawImage:function(d){d.rendNode=new Image();d._src="";this.updateImage(d)},updateImage:function(e){var d=this.context,f=JXG.evaluate(e.visProp.fillopacity),g=JXG.bind(function(){e.imgIsLoaded=true;if(e.size[0]<=0||e.size[1]<=0){return}d.save();d.globalAlpha=f;this.transformImage(e,e.transformations);d.drawImage(e.rendNode,e.coords.scrCoords[1],e.coords.scrCoords[2]-e.size[1],e.size[0],e.size[1]);d.restore()},this);if(this.updateImageURL(e)){e.rendNode.onload=g}else{if(e.imgIsLoaded){g()}}},transformImage:function(h,g){var e,d=g.length,f=this.context;if(d>0){e=this.joinTransforms(h,g);if(Math.abs(JXG.Math.Numerics.det(e))>=JXG.Math.eps){f.transform(e[1][1],e[2][1],e[1][2],e[2][2],e[1][0],e[2][0])}}},updateImageURL:function(e){var d;d=JXG.evaluate(e.url);if(e._src!==d){e.imgIsLoaded=false;e.rendNode.src=d;e._src=d;return true}return false},remove:function(d){if(JXG.exists(d)&&JXG.exists(d.parentNode)){d.parentNode.removeChild(d)}},makeArrows:function(h,l,j){var n=Math.min(h.visProp.strokewidth/2,3),f=[[2,0],[-10,-4*n],[-10,4*n],[2,0]],o=[[-2,0],[10,-4*n],[10,4*n]],g,m,d,k,i,e=this.context;if(h.visProp.strokecolor!=="none"&&(h.visProp.lastarrow||h.visProp.firstarrow)){if(h.elementClass===JXG.OBJECT_CLASS_LINE){g=l.scrCoords[1];m=l.scrCoords[2];d=j.scrCoords[1];k=j.scrCoords[2]}else{return}e.save();if(this._setColor(h,"stroke","fill")){i=Math.atan2(k-m,d-g);if(h.visProp.lastarrow){this._drawFilledPolygon(this._translateShape(this._rotateShape(f,i),d,k))}if(h.visProp.firstarrow){this._drawFilledPolygon(this._translateShape(this._rotateShape(o,i),g,m))}}e.restore()}},updatePathStringPrim:function(e){var g="M",h="L",o="C",f=g,p=5000,j,l,n,m,q=(e.visProp.curvetype!=="plot"),k,d=this.context;if(e.numberPoints<=0){return}k=Math.min(e.points.length,e.numberPoints);d.beginPath();if(e.bezierDegree==1){if(q&&e.board.options.curve.RDPsmoothing){e.points=JXG.Math.Numerics.RamerDouglasPeuker(e.points,0.5)}for(j=0;jp){l[1]=p}else{if(l[1]<-p){l[1]=-p}}if(l[2]>p){l[2]=p}else{if(l[2]<-p){l[2]=-p}}if(f===g){d.moveTo(l[1],l[2])}else{d.lineTo(l[1],l[2])}f=h}}}else{if(e.bezierDegree==3){j=0;while(jt){r[1]=t}else{if(r[1]<-t){r[1]=-t}}if(r[2]>t){r[2]=t}else{if(r[2]<-t){r[2]=-t}}if(k==l){d.moveTo(r[1]+0*q*(2*n*Math.random()-n),r[2]+0*q*(2*n*Math.random()-n))}else{d.bezierCurveTo((h+(r[1]-h)*0.333+q*(2*n*Math.random()-n)),(e+(r[2]-e)*0.333+q*(2*n*Math.random()-n)),(h+2*(r[1]-h)*0.333+q*(2*n*Math.random()-n)),(e+2*(r[2]-e)*0.333+q*(2*n*Math.random()-n)),r[1],r[2])}k=m;h=r[1];e=r[2]}}}this._fill(g);this._stroke(g)},updatePolygonPrim:function(k,j){var f,h,e=j.vertices.length,g=this.context,d=true;if(e<=0){return}g.beginPath();h=0;while(!j.vertices[h].isReal&&h0)?f:0;d=JXG.evaluate(e.visProp.fillcolor)},setShadow:function(d){if(d.visPropOld.shadow===d.visProp.shadow){return}d.visPropOld.shadow=d.visProp.shadow},highlight:function(d){if(d.type===JXG.OBJECT_TYPE_TEXT&&d.visProp.display==="html"){this.updateTextStyle(d,true)}else{d.board.prepareUpdate();d.board.renderer.suspendRedraw(d.board);d.board.updateRenderer();d.board.renderer.unsuspendRedraw()}return this},noHighlight:function(d){if(d.type===JXG.OBJECT_TYPE_TEXT&&d.visProp.display==="html"){this.updateTextStyle(d,false)}else{d.board.prepareUpdate();d.board.renderer.suspendRedraw(d.board);d.board.updateRenderer();d.board.renderer.unsuspendRedraw()}return this},suspendRedraw:function(d){this.context.save();this.context.clearRect(0,0,this.canvasRoot.width,this.canvasRoot.height);if(d&&d.showCopyright){this.displayCopyright(JXG.JSXGraph.licenseText,12)}},unsuspendRedraw:function(){this.context.restore()},resize:function(d,e){this.canvasRoot.style.width=parseFloat(d)+"px";this.canvasRoot.style.height=parseFloat(e)+"px";this.canvasRoot.setAttribute("width",parseFloat(d)+"px");this.canvasRoot.setAttribute("height",parseFloat(e)+"px")}}); \ No newline at end of file From 4f7468859b73d3b510637c86e36982dc59130657 Mon Sep 17 00:00:00 2001 From: alfred Date: Tue, 24 Jul 2012 16:29:51 +0200 Subject: [PATCH 3/5] 0.95: package.json --- ajax/libs/jsxgraph/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ajax/libs/jsxgraph/package.json b/ajax/libs/jsxgraph/package.json index 99dff9cde..4745c04a7 100644 --- a/ajax/libs/jsxgraph/package.json +++ b/ajax/libs/jsxgraph/package.json @@ -16,8 +16,8 @@ ], "repositories": [ { - "type": "svn", - "url": "https://jsxgraph.svn.sourceforge.net/svnroot/jsxgraph" + "type": "git", + "url": "https://github.com/jsxgraph/jsxgraph" } ] } From 2c31f4756bf3ab8d5d7bf8c5edfc8529f0ef8302 Mon Sep 17 00:00:00 2001 From: Michael Gerhaeuser Date: Thu, 6 Dec 2012 09:19:33 +0100 Subject: [PATCH 4/5] JSXGraph release 0.96 --- .../jsxgraph/0.96/CinderellaReader.min.js | 33 +++++++++++++++++++ ajax/libs/jsxgraph/0.96/GeogebraReader.min.js | 33 +++++++++++++++++++ ajax/libs/jsxgraph/0.96/GeonextReader.min.js | 33 +++++++++++++++++++ ajax/libs/jsxgraph/0.96/IntergeoReader.min.js | 33 +++++++++++++++++++ ajax/libs/jsxgraph/0.96/SketchReader.min.js | 33 +++++++++++++++++++ ajax/libs/jsxgraph/0.96/jsxgraphcore.js | 32 ++++++++++++++++++ ajax/libs/jsxgraph/package.json | 10 ++++-- 7 files changed, 204 insertions(+), 3 deletions(-) create mode 100644 ajax/libs/jsxgraph/0.96/CinderellaReader.min.js create mode 100644 ajax/libs/jsxgraph/0.96/GeogebraReader.min.js create mode 100644 ajax/libs/jsxgraph/0.96/GeonextReader.min.js create mode 100644 ajax/libs/jsxgraph/0.96/IntergeoReader.min.js create mode 100644 ajax/libs/jsxgraph/0.96/SketchReader.min.js create mode 100644 ajax/libs/jsxgraph/0.96/jsxgraphcore.js diff --git a/ajax/libs/jsxgraph/0.96/CinderellaReader.min.js b/ajax/libs/jsxgraph/0.96/CinderellaReader.min.js new file mode 100644 index 000000000..2c976ea74 --- /dev/null +++ b/ajax/libs/jsxgraph/0.96/CinderellaReader.min.js @@ -0,0 +1,33 @@ +/* Version 0.96 */ +/* Version 0.96 */ +/* + Copyright 2008-2012 + 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 . +*/ + JXG.CinderellaReader=new function(){this.parseData=function(e){var t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E;t=this.data.split("\n");for(n=0;n + and . +*/ + JXG.GeogebraReader=new function(){this.ggbAct=function(e,t,n){var r=t,i=n,s,o,u;switch(e.toLowerCase()){case"end":return r;case"coord":return s=JXG.GeogebraReader.board.ggbElements[r]?'JXG.getRef(JXG.GeogebraReader.board, "'+r+'")':r,o=JXG.GeogebraReader.board.ggbElements[i]?'JXG.getRef(JXG.GeogebraReader.board, "'+i+'")':i,[s,o];case"le":return"( ("+r+") <= ("+i+") )";case"ge":return"( ("+r+") >= ("+i+") )";case"eq":return"( ("+r+") == ("+i+") )";case"neq":return"( ("+r+") != ("+i+") )";case"lt":return"( ("+r+") < ("+i+") )";case"gt":return"( ("+r+") > ("+i+") )";case"add":if(JXG.GeogebraReader.isGGBVector(r)&&JXG.GeogebraReader.isGGBVector(i))return[1,r[1]+"+"+i[1],r[2]+"+"+i[2]];JXG.isString(r)&&!r.match(/JXG\.getRef\(JXG\.GeogebraReader\.board, "(.+?)"\)\./)&&r.match(/JXG\.getRef/)?s=[r+".X()",r+".Y()"]:s=r,JXG.isString(i)&&!i.match(/JXG\.getRef\(JXG\.GeogebraReader\.board, "(.+?)"\)\./)&&i.match(/JXG\.getRef/)?o=[i+".X()",i+".Y()"]:o=i;if(JXG.GeogebraReader.isGGBVector(s)&&JXG.isArray(o))return[s[1]+"+"+o[0],s[2]+"+"+o[1]];if(JXG.GeogebraReader.isGGBVector(o)&&JXG.isArray(s))return[o[1]+"+"+s[0],o[2]+"+"+s[1]];return JXG.isArray(s)&&JXG.isArray(o)?[s[0]+" + "+o[0],s[1]+" + "+o[1]]:(JXG.isNumber(s)||JXG.isString(s))&&(JXG.isNumber(o)||JXG.isString(o))?s+" + "+o:(JXG.isNumber(s)||JXG.isString(s))&&JXG.isArray(o)?[s+" + "+o[0],s+" + "+o[1]]:JXG.isArray(s)&&(JXG.isNumber(o)||JXG.isString(o))?[s[0]+" + "+o,s[1]+" + "+o]:s+" + "+o;case"sub":if(JXG.GeogebraReader.isGGBVector(r)&&JXG.GeogebraReader.isGGBVector(i))return[1,r[1]+"-"+i[1],r[2]+"-"+i[2]];JXG.isString(r)&&!r.match(/JXG\.getRef\(JXG\.GeogebraReader\.board, "(.+?)"\)\./)&&r.match(/JXG\.getRef/)?s=[r+".X()",r+".Y()"]:s=r,JXG.isString(i)&&!i.match(/JXG\.getRef\(JXG\.GeogebraReader\.board, "(.+?)"\)\./)&&i.match(/JXG\.getRef/)?o=[i+".X()",i+".Y()"]:o=i;if(JXG.GeogebraReader.isGGBVector(s)&&JXG.isArray(o))return[s[1]+"-"+o[0],s[2]+"-"+o[1]];if(JXG.isArray(s)&&JXG.GeogebraReader.isGGBVector(o))return[s[0]+"-("+o[1]+")",s[1]+"-("+o[2]+")"];return JXG.isArray(s)&&JXG.isArray(o)?[s[0]+" - "+o[0],s[1]+" - "+o[1]]:(JXG.isNumber(s)||JXG.isString(s))&&(JXG.isNumber(o)||JXG.isString(o))?s+" - "+o:(JXG.isNumber(s)||JXG.isString(s))&&JXG.isArray(o)?[s+" - "+o[0],s+" - "+o[1]]:JXG.isArray(s)&&(JXG.isNumber(o)||JXG.isString(o))?[s[0]+" - "+o,s[1]+" - "+o]:s+" - "+o;case"neg":return"!("+r+")";case"pow":return"Math.pow("+r+", "+i+")";case"or":return"("+r+"||"+i+")";case"and":return"("+r+"&&"+i+")";case"mul":return JXG.GeogebraReader.isGGBVector(r)&&!JXG.isArray(i)?[1,"("+r[1]+")*"+i,"("+r[2]+")*"+i]:!JXG.isArray(r)&&JXG.GeogebraReader.isGGBVector(i)?new Array(1,"("+i[1]+")*"+r,"("+i[2]+")*"+r):JXG.GeogebraReader.isGGBVector(r)&&JXG.GeogebraReader.isGGBVector(i)?"(("+r[1]+")*("+i[1]+")+("+r[2]+")*("+i[2]+"))":(JXG.isString(r)&&!r.match(/JXG\.getRef\(JXG\.GeogebraReader\.board, "(.+?)"\)\./)&&r.match(/JXG\.getRef/)?s=[r+".X()",r+".Y()"]:s=r,JXG.isString(i)&&!i.match(/JXG\.getRef\(JXG\.GeogebraReader\.board, "(.+?)"\)\./)&&i.match(/JXG\.getRef/)?o=[i+".X()",i+".Y()"]:o=i,JXG.isArray(s)&&JXG.isArray(o)?[s[0]+" * "+o[0],s[1]+" * "+o[1]]:(JXG.isNumber(s)||JXG.isString(s))&&(JXG.isNumber(o)||JXG.isString(o))?s+" * "+o:(JXG.isNumber(s)||JXG.isString(s))&&JXG.isArray(o)?[s+" * "+o[0],s+" * "+o[1]]:JXG.isArray(s)&&(JXG.isNumber(o)||JXG.isString(o))?[s[0]+" * "+o,s[1]+" * "+o]:s+" * "+o);case"div":return JXG.isString(r)&&!r.match(/JXG\.getRef\(JXG\.GeogebraReader\.board, "(.+?)"\)\./)&&r.match(/JXG\.getRef/)?s=[r+".X()",r+".Y()"]:s=r,JXG.isString(i)&&!i.match(/JXG\.getRef\(JXG\.GeogebraReader\.board, "(.+?)"\)\./)&&i.match(/JXG\.getRef/)?o=[i+".X()",i+".Y()"]:o=i,JXG.isArray(s)&&JXG.isArray(o)?[s[0]+" / "+o[0],s[1]+" / "+o[1]]:(JXG.isNumber(s)||JXG.isString(s))&&(JXG.isNumber(o)||JXG.isString(o))?s+" / "+o:(JXG.isNumber(s)||JXG.isString(s))&&JXG.isArray(o)?[s+" / "+o[0],s+" / "+o[1]]:JXG.isArray(s)&&(JXG.isNumber(o)||JXG.isString(o))?[s[0]+" / "+o,s[1]+" / "+o]:s+" / "+o;case"negmult":if(JXG.GeogebraReader.isGGBVector(r))return new Array(1,"-1*"+r[1],"-1*"+r[2]);return"-1*"+r;case"bra":if(JXG.GeogebraReader.isGGBVector(r))return new Array(1,"("+r[1]+")","("+r[2]+")");return"("+r+")";case"int":return parseInt(r);case"float":return parseFloat(r);case"param":return r;case"html":return r;case"string":return i?[r,i]:r;case"command":i=r.split("["),s=i[0],o=i[1].split("]")[0];switch(s.toLowerCase()){case"name":return'JXG.getRef(JXG.GeogebraReader.board, "'+o+'").getName()'}break;case"var":if(!i)return r=="PI"?"Math.PI":(u=JXG.GeogebraReader.checkElement(r),typeof JXG.GeogebraReader.board.ggb[r]!="undefined"?'JXG.GeogebraReader.board.ggb["'+r+'"]()':typeof u.Value!="undefined"?'JXG.getRef(JXG.GeogebraReader.board, "'+r+'").Value()':typeof u.Area!="undefined"?'JXG.getRef(JXG.GeogebraReader.board, "'+r+'").Area()':typeof u.plaintextStr!="undefined"?'1.0*JXG.getRef(JXG.GeogebraReader.board, "'+r+'").plaintextStr':u.type==JXG.OBJECT_TYPE_VECTOR?new Array(1,'JXG.getRef(JXG.GeogebraReader.board, "'+r+'").point2.X()-JXG.getRef(JXG.GeogebraReader.board, "'+r+'").point1.X()','JXG.getRef(JXG.GeogebraReader.board, "'+r+'").point2.Y()-JXG.getRef(JXG.GeogebraReader.board, "'+r+'").point1.Y()'):u.elementClass==JXG.OBJECT_CLASS_LINE?'JXG.getRef(JXG.GeogebraReader.board, "'+r+'").point1.Dist(JXG.getRef(JXG.GeogebraReader.board, "'+r+'").point2)':'JXG.getRef(JXG.GeogebraReader.board, "'+r+'")');switch(r.toLowerCase()){case"x":return i+".X()";case"y":return i+".Y()";case"abs":case"acos":case"asin":case"atan":case"ceil":case"cos":case"exp":case"floor":case"log":case"max":case"min":case"pow":case"random":case"round":case"sin":case"sqrt":case"tan":return"Math."+r.toLowerCase()+"("+i+")";default:return r.toLowerCase()+"*("+i+")"}}},this.ggbParse=function(e,t){function i(e){r+=e+"\n"}function s(e){var t=0,n=-1,r=0,i=0,s=e.offset+1;do{s--,t=0,n=-2,i=s;if(e.src.length<=i)return 28;do{switch(t){case 0:e.src.charCodeAt(s)==9||e.src.charCodeAt(s)==32?t=1:e.src.charCodeAt(s)==33?t=2:e.src.charCodeAt(s)==40?t=3:e.src.charCodeAt(s)==41?t=4:e.src.charCodeAt(s)==42?t=5:e.src.charCodeAt(s)==43?t=6:e.src.charCodeAt(s)==44?t=7:e.src.charCodeAt(s)==45?t=8:e.src.charCodeAt(s)==47?t=9:e.src.charCodeAt(s)>=48&&e.src.charCodeAt(s)<=57?t=10:e.src.charCodeAt(s)==60?t=11:e.src.charCodeAt(s)==62?t=12:e.src.charCodeAt(s)>=65&&e.src.charCodeAt(s)<=90||e.src.charCodeAt(s)>=97&&e.src.charCodeAt(s)<=122?t=13:e.src.charCodeAt(s)==94?t=14:e.src.charCodeAt(s)==34?t=26:e.src.charCodeAt(s)==38?t=28:e.src.charCodeAt(s)==46?t=29:e.src.charCodeAt(s)==61?t=30:e.src.charCodeAt(s)==95?t=31:e.src.charCodeAt(s)==124?t=32:t=-1;break;case 1:t=-1,n=1,r=s;break;case 2:e.src.charCodeAt(s)==61?t=15:t=-1,n=23,r=s;break;case 3:t=-1,n=2,r=s;break;case 4:t=-1,n=3,r=s;break;case 5:t=-1,n=13,r=s;break;case 6:t=-1,n=11,r=s;break;case 7:t=-1,n=16,r=s;break;case 8:t=-1,n=12,r=s;break;case 9:t=-1,n=14,r=s;break;case 10:e.src.charCodeAt(s)>=48&&e.src.charCodeAt(s)<=57?t=10:e.src.charCodeAt(s)==46?t=18:t=-1,n=4,r=s;break;case 11:e.src.charCodeAt(s)==61?t=19:t=-1,n=21,r=s;break;case 12:e.src.charCodeAt(s)==61?t=21:t=-1,n=22,r=s;break;case 13:e.src.charCodeAt(s)>=65&&e.src.charCodeAt(s)<=90||e.src.charCodeAt(s)>=97&&e.src.charCodeAt(s)<=122?t=13:e.src.charCodeAt(s)>=48&&e.src.charCodeAt(s)<=57?t=27:e.src.charCodeAt(s)==91?t=34:e.src.charCodeAt(s)==95?t=35:t=-1,n=7,r=s;break;case 14:t=-1,n=15,r=s;break;case 15:t=-1,n=20,r=s;break;case 16:t=-1,n=9,r=s;break;case 17:t=-1,n=25,r=s;break;case 18:e.src.charCodeAt(s)>=48&&e.src.charCodeAt(s)<=57?t=18:t=-1,n=5,r=s;break;case 19:t=-1,n=17,r=s;break;case 20:t=-1,n=19,r=s;break;case 21:t=-1,n=18,r=s;break;case 22:t=-1,n=24,r=s;break;case 23:t=-1,n=8,r=s;break;case 24:e.src.charCodeAt(s)>=48&&e.src.charCodeAt(s)<=57||e.src.charCodeAt(s)>=65&&e.src.charCodeAt(s)<=90||e.src.charCodeAt(s)>=97&&e.src.charCodeAt(s)<=122?t=24:t=-1,n=6,r=s;break;case 25:t=-1,n=10,r=s;break;case 26:e.src.charCodeAt(s)==34?t=16:e.src.charCodeAt(s)==32||e.src.charCodeAt(s)==46||e.src.charCodeAt(s)>=48&&e.src.charCodeAt(s)<=57||e.src.charCodeAt(s)==61||e.src.charCodeAt(s)>=65&&e.src.charCodeAt(s)<=90||e.src.charCodeAt(s)>=97&&e.src.charCodeAt(s)<=122||e.src.charCodeAt(s)==223||e.src.charCodeAt(s)==228||e.src.charCodeAt(s)==246||e.src.charCodeAt(s)==252?t=26:t=-1;break;case 27:e.src.charCodeAt(s)>=48&&e.src.charCodeAt(s)<=57||e.src.charCodeAt(s)>=65&&e.src.charCodeAt(s)<=90||e.src.charCodeAt(s)>=97&&e.src.charCodeAt(s)<=122?t=27:e.src.charCodeAt(s)==95?t=35:t=-1,n=7,r=s;break;case 28:e.src.charCodeAt(s)==38?t=17:e.src.charCodeAt(s)>=65&&e.src.charCodeAt(s)<=90||e.src.charCodeAt(s)>=97&&e.src.charCodeAt(s)<=122?t=33:t=-1;break;case 29:e.src.charCodeAt(s)>=48&&e.src.charCodeAt(s)<=57?t=18:t=-1;break;case 30:e.src.charCodeAt(s)==61?t=20:t=-1;break;case 31:e.src.charCodeAt(s)==95?t=36:t=-1;break;case 32:e.src.charCodeAt(s)==124?t=22:t=-1;break;case 33:e.src.charCodeAt(s)==59?t=23:e.src.charCodeAt(s)>=65&&e.src.charCodeAt(s)<=90||e.src.charCodeAt(s)>=97&&e.src.charCodeAt(s)<=122?t=33:t=-1;break;case 34:e.src.charCodeAt(s)>=65&&e.src.charCodeAt(s)<=90||e.src.charCodeAt(s)>=97&&e.src.charCodeAt(s)<=122?t=37:t=-1;break;case 35:e.src.charCodeAt(s)>=48&&e.src.charCodeAt(s)<=57||e.src.charCodeAt(s)>=65&&e.src.charCodeAt(s)<=90||e.src.charCodeAt(s)>=97&&e.src.charCodeAt(s)<=122?t=27:e.src.charCodeAt(s)==95?t=35:t=-1;break;case 36:e.src.charCodeAt(s)>=48&&e.src.charCodeAt(s)<=57||e.src.charCodeAt(s)>=65&&e.src.charCodeAt(s)<=90||e.src.charCodeAt(s)>=97&&e.src.charCodeAt(s)<=122?t=24:t=-1;break;case 37:e.src.charCodeAt(s)==93?t=25:e.src.charCodeAt(s)>=65&&e.src.charCodeAt(s)<=90||e.src.charCodeAt(s)>=97&&e.src.charCodeAt(s)<=122?t=37:t=-1}s++}while(t>-1)}while(n==1);return n>-1?(e.att=e.src.substr(i,r-i),e.offset=r):(e.att=new String,n=-1),n}function o(e,o,u){var a=new Array,f=new Array,c=0,h,p,d,v,m=new Function("","var offset; var src; var att;"),g=new m,y=new Array(new Array(0,1),new Array(27,1),new Array(26,5),new Array(26,3),new Array(26,3),new Array(26,3),new Array(26,3),new Array(26,3),new Array(26,3),new Array(26,3),new Array(26,3),new Array(26,2),new Array(26,3),new Array(26,3),new Array(26,3),new Array(26,3),new Array(26,3),new Array(26,2),new Array(26,3),new Array(26,3),new Array(26,1),new Array(26,1),new Array(26,1),new Array(26,1),new Array(26,1),new Array(26,1),new Array(26,4),new Array(26,1)),b=new Array(new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(28,0),new Array(14,13,13,14,25,15,24,16,15,17,12,18,11,19,22,20,21,21,20,22,19,23,18,24,17,25,28,-1),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(11,29,28,-24,17,-24,18,-24,19,-24,20,-24,21,-24,22,-24,12,-24,15,-24,24,-24,25,-24,13,-24,14,-24,16,-24,3,-24),new Array(28,-20,17,-20,18,-20,19,-20,20,-20,21,-20,22,-20,11,-20,12,-20,15,-20,24,-20,25,-20,13,-20,14,-20,16,-20,3,-20),new Array(28,-21,17,-21,18,-21,19,-21,20,-21,21,-21,22,-21,11,-21,12,-21,15,-21,24,-21,25,-21,13,-21,14,-21,16,-21,3,-21),new Array(28,-22,17,-22,18,-22,19,-22,20,-22,21,-22,22,-22,11,-22,12,-22,15,-22,24,-22,25,-22,13,-22,14,-22,16,-22,3,-22),new Array(28,-23,17,-23,18,-23,19,-23,20,-23,21,-23,22,-23,11,-23,12,-23,15,-23,24,-23,25,-23,13,-23,14,-23,16,-23,3,-23),new Array(28,-25,17,-25,18,-25,19,-25,20,-25,21,-25,22,-25,11,-25,12,-25,15,-25,24,-25,25,-25,13,-25,14,-25,16,-25,3,-25),new Array(2,30,28,-27,17,-27,18,-27,19,-27,20,-27,21,-27,22,-27,11,-27,12,-27,15,-27,24,-27,25,-27,13,-27,14,-27,16,-27,3,-27),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(14,13,13,14,25,15,24,16,15,17,12,18,11,19,22,20,21,21,20,22,19,23,18,24,17,25,16,44,3,45),new Array(14,-11,13,-11,25,15,24,16,15,-11,12,-11,11,-11,22,-11,21,-11,20,-11,19,-11,18,-11,17,-11,28,-11,16,-11,3,-11),new Array(14,-17,13,-17,25,15,24,16,15,17,12,-17,11,-17,22,20,21,21,20,22,19,23,18,24,17,25,28,-17,16,-17,3,-17),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(14,-16,13,-16,25,15,24,16,15,17,12,-16,11,-16,22,20,21,21,20,22,19,23,18,24,17,25,28,-16,16,-16,3,-16),new Array(14,-15,13,-15,25,15,24,16,15,17,12,-15,11,-15,22,20,21,21,20,22,19,23,18,24,17,25,28,-15,16,-15,3,-15),new Array(14,-14,13,-14,25,-14,24,-14,15,-14,12,-14,11,-14,22,-14,21,-14,20,-14,19,-14,18,-14,17,-14,28,-14,16,-14,3,-14),new Array(14,-13,13,-13,25,-13,24,-13,15,-13,12,-13,11,-13,22,-13,21,-13,20,-13,19,-13,18,-13,17,-13,28,-13,16,-13,3,-13),new Array(14,-12,13,-12,25,15,24,16,15,-12,12,-12,11,-12,22,20,21,21,20,22,19,23,18,24,17,25,28,-12,16,-12,3,-12),new Array(14,13,13,14,25,15,24,16,15,17,12,-10,11,-10,22,20,21,21,20,22,19,23,18,24,17,25,28,-10,16,-10,3,-10),new Array(14,13,13,14,25,15,24,16,15,17,12,-9,11,-9,22,20,21,21,20,22,19,23,18,24,17,25,28,-9,16,-9,3,-9),new Array(14,-8,13,-8,25,15,24,16,15,-8,12,-8,11,-8,22,-8,21,-8,20,-8,19,-8,18,-8,17,-8,28,-8,16,-8,3,-8),new Array(14,-7,13,-7,25,15,24,16,15,-7,12,-7,11,-7,22,-7,21,-7,20,-7,19,-7,18,-7,17,-7,28,-7,16,-7,3,-7),new Array(14,-6,13,-6,25,15,24,16,15,-6,12,-6,11,-6,22,-6,21,-6,20,-6,19,-6,18,-6,17,-6,28,-6,16,-6,3,-6),new Array(14,-5,13,-5,25,15,24,16,15,-5,12,-5,11,-5,22,-5,21,-5,20,-5,19,-5,18,-5,17,-5,28,-5,16,-5,3,-5),new Array(14,-4,13,-4,25,15,24,16,15,-4,12,-4,11,-4,22,-4,21,-4,20,-4,19,-4,18,-4,17,-4,28,-4,16,-4,3,-4),new Array(14,-3,13,-3,25,15,24,16,15,-3,12,-3,11,-3,22,-3,21,-3,20,-3,19,-3,18,-3,17,-3,28,-3,16,-3,3,-3),new Array(2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12),new Array(28,-18,17,-18,18,-18,19,-18,20,-18,21,-18,22,-18,11,-18,12,-18,15,-18,24,-18,25,-18,13,-18,14,-18,16,-18,3,-18),new Array(14,13,13,14,25,15,24,16,15,17,12,-19,11,-19,22,20,21,21,20,22,19,23,18,24,17,25,28,-19,16,-19,3,-19),new Array(14,13,13,14,25,15,24,16,15,17,12,18,11,19,22,20,21,21,20,22,19,23,18,24,17,25,3,49),new Array(14,13,13,14,25,15,24,16,15,17,12,18,11,19,22,20,21,21,20,22,19,23,18,24,17,25,3,50),new Array(28,-26,17,-26,18,-26,19,-26,20,-26,21,-26,22,-26,11,-26,12,-26,15,-26,24,-26,25,-26,13,-26,14,-26,16,-26,3,-26),new Array(28,-2,17,-2,18,-2,19,-2,20,-2,21,-2,22,-2,11,-2,12,-2,15,-2,24,-2,25,-2,13,-2,14,-2,16,-2,3,-2)),w=new Array(new Array(27,1,26,2),new Array,new Array,new Array(26,26),new Array(26,27),new Array(26,28),new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array(26,31),new Array(26,32),new Array(26,33),new Array(26,34),new Array(26,35),new Array(26,36),new Array(26,37),new Array(26,38),new Array(26,39),new Array(26,40),new Array(26,41),new Array(26,42),new Array(26,43),new Array,new Array,new Array,new Array(26,46),new Array(26,47),new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array(26,48),new Array,new Array,new Array,new Array,new Array,new Array),E=new Array("p'","WHITESPACE","(",")","INT","FLOAT","PARAM","VAR","HTML","STRING","COMMAND","+","-","*","/","^",",","<=",">=","==","!=","<",">","!","||","&&","e","p","$");g.offset=0,g.src=e,g.att=new String,o||(o=new Array),u||(u=new Array),a.push(0),f.push(0),d=s(g);for(;;){h=52;for(var S=0;S0&&i("\nState "+a[a.length-1]+"\n"+" Lookahead: "+E[d]+' ("'+g.att+'")\n'+" Action: "+h+"\n"+' Source: "'+g.src.substr(g.offset,30)+(g.offset+300){a.pop(),f.pop();if(a.length==0)break;h=52;for(var S=0;S0)n&&i("Shifting symbol: "+E[d]+" ("+g.att+")"),a.push(h),f.push(g.att),d=s(g),n&&i(" New lookahead symbol: "+E[d]+" ("+g.att+")");else{h*=-1,n&&i("Reducing by producution: "+h),v=void 0,n&&i(" Performing semantic action...");switch(h){case 0:v=f[f.length-1];break;case 1:v=JXG.GeogebraReader.ggbAct("end",f[f.length-1]);break;case 2:v=JXG.GeogebraReader.ggbAct("coord",f[f.length-4],f[f.length-2],t);break;case 3:v=JXG.GeogebraReader.ggbAct("le",f[f.length-3],f[f.length-1]);break;case 4:v=JXG.GeogebraReader.ggbAct("ge",f[f.length-3],f[f.length-1]);break;case 5:v=JXG.GeogebraReader.ggbAct("eq",f[f.length-3],f[f.length-1]);break;case 6:v=JXG.GeogebraReader.ggbAct("neq",f[f.length-3],f[f.length-1]);break;case 7:v=JXG.GeogebraReader.ggbAct("lt",f[f.length-3],f[f.length-1]);break;case 8:v=JXG.GeogebraReader.ggbAct("gt",f[f.length-3],f[f.length-1]);break;case 9:v=JXG.GeogebraReader.ggbAct("add",f[f.length-3],f[f.length-1]);break;case 10:v=JXG.GeogebraReader.ggbAct("sub",f[f.length-3],f[f.length-1]);break;case 11:v=JXG.GeogebraReader.ggbAct("neg",f[f.length-1]);break;case 12:v=JXG.GeogebraReader.ggbAct("pow",f[f.length-3],f[f.length-1]);break;case 13:v=JXG.GeogebraReader.ggbAct("or",f[f.length-3],f[f.length-1]);break;case 14:v=JXG.GeogebraReader.ggbAct("and",f[f.length-3],f[f.length-1]);break;case 15:v=JXG.GeogebraReader.ggbAct("mul",f[f.length-3],f[f.length-1]);break;case 16:v=JXG.GeogebraReader.ggbAct("div",f[f.length-3],f[f.length-1]);break;case 17:v=JXG.GeogebraReader.ggbAct("negmult",f[f.length-1]);break;case 18:v=JXG.GeogebraReader.ggbAct("bra",f[f.length-2]);break;case 19:v=JXG.GeogebraReader.ggbAct("string",f[f.length-3],f[f.length-1]);break;case 20:v=JXG.GeogebraReader.ggbAct("int",f[f.length-1]);break;case 21:v=JXG.GeogebraReader.ggbAct("float",f[f.length-1]);break;case 22:v=JXG.GeogebraReader.ggbAct("param",f[f.length-1]);break;case 23:v=JXG.GeogebraReader.ggbAct("html",f[f.length-1]);break;case 24:v=JXG.GeogebraReader.ggbAct("string",f[f.length-1]);break;case 25:v=JXG.GeogebraReader.ggbAct("command",f[f.length-1]);break;case 26:v=JXG.GeogebraReader.ggbAct("var",f[f.length-4],f[f.length-2]);break;case 27:v=JXG.GeogebraReader.ggbAct("var",f[f.length-1])}n&&i(" Popping "+y[h][1]+" off the stack...");for(var S=0;S0){var c=new String;for(var h=0;h0&&e.getElementsByTagName("objColor")[0].getAttribute("alpha")?parseFloat(e.getElementsByTagName("objColor")[0].getAttribute("alpha")):0,r=e.getElementsByTagName("objColor").length>0&&e.getElementsByTagName("objColor")[0].getAttribute("r")?parseInt(e.getElementsByTagName("objColor")[0].getAttribute("r")).toString(16):0,i=e.getElementsByTagName("objColor").length>0&&e.getElementsByTagName("objColor")[0].getAttribute("g")?parseInt(e.getElementsByTagName("objColor")[0].getAttribute("g")).toString(16):0,s=e.getElementsByTagName("objColor").length>0&&e.getElementsByTagName("objColor")[0].getAttribute("b")?parseInt(e.getElementsByTagName("objColor")[0].getAttribute("b")).toString(16):0,r.length==1&&(r="0"+r),i.length==1&&(i="0"+i),s.length==1&&(s="0"+s),t.fillColor="#"+r+i+s,t.strokeColor=t.fillColor,t.highlightFillColor=t.fillColor,t.highlightStrokeColor=t.strokeColor,t.fillOpacity=n,t.highlightFillOpacity=n,t.labelColor=t.fillColor,t},this.boardProperties=function(e,t,n){return n},this.coordinates=function(e,t){var n={},r;n.x=0,n.y=0,n.z=0,t.getElementsByTagName("labelOffset")[0]&&(n.x=parseFloat(t.getElementsByTagName("labelOffset")[0].getAttribute("x"))/JXG.GeogebraReader.board.unitX,n.y=parseFloat(t.getElementsByTagName("labelOffset")[0].getAttribute("y"))/JXG.GeogebraReader.board.unitY);if(t.getElementsByTagName("coords")[0])e.x=parseFloat(t.getElementsByTagName("coords")[0].getAttribute("x")),e.y=parseFloat(t.getElementsByTagName("coords")[0].getAttribute("y")),e.z=parseFloat(t.getElementsByTagName("coords")[0].getAttribute("z"));else if(t.getElementsByTagName("startPoint")[0])if(t.getElementsByTagName("startPoint")[0].getAttribute("exp")){var i=JXG.getRef(JXG.GeogebraReader.board,t.getElementsByTagName("startPoint")[0].getAttribute("exp"));e.x=function(){return i.X()+n.x},e.y=function(){return i.Y()-n.y},e.z=!1}else e.x=parseFloat(t.getElementsByTagName("startPoint")[0].getAttribute("x")),e.y=parseFloat(t.getElementsByTagName("startPoint")[0].getAttribute("y")),e.z=parseFloat(t.getElementsByTagName("startPoint")[0].getAttribute("z"));else{if(!t.getElementsByTagName("absoluteScreenLocation")[0])return!1;var r=new JXG.Coords(JXG.COORDS_BY_SCREEN,[parseFloat(t.getElementsByTagName("absoluteScreenLocation")[0].getAttribute("x")),parseFloat(t.getElementsByTagName("absoluteScreenLocation")[0].getAttribute("y"))],JXG.GeogebraReader.board);e.x=r.usrCoords[1]+n.x,e.y=r.usrCoords[2]+n.y,e.z=!1}return e},this.visualProperties=function(e,t){return e.getElementsByTagName("show").length!=0&&e.getElementsByTagName("show")[0].getAttribute("object")?t.visible=e.getElementsByTagName("show")[0].getAttribute("object"):!1,e.getElementsByTagName("show").length!=0&&e.getElementsByTagName("show")[0].getAttribute("label")?t.withLabel=e.getElementsByTagName("show")[0].getAttribute("label"):!0,t.withLabel=="true"?t.withLabel=!0:t.withLabel=="false"&&(t.withLabel=!1),e.getElementsByTagName("pointSize")[0]?t.size=e.getElementsByTagName("pointSize")[0].getAttribute("val"):!1,e.getElementsByTagName("pointStyle")[0]?t.styleGGB=e.getElementsByTagName("pointStyle")[0].getAttribute("val"):!1,t.styleGGB==0||t.styleGGB==2?(t.face="circle",t.styleGGB==0?(t.fillColor=t.strokeColor,t.fillOpacity=1,t.highlightFillColor=t.strokeColor,t.highlightFillOpacity=1,t.strokeColor="black",t.strokeWidth="1px"):t.styleGGB==2&&(t.fillColor="none")):t.styleGGB==1?t.face="x":t.styleGGB==3?(t.face="+",t.strokeOpacity=1):t.styleGGB==4||t.styleGGB==5?(t.face="diamond",t.styleGGB==4?(t.fillColor=t.strokeColor,t.fillOpacity=1):t.styleGGB==5&&(t.fillColor="none")):t.styleGGB==6?(t.face="triangleUp",t.fillColor=t.strokeColor,t.fillOpacity=1):t.styleGGB==7?(t.face="triangleDown",t.fillColor=t.strokeColor,t.fillOpacity=1):t.styleGGB==8?(t.face="triangleRight",t.fillColor=t.strokeColor,t.fillOpacity=1):t.styleGGB==9&&(t.face="triangleLeft",t.fillColor=t.strokeColor,t.fillOpacity=1),e.getElementsByTagName("slopeTriangleSize")[0]?t.slopeWidth=e.getElementsByTagName("slopeTriangleSize")[0].getAttribute("val"):!1,e.getElementsByTagName("lineStyle")[0]?t.strokeWidth=e.getElementsByTagName("lineStyle")[0].getAttribute("thickness")/2+"px":!1,t.strokeWidth&&(t.highlightStrokeWidth=1*t.strokeWidth.substr(0,t.strokeWidth.length-2)+1+"px"),e.getElementsByTagName("lineStyle")[0]?t.dashGGB=e.getElementsByTagName("lineStyle")[0].getAttribute("type"):!1,t.dashGGB==0?t.dash=0:t.dashGGB==10?t.dash=2:t.dashGGB==15?t.dash=3:t.dashGGB==20?t.dash=1:t.dashGGB==30&&(t.dash=6),e.getElementsByTagName("labelOffset")[0]?t.labelX=1*e.getElementsByTagName("labelOffset")[0].getAttribute("x"):!1,e.getElementsByTagName("labelOffset")[0]?t.labelY=1*e.getElementsByTagName("labelOffset")[0].getAttribute("y"):!1,e.getElementsByTagName("trace")[0]?t.trace=e.getElementsByTagName("trace")[0].getAttribute("val"):!1,e.getElementsByTagName("fix")[0]?t.fixed=e.getElementsByTagName("fix")[0].getAttribute("val"):!1,t},this.getElement=function(e,t){var n,r,i;t=t||!1;for(r=0;r-1||s[i].search(/[0-9]+$/)>-1||s[i].search(/[a-zA-Z]+(\_*[a-zA-Z0-9]+)*$/)>-1)&&(s[i+1].search(/^\(/)>-1||s[i+1].search(/^[0-9]+/)>-1||s[i+1].search(/^[a-zA-Z]+(\_*[a-zA-Z0-9]+)*/)>-1||s[i+1].search(/\_\_[a-zA-Z0-9]+/)>-1)&&(s[i]=s[i]+"*"),o+=s[i];expr=o}return output.push(expr),output}return exp;case"s":return exp=exp.replace(/(?![e])x(?!\()(?![p])/g,"__x"),["__x",exp];default:if(JXG.GeogebraReader.format<=3.01){s=exp.split(" "),o="";for(i=0;i-1||s[i].search(/[0-9]+$/)>-1||s[i].search(/[a-zA-Z]+(\_*[a-zA-Z0-9]+)*$/)>-1)&&(s[i+1].search(/^\(/)>-1||s[i+1].search(/^[0-9]+/)>-1||s[i+1].search(/^[a-zA-Z]+(\_*[a-zA-Z0-9]+)*/)>-1||s[i+1].search(/\_\_[a-zA-Z0-9]+/)>-1)&&(s[i]=s[i]+"*"),o+=s[i];exp=o}return exp}},this.writeBoard=function(e){var t=JXG.GeogebraReader.tree.getElementsByTagName("euclidianView")[0];e.origin={},e.origin.usrCoords=[1,0,0],e.origin.scrCoords=[1,1*t.getElementsByTagName("coordSystem")[0].getAttribute("xZero"),1*t.getElementsByTagName("coordSystem")[0].getAttribute("yZero")],e.unitX=t.getElementsByTagName("coordSystem")[0].getAttribute("scale")?1*t.getElementsByTagName("coordSystem")[0].getAttribute("scale"):1,e.unitY=t.getElementsByTagName("coordSystem")[0].getAttribute("yscale")?1*t.getElementsByTagName("coordSystem")[0].getAttribute("yscale"):e.unitX,e.fontSize=JXG.GeogebraReader.tree.getElementsByTagName("gui")[0]&&JXG.GeogebraReader.tree.getElementsByTagName("gui")[0].getElementsByTagName("font")[0]?1*JXG.GeogebraReader.tree.getElementsByTagName("gui")[0].getElementsByTagName("font")[0].getAttribute("size"):"12px",JXG.JSXGraph.boards[e.id]=e,e.renderer.enhancedRendering=!0;var n=t.getElementsByTagName("evSettings")[0].getAttribute("pointCapturing")=="true",r=t.getElementsByTagName("evSettings")[0].getAttribute("grid")=="true"?e.create("grid"):null;t.getElementsByTagName("evSettings")[0].getAttribute("axes")&&t.getElementsByTagName("evSettings")[0].getAttribute("axes")=="true"&&(e.ggbElements.xAxis=e.create("axis",[[0,0],[1,0]],{strokeColor:"black",minorTicks:0}),e.ggbElements.yAxis=e.create("axis",[[0,0],[0,1]],{strokeColor:"black",minorTicks:0}))},this.writeElement=function(e,t,n,r){var i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S;i=JXG.isArray(t)?t[0]:t,s={},o={},JXG.debug(i),s.type=i&&i.attributes&&typeof r=="undefined"?i.getAttribute("type").toLowerCase():r,s.label=i.getAttribute("label"),o.name=s.label,JXG.debug("
Konstruiere "+o.name+"("+s.type+"):");switch(s.type){case"point":o=JXG.GeogebraReader.boardProperties(s,i,o),o=JXG.GeogebraReader.colorProperties(i,o),o=JXG.GeogebraReader.visualProperties(i,o),JXG.GeogebraReader.getElement(o.name,!0)?(a=JXG.GeogebraReader.getElement(o.name,!0).getAttribute("exp"),f=JXG.GeogebraReader.ggbParse(a),s.x=new Function("return "+f[0]+";"),s.y=new Function("return "+f[1]+";")):s=JXG.GeogebraReader.coordinates(s,i),JXG.exists(o.styleGGB)||(o.face="circle",o.fillColor=o.strokeColor,o.fillOpacity=1,o.highlightFillColor=o.strokeColor,o.highlightFillOpacity=1,o.strokeColor="black",o.strokeWidth="1px"),JXG.debug(s),JXG.debug(n);try{var x=/Circle\[\s*(\w+)\s*,\s*([\d\.]+)\s*\]/.exec(n);if(typeof n!="undefined")if(x!=null&&x.length==3){var T=JXG.GeogebraReader.checkElement(x[1]),N=e.create("circle",[T,parseFloat(x[2])],{fillColor:"none",visible:!1,name:""});u=e.create("glider",[s.x,s.y,N],o)}else JXG.isArray(n)?u=e.create("glider",[s.x,s.y,n[0]],o):u=e.create("glider",[s.x,s.y,n],o);else u=e.create("point",[s.x,s.y],o);return u}catch(m){return JXG.debug("* Err: Point "+o.name+"
\n"),!1}break;case"segment":o=JXG.GeogebraReader.boardProperties(s,i,o),o=JXG.GeogebraReader.colorProperties(i,o),s=JXG.GeogebraReader.coordinates(s,i),o=JXG.GeogebraReader.visualProperties(i,o);try{return JXG.debug("* Segment: ("+o.name+") First: "+n[0].name+", Last: "+n[1].name+"
\n"),o.straightFirst=!1,o.straightLast=!1,u=e.create("line",n,o),u}catch(m){return JXG.debug("* Err: Segment "+o.name+" First: "+n[0].name+", Last: "+n[1].name+"
\n"),!1}break;case"line":o=JXG.GeogebraReader.boardProperties(s,i,o),o=JXG.GeogebraReader.colorProperties(i,o),s=JXG.GeogebraReader.coordinates(s,i),o=JXG.GeogebraReader.visualProperties(i,o),l="line",n?JXG.getRef(e,n[1].id).elementClass==JXG.OBJECT_CLASS_LINE&&(l="parallel"):n=[parseFloat(i.getElementsByTagName("coords")[0].getAttribute("z")),parseFloat(i.getElementsByTagName("coords")[0].getAttribute("x")),parseFloat(i.getElementsByTagName("coords")[0].getAttribute("y"))];try{return u=e.create(l,n,o),u}catch(m){return JXG.debug("* Err: Line "+o.label+"
\n"),!1}break;case"orthogonalline":o=JXG.GeogebraReader.boardProperties(s,i,o),o=JXG.GeogebraReader.colorProperties(i,o),s=JXG.GeogebraReader.coordinates(s,i),o=JXG.GeogebraReader.visualProperties(i,o);try{return JXG.debug("* Orthogonalline: First: "+n[0].id+", Last: "+n[1].id+"
\n"),u=e.create("normal",n,o),u}catch(m){return JXG.debug("* Err: Orthogonalline "+o.label+"
\n"),!1}break;case"polygon":o=JXG.GeogebraReader.boardProperties(s,i,o),o=JXG.GeogebraReader.colorProperties(i,o),s=JXG.GeogebraReader.coordinates(s,i),o=JXG.GeogebraReader.visualProperties(i,o),n.length==3&&t.length!=4&&(n[2]=parseInt(n[2]),l="regular");try{JXG.debug("* Polygon: First: "+n[0].name+", Second: "+n[1].name+", Third: "+n[2]+"
\n");var C=[],k=[];p=l=="regular"?t.length-n[2]+2:t.length;for(var L=1;LErr: Polygon "+o.name+"
\n"),!1}break;case"intersect":o=JXG.GeogebraReader.boardProperties(s,i,o),o=JXG.GeogebraReader.colorProperties(i,o),s=JXG.GeogebraReader.coordinates(s,i),o=JXG.GeogebraReader.visualProperties(i,o);try{JXG.debug("* Intersection: First: "+n[0].name+", Second: "+n[1].name+"
\n"),JXG.exists(o.styleGGB)||(o.face="circle",o.fillColor=o.strokeColor,o.fillOpacity=1,o.highlightFillColor=o.strokeColor,o.highlightFillOpacity=1,o.strokeColor="black",o.strokeWidth="1px");if(t.length==1)u=e.create("intersection",[n[0],n[1],0],o);else{u=e.create("intersection",[n[0],n[1],1],o);var A={};A=JXG.GeogebraReader.colorProperties(t[1],A),A=JXG.GeogebraReader.visualProperties(t[1],A),A.name=t[1].getAttribute("label");var O=e.create("otherintersection",[n[0],n[1],u],A);e.ggbElements[A.name]=O}return u}catch(m){return JXG.debug("* Err: Intersection "+o.name+"
\n"),!1}break;case"distance":o=JXG.GeogebraReader.boardProperties(s,i,o),o=JXG.GeogebraReader.colorProperties(i,o),s=JXG.GeogebraReader.coordinates(s,i),o=JXG.GeogebraReader.visualProperties(i,o);try{return JXG.debug("* Distance: First: "+n[0].name+", Second: "+n[1].name+"
\n"),d=e.create("midpoint",n,{visible:"false"}),o.visible="true",u=e.create("text",[function(){return d.X()},function(){return d.Y()},function(){return""+n[0].name+n[1].name+" = "+JXG.trimNumber(JXG.getRef(e,n[0].id).Dist(JXG.getRef(e,n[1].id)).toFixed(JXG.GeogebraReader.decimals))}],o),u.Value=function(){return JXG.getRef(e,n[0].id).Dist(JXG.getRef(e,n[1].id))},u}catch(m){return JXG.debug("* Err: Distance "+o.name+"
\n"),!1}break;case"vector":o=JXG.GeogebraReader.boardProperties(s,i,o),o=JXG.GeogebraReader.colorProperties(i,o),s=JXG.GeogebraReader.coordinates(s,i),o=JXG.GeogebraReader.visualProperties(i,o);if(i.getElementsByTagName("startPoint")[0]){n&&n.length==2?m=JXG.GeogebraReader.checkElement(n[1].name):m=[parseFloat(i.getElementsByTagName("coords")[0].getAttribute("x")),parseFloat(i.getElementsByTagName("coords")[0].getAttribute("y"))];if(i.getElementsByTagName("startPoint")[0].getAttribute("x")&&i.getElementsByTagName("startPoint")[0].getAttribute("y"))v=[parseFloat(i.getElementsByTagName("startPoint")[0].getAttribute("x")),parseFloat(i.getElementsByTagName("startPoint")[0].getAttribute("y"))];else if(i.getElementsByTagName("startPoint")[0].getAttribute("exp")){var M=i.getElementsByTagName("startPoint")[0].getAttribute("exp");v=JXG.GeogebraReader.checkElement(M)}}else if(n&&n.length!=0)v=n[0],m=n[1];else{a=JXG.GeogebraReader.getElement(i.getAttribute("label"),!0);if(a)return a=a.getAttribute("exp"),a=JXG.GeogebraReader.ggbParse(a),JXG.isArray(a)?a=new Array(new Function("return "+a[1]+";"),new Function("return "+a[2]+";")):a=new Function("return "+a+";"),JXG.debug("exp: "+a),u=e.create("arrow",[[0,0],[a[0],a[1]]],o),u}try{return JXG.debug("* Vector: First: "+o.name),u=e.create("arrow",[v,m],o),u}catch(m){return JXG.debug("* Err: Vector "+o.name+m+"
\n"),!1}break;case"rotate":o=JXG.GeogebraReader.boardProperties(s,i,o),o=JXG.GeogebraReader.colorProperties(i,o),s=JXG.GeogebraReader.coordinates(s,i),o=JXG.GeogebraReader.visualProperties(i,o);try{return JXG.debug("* Rotate: First: "+n[0].name+", Second: "+n[1]+"
\n"),o.type="rotate",JXG.exists(o.styleGGB)||(o.face="circle",o.fillColor=o.strokeColor,o.fillOpacity=1,o.highlightFillColor=o.strokeColor,o.highlightFillOpacity=1,o.strokeColor="black",o.strokeWidth="1px"),X=e.create("transform",[parseInt(n[1])*Math.PI/180,n[2]],{type:"rotate"}),u=e.create("point",[n[0],X],o),u}catch(m){return JXG.debug("* Err: Rotate "+o.name+"
\n"),!1}break;case"dilate":o=JXG.GeogebraReader.boardProperties(s,i,o),o=JXG.GeogebraReader.colorProperties(i,o),s=JXG.GeogebraReader.coordinates(s,i),o=JXG.GeogebraReader.visualProperties(i,o);try{JXG.debug("* Dilate: First: "+n[0].name+", Second: "+n[1]+"
\n"),o.type="rotate";var _=parseInt(n[1]),D=e.create("transform",[_,_],{type:"scale"}),P=e.create("transform",[function(){return(1-_)*n[2].X()},function(){return(1-_)*n[2].Y()}],{type:"translate"});return JXG.exists(o.styleGGB)||(o.face="circle",o.fillColor=o.strokeColor,o.fillOpacity=1,o.highlightFillColor=o.strokeColor,o.highlightFillOpacity=1,o.strokeColor="black",o.strokeWidth="1px"),u=e.create("point",[n[0],[D,P]],o),u}catch(m){return JXG.debug("* Err: Dilate "+o.name+"
\n"),!1}break;case"translate":o=JXG.GeogebraReader.boardProperties(s,i,o),o=JXG.GeogebraReader.colorProperties(i,o),s=JXG.GeogebraReader.coordinates(s,i),o=JXG.GeogebraReader.visualProperties(i,o);try{return X=e.create("transform",[function(){return n[1].point2.X()-n[1].point1.X()},function(){return n[1].point2.Y()-n[1].point1.Y()}],{type:"translate"}),JXG.exists(o.styleGGB)||(o.face="circle",o.fillColor=o.strokeColor,o.fillOpacity=1,o.highlightFillColor=o.strokeColor,o.highlightFillOpacity=1,o.strokeColor="black",o.strokeWidth="1px"),u=e.create("point",[n[0],X],o),u}catch(m){return JXG.debug("* Err: Translate "+o.name+"
\n"),!1}break;case"mirror":o=JXG.GeogebraReader.boardProperties(s,i,o),o=JXG.GeogebraReader.colorProperties(i,o),s=JXG.GeogebraReader.coordinates(s,i),o=JXG.GeogebraReader.visualProperties(i,o);if(JXG.isPoint(JXG.getRef(e,n[1].id)))var l="mirrorpoint";else if(JXG.getRef(e,n[1].id).elementClass==JXG.OBJECT_CLASS_LINE)var l="reflection";try{return JXG.debug("* Mirror: First: "+n[0].name+", Second: "+n[1].name+"
\n"),u=e.create(l,[n[1],n[0]],o),u}catch(m){return JXG.debug("* Err: Mirror "+o.name+"
\n"),!1}break;case"circle":o=JXG.GeogebraReader.boardProperties(s,i,o),o=JXG.GeogebraReader.colorProperties(i,o),s=JXG.GeogebraReader.coordinates(s,i),o=JXG.GeogebraReader.visualProperties(i,o);try{return JXG.debug("* Circle: First: "+n[0].name+", Second: "+n[1]+"
\n"),u=e.create("circle",n,o),u}catch(m){return JXG.debug("* Err: Circle "+o.name+"
\n"),!1}break;case"circlearc":o=JXG.GeogebraReader.boardProperties(s,i,o),o=JXG.GeogebraReader.colorProperties(i,o),s=JXG.GeogebraReader.coordinates(s,i),o=JXG.GeogebraReader.visualProperties(i,o);try{return JXG.debug("* CircleArc: First: "+n[0].name+", Second: "+n[1].name+"
\n"),u=e.create("arc",n,o),u}catch(m){return JXG.debug("* Err: CircleArc "+o.name+"
\n"),!1}break;case"ellipse":o=JXG.GeogebraReader.boardProperties(s,i,o),o=JXG.GeogebraReader.colorProperties(i,o),s=JXG.GeogebraReader.coordinates(s,i),o=JXG.GeogebraReader.visualProperties(i,o);try{return JXG.debug("* Ellipse: First: "+n[0].name+", Second: "+n[1].name+", Third: "+n[2]+"
\n"),parseInt(n[2])==n[2]&&(n[2]=parseInt(n[2]*2)),u=e.create("ellipse",n,o),u}catch(m){return JXG.debug("* Err: Ellipse "+o.name+"
\n"),!1}break;case"conic":o=JXG.GeogebraReader.boardProperties(s,i,o),o=JXG.GeogebraReader.colorProperties(i,o),s=JXG.GeogebraReader.coordinates(s,i),o=JXG.GeogebraReader.visualProperties(i,o);if(n&&n.length==5)u=e.create("conic",n,o);else if(i.getElementsByTagName("matrix")){d=[];for(var L=0;LCircleSector: First: "+n[0].name+", Second: "+n[1].name+", Third: "+n[2].name+"
\n"),u=e.create("sector",[n[0],n[1],n[2]],o),u}catch(m){return JXG.debug("* Err: CircleSector "+o.name+"
\n"),!1}break;case"linebisector":o=JXG.GeogebraReader.boardProperties(s,i,o),o=JXG.GeogebraReader.colorProperties(i,o),s=JXG.GeogebraReader.coordinates(s,i),o=JXG.GeogebraReader.visualProperties(i,o);try{return JXG.debug("* LineBiSector (Mittelsenkrechte): First: "+n[0].name+"
\n"),d=e.create("midpoint",n,{visible:!1}),JXG.isPoint(JXG.getRef(e,n[0].id))&&JXG.isPoint(JXG.getRef(e,n[1].id))?(X=e.create("line",n,{visible:"false"}),u=e.create("perpendicular",[d,X],o)):u=e.create("perpendicular",[d,n[0]],o),u}catch(m){return JXG.debug("* Err: LineBiSector (Mittelsenkrechte) "+o.name+"
\n"),!1}break;case"ray":o=JXG.GeogebraReader.boardProperties(s,i,o),o=JXG.GeogebraReader.colorProperties(i,o),s=JXG.GeogebraReader.coordinates(s,i),o=JXG.GeogebraReader.visualProperties(i,o);try{return JXG.debug("* Ray: First: "+n[0].name+"
\n"),o.straightFirst=!0,o.straightLast=!1,u=e.create("line",[n[1],n[0]],o),u}catch(m){return JXG.debug("* Err: Ray "+o.name+"
\n"),!1}break;case"tangent":o=JXG.GeogebraReader.boardProperties(s,i,o),o=JXG.GeogebraReader.colorProperties(i,o),s=JXG.GeogebraReader.coordinates(s,i),o=JXG.GeogebraReader.visualProperties(i,o);try{JXG.debug("* Tangent: First: "+n[0].name+", Sec.: "+n[1].name+"("+n[1].type+")
\n");switch(n[1].type){case 1330923344:return n[0].makeGlider(n[1]),u=e.create("tangent",[n[0]],o),u;case 1330922316:case 1330922319:var H=e.create("polar",[n[1],n[0]],{visible:!1}),B=e.create("intersection",[n[1],H,0],{visible:!1}),j=e.create("intersection",[n[1],H,1],{visible:!1}),F=e.create("line",[n[0],B],o),A={};A=JXG.GeogebraReader.colorProperties(t[1],A),A=JXG.GeogebraReader.visualProperties(t[1],A),A.name=t[1].getAttribute("label");var I=e.create("line",[n[0],j],A);return e.ggbElements[A.name]=I,[F,I]}}catch(m){return JXG.debug("* Err: Tangent "+o.name+" "+A.name+"
\n"),!1}break;case"circumcirclearc":o=JXG.GeogebraReader.boardProperties(s,i,o),o=JXG.GeogebraReader.colorProperties(i,o),s=JXG.GeogebraReader.coordinates(s,i),o=JXG.GeogebraReader.visualProperties(i,o);try{return JXG.debug("* CircumcircleArc: First: "+n[0].name+"
\n"),u=e.create("circumcirclearc",n,o),u}catch(m){return JXG.debug("* Err: CircumcircleArc "+o.name+"
\n"),!1}break;case"circumcirclesector":o=JXG.GeogebraReader.boardProperties(s,i,o),o=JXG.GeogebraReader.colorProperties(i,o),s=JXG.GeogebraReader.coordinates(s,i),o=JXG.GeogebraReader.visualProperties(i,o);try{return JXG.debug("* CircumcircleSector: First: "+n[0].name+"
\n"),u=e.create("circumcirclesector",[n[0],n[1],n[2]],o),u}catch(m){return JXG.debug("* Err: CircumcircleSector "+o.name+"
\n"),!1}break;case"semicircle":o=JXG.GeogebraReader.boardProperties(s,i,o),o=JXG.GeogebraReader.colorProperties(i,o),s=JXG.GeogebraReader.coordinates(s,i),o=JXG.GeogebraReader.visualProperties(i,o);try{return JXG.debug("* Semicircle: First: "+n[0].name+"
\n"),u=e.create("semicircle",[n[0],n[1]],o),u}catch(m){return JXG.debug("* Err: Semicircle "+o.name+"
\n"),!1}break;case"angle":o=JXG.GeogebraReader.boardProperties(s,i,o),o=JXG.GeogebraReader.colorProperties(i,o),s=JXG.GeogebraReader.coordinates(s,i),o=JXG.GeogebraReader.visualProperties(i,o);try{return JXG.debug("* Angle: First: "+n[0].name+"
\n"),u=e.create("angle",n,o),u}catch(m){return JXG.debug("* Err: Angle "+o.name+"
\n"),!1}break;case"angularbisector":o=JXG.GeogebraReader.boardProperties(s,i,o),o=JXG.GeogebraReader.colorProperties(i,o),s=JXG.GeogebraReader.coordinates(s,i),o=JXG.GeogebraReader.visualProperties(i,o),o.straightFirst=!0,o.straightLast=!0;try{return JXG.debug("* Angularbisector: First: "+n[0].name+"
\n"),u=e.create("bisector",n,o),u}catch(m){return JXG.debug("* Err: Angularbisector "+o.name+"
\n"),!1}break;case"numeric":if(i.getElementsByTagName("slider").length==0)return a=JXG.GeogebraReader.getElement(i.getAttribute("label"),!0),a&&(a=a.getAttribute("exp"),a=JXG.GeogebraReader.functionParse("",a),a=JXG.GeogebraReader.ggbParse(a)),e.ggb[o.name]=new Function("return "+a+";"),JXG.debug("value: "+e.ggb[o.name]()),e.ggb[o.name];o=JXG.GeogebraReader.boardProperties(s,i,o),o=JXG.GeogebraReader.colorProperties(i,o),o=JXG.GeogebraReader.visualProperties(i,o);if(i.getElementsByTagName("slider").length==1){g=parseFloat(i.getElementsByTagName("slider")[0].getAttribute("x")),y=parseFloat(i.getElementsByTagName("slider")[0].getAttribute("y")),p=parseFloat(i.getElementsByTagName("slider")[0].getAttribute("width"));if(i.getElementsByTagName("slider")[0].getAttribute("absoluteScreenLocation")&&i.getElementsByTagName("slider")[0].getAttribute("absoluteScreenLocation")=="true"){var q=new JXG.Coords(JXG.COORDS_BY_SCREEN,[g,y],e);g=q.usrCoords[1],y=q.usrCoords[2]}i.getElementsByTagName("slider")[0].getAttribute("horizontal")=="true"?(i.getElementsByTagName("slider")[0].getAttribute("absoluteScreenLocation")&&i.getElementsByTagName("slider")[0].getAttribute("absoluteScreenLocation")=="true"&&(p/=e.unitX),b=g+p,w=y):(i.getElementsByTagName("slider")[0].getAttribute("absoluteScreenLocation")&&i.getElementsByTagName("slider")[0].getAttribute("absoluteScreenLocation")=="true"&&(p/=e.unitY),b=g,w=y+p),i.getElementsByTagName("animation")[0]?o.snapWidth=parseFloat(i.getElementsByTagName("animation")[0].getAttribute("step")):!1;try{return JXG.debug("* Numeric: First: "+o.name+"
\n"),o.withTicks=!1,u=e.create("slider",[[g,y],[b,w],[parseFloat(i.getElementsByTagName("slider")[0].getAttribute("min")),parseFloat(i.getElementsByTagName("value")[0].getAttribute("val")),parseFloat(i.getElementsByTagName("slider")[0].getAttribute("max"))]],o),u.setProperty({withLabel:!1}),u}catch(m){return JXG.debug("* Err: Numeric "+o.name+"
\n"),!1}}break;case"midpoint":o=JXG.GeogebraReader.boardProperties(s,i,o),o=JXG.GeogebraReader.colorProperties(i,o),s=JXG.GeogebraReader.coordinates(s,i),o=JXG.GeogebraReader.visualProperties(i,o);try{return JXG.exists(o.styleGGB)||(o.face="circle",o.fillColor=o.strokeColor,o.fillOpacity=1,o.highlightFillColor=o.strokeColor,o.highlightFillOpacity=1,o.strokeColor="black",o.strokeWidth="1px"),u=e.create("midpoint",n,o),JXG.debug("* Midpoint ("+u.id+"): "+o.name+"("+s.x+", "+s.y+")
\n"),u}catch(m){return JXG.debug("* Err: Midpoint "+o.name+"
\n"),!1}break;case"center":o=JXG.GeogebraReader.boardProperties(s,i,o),o=JXG.GeogebraReader.colorProperties(i,o),s=JXG.GeogebraReader.coordinates(s,i),o=JXG.GeogebraReader.visualProperties(i,o);try{return JXG.exists(o.styleGGB)||(o.face="circle",o.fillColor=o.strokeColor,o.fillOpacity=1,o.highlightFillColor=o.strokeColor,o.highlightFillOpacity=1,o.strokeColor="black",o.strokeWidth="1px"),u=e.create("point",[function(){return JXG.getRef(e,n[0].id).center.X()},function(){return JXG.getRef(e,n[0].id).center.Y()}],o),JXG.debug("* Center ("+u.id+"): "+o.name+"("+s.x+", "+s.y+")
\n"),u}catch(m){return JXG.debug("* Err: Center "+o.name+"
\n"),!1}break;case"function":o=JXG.GeogebraReader.boardProperties(s,i,o),o=JXG.GeogebraReader.colorProperties(i,o),s=JXG.GeogebraReader.coordinates(s,i),o=JXG.GeogebraReader.visualProperties(i,o),JXG.GeogebraReader.getElement(o.name,!0)?(E=JXG.GeogebraReader.getElement(o.name,!0).getAttribute("exp"),E=JXG.GeogebraReader.functionParse("c",E)):(E=n[0],E=JXG.GeogebraReader.functionParse("s",E)),JXG.debug(E),p=E.length,E[E.length-1]="return "+JXG.GeogebraReader.ggbParse(E[E.length-1])+";",JXG.debug(E),S=[n&&n[1]?n[1]:null,n&&n[2]?n[2]:null];try{return p==1?u=e.create("functiongraph",[new Function(E[0]),S[0],S[1]],o):p==2?u=e.create("functiongraph",[new Function(E[0],E[1]),S[0],S[1]],o):p==3?u=e.create("functiongraph",[new Function(E[0],E[1],E[2]),S[0],S[1]],o):p==4?u=e.create("functiongraph",[new Function(E[0],E[1],E[2],E[3]),S[0],S[1]],o):p==5&&(u=e.create("functiongraph",[new Function(E[0],E[1],E[2],E[3],E[4]),S[0],S[1]],o)),u}catch(m){return JXG.debug("* Err: Functiongraph "+o.name+"
\n"),!1}break;case"polar":o=JXG.GeogebraReader.boardProperties(s,i,o),o=JXG.GeogebraReader.colorProperties(i,o),s=JXG.GeogebraReader.coordinates(s,i),o=JXG.GeogebraReader.visualProperties(i,o);try{return JXG.debug("* Polar: First: "+n[0].name+", Sec.: "+n[1].name+"
\n"),u=e.create("polar",n,o),u}catch(m){return JXG.debug("* Err: Polar "+o.name+"
\n"),!1}break;case"slope":o=JXG.GeogebraReader.boardProperties(s,i,o),o=JXG.GeogebraReader.colorProperties(i,o),s=JXG.GeogebraReader.coordinates(s,i),o=JXG.GeogebraReader.visualProperties(i,o);try{JXG.debug("* Slope ("+o.name+"): First: "+n[0].name+"
\n");var R=parseInt(o.slopeWidth)||1,U=n[0].glider||n[0].point1,O=e.create("point",[function(){return R+U.X()},function(){return U.Y()}],{visible:!1}),z=e.create("segment",[U,O],{visible:!1}),W=e.create("normal",[z,z.point2],{visible:!1}),L=e.create("intersection",[n[0],W,0],{visible:!1}),d=e.create("midpoint",[z.point2,L],{visible:!1}),X=e.create("text",[function(){return d.X()},function(){return d.Y()},function(){return"  "+(R>1?R.toString():"")+" "+this.name+" = "+JXG.trimNumber((R*n[0].getSlope()).toFixed(JXG.GeogebraReader.decimals))}],o);o.name="";var I=e.create("text",[function(){return(U.X()+O.X())/2},function(){return U.Y()},function(){return"
"+R}],o);X.Value=function(){return function(){return n[0].getSlope()}}();var V=e.create("polygon",[U,O,L],o);return V.borders[2].setProperty({visible:!1}),V.borders[0].setProperty({strokeColor:o.fillColor,strokeWidth:o.strokeWidth,highlightStrokeColor:o.fillColor,dash:o.dash}),V.borders[1].setProperty({strokeColor:o.fillColor,strokeWidth:o.strokeWidth,highlightStrokeColor:o.fillColor,dash:o.dash}),X}catch(m){return JXG.debug("* Err: Slope "+o.name+"
\n"),!1}break;case"text":o=JXG.GeogebraReader.boardProperties(s,i,o),o=JXG.GeogebraReader.colorProperties(i,o),s=JXG.GeogebraReader.coordinates(s,i),o=JXG.GeogebraReader.visualProperties(i,o);var $,J="";try{if(i.getElementsByTagName("isLaTeX")[0]&&i.getElementsByTagName("isLaTeX")[0].getAttribute("val")=="true"){JXG.GeogebraReader.board.options.text.useASCIIMathML=!0,X=JXG.GeogebraReader.getElement(o.name,!0).getAttribute("exp");while($=X.match(/(.*?)" \+ (.+) \+ "(.*)/)){var K=JXG.GeogebraReader.ggbParse(RegExp.$2);typeof K=="string"?J=J+RegExp.$1+K:J=J+RegExp.$1+'" + JXG.trimNumber(('+K+').toFixed(JXG.GeogebraReader.decimals)) + "',X=RegExp.$3}($=X.match(/(.*?)" \+ (.+)/))?J=J+RegExp.$1+'" + JXG.trimNumber(('+JXG.GeogebraReader.ggbParse(RegExp.$2)+").toFixed(JXG.GeogebraReader.decimals))":J+=X,JXG.debug("Text: "+J),u=e.create("text",[s.x,s.y,new Function("return "+J+";")],o)}else JXG.debug(JXG.GeogebraReader.getElement(o.name,!0).getAttribute("exp")),X=JXG.GeogebraReader.ggbParse(JXG.GeogebraReader.functionParse(!1,JXG.GeogebraReader.getElement(o.name,!0).getAttribute("exp"))),JXG.debug(X[1]),u=e.create("text",[s.x,s.y,new Function("return "+X[0]+' + " " + JXG.trimNumber(parseFloat('+X[1]+").toFixed(JXG.GeogebraReader.decimals));")],o);return JXG.debug("* Text: "+X+"
\n"),u}catch(m){return JXG.debug("* Err: Text: "+X+"
\n"),!1}break;case"root":o=JXG.GeogebraReader.boardProperties(s,i,o),o=JXG.GeogebraReader.colorProperties(i,o),s=JXG.GeogebraReader.coordinates(s,i),o=JXG.GeogebraReader.visualProperties(i,o);for(var L=0;LIntegral: First: "+n[0].name+", Sec.: "+n[1].name+", Thir.: "+n[2].name+"
\n"),JXG.debug([n[1](),n[2]()]);var u=e.create("integral",[JXG.getRef(e,n[0]),[n[1],n[2]]],o);return u}catch(m){return JXG.debug("* Err: Integral "+o.name+m+"
\n"),!1}break;default:return!1}},this.readGeogebra=function(e,t){var n,r,i,s=[],o;t.ggbElements=[],t.ggb={},JXG.GeogebraReader.tree=e,JXG.GeogebraReader.board=t,JXG.GeogebraReader.format=parseFloat(JXG.GeogebraReader.tree.getElementsByTagName("geogebra")[0].getAttribute("format")),JXG.GeogebraReader.decimals=parseInt(JXG.GeogebraReader.tree.getElementsByTagName("geogebra")[0].getElementsByTagName("kernel")[0].getElementsByTagName("decimals")[0].getAttribute("val")),JXG.GeogebraReader.writeBoard(t),t=JXG.GeogebraReader.setDefaultOptions(t);var u=JXG.GeogebraReader.tree.getElementsByTagName("construction");for(var a=0;a="):e,e=e.match(/\u2227/)?e.replace(/\u2227/g,"&&"):e,e=e.match(/\u2228/)?e.replace(/\u2228/g,"//"):e,e},this.prepareString=function(e,t){var n,r,i,s;t&&(s=JXG.Util.Base64.decode(e),s.slice(0,2)!=="PK"&&(s=JXG.Util.Base64.decode(e,!0)),e=s);if(e.indexOf("<")!=0){r=[],i=e.length;for(n=0;n + and . +*/ + JXG.debug=function(){},JXG.GeonextReader={changeOriginIds:function(e,t){return t=="gOOe0"||t=="gXOe0"||t=="gYOe0"||t=="gXLe0"||t=="gYLe0"?e.id+t:t},gEBTN:function(e,t,n,r){var i;return JXG.exists(e||!e.getElementsByTagName)?(JXG.exists(r)||(r=!0),n=n||0,i=e.getElementsByTagName(t),i.length>0&&(i=i[n],r&&i.firstChild&&(i=i.firstChild.data)),i):""},colorProperties:function(e,t){var n=this.gEBTN(t,"color",0,!1),r;return r=JXG.rgba2rgbo(this.gEBTN(n,"stroke")),e.strokeColor=r[0],e.strokeOpacity=r[1],r=JXG.rgba2rgbo(this.gEBTN(n,"lighting")),e.highlightStrokeColor=r[0],e.highlightStrokeOpacity=r[1],r=JXG.rgba2rgbo(this.gEBTN(n,"fill")),e.fillColor=r[0],e.fillOpacity=r[1],e.highlightFillColor=e.fillColor,e.highlightFillOpacity=e.fillOpacity,e.labelColor=JXG.rgba2rgbo(this.gEBTN(n,"label"))[0],e.colorDraft=JXG.rgba2rgbo(this.gEBTN(n,"draft"))[0],JXG.rgba2rgbo(this.gEBTN(n,"label"))[1]==0?e.withLabel=!1:e.withLabel=!0,e.colorStroke=e.strokeColor,e.colorFill=e.fillColor,e.colorLabel=e.labelColor,e},firstLevelProperties:function(e,t){if(!JXG.exists(t)||!JXG.exists(t.childNodes))return e;var n=t.childNodes,r,i;for(r=0;r\n")},readGeonext:function(e,t){var n,r,i,s,o,u,a,f,l,c,h="true",p=this;t.options.layer.sector=t.options.layer.angle,t.options.layer.circle=t.options.layer.angle,t.options.line.label.position="top",u=this.gEBTN(e,"board",0,!1),l=this.readConditions(u.getElementsByTagName("conditions")[0]),t.options.takeSizeFromFile&&t.resizeContainer(this.gEBTN(u,"width"),this.gEBTN(u,"height")),n=this.gEBTN(u,"coordinates",0,!1),c=this.readViewPort(n),c.length==4?t.setBoundingBox(c,!1):(c=this.gEBTN(n,"zoom",0,!1),t.zoomX=parseFloat(this.gEBTN(c,"x")),t.zoomY=parseFloat(this.gEBTN(c,"y")),c=this.gEBTN(n,"origin",0,!1),t.origin={usrCoords:[1,0,0],scrCoords:[1,parseFloat(this.gEBTN(c,"x"))*t.zoomX,parseFloat(this.gEBTN(c,"y"))*t.zoomY]},c=this.gEBTN(n,"unit",0,!1),t.unitX=parseFloat(this.gEBTN(c,"x"))*t.zoomX,t.unitY=parseFloat(this.gEBTN(c,"y"))*t.zoomY),t.options.takeSizeFromFile&&t.resizeContainer(this.gEBTN(u,"width"),this.gEBTN(u,"height")),parseFloat(t.options.text.fontSize)>0||(t.options.text.fontSize=12),t.geonextCompatibilityMode=!0,delete JXG.JSXGraph.boards[t.id],t.id=this.gEBTN(u,"id"),JXG.JSXGraph.boards[t.id]=t,t.initGeonextBoard(),t.renderer.enhancedRendering=!0,this.parseImage(t,this.gEBTN(u,"file",0,!1),t.options.layer.image),t.options.point.snapToGrid=this.gEBTN(this.gEBTN(u,"coordinates",0,false),"snap")==h,t.options.point.snapToGrid&&this.gEBTN(this.gEBTN(u,"grid",1,false),"pointsnap")==h&&(t.options.point.snapToGrid=!1,t.options.point.snapToPoints=!0,t.options.point.attractorDistance=.5),n=this.gEBTN(u,"grid",1,!1),c=this.gEBTN(n,"x"),c&&(t.options.grid.gridX=1/parseFloat(c),t.options.point.snapSizeX=parseFloat(c)),c=this.gEBTN(n,"y"),c&&(t.options.grid.gridY=1/parseFloat(c),t.options.point.snapSizeY=parseFloat(c)),t.options.grid.gridDash=JXG.str2Bool(this.gEBTN(n,"dash")),c=JXG.rgba2rgbo(this.gEBTN(n,"color")),t.options.grid.gridColor=c[0],t.options.grid.gridOpacity=c[1],n=this.gEBTN(u,"coordinates",0,!1),this.gEBTN(n,"grid")==h&&t.create("grid",[]),this.gEBTN(n,"coord")==h&&(t.options.axis.ticks.majorHeight=10,t.options.axis.ticks.minorHeight=4,t.create("axis",[[0,0],[1,0]]),t.create("axis",[[0,0],[0,1]])),c=this.gEBTN(this.gEBTN(u,"background",0,!1),"color"),c.length==8&&(c="#"+c),t.containerObj.style.backgroundColor=JXG.rgba2rgbo(c)[0],r=e.getElementsByTagName("elements")[0].childNodes;for(i=0;i0?o.radius=p.changeOriginIds(t,p.gEBTN(g,"radius")):g.getElementsByTagName("radiusvalue").length>0&&(o.radius=p.gEBTN(g,"radiusvalue")),o=p.transformProperties(o),l=t.create("circle",[o.center,o.radius],o),p.parseImage(t,s,t.options.layer.image,0,0,0,0,l),p.printDebugMessage("debug",o,s.nodeName,"OK");break;case"slider":o.strokewidth=1,o=p.colorProperties(o,s),o=p.visualProperties(o,s),o=p.firstLevelProperties(o,s),o=p.readNodes(o,s,"data"),o.fixed=JXG.str2Bool(p.gEBTN(s,"fix")),o=p.readNodes(o,s,"animate","animate"),o=p.transformProperties(o,"point");try{o.parent=p.changeOriginIds(t,o.parent),d=t.create("glider",[parseFloat(o.x),parseFloat(o.y),o.parent],o),d.onPolygon=JXG.exists(o.onpolygon)&&JXG.str2Bool(o.onpolygon),p.parseImage(t,s,t.options.layer.point,0,0,0,0,d),p.printDebugMessage("debug",o,s.nodeName,"OK")}catch(b){JXG.debug("* Err: Slider "+o.name+" "+o.id+": "+o.parent+"
\n")}break;case"cas":o=p.colorProperties(o,s),o=p.visualProperties(o,s),o=p.firstLevelProperties(o,s),o.fixed=JXG.str2Bool(s.getElementsByTagName("fix")[0].firstChild.data),o=p.readNodes(o,s,"data"),o=p.transformProperties(o,"point"),o.x=JXG.GeonextParser.geonext2JS(o.x,t),o.x=new Function("return "+o.x+";"),o.y=JXG.GeonextParser.geonext2JS(o.y,t),o.y=new Function("return "+o.y+";"),d=t.create("point",[o.x,o.y],o),p.parseImage(t,s,t.options.layer.point,0,0,0,0,d),p.printDebugMessage("debug",o,s.nodeName,"OK");break;case"intersection":o.strokewidth=1,o=p.readNodes(o,s,"data"),n=s.getElementsByTagName("first")[1],o.outFirst={},o.outFirst=p.colorProperties(o.outFirst,n),o.outFirst=p.visualProperties(o.outFirst,n),o.outFirst=p.firstLevelProperties(o.outFirst,n),o.outFirst.fixed=JXG.str2Bool(n.getElementsByTagName("fix")[0].firstChild.data),o.outFirst=p.transformProperties(o.outFirst,"point"),o.first=p.changeOriginIds(t,o.first),o.last=p.changeOriginIds(t,o.last),JXG.getReference(t,o.first).elementClass==JXG.OBJECT_CLASS_LINE&&JXG.getReference(t,o.last).elementClass==JXG.OBJECT_CLASS_LINE?(v=t.create("intersection",[t.objects[o.first],t.objects[o.last],0],o.outFirst),o.outFirst.visible=="false"&&v.hideElement()):(n=s.getElementsByTagName("last")[1],JXG.exists(n)&&(o.outLast={},o.outLast=p.colorProperties(o.outLast,n),o.outLast=p.visualProperties(o.outLast,n),o.outLast=p.firstLevelProperties(o.outLast,n),o.outLast.fixed=JXG.str2Bool(n.getElementsByTagName("fix")[0].firstChild.data),o.outLast=p.transformProperties(o.outLast,"point"),v=t.create("intersection",[t.objects[o.first],t.objects[o.last],0],o.outFirst),v=t.create("intersection",[t.objects[o.first],t.objects[o.last],1],o.outLast))),p.printDebugMessage("debug",o,s.nodeName,"OK");break;case"composition":o=p.readNodes(o,s,"data"),o=p.firstLevelProperties(o,s),o.defEl=[],c=0,n=s.getElementsByTagName("data")[0].getElementsByTagName("input");for(i=0;i/g,"")}catch(b){o.mpStr=p.subtreeToString(s.getElementsByTagName("data")[0].getElementsByTagName("content")[0]),o.mpStr=o.mpStr.replace(/<\/?content>/g,"")}o.fixed=!1;try{s.getElementsByTagName("data")[0].getElementsByTagName("parent")[0].firstChild&&(o.parent=s.getElementsByTagName("data")[0].getElementsByTagName("parent")[0].firstChild.data,o.fixed=!0)}catch(b){}try{o.condition=s.getElementsByTagName("condition")[0].firstChild.data}catch(b){o.condition=""}o.content=s.getElementsByTagName("content")[0].firstChild.data;try{o.fixed=s.getElementsByTagName("fix")[0].firstChild.data}catch(b){o.fixed=!1}try{o.autodigits=s.getElementsByTagName("digits")[0].firstChild.data}catch(b){o.autodigits=2}o.parent=p.changeOriginIds(t,o.parent),l=t.create("text",[o.x,o.y,o.mpStr],{anchor:o.parent,id:o.id,name:o.name,digits:o.autodigits,isLabel:!1,strokeColor:o.colorLabel,fixed:o.fixed,visible:JXG.str2Bool(o.visible)});break;case"parametercurve":o=p.colorProperties(o,s),o=p.visualProperties(o,s),o=p.firstLevelProperties(o,s),o=p.transformProperties(o),o.functionx=s.getElementsByTagName("functionx")[0].firstChild.data,o.functiony=s.getElementsByTagName("functiony")[0].firstChild.data,o.min=s.getElementsByTagName("min")[0].firstChild.data,o.max=s.getElementsByTagName("max")[0].firstChild.data,o.fillColor="none",o.highlightFillColor="none",t.create("curve",[new Function("t","return "+JXG.GeonextParser.geonext2JS(o.functionx,t)+";"),new Function("t","return "+JXG.GeonextParser.geonext2JS(o.functiony,t)+";"),new Function("return "+JXG.GeonextParser.geonext2JS(o.min,t)+";"),new Function("return "+JXG.GeonextParser.geonext2JS(o.max,t)+";")],o),p.printDebugMessage("debug",o,s.nodeName,"OK");break;case"tracecurve":o.tracepoint=s.getElementsByTagName("tracepoint")[0].firstChild.data,o.traceslider=s.getElementsByTagName("traceslider")[0].firstChild.data,t.create("tracecurve",[o.traceslider,o.tracepoint],o),p.printDebugMessage("debug",o,s.nodeName,"OK");break;case"group":o=p.colorProperties(o,s),o=p.firstLevelProperties(o,s),o.members=[];for(i=0;iErr: "+s.nodeName+" not yet implemented
\n")}delete o})(i);t.addConditions(l)},decodeString:function(e){var t;return e.indexOf("")<0?(t=(new JXG.Util.Unzip(JXG.Util.Base64.decodeAsArray(e))).unzip(),t==""?e:t):e},prepareString:function(e){try{e.indexOf("GEONEXT")<0&&(e=this.decodeString(e)[0][0]),e=this.fixXML(e)}catch(t){e=""}return e},fixXML:function(e){var t=["active","angle","animate","animated","arc","area","arrow","author","autodigits","axis","back","background","board","border","bottom","buttonsize","cas","circle","color","comment","composition","condition","conditions","content","continuous","control","coord","coordinates","cross","cs","dash","data","description","digits","direction","draft","editable","elements","event","file","fill","first","firstarrow","fix","fontsize","free","full","function","functionx","functiony","GEONEXT","graph","grid","group","height","id","image","info","information","input","intersection","item","jsf","label","last","lastarrow","left","lefttoolbar","lighting","line","loop","max","maximized","member","middle","midpoint","min","modifier","modus","mp","mpx","multi","name","onpolygon","order","origin","output","overline","parametercurve","parent","point","pointsnap","polygon","position","radius","radiusnum","radiusvalue","right","section","selectedlefttoolbar","showconstruction","showcoord","showinfo","showunit","showx","showy","size","slider","snap","speed","src","start","stop","straight","stroke","strokewidth","style","term","text","top","trace","tracecurve","tracepoint","traceslider","type","unit","value","VERSION","vertex","viewport","visible","width","wot","x","xooy","xval","y","yval","zoom"],n=t.join("|"),r="<(/?("+n+"))>",i=new RegExp(r,"g");return e=JXG.escapeHTML(e),e=e.replace(i,"<$1>"),e=e.replace(/(.*)(.*<\/content>)/g,"$1<arc>$2"),e=e.replace(/(.*)(.*<\/mpx>)/g,"$1<arc>$2"),e=e.replace(/(.*)(.*<\/mpx>)/g,"$1<arc>$2"),e}}; diff --git a/ajax/libs/jsxgraph/0.96/IntergeoReader.min.js b/ajax/libs/jsxgraph/0.96/IntergeoReader.min.js new file mode 100644 index 000000000..a1a026187 --- /dev/null +++ b/ajax/libs/jsxgraph/0.96/IntergeoReader.min.js @@ -0,0 +1,33 @@ +/* Version 0.96 */ +/* Version 0.96 */ +/* + Copyright 2008-2012 + 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 . +*/ + JXG.IntergeoReader=new function(){this.board=null,this.objects={},this.readIntergeo=function(e,t){this.board=t,this.board.origin={},this.board.origin.usrCoords=[1,0,0],this.board.origin.scrCoords=[1,400,300],this.board.unitX=30,this.board.unitY=30,this.readElements(e.getElementsByTagName("elements")),this.readConstraints(e.getElementsByTagName("constraints")),this.cleanUp(),this.board.fullUpdate(),this.readDisplay(e.getElementsByTagName("display")),this.board.fullUpdate()},this.readElements=function(e){var t;for(var t=0;t1)return;n.nodeName=="point"?JXG.IntergeoReader.storePoint(n):n.nodeName=="line"||n.nodeName=="line_segment"||n.nodeName=="ray"||n.nodeName=="vector"?JXG.IntergeoReader.storeLine(n):n.nodeName=="circle"?JXG.IntergeoReader.storeConic(n):n.nodeName=="conic"?JXG.IntergeoReader.storeConic(n):n.nodeName!="polygon"&&JXG.debug("Not implemented: "+n.nodeName+" "+n.getAttribute("id"))})(t)},this.addPointOld=function(e){var t=0,n=0,r=0,i,s=e.childNodes[t],o=[],u={strokeColor:"red",fillColor:"red",withLabel:!0},a=[];while(s.nodeType>1)t++,s=e.childNodes[t];u.name=e.getAttribute("id");if(s.nodeName=="homogeneous_coordinates"){for(n=0;n1)t++,i=e.childNodes[t];if(i.nodeName=="homogeneous_coordinates"){for(n=0;n1)t++,n=e.childNodes[t];if(n.nodeName=="homogeneous_coordinates"){r=[];for(i=0;i1)t++,r=e.childNodes[t];if(r.nodeName=="matrix"){i=[];for(n=0;n1)return;r.nodeName=="line_through_two_points"?JXG.IntergeoReader.addLineThroughTwoPoints(r,!1):r.nodeName=="ray_from_point_through_point"?JXG.IntergeoReader.addLineThroughTwoPoints(r,!0):r.nodeName=="line_through_point"?JXG.IntergeoReader.addLineThroughPoint(r):r.nodeName=="line_parallel_to_line_through_point"?JXG.IntergeoReader.addLineParallelToLineThroughPoint(r,!1):r.nodeName=="ray_from_point_and_vector"?JXG.IntergeoReader.addLineParallelToLineThroughPoint(r,!0):r.nodeName=="line_perpendicular_to_line_through_point"?JXG.IntergeoReader.addLinePerpendicularToLineThroughPoint(r):r.nodeName=="line_segment_by_points"?JXG.IntergeoReader.addLineSegmentByTwoPoints(r):r.nodeName=="vector_from_point_to_point"?JXG.IntergeoReader.addVectorFromPointToPoint(r):r.nodeName=="endpoints_of_line_segment"?JXG.IntergeoReader.addEndpointsOfLineSegment(r):r.nodeName!="free_point"&&(r.nodeName=="free_line"?JXG.IntergeoReader.addFreeLine(r):r.nodeName=="point_on_line"?JXG.IntergeoReader.addPointOnLine(r):r.nodeName=="point_on_line_segment"?JXG.IntergeoReader.addPointOnLine(r):r.nodeName=="point_on_circle"?JXG.IntergeoReader.addPointOnCircle(r):r.nodeName=="angular_bisector_of_three_points"?JXG.IntergeoReader.addAngularBisectorOfThreePoints(r,!1):r.nodeName=="angular_bisectors_of_two_lines"?JXG.IntergeoReader.addAngularBisectorsOfTwoLines(r,!1):r.nodeName=="line_angular_bisector_of_three_points"?JXG.IntergeoReader.addAngularBisectorOfThreePoints(r,!0):r.nodeName=="line_angular_bisectors_of_two_lines"?JXG.IntergeoReader.addAngularBisectorsOfTwoLines(r,!0):r.nodeName=="midpoint_of_two_points"?JXG.IntergeoReader.addMidpointOfTwoPoints(r):r.nodeName=="midpoint"?JXG.IntergeoReader.addMidpointOfTwoPoints(r):r.nodeName=="midpoint_of_line_segment"||r.nodeName=="midpoint_line_segment"?JXG.IntergeoReader.addMidpointOfLineSegment(r):r.nodeName=="point_intersection_of_two_lines"?JXG.IntergeoReader.addPointIntersectionOfTwoLines(r):r.nodeName=="locus_defined_by_point"?JXG.IntergeoReader.addLocusDefinedByPoint(r):r.nodeName=="locus_defined_by_point_on_line"?JXG.IntergeoReader.addLocusDefinedByPointOnLine(r):r.nodeName=="locus_defined_by_point_on_line_segment"?JXG.IntergeoReader.addLocusDefinedByPointOnLine(r):r.nodeName=="locus_defined_by_line_through_point"?JXG.IntergeoReader.addLocusDefinedByLineThroughPoint(r):r.nodeName=="locus_defined_by_point_on_circle"?JXG.IntergeoReader.addLocusDefinedByPointOnCircle(r):r.nodeName=="circle_by_three_points"?JXG.IntergeoReader.addCircleByThreePoints(r):r.nodeName=="circle_by_center_and_point"?JXG.IntergeoReader.addCircleByCenterAndPoint(r):r.nodeName=="center_of_circle"?JXG.IntergeoReader.addCenterOfCircle(r):r.nodeName=="intersection_points_of_two_circles"?JXG.IntergeoReader.addIntersectionPointsOfTwoCircles(r):r.nodeName=="intersection_points_of_circle_and_line"?JXG.IntergeoReader.addIntersectionPointsOfCircleAndLine(r):r.nodeName=="other_intersection_point_of_two_circles"?JXG.IntergeoReader.addOtherIntersectionPointOfTwoCircles(r):r.nodeName=="other_intersection_point_of_circle_and_line"?JXG.IntergeoReader.addOtherIntersectionPointOfCircleAndLine(r):r.nodeName=="circle_tangent_lines_by_point"?JXG.IntergeoReader.addCircleTangentLinesByPoint(r):r.nodeName=="polygon_by_vertices"?JXG.IntergeoReader.addPolygonByVertices(r):(n=JXG.IntergeoReader.readParams(r),JXG.debug("readConstraints: not implemented: "+r.nodeName+": "+n[0])))})(t)},this.setAttributes=function(e){e.setProperty({strokecolor:this.board.options.point.strokeColor,fillColor:this.board.options.point.fillColor})},this.readParams=function(e){var t=[],n;for(n=0;n1)return;if(n.nodeName=="background-color")this.board.containerObj.style.backgroundColor=n.firstChild.data;else if(n.nodeName=="style"){r=JXG.getReference(this.board,n.getAttribute("ref"));var u=[],a;for(a=0;a + and . +*/ + JXG.extend(JXG,{GENTYPE_ABC:1,GENTYPE_AXIS:2,GENTYPE_MID:3,GENTYPE_REFLECTION:4,GENTYPE_MIRRORPOINT:5,GENTYPE_TANGENT:6,GENTYPE_PARALLEL:7,GENTYPE_BISECTORLINES:8,GENTYPE_PERPENDICULAR_BISECTOR: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_XYZ:27,GENTYPE_JCODE:28,GENTYPE_MOVEMENT:29,GENTYPE_GRID:33,GENTYPE_DELETE:41,GENTYPE_COPY:42,GENTYPE_MIRROR:43,GENTYPE_ROTATE:44,GENTYPE_ABLATION:45,GENTYPE_MIGRATE:46,GENTYPE_TRANSFORM:47,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_SETLABEL:58,GENTYPE_CTX_SETFIXED: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,SketchReader:{generator:{toFixed:0,freeLine:!1,useGlider:!1,useSymbols:!1},generateJCodeMeta:function(){},id:function(){return JXG.Util.genUUID()},generateJCode:function(e,t,n){var r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N,C,k,L=[],A="",O="",M="",_="";r=JXG.SketchReader.generator,v=t.objects;var D=function(e){return r.toFixed>0&&(e=e.toFixed(r.toFixed)),e},P=function(e){var n;return r.useSymbols?t.jc.sstack[0][e]?n=t.jc.sstack[0][e]:n=v[e]:n=v[e],n};i="",s="id: '"+e.dest_id+"', ";if(JXG.exists(t)&&r.useSymbols&&e.type!==JXG.GENTYPE_ABLATION){s="",i=e.dest_id+" = ";for(a=0;a0&&(e.src_ids[a]=h[0])}if(e.type>50)return JXG.SketchReader.generateJCodeMeta(e,t);switch(e.type){case JXG.GENTYPE_JCODE:A=e.args.code;break;case JXG.GENTYPE_AXIS:A=e.args.name[0]+" = point("+D(e.args.coords[0].usrCoords[1])+", ",A+=D(e.args.coords[0].usrCoords[2])+") <>; "+e.args.name[1],A+=" = point("+D(e.args.coords[1].usrCoords[1])+", ",A+=D(e.args.coords[1].usrCoords[2])+") <>; "+e.args.name[2],A+=" = point("+D(e.args.coords[2].usrCoords[1])+", ",A+=D(e.args.coords[2].usrCoords[2])+") <>; ",A+=e.args.name[3]+" = axis("+e.args.name[0]+", "+e.args.name[1]+") ",A+="<>; ",O="delete "+e.dest_id+"; ";break;case JXG.GENTYPE_REFLECTION:A=i+"reflection("+e.src_ids[0]+", "+e.src_ids[1]+") <<"+s,A+="fillColor: '"+e.args.fillColor+"'>>; ",O="delete "+e.dest_id+"; ";break;case JXG.GENTYPE_MIRRORPOINT:A=i+"mirrorpoint("+e.src_ids[1]+", "+e.src_ids[0]+") <<"+s,A+="fillColor: '"+e.args.fillColor+"'>>; ",O="delete "+e.dest_id+"; ";break;case JXG.GENTYPE_TANGENT:e.args.create_point===!0?(c=e.dest_sub_ids[2],A="point("+D(e.args.usrCoords[1])+","+D(e.args.usrCoords[2])+") <>; "+c+".glide(",A+=e.src_ids[0]+"); ",O="delete "+c+"; "):c=e.src_ids[0],A+=i+"tangent("+c+") <<"+s+"point1: <>, point2: <> >>; ",O="delete "+e.dest_sub_ids[0]+"; "+O,O="delete "+e.dest_id+"; delete "+e.dest_sub_ids[1]+"; "+O;break;case JXG.GENTYPE_PARALLEL:e.args.create_point===!0?(c=e.dest_sub_ids[1],A="point("+D(e.args.usrCoords[1])+", "+D(e.args.usrCoords[2])+") <>; ",O="delete "+c+"; "):c=e.src_ids[1],A+=i+"parallel("+e.src_ids[0]+", "+c+") <<"+s+"point: <> >>; ",O="delete "+e.dest_id+"; delete "+e.dest_sub_ids[0]+"; "+O;break;case JXG.GENTYPE_BISECTORLINES:A="bisectorlines("+e.src_ids[0]+", "+e.src_ids[1]+") <>, point2: <>>>, line2: <>; ",A+=i+"normal("+e.dest_sub_ids[0]+", "+c+") <<"+s,A+=" point: <> >>; ",O+="delete "+e.dest_id+"; delete "+e.dest_sub_ids[0]+"; "):(A=i+"bisector("+e.src_ids[1]+", "+e.src_ids[2]+", "+e.src_ids[0],A+=") <<"+s+"point: <>>>; ",O="delete "+e.dest_id+"; delete "+e.dest_sub_ids[0]+"; ");break;case JXG.GENTYPE_NORMAL:e.args.create_point===!0?(c=e.dest_sub_ids[1],A="point("+D(e.args.usrCoords[1])+", "+D(e.args.usrCoords[2]),A+=") <>; ",O="delete "+c+"; "):c=e.src_ids[1],A+=i+"normal("+c+", "+e.src_ids[0]+") <<"+s,A+="point: <>")+";",O="delete "+e.dest_id+"; ";break;case JXG.GENTYPE_GLIDER:r.useGlider?(A=i+"glider("+D(e.args.usrCoords[1])+", "+D(e.args.usrCoords[2]),A+=", "+e.src_ids[0]+")",A+=(r.useSymbols?"":"<>")+";"):(A=i+"point("+D(e.args.usrCoords[1])+", "+D(e.args.usrCoords[2]),A+=") <<"+s+" fillColor: '"+e.args.fillColor+"'>>; "+e.dest_id,A+=".glide("+e.src_ids[0]+"); "),O="delete "+e.dest_id+"; ";break;case JXG.GENTYPE_INTERSECTION:A=i+"intersection("+e.src_ids[0]+", "+e.src_ids[1]+", "+e.args.choice,A+=") <<"+s+" fillColor: '"+e.args.fillColor+"'>>; ",O="delete "+e.dest_id+"; ";break;case JXG.GENTYPE_CIRCLE:O="delete "+e.dest_sub_ids[0]+"; ",e.args.create_point===!0?(A="point("+D(e.args.usrCoords[1])+", "+D(e.args.usrCoords[2]),A+=") <>; ",A+=i+"circle("+e.dest_sub_ids[0]+", "+e.src_ids[0]+") <<"+s,A+=" fillOpacity: "+JXG.Options.opacityLevel+" >>; ",O="delete "+e.dest_id+"; "+O):e.args.create_by_radius===!0?(A="point("+D(e.args.x)+", "+D(e.args.y)+") <>; ",O="delete "+e.dest_id+"; delete "+e.dest_sub_ids[0]+"; "):(A=i+"circle("+e.src_ids[0]+", "+e.src_ids[1]+", "+e.src_ids[2],A+=") <>; ",O="delete "+e.dest_id+"; "+O);break;case JXG.GENTYPE_CIRCLE2POINTS:e.args.create_two_points===!0?(A="point("+D(e.args.x1)+", "+D(e.args.y1)+") <>; ",A+=i+"circle("+e.dest_sub_ids[0]+", "+e.dest_sub_ids[1]+") <<"+s,A+=" fillOpacity: "+JXG.Options.opacityLevel+">>; ",O="delete "+e.dest_id+"; delete "+e.dest_sub_ids[1]+"; delete ",O+=e.dest_sub_ids[0]+"; "):e.args.create_point===!0?(A="point("+D(e.args.x)+", "+D(e.args.y)+") <>; ",O="delete "+e.dest_id+"; delete "+e.dest_sub_ids[0]+"; "):e.args.create_by_radius===!0?(A=i+"circle("+e.src_ids[0]+", "+e.args.r+") <<"+s,A+=" fillOpacity: "+JXG.Options.opacityLevel+">>; ",O="delete "+e.dest_id+"; "):(A=i+"circle("+e.src_ids[0]+", "+e.src_ids[1]+") <<"+s,A+=" fillOpacity: "+JXG.Options.opacityLevel+">>; ",O="delete "+e.dest_id+"; ");break;case JXG.GENTYPE_LINE:l=0,f=0;if(e.args.create_point1){m=e.dest_sub_ids[l++],p=[];for(a=0;a0&&!r.useSymbols&&(p+=", ")),r.useSymbols||(s=" id: '"+e.dest_id+"' "),A+=i+h+"("+d+")",A+=(p.length+s.length>0?" <<"+p+s+">>":"")+";",O="delete "+e.dest_id+"; "+O;break;case JXG.GENTYPE_TRIANGLE:for(a=0;a0||a>0)A+=", ";A+=e.dest_sub_ids[a]}A+=") <>, "+s+" fillOpacity: ",A+=JXG.Options.opacityLevel+", hasInnerPoints:true, scalable:true>>; ";break;case JXG.GENTYPE_QUADRILATERAL:for(a=0;a>, "+s,A+=" fillOpacity: ",A+=JXG.Options.opacityLevel+", hasInnerPoints:true, scalable:true>>; ";break;case JXG.GENTYPE_TEXT:A=i+"text("+D(e.args.x)+", "+D(e.args.y)+", "+e.args.str+") <<",A+=s+" name: '"+e.dest_id+"'>>; "+e.dest_id+".setText("+e.args.str,A+="); ",O="delete "+e.dest_id+"; ";break;case JXG.GENTYPE_POLYGON:A=i+"polygon(";for(a=0;a>; ",O="delete "+e.dest_id+"; ";break;case JXG.GENTYPE_REGULARPOLYGON:A=i+"regularpolygon("+e.src_ids[0]+", "+e.src_ids[1]+", ",A+=e.args.corners+") <>; ",O="delete "+e.dest_id+"; "+O;break;case JXG.GENTYPE_SECTOR:A=i+"sector("+e.src_ids[0]+", "+e.src_ids[1]+", "+e.src_ids[2],A+=") <<",A+=s+" name: '"+e.dest_id+"', fillOpacity: "+JXG.Options.opacityLevel,A+=">>; ",O="delete "+e.dest_id+"; ";break;case JXG.GENTYPE_ANGLE:A=i+"angle("+e.src_ids[0]+", "+e.src_ids[1]+", "+e.src_ids[2]+") ",A+="<>; ",O="delete "+e.dest_id+"; delete "+e.dest_sub_ids[2]+"; delete ",O+=e.dest_sub_ids[1],O+="; delete "+e.dest_sub_ids[0]+"; ";break;case JXG.GENTYPE_PLOT:A=i+e.args.plot_type+"("+e.args.func+") <<",e.args.isPolar&&(A+="curveType: 'polar', "),A+=s+" name:'"+e.dest_id+"'>>; ",O="delete "+e.dest_id+"; ";break;case JXG.GENTYPE_SLIDER:A=i+"slider(["+D(e.args.x1)+", "+D(e.args.y1)+"], ["+D(e.args.x2),A+=", "+D(e.args.y2)+"], ["+D(e.args.start)+", "+D(e.args.ini)+", ",A+=D(e.args.end)+"]) <<"+s+" name: '"+e.dest_id+"', baseline: <>, highline: <>, point1: <>, point2: <>, label: <>>>; ",O="delete "+e.dest_id+"; delete "+e.dest_sub_ids[4]+"; delete ",O+=e.dest_sub_ids[3]+"; delete "+e.dest_sub_ids[2]+"; delete ",O+=e.dest_sub_ids[1]+"; delete ",O+=e.dest_sub_ids[0]+"; ";break;case JXG.GENTYPE_DELETE:x=[],M=[],_=[];for(a=0;a50?x=this.generateJCodeMeta(n[e.args.steps[a]],t):x=this.generateJCode(n[e.args.steps[a]],t,n),x[2].trim()!==""&&(A=x[2]+A),JXG.isFunction(x[3])&&M.unshift(x[3]),x[0].trim()!==""&&(O+=x[0]),JXG.isFunction(x[1])&&_.push(x[1]);break;case JXG.GENTYPE_COPY:L=[];for(E in e.args.steps)if(e.args.steps.hasOwnProperty(E)){k=JXG.deepCopy(n[e.args.steps[E]]);if(k.type==JXG.GENTYPE_COPY){for(a=0;a50?x=this.generateJCodeMeta(L[a],t):x=this.generateJCode(L[a],t,n),x[0].trim()!==""&&(A+=x[0]),JXG.isFunction(x[1])&&M.push(x[1]),x[2].trim()!==""&&(O=x[2]+O),JXG.isFunction(x[3])&&_.unshift(x[3]);if(e.args.dep_copy)for(a=0;a>; ",A+="circle("+e.dest_sub_ids[0]+", 1) <>; ",e.args.fids.length==1?e.args.func=e.args.fids[0]+".radius()":e.args.func="dist("+e.args.fids[0]+", "+e.args.fids[1]+")",A+=e.dest_sub_ids[1]+".setRadius(function() { return "+e.args.func+"; }); ",e.args.migrate!=0&&e.args.migrate!=-1?A+="$board.migratePoint("+e.dest_sub_ids[0]+", "+e.args.migrate+"); ":O+="delete "+e.dest_sub_ids[0]+"; ",O="delete "+e.dest_sub_ids[1]+"; "+O;break;case JXG.GENTYPE_MIGRATE:A+="$board.migratePoint("+e.src_ids[0]+", "+e.dest_id+"); ",O+="delete "+e.dest_id+"; ";break;case JXG.GENTYPE_TRANSFORM:A=e.dest_sub_ids[0]+" = transform("+e.args.tmat+") <>; ",A+="point("+e.src_ids[0]+", "+e.dest_sub_ids[0]+") <50?i=this.generateJCodeMeta(a[n],t):i=this.generateJCode(a[n],t,a),t.jc.parse(i[0],!0)}return u=a.pop(),i=u.boundingBox,t.setBoundingBox(i),t.options.grid.snapToGrid=!u.snapToGrid,t.options.point.snapToGrid=!u.snapToGrid,t.options.point.snapToPoints=!u.snapToPoints,""}}}); diff --git a/ajax/libs/jsxgraph/0.96/jsxgraphcore.js b/ajax/libs/jsxgraph/0.96/jsxgraphcore.js new file mode 100644 index 000000000..dddebd9b7 --- /dev/null +++ b/ajax/libs/jsxgraph/0.96/jsxgraphcore.js @@ -0,0 +1,32 @@ +/* Version 0.96 */ +/* + Copyright 2008-2012 + 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 . +*/ + var JXG={};(function(){var e,t;JXG.countDrawings=0,JXG.countTime=0,JXG.require=function(e){},JXG.rendererFiles={},JXG.rendererFiles.svg="SVGRenderer",JXG.rendererFiles.vml="VMLRenderer",JXG.rendererFiles.canvas="CanvasRenderer",JXG.baseFiles=null,JXG.requirePath="";if(typeof document!="undefined")for(e=0;e-1},isWebkitAndroid:function(){return this.isAndroid()&&navigator.userAgent.search(" AppleWebKit/")>-1},isApple:function(){return JXG.exists(navigator)&&(navigator.userAgent.search(/iPad/)!=-1||navigator.userAgent.search(/iPhone/)!=-1)},isWebkitApple:function(){return this.isApple()&&navigator.userAgent.search(/Mobile *.*Safari/)>-1},isMetroApp:function(){return typeof window!="undefined"&&window.clientInformation&&window.clientInformation.appName&&window.clientInformation.appName.indexOf("MSAppHost")>-1},clearVisPropOld:function(e){e.visPropOld={strokecolor:"",strokeopacity:"",strokewidth:"",fillcolor:"",fillopacity:"",shadow:!1,firstarrow:!1,lastarrow:!1,cssclass:"",fontsize:-1}},ieVersion:function(){var e;if(typeof document=="undefined")return e;var t=3,n=document.createElement("div"),r=n.getElementsByTagName("i");while(n.innerHTML="",r[0]);return t>4?t:e}(),getReference:function(e,t){return typeof t=="string"&&(JXG.exists(e.objects[t])?t=e.objects[t]:JXG.exists(e.elementsByName[t])?t=e.elementsByName[t]:JXG.exists(e.groups[t])&&(t=e.groups[t])),t},getRef:JXG.shortcut(JXG,"getReference"),isId:function(e,t){return typeof t=="string"&&!!e.objects[t]},isName:function(e,t){return typeof t=="string"&&!!e.elementsByName[t]},isGroup:function(e,t){return typeof t=="string"&&!!e.groups[t]},isString:function(e){return typeof e=="string"},isNumber:function(e){return typeof e=="number"},isFunction:function(e){return typeof e=="function"},isArray:function(e){var t;return Array.isArray?t=Array.isArray(e):t=e!==null&&typeof e=="object"&&"splice"in e&&"join"in e,t},isPoint:function(e){return typeof e=="object"?e.elementClass==JXG.OBJECT_CLASS_POINT:!1},exists:function(e){return function(t){return t!==e&&t!==null}}(),def:function(e,t){return JXG.exists(e)?e:t},str2Bool:function(e){return JXG.exists(e)?typeof e=="boolean"?e:JXG.isString(e)?e.toLowerCase()=="true":!1:!0},_board:function(e,t){return JXG.JSXGraph.initBoard(e,t)},createEvalFunction:function(e,t,n){var r=[],i,s;for(i=0;i=n[r].length;i++){s=0;while(s=0;r--)JXG.removeEvent(e,t,n["x_internal"+t][r].origin,n);n["x_internal"+t].length>0&&JXG.debug("removeAllEvents: Not all events could be removed.")}},bind:function(e,t){return function(){return e.apply(t,arguments)}},removeElementFromArray:function(e,t){var n;for(n=0;n=9?n=e.currentStyle[t]:e.style&&(t=t.replace(/-([a-z]|[0-9])/ig,function(e,t){return(t+"").toUpperCase()}),n=e.style[t]),n},getCSSTransform:function(e,t){var n=["transform","webkitTransform","MozTransform","msTransform","oTransform"],r,i,s,o,u,a,f,l,c;a=n.length;for(r=0,s="";r0){a=s.length,arrstr=s.substring(u+1,a-1),l=arrstr.split(",");for(i=0,f=l.length;i0){u=i.length,arrstr=i.substring(o+1,u-1),f=arrstr.split(",");for(r=0,a=f.length;r/g,">")},unescapeHTML:function(e){return e.replace(/<\/?[^>]+>/gi,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")},clone:function(e){var t={};return t.prototype=e,t},cloneAndCopy:function(e,t){var n=function(){},r;n.prototype=e;for(r in t)n[r]=t[r];return n},deepCopy:function(e,t,n){var r,i,s,o,u;n=n||!1;if(typeof e!="object"||e==null)return e;if(this.isArray(e)){r=[];for(i=0;i0&&+(new Date)-s<300);i.length>0?setTimeout(arguments.callee,1):r(e)},1)},trimNumber:function(e){e=e.replace(/^0+/,""),e=e.replace(/0+$/,"");if(e[e.length-1]=="."||e[e.length-1]==",")e=e.slice(0,-1);if(e[0]=="."||e[0]==",")e="0"+e;return e},trim:function(e){return e=e.replace(/^\s+/,""),e=e.replace(/\s+$/,""),e},evaluate:function(e){return JXG.isFunction(e)?e():e},eliminateDuplicates:function(e){var t,n=e.length,r=[],i={};for(t=0;t.1?t=e.toFixed(2):t>=.01?t=e.toFixed(4):t>=1e-4?t=e.toFixed(6):t=e,t},debug:function(e){var t;for(t=0;t")},debugWST:function(e){var t;JXG.debug(e),window.console&&console.log&&(t=new Error,t&&t.stack&&(console.log("stacktrace"),console.log(t.stack.split("\n").slice(1).join("\n"))))},uniqueArray:function(e){var t,n,r,i=[];if(e.length===0)return[];r=JXG.isArray(e[0]);for(t=0;t/g,""),e[n].innerHTML=c;if(t.toLowerCase().indexOf("script")>-1)s.construct(c);else try{s.jc.parse(c)}catch(h){JXG.debug(h)}}else JXG.debug("JSXGraph: Apparently the div injection failed. Can't create a board, sorry.")}}},window),JXG.EventEmitter={eventHandlers:{},triggerEventHandlers:function(e){var t,n,r=Array.prototype.slice.call(arguments,1),i,s,o,u;JXG.isArray(e)||(e=[e]),o=e.length;for(i=0;i-1&&this.eventHandlers[e].splice(n,1)):this.eventHandlers[e].length=0,this)},eventify:function(e){e.eventHandlers={},e.on=this.on,e.off=this.off,e.triggerEventHandlers=this.triggerEventHandlers}},JXG.Math=function(e,t,n){var r=function(e){var t,r;return e.memo?e.memo:(t={},r=Array.prototype.join,e.memo=function(){var i=r.call(arguments);return t[i]!==n?t[i]:t[i]=e.apply(this,arguments)})};return{eps:1e-6,mod:function(e,n){return e-t.floor(e/n)*n},vector:function(e,n){var r,i;n=n||0,r=new Array(t.ceil(e));for(i=0;i0?t[0].length:0,i=t.length,s=this.matrix(n,r),o,u,a,f;for(o=0;o0?e[0].length:0,t=this.matrix(s,i);for(n=0;nu&&(u=t.abs(c[r][i]),a=r);if(u<=e.Math.eps)return!1;if(a>i){for(s=0;se||n<0)return NaN;n=t.round(n),e=t.round(e);if(n===0||n===e)return 1;r=1;for(i=0;i0?t.exp(n*t.log(t.abs(e))):NaN},squampow:function(e,n){var r;if(t.floor(n)===n){r=1,n<0&&(e=1/e,n*=-1);while(n!=0)n&1&&(r*=e),n>>=1,e*=e;return r}return this.pow(e,n)},normalize:function(e){var n=2*e[3],r=e[4]/n,i,s;return e[5]=r,e[6]=-e[1]/n,e[7]=-e[2]/n,r===Infinity||isNaN(r)?(i=t.sqrt(e[1]*e[1]+e[2]*e[2]),e[0]/=i,e[1]/=i,e[2]/=i,e[3]=0,e[4]=1):t.abs(r)>=1?(e[0]=(e[6]*e[6]+e[7]*e[7]-r*r)/(2*r),e[1]=-e[6]/r,e[2]=-e[7]/r,e[3]=1/(2*r),e[4]=1):(s=r<=0?-1:1,e[0]=s*(e[6]*e[6]+e[7]*e[7]-r*r)*.5,e[1]=-s*e[6],e[2]=-s*e[7],e[3]=s/2,e[4]=s*r),e},toGL:function(e){var t,n,r;typeof Float32Array!="undefined"?t=new Float32Array(16):t=new Array(16);if(e.length!==4&&e[0].length!==4)return t;for(n=0;n<4;n++)for(r=0;r<4;r++)t[n+4*r]=e[n][r];return t}}}(JXG,Math),JXG.Math.Numerics=function(e,t){var n={rk4:{s:4,A:[[0,0,0,0],[.5,0,0,0],[0,.5,0,0],[0,0,1,0]],b:[1/6,1/3,1/3,1/6],c:[0,.5,.5,1]},heun:{s:2,A:[[0,0],[1,0]],b:[.5,.5],c:[0,1]},euler:{s:1,A:[[0]],b:[1],c:[0]}};return{Gauss:function(n,r){var i=e.Math.eps,s=n.length>0?n[0].length:0,o,u,a,f,l,c=function(e,t){var n=this[e];this[e]=this[t],this[t]=n};if(s!==r.length||s!==n.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.");o=new Array(s),u=r.slice(0,s);for(a=0;af;a--)if(t.abs(o[a][f])>i)if(t.abs(o[f][f])0?e[0].length:0;for(o=i-1;o>=0;o--){for(u=s-1;u>o;u--)r[o]-=e[o][u]*r[u];r[o]/=e[o][o]}return r},gaussBareiss:function(n){var r,i,s,o,u,a,f,l,c,h=e.Math.eps;f=n.length;if(f<=0)return 0;n[0].length=h)break;if(o==f)return 0;for(u=r;up&&(p=o),h+=o;if(o>=l){o=t.atan2(2*m[r][i],m[r][r]-m[i][i])*.5,u=t.sin(o),a=t.cos(o);for(s=0;sl&&g<2e3);return[m,v]},NewtonCotes:function(e,t,n){var r=0,i=n&&typeof n.number_of_nodes=="number"?n.number_of_nodes:28,s={trapez:!0,simpson:!0,milne:!0},o=n&&n.integration_type&&s.hasOwnProperty(n.integration_type)&&s[n.integration_type]?n.integration_type:"milne",u=(e[1]-e[0])/i,a,f,l;switch(o){case"trapez":r=(t(e[0])+t(e[1]))*.5,a=e[0];for(f=0;f0)throw new Error("JSXGraph: INT_SIMPSON requires config.number_of_nodes dividable by 2.");l=i/2,r=t(e[0])+t(e[1]),a=e[0];for(f=0;f0)throw new Error("JSXGraph: Error in INT_MILNE: config.number_of_nodes must be a multiple of 4");l=i*.25,r=7*(t(e[0])+t(e[1])),a=e[0];for(f=0;fo)f=this.D(n,i)(r),a+=2,t.abs(f)>o?r-=u/f:r+=t.random()*.2-1,u=n.apply(i,[r]),a++,s++;return r},root:function(e,t,n){return this.fzero(e,t,n)},Neville:function(t){var n=[],r=function(r){return function(i,s){var o,u,a,f=e.Math.binomial,l=t.length,c=l-1,h=0,d=0;if(!s){a=1;for(o=0;o=0;s--)h[s]=(a[s]-l[s+1]*h[s+1])/u[s];for(s=r-3;s>=0;s--)h[s+1]=h[s];return h[0]=0,h[r-1]=0,h},splineEval:function(n,r,i,s){var o=t.min(r.length,i.length),u=1,a=!1,f=[],l,c,h,p,d,v,m;e.isArray(n)?(u=n.length,a=!0):n=[n];for(l=0;lr[o-1])return NaN;for(c=1;c=0;s--)i=i.concat(["(",e[s].toPrecision(r),")"]),s>1?i=i.concat(["*",n,"",s,"<","/sup> + "]):s===1&&(i=i.concat(["*",n," + "]));return i.join("")},lagrangePolynomial:function(e){var t=[],n=function(n,r){var i,s,o,u,a,f=0,l=0,c,h;o=e.length;if(!r){for(i=0;i=f-3?r[f-2][o]():(l=t.floor(u),l==u?r[l][o]():(u-=l,c=n[o][l],.5*(((c[3]*u+c[2])*u+c[1])*u+c[0])))}};return[o("X"),o("Y"),0,function(){return e.length-1}]},regressionPolynomial:function(n,r,i){var s,o,u,a,f,l,c="";if(e.isPoint(n)&&typeof n.Value=="function")o=function(){return n.Value()};else if(e.isFunction(n))o=n;else{if(!e.isNumber(n))throw new Error("JSXGraph: Can't create regressionPolynomial from degree of type'"+typeof n+"'.");o=function(){return n}}if(arguments.length==3&&e.isArray(r)&&e.isArray(i))f=0;else{if(!(arguments.length==2&&e.isArray(r)&&r.length>0&&e.isPoint(r[0])))throw new Error("JSXGraph: Can't create regressionPolynomial. Wrong parameters.");f=1}return l=function(n,l){var h,p,d,v,m,g,y,b,w,E=r.length;w=t.floor(o());if(!l){if(f===1){u=[],a=[];for(h=0;h=0;h--)b=b*n+s[h];return b},l.getTerm=function(){return c},l},bezier:function(e){var n,r=function(r){return function(i,s){var o=t.floor(i)*3,u=i%1,a=1-u;return s||(n=t.floor(e.length/3)),i<0?e[0][r]():i>=n?e[e.length-1][r]():isNaN(i)?NaN:a*a*(a*e[o][r]()+3*u*e[o+1][r]())+(3*a*e[o+2][r]()+u*e[o+3][r]())*u*u}};return[r("X"),r("Y"),0,function(){return t.floor(e.length/3)}]},bspline:function(e,n){var r,i=[],s=function(e,t){var n,r=[];for(n=0;n=i?a=0:a=l[o+1],f=t[o+s-1]-t[o],f==0?l[o]=0:l[o]=(e-t[o])/f*u,f=t[o+s]-t[o+1],f!=0&&(l[o]+=(t[o+s]-e)/f*a);return l},u=function(u){return function(a,f){var l=e.length,c,h,p,d=l-1,v=n;if(d<=0)return NaN;d+2<=v&&(v=d+1);if(a<=0)return e[0][u]();if(a>=d-v+2)return e[d][u]();r=s(d,v),p=t.floor(a)+v-1,i=o(a,r,d,v,p),c=0;for(h=p-v+1;h<=p;h++)h=0&&(c+=e[h][u]()*i[h]);return c}};return[u("X"),u("Y"),0,function(){return e.length-1}]},D:function(t,n){var r=1e-5,i=1/(r*2);return arguments.length==1||arguments.length>1&&!e.exists(arguments[1])?function(e,n){return(t(e+r,n)-t(e-r,n))*i}:function(e,s){return(t.apply(n,[e+r,s])-t.apply(n,[e-r,s]))*i}},riemann:function(e,n,r,i,s){var o=[],u=[],a,f=0,l,c=i,h,p,d,v,m=0;n=t.round(n),o[f]=c,u[f]=0;if(n>0){l=(s-i)/n,v=l*.01;for(a=0;ah&&(h=d)}else h=e(c+l*t.random());f++,o[f]=c,u[f]=h,f++,c+=l,r==="trapezodial"&&(h=e(c)),o[f]=c,u[f]=h,f++,o[f]=c,u[f]=0,m+=h*l}}return[o,u,m]},riemannsum:function(e,n,r,i,s){var o=0,u,a,f=i,l,c,h,p;n=t.floor(n);if(n>0){a=(s-i)/n,p=a*.01;for(u=0;ul&&(l=h)}else l=e(f+a*t.random());o+=a*l,f+=a}}return o},rungeKutta:function(t,r,i,s,o){var u=[],a=[],f=(i[1]-i[0])/s,l=i[0],c,h,p,d,v,m=r.length,g,y=[],b=0;e.isString(t)&&(t=n[t]||n.euler),g=t.s;for(c=0;c0)return e.isArray(r)?this.fminbr(n,[l,c],i):this.Newton(n,l,i);h=l,v=p;while(u=x&&t.abs(p)>t.abs(d)&&(L=h-c,l==h?(k=d/p,T=L*k,N=1-k):(N=p/v,k=d/v,A=d/p,T=A*(L*N*(N-k)-(c-l)*(k-1)),N=(N-1)*(k-1)*(A-1)),T>0?N=-N:T=-T,T<.75*L*N-t.abs(x*N)*.5&&T0?C=x:C=-x),l=c,p=d,c+=C,d=n.apply(i,[c]),a++;if(d>0&&v>0||d<0&&v<0)h=l,v=p;u++}return c},fminbr:function(n,r,i){var s,o,u,a,f,l,c,h,p=(3-t.sqrt(5))*.5,d=e.Math.eps,v=t.sqrt(e.Math.eps),m=this.maxIterationsMinimize,g=0,y,b,w,E,S,x,T,N,C=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.");s=r[0],o=r[1],a=s+p*(o-s),c=n.apply(i,[a]),C++,u=a,f=a,l=c,h=c;while(g=w&&(T=(u-f)*(l-c),x=(u-a)*(l-h),S=(u-a)*x-(u-f)*T,x=2*(x-T),x>0?S=-S:x=-x,t.abs(S)x*(s-u+2*w)&&S0?E=w:E=-w),T=u+E,N=n.apply(i,[T]),C++;if(N<=l)Tr?(a(e,t,s[1],r,i),a(e,s[1],n,r,i)):i.push(e[n])},f=function(n,r,i){var s=0,o=r,u,a,f,l,c,h,p,d,v,m,g;if(i-r<2)return[-1,0];f=n[r].scrCoords,l=n[i].scrCoords;if(isNaN(f[1]+f[2]+l[1]+l[2]))return[NaN,i];for(a=r+1;a=e.Math.eps?(g=(h*d+p*v)/m,g<0?g=0:g>1&&(g=1),h-=g*d,p-=g*v,u=h*h+p*p):(g=0,u=h*h+p*p),u>s&&(s=u,o=a);return[t.sqrt(s),o]};u=n.length,s=0;while(ss&&isNaN(n[o].scrCoords[1]+n[o].scrCoords[2]))o--;return s>o||s==u||(i[0]=n[s],a(n,s,o,r,i)),i}}}(JXG,Math),JXG.Math.Statistics={sum:function(e){var t,n=e.length,r=0;for(t=0;t0?this.sum(e)/e.length:0},median:function(e){var t,n;return e.length>0?(t=e.slice(0),t.sort(function(e,t){return e-t}),n=t.length,n%2==1?t[parseInt(n*.5)]:(t[n*.5-1]+t[n*.5])*.5):0},variance:function(e){var t,n,r,i=e.length;if(i>1){t=this.mean(e),n=0;for(r=0;r0?this.mean(this.multiply(e,t)):0},max:function(e){return Math.max.apply(this,e)},min:function(e){return Math.min.apply(this,e)},range:function(e){return[this.min(e),this.max(e)]},abs:function(e){var t,n,r;if(JXG.isArray(e)){n=e.length,r=[];for(t=0;t0){o=i[a].generatePolynomial();for(l=0;l0){C.toOrigin!==t&&C.toOrigin!=null&&N(C.toOrigin.id,n.listOfFreePoints)?c=C.toOrigin:c=n.listOfFreePoints[0],v=c.symbolic.x,m=c.symbolic.y;for(p=0;p1){C.to10!==t&&C.to10!=null&&C.to10.id!=C.toOrigin.id&&N(C.to10.id,n.listOfFreePoints)?h=C.to10:n.listOfFreePoints[0].id==c.id?h=n.listOfFreePoints[1]:h=n.listOfFreePoints[0],g=e.Math.Geometry.rad([1,0],[0,0],[h.symbolic.x,h.symbolic.y]),y=Math.cos(-g),b=Math.sin(-g);for(p=0;pe.Math.eps){d=h.symbolic.x;for(p=0;pc&&(h+=Math.PI),u=Math.cos(h)+s[1],a=Math.sin(h)+s[2],new JXG.Coords(JXG.COORDS_BY_USER,[u,a],r)},reflection:function(e,t,n){var r=t.coords.usrCoords,i=e.point1.coords.usrCoords,s=e.point2.coords.usrCoords,o,u,a,f,l,c,h;return JXG.exists(n)||(n=t.board),l=s[1]-i[1],c=s[2]-i[2],o=r[1]-i[1],u=r[2]-i[2],h=(l*u-c*o)/(l*l+c*c),a=r[1]+2*h*c,f=r[2]-2*h*l,new JXG.Coords(JXG.COORDS_BY_USER,[a,f],n)},rotation:function(e,t,n,r){var i=t.coords.usrCoords,s=e.coords.usrCoords,o,u,a,f,l,c;return JXG.exists(r)||(r=t.board),o=i[1]-s[1],u=i[2]-s[2],a=Math.cos(n),f=Math.sin(n),l=o*a-u*f+s[1],c=o*f+u*a+s[2],new JXG.Coords(JXG.COORDS_BY_USER,[l,c],r)},perpendicular:function(e,t,n){var r=e.point1.coords.usrCoords,i=e.point2.coords.usrCoords,s=t.coords.usrCoords,o,u,a,f,l,c,h,p;return JXG.exists(n)||(n=t.board),t==e.point1?(o=r[1]+i[2]-r[2],u=r[2]-i[1]+r[1],a=!0):t==e.point2?(o=i[1]+r[2]-i[2],u=i[2]-r[1]+i[1],a=!1):Math.abs(r[1]-i[1])>JXG.Math.eps&&Math.abs(s[2]-(r[2]-i[2])*(s[1]-r[1])/(r[1]-i[1])-r[2])JXG.Math.eps&&(Math.abs(e[0])JXG.Math.eps){for(p=2;p>0;p--)c[h][p]/=c[h][0];c[h][0]=1}i=!1,s=!1,!a&&Math.abs(t.usrCoords[0])>=JXG.Math.eps&&t.scrCoords[1]>=0&&t.scrCoords[1]<=e.board.canvasWidth&&t.scrCoords[2]>=0&&t.scrCoords[2]<=e.board.canvasHeight&&(i=!0),!f&&Math.abs(n.usrCoords[0])>=JXG.Math.eps&&n.scrCoords[1]>=0&&n.scrCoords[1]<=e.board.canvasWidth&&n.scrCoords[2]>=0&&n.scrCoords[2]<=e.board.canvasHeight&&(s=!0),Math.abs(c[1][0])e.board.canvasHeight?u=c[2]:u=c[3]):c[1][2]>e.board.canvasHeight?(o=c[2],c[3][2]<0?u=c[0]:u=c[3]):(o=c[1],c[3][2]<0?u=c[0]:c[3][2]>e.board.canvasHeight?u=c[2]:u=c[3]),o=new JXG.Coords(JXG.COORDS_BY_SCREEN,o.slice(1),e.board),u=new JXG.Coords(JXG.COORDS_BY_SCREEN,u.slice(1),e.board);if(!i&&!s){if(!a&&f&&!this.isSameDirection(t,n,o)&&!this.isSameDirection(t,n,u))return;if(a&&!f&&!this.isSameDirection(n,t,o)&&!this.isSameDirection(n,t,u))return}i?s||(this.isSameDir(t,n,o,u)?v=u:v=o):s?this.isSameDir(t,n,o,u)?d=o:d=u:this.isSameDir(t,n,o,u)?(d=o,v=u):(v=o,d=u),d&&t.setCoordinates(JXG.COORDS_BY_USER,d.usrCoords.slice(1)),v&&n.setCoordinates(JXG.COORDS_BY_USER,v.usrCoords.slice(1))},isSameDir:function(e,t,n,r){var i=t.usrCoords[1]-e.usrCoords[1],s=t.usrCoords[2]-e.usrCoords[2],o=r.usrCoords[1]-n.usrCoords[1],u=r.usrCoords[2]-n.usrCoords[2];return Math.abs(t.usrCoords[0])=0},isSameDirection:function(e,t,n){var r,i,s,o,u=!1;r=t.usrCoords[1]-e.usrCoords[1],i=t.usrCoords[2]-e.usrCoords[2],s=n.usrCoords[1]-e.usrCoords[1],o=n.usrCoords[2]-e.usrCoords[2],Math.abs(r)=0&&s>=0){if(i>=0&&o>=0||i<=0&&o<=0)u=!0}else r<=0&&s<=0&&(i>=0&&o>=0||i<=0&&o<=0)&&(u=!0);return u},intersectLineLine:function(e,t,n){var r=e.point1.coords.usrCoords,i=e.point2.coords.usrCoords,s=t.point1.coords.usrCoords,o=t.point2.coords.usrCoords,u,a,f,l,c;return JXG.exists(n)||(n=e.board),u=r[1]*i[2]-r[2]*i[1],a=s[1]*o[2]-s[2]*o[1],f=(i[2]-r[2])*(s[1]-o[1])-(r[1]-i[1])*(o[2]-s[2]),Math.abs(f)0?(u=e.center.Dist(t.point1),a=e.center.Dist(t.point2),f=(u*u+o*o-a*a)/(2*o),l=u*u-f*f,l=l<0?0:l,c=Math.sqrt(l),h=e.Radius(),p=Math.sqrt(h*h-c*c),d=i[1]-r[1],v=i[2]-r[2],m=s[1]+c/o*v,g=s[2]-c/o*d,u=i[1]*v-i[2]*d,a=m*d+g*v,y=v*v+d*d,Math.abs(y)a?[0]:l=i&&Math.abs(t[3])=i?this.meetLineCircle(e,t,n,r):this.meetCircleCircle(e,t,n,r)},meetLineLine:function(e,t,n,r){var i=JXG.Math.crossProduct(e,t);return Math.abs(i[0])>JXG.Math.eps&&(i[1]/=i[0],i[2]/=i[0],i[0]=1),new JXG.Coords(JXG.COORDS_BY_USER,i,r)},meetLineCircle:function(e,t,n,r){var i,s,o,u,a,f,l,c,h,p;return t[4]=0?(h=Math.sqrt(h),p=[(-l+h)/(2*f),(-l-h)/(2*f)],n==0?new JXG.Coords(JXG.COORDS_BY_USER,[-p[0]*-a[1]-u*a[0],-p[0]*a[0]-u*a[1]],r):new JXG.Coords(JXG.COORDS_BY_USER,[-p[1]*-a[1]-u*a[0],-p[1]*a[0]-u*a[1]],r)):new JXG.Coords(JXG.COORDS_BY_USER,[0,0,0],r))},meetCircleCircle:function(e,t,n,r){var i;return e[4]JXG.Math.eps&&s<10)a=m(o),f=-g(u),l=y(o),c=-b(u),h=a*c-f*l,o-=(c*p-f*d)/h,u-=(a*d-l*p)/h,p=e.X(o)-t.X(u),d=e.Y(o)-t.Y(u),v=p*p+d*d,s++;return arguments.callee.t1memo=o,arguments.callee.t2memo=u,Math.abs(o).1&&Math.abs(d-e.X(s))>.1&&Math.abs(v-e.Y(s))>.1)){l=20,c=(e.maxX()-e.minX())/l,f=e.minX();for(o=0;o.1&&Math.abs(d-e.X(s))>.1&&Math.abs(v-e.Y(s))>.1)break;f+=c}}i=s,arguments.callee.t2memo=i}return Math.abs(u(i))>JXG.Math.eps?a=NaN:a=1,new JXG.Coords(JXG.COORDS_BY_USER,[a,e.X(i),e.Y(i)],r)},meetCurveLineDiscrete:function(e,t,n,r,i){var s,o,u,a,f,l,c=0,h,p,d=!1;s=e.numberPoints,i!=null&&(p=i.point,JXG.exists(p)&&!p.visProp.alwaysintersect&&(d=!0)),f=new JXG.Coords(JXG.COORDS_BY_USER,[0,NaN,NaN],r),a=[1,e.X(0),e.Y(0)];for(o=1;o1))break;f=new JXG.Coords(JXG.COORDS_BY_USER,h[0],r);break}c++}}return f},meetSegmentSegment:function(e,t,n,r,i){var s=JXG.Math.crossProduct(e,t),o=JXG.Math.crossProduct(n,r),u=JXG.Math.crossProduct(s,o),a=u[0],f,l,c;return Math.abs(a)r.maxX()&&(n=r.minX()+n-r.maxX()),s=new JXG.Coords(JXG.COORDS_BY_USER,[r.X(n),r.Y(n)],i)}else if(r.visProp.curvetype=="plot"){n=0,c=x,r.numberPoints==0?s=[0,1,1]:s=[r.Z(0),r.X(0),r.Y(0)];if(r.numberPoints>1){y=[r.Z(0),r.X(0),r.Y(0)];for(o=0;o1&&o+1==r.numberPoints-1&&(m=b,h=this.distance(m,v),g=r.numberPoints-1),h-1?this.monomials[n].coefficient+=t*e.coefficient:(e.coefficient*=t,this.monomials.push(e))},add:function(e){var t;if(!JXG.exists(e)||e.ring!==this.ring)throw new Error("JSXGraph error: In JXG.Math.Poly.polynomial.add either summand is undefined or rings don't match.");if(JXG.isArray(e.exponents))this.addSubMonomial(e,1);else for(t=0;t1&&this.makeArrows(e)},drawEllipse:function(e){this.appendChildPrim(this.createPrim("ellipse",e.id),e.visProp.layer),this.appendNodesToElement(e,"ellipse"),this.updateEllipse(e)},updateEllipse:function(e){this._updateVisual(e);var t=e.Radius();t>0&&Math.abs(e.center.coords.usrCoords[0])>JXG.Math.eps&&!isNaN(t+e.center.coords.scrCoords[1]+e.center.coords.scrCoords[2])&&t*e.board.unitX<2e6&&this.updateEllipsePrim(e.rendNode,e.center.coords.scrCoords[1],e.center.coords.scrCoords[2],t*e.board.unitX,t*e.board.unitY)},drawPolygon:function(e){this.appendChildPrim(this.createPrim("polygon",e.id),e.visProp.layer),this.appendNodesToElement(e,"polygon"),this.updatePolygon(e)},updatePolygon:function(e){this._updateVisual(e,{stroke:!0,dash:!0}),this.updatePolygonPrim(e.rendNode,e)},displayCopyright:function(e,t){},drawInternalText:function(e){},updateInternalText:function(e){},drawText:function(e){var t,n;e.visProp.display==="html"?(t=this.container.ownerDocument.createElement("div"),t.style.position="absolute",t.className=e.visProp.cssclass,this.container.style.zIndex==""?n=0:n=parseInt(this.container.style.zIndex),t.style.zIndex=n+e.board.options.layer.text,this.container.appendChild(t),t.setAttribute("id",this.container.id+"_"+e.id)):t=this.drawInternalText(e),e.rendNode=t,e.htmlStr="",this.updateText(e)},updateText:function(e){var t=e.plaintext;e.visProp.visible&&(this.updateTextStyle(e,!1),e.visProp.display==="html"?(isNaN(e.coords.scrCoords[1]+e.coords.scrCoords[2])||(e.visProp.anchorx==="right"?e.rendNode.style.right=parseInt(e.board.canvasWidth-e.coords.scrCoords[1])+"px":e.visProp.anchorx==="middle"?e.rendNode.style.left=parseInt(e.coords.scrCoords[1]-.5*e.size[0])+"px":e.rendNode.style.left=parseInt(e.coords.scrCoords[1])+"px",e.visProp.anchory==="top"?e.rendNode.style.top=parseInt(e.coords.scrCoords[2]+this.vOffsetText)+"px":e.visProp.anchory==="middle"?e.rendNode.style.top=parseInt(e.coords.scrCoords[2]-.5*e.size[1]+this.vOffsetText)+"px":e.rendNode.style.top=parseInt(e.coords.scrCoords[2]-e.size[1]+this.vOffsetText)+"px"),e.htmlStr!==t&&(e.rendNode.innerHTML=t,e.htmlStr=t,e.visProp.usemathjax?MathJax.Hub.Queue(["Typeset",MathJax.Hub,e.rendNode]):e.visProp.useasciimathml&&AMprocessNode(e.rendNode,!1)),this.transformImage(e,e.transformations)):this.updateInternalText(e))},updateTextStyle:function(e,t){var n,r,i,s,o=e.visProp;t?(i=o.highlightstrokecolor,r=o.highlightstrokeopacity,s=o.highlightcssclass):(i=o.strokecolor,r=o.strokeopacity,s=o.cssclass);if(e.visProp.display==="html"||this.type!="canvas"){n=JXG.evaluate(e.visProp.fontsize);if(e.visPropOld.fontsize!=n){try{e.rendNode.style.fontSize=n+"px"}catch(u){e.rendNode.style.fontSize=n}e.visPropOld.fontsize=n}e.visPropOld.cssclass!=s&&(e.rendNode.className=s,e.visPropOld.cssclass=s)}return e.visProp.display==="html"?this.setObjectStrokeColor(e,i,r):this.updateInternalTextStyle(e,i,r),this},updateInternalTextStyle:function(e,t,n){this.setObjectStrokeColor(e,t,n)},drawImage:function(e){},updateImage:function(e){this.updateRectPrim(e.rendNode,e.coords.scrCoords[1],e.coords.scrCoords[2]-e.size[1],e.size[0],e.size[1]),this.updateImageURL(e),this.transformImage(e,e.transformations),this._updateVisual(e,{stroke:!0,dash:!0},!0)},joinTransforms:function(e,t){var n=[[1,0,0],[0,1,0],[0,0,1]],r=e.board.origin.scrCoords[1],i=e.board.origin.scrCoords[2],s=e.board.unitX,o=e.board.unitY,u=[[1,0,0],[-r,1,0],[-i,0,1]],a=[[1,0,0],[0,1/s,0],[0,0,-1/o]],f=[[1,0,0],[0,s,0],[0,0,-o]],l=[[1,0,0],[r,1,0],[i,0,1]],c,h=t.length;for(c=0;c\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 BinFileReader(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 BinFileReader = b64String\nEnd Function\n\n'),JXG.GeonextParser={},JXG.GeonextParser.replacePow=function(e){var t,n,r,i,s,o,u,a,f,l,c;e=e.replace(/(\s*)\^(\s*)/g,"^"),f=e.indexOf("^");while(f>=0){a=e.slice(0,f),l=e.slice(f+1);if(a.charAt(a.length-1)==")"){t=1,n=a.length-2;while(n>=0&&t>0)r=a.charAt(n),r==")"?t++:r=="("&&t--,n--;if(t!=0)throw new Error("JSXGraph: Missing '(' in expression");i="",o=a.substring(0,n+1),u=n;while(u>=0&&o.substr(u,1).match(/([\w\.]+)/))i=RegExp.$1+i,u--;i+=a.substring(n+1,a.length),i=i.replace(/([\(\)\+\*\%\^\-\/\]\[])/g,"\\$1")}else i="[\\w\\.]+";if(l.match(/^([\w\.]*\()/)){t=1,n=RegExp.$1.length;while(n0)r=l.charAt(n),r==")"?t--:r=="("&&t++,n++;if(t!=0)throw new Error("JSXGraph: Missing ')' in expression");s=l.substring(0,n),s=s.replace(/([\(\)\+\*\%\^\-\/\[\]])/g,"\\$1")}else s="[\\w\\.]+";c=new RegExp("("+i+")\\^("+s+")"),e=e.replace(c,"JXG.Math.pow($1,$2)"),f=e.indexOf("^")}return e},JXG.GeonextParser.replaceIf=function(e){var t="",n,r,i=null,s=null,o=null,u,a,f,l,c,h,p;u=e.indexOf("If(");if(u<0)return e;e=e.replace(/""/g,"0");while(u>=0){n=e.slice(0,u),r=e.slice(u+3),f=1,a=0,l=-1,c=-1;while(a0)h=r.charAt(a),h==")"?f--:h=="("?f++:h==","&&f==1&&(l<0?l=a:c=a),a++;p=r.slice(0,a-1),r=r.slice(a);if(l<0)return"";if(c<0)return"";i=p.slice(0,l),s=p.slice(l+1,c),o=p.slice(c+1),i=this.replaceIf(i),s=this.replaceIf(s),o=this.replaceIf(o),t+=n+"(("+i+")?"+"("+s+"):("+o+"))",e=r,i=null,s=null,u=e.indexOf("If(")}return t+=r,t},JXG.GeonextParser.replaceSub=function(e){if(!e.indexOf)return e;var t=e.indexOf("_{"),n;while(t>=0)e=e.substr(0,t)+e.substr(t).replace(/_\{/,""),n=e.substr(t).indexOf("}"),n>=0&&(e=e.substr(0,n)+e.substr(n).replace(/\}/,"")),t=e.indexOf("_{");t=e.indexOf("_");while(t>=0)e=e.substr(0,t)+e.substr(t).replace(/_(.?)/,"$1"),t=e.indexOf("_");return e},JXG.GeonextParser.replaceSup=function(e){if(!e.indexOf)return e;var t=e.indexOf("^{"),n;while(t>=0)e=e.substr(0,t)+e.substr(t).replace(/\^\{/,""),n=e.substr(t).indexOf("}"),n>=0&&(e=e.substr(0,n)+e.substr(n).replace(/\}/,"")),t=e.indexOf("^{");t=e.indexOf("^");while(t>=0)e=e.substr(0,t)+e.substr(t).replace(/\^(.?)/,"$1"),t=e.indexOf("^");return e},JXG.GeonextParser.replaceNameById=function(e,t){var n=0,r,i,s,o,u=["X","Y","L","V"];for(o=0;o=0)n>=0&&(r=e.indexOf(")",n+2),r>=0&&(i=e.slice(n+2,r),i=i.replace(/\\(['"])?/g,"$1"),s=t.elementsByName[i],e=e.slice(0,n+2)+s.id+e.slice(r))),r=e.indexOf(")",n+2),n=e.indexOf(u[o]+"(",r)}n=e.indexOf("Dist(");while(n>=0)n>=0&&(r=e.indexOf(",",n+5),r>=0&&(i=e.slice(n+5,r),i=i.replace(/\\(['"])?/g,"$1"),s=t.elementsByName[i],e=e.slice(0,n+5)+s.id+e.slice(r))),r=e.indexOf(",",n+5),n=e.indexOf(",",r),r=e.indexOf(")",n+1),r>=0&&(i=e.slice(n+1,r),i=i.replace(/\\(['"])?/g,"$1"),s=t.elementsByName[i],e=e.slice(0,n+1)+s.id+e.slice(r)),r=e.indexOf(")",n+1),n=e.indexOf("Dist(",r);u=["Deg","Rad"];for(o=0;o=0)n>=0&&(r=e.indexOf(",",n+4),r>=0&&(i=e.slice(n+4,r),i=i.replace(/\\(['"])?/g,"$1"),s=t.elementsByName[i],e=e.slice(0,n+4)+s.id+e.slice(r))),r=e.indexOf(",",n+4),n=e.indexOf(",",r),r=e.indexOf(",",n+1),r>=0&&(i=e.slice(n+1,r),i=i.replace(/\\(['"])?/g,"$1"),s=t.elementsByName[i],e=e.slice(0,n+1)+s.id+e.slice(r)),r=e.indexOf(",",n+1),n=e.indexOf(",",r),r=e.indexOf(")",n+1),r>=0&&(i=e.slice(n+1,r),i=i.replace(/\\(['"])?/g,"$1"),s=t.elementsByName[i],e=e.slice(0,n+1)+s.id+e.slice(r)),r=e.indexOf(")",n+1),n=e.indexOf(u[o]+"(",r)}return e},JXG.GeonextParser.replaceIdByObj=function(e){var t=/(X|Y|L)\(([\w_]+)\)/g;return e=e.replace(t,'this.board.objects["$2"].$1()'),t=/(V)\(([\w_]+)\)/g,e=e.replace(t,'this.board.objects["$2"].Value()'),t=/(Dist)\(([\w_]+),([\w_]+)\)/g,e=e.replace(t,'this.board.objects["$2"].Dist(this.board.objects["$3"])'),t=/(Deg)\(([\w_]+),([ \w\[\w_]+),([\w_]+)\)/g,e=e.replace(t,'JXG.Math.Geometry.trueAngle(this.board.objects["$2"],this.board.objects["$3"],this.board.objects["$4"])'),t=/Rad\(([\w_]+),([\w_]+),([\w_]+)\)/g,e=e.replace(t,'JXG.Math.Geometry.rad(this.board.objects["$1"],this.board.objects["$2"],this.board.objects["$3"])'),t=/N\((.+)\)/g,e=e.replace(t,"($1)"),e},JXG.GeonextParser.geonext2JS=function(e,t){var n,r,i,s=["Abs","ACos","ASin","ATan","Ceil","Cos","Exp","Factorial","Floor","Log","Max","Min","Random","Round","Sin","Sqrt","Tan","Trunc"],o=["Math.abs","Math.acos","Math.asin","Math.atan","Math.ceil","Math.cos","Math.exp","JXG.Math.factorial","Math.floor","Math.log","Math.max","Math.min","Math.random","this.board.round","Math.sin","Math.sqrt","Math.tan","Math.ceil"];e=e.replace(/</g,"<"),e=e.replace(/>/g,">"),e=e.replace(/&/g,"&"),r=e,r=this.replaceNameById(r,t),r=this.replaceIf(r),r=this.replacePow(r),r=this.replaceIdByObj(r);for(i=0;i=0&&r[i].addChild(e)):(o=i.replace(/\[/g,"\\["),o=o.replace(/\]/g,"\\]"),s=new RegExp("\\(([\\w\\[\\]'_ ]+,)*("+o+")(,[\\w\\[\\]'_ ]+)*\\)","g"),t.search(s)>=0&&r[i].addChild(e)))},JXG.GeonextParser.gxt2jc=function(e,t){var n,r=["Sqrt"],i=["sqrt"];return e=e.replace(/</g,"<"),e=e.replace(/>/g,">"),e=e.replace(/&/g,"&"),n=e,n=this.replaceNameById2(n,t),n=n.replace(/True/g,"true"),n=n.replace(/False/g,"false"),n=n.replace(/fasle/g,"false"),n},JXG.GeonextParser.replaceNameById2=function(e,t){var n=0,r,i,s,o,u=["X","Y","L","V"];for(o=0;o=0)n>=0&&(r=e.indexOf(")",n+2),r>=0&&(i=e.slice(n+2,r),i=i.replace(/\\(['"])?/g,"$1"),s=t.elementsByName[i],e=e.slice(0,n+2)+"$('"+s.id+"')"+e.slice(r))),r=e.indexOf(")",n+2),n=e.indexOf(u[o]+"(",r)}n=e.indexOf("Dist(");while(n>=0)n>=0&&(r=e.indexOf(",",n+5),r>=0&&(i=e.slice(n+5,r),i=i.replace(/\\(['"])?/g,"$1"),s=t.elementsByName[i],e=e.slice(0,n+5)+"$('"+s.id+"')"+e.slice(r))),r=e.indexOf(",",n+5),n=e.indexOf(",",r),r=e.indexOf(")",n+1),r>=0&&(i=e.slice(n+1,r),i=i.replace(/\\(['"])?/g,"$1"),s=t.elementsByName[i],e=e.slice(0,n+1)+"$('"+s.id+"')"+e.slice(r)),r=e.indexOf(")",n+1),n=e.indexOf("Dist(",r);u=["Deg","Rad"];for(o=0;o=0)n>=0&&(r=e.indexOf(",",n+4),r>=0&&(i=e.slice(n+4,r),i=i.replace(/\\(['"])?/g,"$1"),s=t.elementsByName[i],e=e.slice(0,n+4)+"$('"+s.id+"')"+e.slice(r))),r=e.indexOf(",",n+4),n=e.indexOf(",",r),r=e.indexOf(",",n+1),r>=0&&(i=e.slice(n+1,r),i=i.replace(/\\(['"])?/g,"$1"),s=t.elementsByName[i],e=e.slice(0,n+1)+"$('"+s.id+"')"+e.slice(r)),r=e.indexOf(",",n+1),n=e.indexOf(",",r),r=e.indexOf(")",n+1),r>=0&&(i=e.slice(n+1,r),i=i.replace(/\\(['"])?/g,"$1"),s=t.elementsByName[i],e=e.slice(0,n+1)+"$('"+s.id+"')"+e.slice(r)),r=e.indexOf(")",n+1),n=e.indexOf(u[o]+"(",r)}return e},JXG.Board=function(e,t,n,r,i,s,o,u,a,f,l){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,this.BOARD_MODE_CONSTRUCT=16,this.CONSTRUCTION_TYPE_POINT=1129599060,this.CONSTRUCTION_TYPE_CIRCLE=1129595724,this.CONSTRUCTION_TYPE_LINE=1129598030,this.CONSTRUCTION_TYPE_GLIDER=1129596740,this.CONSTRUCTION_TYPE_MIDPOINT=1129598288,this.CONSTRUCTION_TYPE_PERPENDICULAR=1129599044,this.CONSTRUCTION_TYPE_PARALLEL=1129599052,this.CONSTRUCTION_TYPE_INTERSECTION=1129597267,this.container=e,this.containerObj=typeof document!="undefined"?document.getElementById(this.container):null;if(typeof document!="undefined"&&this.containerObj==null)throw new Error("\nJSXGraph: HTML container element '"+e+"' not found.");this.renderer=t,this.grids=[],this.options=JXG.deepCopy(JXG.Options),this.dimension=2,this.jc=new JXG.JessieCode,this.jc.use(this),this.origin={},this.origin.usrCoords=[1,0,0],this.origin.scrCoords=[1,r[0],r[1]],this.zoomX=i,this.zoomY=s,this.unitX=o*this.zoomX,this.unitY=u*this.zoomY,this.canvasWidth=a,this.canvasHeight=f,JXG.exists(n)&&n!==""&&typeof document!="undefined"&&!JXG.exists(document.getElementById(n))?this.id=n:this.id=this.generateId(),JXG.EventEmitter.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.mouse=null,this.touches=[],this.xmlString="",this.cPos=[],this.touchMoveLast=0,this.downObjects=[],this.showCopyright=!1;if(l!=null&&l||l==null&&this.options.showCopyright)this.showCopyright=!0,this.renderer.displayCopyright(JXG.JSXGraph.licenseText,parseInt(this.options.text.fontSize));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.hasMouseUp=!1,this.hasTouchEnd=!1,this.addEventHandlers(),this.methodMap={update:"update",on:"on",off:"off",setView:"setBoundingBox",setBoundingBox:"setBoundingBox",migratePoint:"migratePoint",colorblind:"emulateColorblindness"}},JXG.extend(JXG.Board.prototype,{generateName:function(e){if(e.type==JXG.OBJECT_TYPE_TICKS)return"";var t,n=2,r="",i="",s=[],o="",u,a;e.elementClass==JXG.OBJECT_CLASS_POINT?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"]:e.type==JXG.OBJECT_TYPE_ANGLE?t=["","α","β","γ","δ","ε","ζ","η","θ","ι","κ","λ","μ","ν","ξ","ο","π","ρ","σ","τ","υ","φ","χ","ψ","ω"]: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"],e.elementClass!==JXG.OBJECT_CLASS_POINT&&e.elementClass!=JXG.OBJECT_CLASS_LINE&&e.type!=JXG.OBJECT_TYPE_ANGLE&&(e.type===JXG.OBJECT_TYPE_POLYGON?r="P_{":e.elementClass===JXG.OBJECT_CLASS_CIRCLE?r="k_{":e.type===JXG.OBJECT_TYPE_TEXT?r="t_{":r="s_{",i="}");for(u=0;u0;u--)o+=t[s[u-1]];if(this.elementsByName[o+i]==null)return o+i}s[0]=t.length;for(u=1;u0&&(this.mode===JXG.BOARD_MODE_DRAG||this.mode===JXG.BOARD_MODE_MOVE_ORIGIN)?this.cPos:(!e.currentStyle&&n.defaultView&&(e=document.documentElement,t[0]+=r("margin-left"),t[1]+=r("margin-top"),t[0]+=r("border-left-width"),t[1]+=r("border-top-width"),t[0]+=r("padding-left"),t[1]+=r("padding-top"),e=this.containerObj),t[0]+=r("border-left-width"),t[1]+=r("border-top-width"),this.renderer.type!=="vml"&&(t[0]+=r("padding-left"),t[1]+=r("padding-top")),this.cPos=t,t)},getMousePosition:function(e,t){var n=this.getCoordsTopLeftCorner(),r,i;return r=JXG.getPosition(e,t),[r[0]-n[0],r[1]-n[1]]},initMoveOrigin:function(e,t){this.drag_dx=e-this.origin.scrCoords[1],this.drag_dy=t-this.origin.scrCoords[2],this.mode=this.BOARD_MODE_MOVE_ORIGIN},initMoveObject:function(e,t,n,r){var i,s,o=[],u,a=this.objectsList.length,f={visProp:{layer:-1e4}};for(s=0;s=f.visProp.layer){if(JXG.exists(f.label)&&i==f.label.content)continue;f=i,o[0]=f}}return o.length>0&&(this.mode=this.BOARD_MODE_DRAG),this.options.takeFirst&&(o.length=1),o},moveObject:function(e,t,n,r,i){var s=new JXG.Coords(JXG.COORDS_BY_SCREEN,this.getScrCoordsOfMouse(e,t),this),o=n.obj,u;o.type!=JXG.OBJECT_TYPE_GLIDER?(isNaN(n.targets[0].Xprev+n.targets[0].Yprev)||o.setPositionDirectly(JXG.COORDS_BY_SCREEN,s.scrCoords.slice(1),[n.targets[0].Xprev,n.targets[0].Yprev]),n.targets[0].Xprev=s.scrCoords[1],n.targets[0].Yprev=s.scrCoords[2],this.update(o)):o.type==JXG.OBJECT_TYPE_GLIDER&&(u=o.coords,o.setPositionDirectly(JXG.COORDS_BY_USER,s.usrCoords.slice(1)),o.slideObject.elementClass==JXG.OBJECT_CLASS_CIRCLE?o.coords=JXG.Math.Geometry.projectPointToCircle(o,o.slideObject,this):o.slideObject.elementClass==JXG.OBJECT_CLASS_LINE&&(o.coords=JXG.Math.Geometry.projectPointToLine(o,o.slideObject,this)),o.group.length!=0?(o.group[o.group.length-1].dX=o.coords.scrCoords[1]-u.scrCoords[1],o.group[o.group.length-1].dY=o.coords.scrCoords[2]-u.scrCoords[2],o.group[o.group.length-1].update(this)):this.update(o)),o.triggerEventHandlers([i+"drag","drag"],r),this.updateInfobox(o),this.update(),o.highlight(!0)},twoFingerMove:function(e,t,n,r){var i,s,o;if(!JXG.exists(n)||!JXG.exists(n.obj))return;o=n.obj,i=new JXG.Coords(JXG.COORDS_BY_SCREEN,this.getScrCoordsOfMouse(e[0],e[1]),this),s=new JXG.Coords(JXG.COORDS_BY_SCREEN,this.getScrCoordsOfMouse(t[0],t[1]),this),o.elementClass===JXG.OBJECT_CLASS_LINE||o.type===JXG.OBJECT_TYPE_POLYGON?this.twoFingerTouchObject(i,s,n,o):o.elementClass===JXG.OBJECT_CLASS_CIRCLE&&this.twoFingerTouchCircle(i,s,n,o),o.triggerEventHandlers(["touchdrag","drag"],r),n.targets[0].Xprev=i.scrCoords[1],n.targets[0].Yprev=i.scrCoords[2],n.targets[1].Xprev=s.scrCoords[1],n.targets[1].Yprev=s.scrCoords[2]},twoFingerTouchObject:function(e,t,n,r){var i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b;if(JXG.exists(n.targets[0])&&JXG.exists(n.targets[1])&&!isNaN(n.targets[0].Xprev+n.targets[0].Yprev+n.targets[1].Xprev+n.targets[1].Yprev)){i=e.usrCoords,s=t.usrCoords,o=(new JXG.Coords(JXG.COORDS_BY_SCREEN,[n.targets[0].Xprev,n.targets[0].Yprev],this)).usrCoords,u=(new JXG.Coords(JXG.COORDS_BY_SCREEN,[n.targets[1].Xprev,n.targets[1].Yprev],this)).usrCoords,f=[1,(o[1]+u[1])*.5,(o[2]+u[2])*.5],a=[1,(i[1]+s[1])*.5,(i[2]+s[2])*.5],c=JXG.Math.crossProduct(o,u),l=JXG.Math.crossProduct(i,s),p=JXG.Math.crossProduct(c,l);if(Math.abs(p[0])0&&(e.preventDefault(),e.stopPropagation());if(this.mode===this.BOARD_MODE_NONE&&this.touchOriginMoveStart(e))return this.triggerEventHandlers(["touchstart","down"],e),!1;if(JXG.isWebkitAndroid()){var p=new Date;this.touchMoveLast=p.getTime()-200}return this.options.precision.hasPoint=this.options.precision.mouse,this.triggerEventHandlers(["touchstart","down"],e),this.touches.length>0},touchMoveListener:function(e){var t,n=0,r,i=e[JXG.touchProperty];this.mode!==this.BOARD_MODE_NONE&&(e.preventDefault(),e.stopPropagation());if(JXG.isWebkitAndroid()){var s=new Date;s=s.getTime();if(s-this.touchMoveLast<80)return this.updateQuality=this.BOARD_QUALITY_HIGH,this.triggerEventHandlers(["touchmove","move"],e,this.mode),!1;this.touchMoveLast=s}this.mode!=this.BOARD_MODE_DRAG&&this.renderer.hide(this.infobox),this.options.precision.hasPoint=this.options.precision.touch;if(!this.touchOriginMove(e)&&this.mode==this.BOARD_MODE_DRAG)for(t=0;t-1&&this.touches[t].targets[1].num>-1&&i[this.touches[t].targets[0].num]&&i[this.touches[t].targets[1].num]&&(this.touches[t].targets[0].X=i[this.touches[t].targets[0].num].screenX,this.touches[t].targets[0].Y=i[this.touches[t].targets[0].num].screenY,this.touches[t].targets[1].X=i[this.touches[t].targets[1].num].screenX,this.touches[t].targets[1].Y=i[this.touches[t].targets[1].num].screenY,this.twoFingerMove(this.getMousePosition(e,this.touches[t].targets[0].num),this.getMousePosition(e,this.touches[t].targets[1].num),this.touches[t],e));return this.mode!=this.BOARD_MODE_DRAG&&this.renderer.hide(this.infobox),this.options.precision.hasPoint=this.options.precision.mouse,this.triggerEventHandlers(["touchmove","move"],e,this.mode),this.mode===this.BOARD_MODE_NONE},touchEndListener:function(e){var t,n,r,i=this.options.precision.touch,s=[],o,u,a=e[JXG.touchProperty];this.triggerEventHandlers(["touchend","up"],e),this.renderer.hide(this.infobox);if(a.length>0){for(t=0;t0?this.zoomIn(n.usrCoords[1],n.usrCoords[2]):this.zoomOut(n.usrCoords[1],n.usrCoords[2]),e.preventDefault(),!1},updateInfobox:function(e){var t,n,r,i;return e.visProp.showinfobox?(e.elementClass==JXG.OBJECT_CLASS_POINT&&(r=e.coords.usrCoords[1],i=e.coords.usrCoords[2],this.infobox.setCoords(r+this.infobox.distanceX/this.unitX,i+this.infobox.distanceY/this.unitY),typeof e.infoboxText!="string"?(e.visProp.infoboxdigits==="auto"?(t=JXG.autoDigits(r),n=JXG.autoDigits(i)):JXG.isNumber(e.visProp.infoboxdigits)?(t=r.toFixed(e.visProp.infoboxdigits),n=i.toFixed(e.visProp.infoboxdigits)):(t=r,n=i),this.highlightInfobox(t,n,e)):this.highlightCustomInfobox(e.infoboxText,e),this.renderer.show(this.infobox)),this):this},highlightCustomInfobox:function(e){return this.infobox.setText(e),this},highlightInfobox:function(e,t,n){return this.highlightCustomInfobox("("+e+", "+t+")"),this},dehighlightAll:function(){var e,t,n=!1;for(e in this.highlightedObjects)t=this.highlightedObjects[e],this.hasMouseHandlers&&t.noHighlight(),n=!0;return this.highlightedObjects={},this.options.renderer=="canvas"&&n&&(this.prepareUpdate(),this.renderer.suspendRedraw(this),this.updateRenderer(),this.renderer.unsuspendRedraw()),this},getScrCoordsOfMouse:function(e,t){return[e,t]},getUsrCoordsOfMouse:function(e){var t=this.getCoordsTopLeftCorner(),n=JXG.getPosition(e),r=n[0]-t[0],i=n[1]-t[1],s=new JXG.Coords(JXG.COORDS_BY_SCREEN,[r,i],this);return s.usrCoords.slice(1)},getAllUnderMouse:function(e){var t=this.getAllObjectsUnderMouse(e);return t.push(this.getUsrCoordsOfMouse(e)),t},getAllObjectsUnderMouse:function(e){var t=this.getCoordsTopLeftCorner(),n=JXG.getPosition(e),r=n[0]-t[0],i=n[1]-t[1],s=[],o,u,a=this.objectsList.length;for(o=0;o"),r=e.indexOf(""),i,s,o,u,a,f;if(n<0)return;while(n>=0){i=e.slice(n+6,r),s=i.indexOf("="),o=i.slice(0,s),u=i.slice(s+1),s=o.indexOf("."),a=o.slice(0,s),f=this.elementsByName[JXG.unescapeHTML(a)];var l=o.slice(s+1).replace(/\s+/g,"").toLowerCase();u=JXG.GeonextParser.geonext2JS(u,this),u=u.replace(/this\.board\./g,"this."),JXG.exists(this.elementsByName[a])||JXG.debug("debug conditions: |"+a+"| undefined"),t+='el = this.objects["'+f.id+'"];\n';switch(l){case"x":t+="var y=el.coords.usrCoords[2];\n",t+="el.setPositionDirectly(JXG.COORDS_BY_USER,["+u+",y]);\n",t+="el.prepareUpdate().update();\n";break;case"y":t+="var x=el.coords.usrCoords[1];\n",t+="el.coords=new JXG.Coords(JXG.COORDS_BY_USER,[x,"+u+"],this);\n",t+="el.setPositionDirectly(JXG.COORDS_BY_USER,[x,"+u+"]);\n",t+="el.prepareUpdate().update();\n";break;case"visible":t+="var c="+u+";\n",t+="el.visProp.visible = c;\n",t+="if (c) {el.showElement();} else {el.hideElement();}\n";break;case"position":t+="el.position = "+u+";\n",t+="el.prepareUpdate().update(true);\n";break;case"stroke":t+="rgbo = JXG.rgba2rgbo("+u+");\n",t+="el.visProp.strokecolor = rgbo[0];\n",t+="el.visProp.strokeopacity = rgbo[1];\n";break;case"style":t+="el.setStyle("+u+");\n";break;case"strokewidth":t+="el.strokeWidth = "+u+";\n";break;case"fill":t+="var rgbo = JXG.rgba2rgbo("+u+");\n",t+="el.visProp.fillcolor = rgbo[0];\n",t+="el.visProp.fillopacity = rgbo[1];\n";break;case"label":break;default:JXG.debug("property '"+l+"' in conditions not yet implemented:"+u)}e=e.slice(r+7),n=e.indexOf(""),r=e.indexOf("")}t+="this.prepareUpdate().updateElements();\n",t+="return true;\n",t=t.replace(/</g,"<"),t=t.replace(/>/g,">"),t=t.replace(/&/g,"&"),this.updateConditions=new Function(t),this.updateConditions()},updateConditions:function(){return!1},calculateSnapSizes:function(){var e=new JXG.Coords(JXG.COORDS_BY_USER,[0,0],this),t=new JXG.Coords(JXG.COORDS_BY_USER,[this.options.grid.gridX,this.options.grid.gridY],this),n=e.scrCoords[1]-t.scrCoords[1],r=e.scrCoords[2]-t.scrCoords[2];this.options.grid.snapSizeX=this.options.grid.gridX;while(Math.abs(n)>25)this.options.grid.snapSizeX*=2,n/=2;this.options.grid.snapSizeY=this.options.grid.gridY;while(Math.abs(r)>25)this.options.grid.snapSizeY*=2,r/=2;return this},applyZoom:function(){var e,t,n=this.objectsList.length;for(t=0;tt&&(t=f.coords.usrCoords[1]),f.coords.usrCoords[2]>r?r=f.coords.usrCoords[2]:f.coords.usrCoords[2]-1){this.objectsList.splice(e._pos,1);for(t=e._pos;t=0&&(t+=""+this.objects[e].id+":<"+"/b> ");for(n in this.objects[e].childElements)t+=this.objects[e].childElements[n].id+"("+this.objects[e].childElements[n].name+")"+", ";t+="

\n"}return t+="

\n",r=window.open(),r.document.open(),r.document.write(t),r.document.close(),this},showXML:function(){var e=window.open("");return e.document.open(),e.document.write("
"+JXG.escapeHTML(this.xmlString)+"<"+"/pre>"),e.document.close(),this},prepareUpdate:function(){var e,t,n=this.objectsList.length;for(e=0;eu&&s[f]=0;t--)this.dependentBoards[t]==e&&this.dependentBoards.splice(t,1);return this},update:function(e){var t,n,r,i;if(this.inUpdate||this.isSuspendedUpdate)return this;this.inUpdate=!0,this.prepareUpdate(e).updateElements(e).updateConditions(),this.renderer.suspendRedraw(this),this.updateRenderer(e),this.renderer.unsuspendRedraw(),this.triggerEventHandlers("update"),n=this.dependentBoards.length;for(t=0;t-S?(a=-E,g.applyOnce(o)):a>E&&a0&&(x=setInterval(this.rolling,s)),this},this.stop=function(){return clearInterval(x),this},this};return new a}}),JXG.Options={showCopyright:!0,showNavigation:!0,takeSizeFromFile:!1,renderer:"svg",takeFirst:!1,animationDelay:35,zoom:{factorX:1.25,factorY:1.25,wheel:!1,needShift:!1,eps:.1},pan:{needShift:!0,needTwoFingers:!0,enabled:!0},jc:{enabled:!0,compile:!0},navbar:{strokeColor:"#aaaaaa",fillColor:"#f5f5f5",padding:"2px",position:"absolute",fontSize:"10px",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,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,draft:{draft:!1,strokeColor:"#565656",fillColor:"#565656",strokeOpacity:.8,fillOpacity:.8,strokeWidth:1}},ticks:{drawLabels:!1,label:{},drawZero:!1,insertTicks:!1,minTicksDistance:50,minorHeight:4,majorHeight:10,minorTicks:4,scale:1,scaleSymbol:"",labels:[],ticksDistance:1,strokeOpacity:1,strokeWidth:1,strokeColor:"black",highlightStrokeColor:"#888888"},precision:{touch:30,touchMax:100,mouse: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,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:{label:{},firstArrow:!1,lastArrow:!1,fillColor:"none",highlightFillColor:"none",strokeColor:"#0000ff",highlightStrokeColor:"#C3D9FF",useDirection:!1},inequality:{fillColor:"red",fillOpacity:.2,strokeColor:"none",inverse:!1},axis:{needsRegularUpdate:!1,strokeWidth:1,strokeColor:"#666666",highlightStrokeWidth:1,highlightStrokeColor:"#888888",withTicks:!0,straightFirst:!0,straightLast:!0,lastArrow:!0,withLabel:!1,scalable:!1,ticks:{label:{offset:[4,-9]},needsRegularUpdate:!1,strokeWidth:1,strokeColor:"#666666",highlightStrokeColor:"#888888",drawLabels:!0,drawZero:!1,insertTicks:!0,minTicksDistance:10,minorHeight:4,majorHeight:-1,minorTicks:4,ticksDistance:1,strokeOpacity:.25},point1:{needsRegularUpdate:!1},point2:{needsRegularUpdate:!1},label:{position:"lft",offset:[10,-20]}},bisector:{strokeColor:"#000000",point:{visible:!1,fixed:!1,withLabel:!1,name:""}},bisectorlines:{line1:{strokeColor:"black"},line2:{strokeColor:"black"}},chart:{chartStyle:"line",colors:["#B02B2C","#3F4C6B","#C79810","#D15600","#FFFF88","#C3D9FF","#4096EE","#008C00"],highlightcolors:null,fillcolor:null,highlightonsector:!1,highlightbysize:!1},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:""}},curve:{strokeWidth:1,strokeColor:"#0000ff",fillColor:"none",fixed:!0,handDrawing:!1,curveType:null,RDPsmoothing:!1,numberPointsHigh:1600,numberPointsLow:400,doAdvancedPlot:!0,label:{position:"lft"}},glider:{label:{}},grid:{needsRegularUpdate:!1,hasGrid:!1,gridX:1,gridY:1,strokeColor:"#C0C0C0",strokeOpacity:"0.5",strokeWidth:1,dash:0,snapToGrid:!1,snapSizeX:10,snapSizeY:10},image:{imageString:null,fillOpacity:1,cssClass:"JXGimage",highlightCssClass:"JXGimageHighlight",rotate:0},incircle:{fillColor:"none",highlightFillColor:"none",strokeColor:"#0000ff",highlightStrokeColor:"#C3D9FF",center:{visible:!1,fixed:!1,withLabel:!1,name:""}},infobox:{fontSize:12,isLabel:!1,strokeColor:"#bbbbbb",display:"html",anchorX:"left",anchorY:"middle",cssClass:"JXGinfobox",rotate:0,visible:!0},integral:{withLabel:!0,strokeWidth:0,strokeOpacity:0,fillOpacity:.8,curveLeft:{visible:!0,layer:9},baseLeft:{visible:!1,fixed:!1,withLabel:!1,name:""},curveRight:{visible:!0,layer:9},baseRight:{visible:!1,fixed:!1,withLabel:!1,name:""},label:{fontSize:20}},intersection:{alwaysIntersect:!0},label:{strokeColor:"#552222",highlightStrokeOpacity:1,highlightStrokeColor:"#C3D9FF",fixed:!0,position:"urt",offset:[10,10]},legend:{style:"vertical",labels:["1","2","3","4","5","6","7","8"],colors:["#B02B2C","#3F4C6B","#C79810","#D15600","#FFFF88","#C3D9FF","#4096EE","#008C00"]},line:{firstArrow:!1,lastArrow:!1,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,maxTicksDistance:300,minorHeight:4,majorHeight:-1,minorTicks:4,defaultDistance:1,strokeOpacity:.3},label:{position:"llft"}},locus:{translateToOrigin:!1,translateTo10:!1,stretch:!1,toOrigin:null,to10:null},normal:{strokeColor:"#000000",point:{visible:!1,fixed:!1,withLabel:!1,name:""}},orthogonalprojection:{},parallel:{strokeColor:"#000000",point:{visible:!1,fixed:!1,withLabel:!1,name:""}},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,fillColor:"#ff0000",highlightFillColor:"#EEEEEE",strokeWidth:2,strokeColor:"#ff0000",highlightStrokeColor:"#C3D9FF",zoom:!1,showInfobox:!0,infoboxDigits:"auto",draft:!1,attractors:[],attractorDistance:0,snatchDistance:0,snapToGrid:!1,snapSizeX:1,snapSizeY:1,snapToPoints:!1},polygon:{hasInnerPoints:!1,fillColor:"#00FF00",highlightFillColor:"#00FF00",fillOpacity:.3,highlightFillOpacity:.3,withLines:!0,borders:{withLabel:!1,strokeWidth:1,highlightStrokeWidth:1,layer:5},vertices:{withLabel:!0,strokeColor:"#ff0000",fillColor:"#ff0000",fixed:!0},label:{offset:[0,0]}},prescribedangle:{anglepoint:{size:2,visible:!1,withLabel:!1}},riemannsum:{withLabel:!1,fillOpacity:.3,fillColor:"#ffff00"},sector:{fillColor:"#00FF00",highlightFillColor:"#00FF00",fillOpacity:.3,highlightFillOpacity:.3,label:{offset:[0,0]}},segment:{label:{position:"top"}},semicircle:{midpoint:{visible:!1,withLabel:!1,fixed:!1,name:""}},slider:{snapWidth:-1,precision:2,firstArrow:!1,lastArrow:!1,withTicks:!0,withLabel:!0,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,name:"",strokeWidth:1,strokeColor:"#000000",highlightStrokeColor:"#888888"},ticks:{needsRegularUpdate:!1,drawLabels:!1,drawZero:!0,insertTicks:!0,minorHeight:4,majorHeight:10,minorTicks:0,defaultDistance:1,strokeOpacity:1,strokeWidth:1,strokeColor:"#000000"},highline:{strokeWidth:3,name:"",strokeColor:"#000000",highlightStrokeColor:"#888888"},label:{strokeColor:"#000000"}},text:{fontSize:12,digits:2,isLabel:!1,strokeColor:"#552222",useASCIIMathML:!1,useMathJax:!1,display:"html",anchorX:"left",anchorY:"middle",cssClass:"JXGtext",highlightCssClass:"JXGtext",withLabel:!1,rotate:0,visible:!0},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"]}},JXG.Validator=function(){var e=function(e){return/^[0-9]+px$/.test(e)},t=function(e){return e in{html:0,internal:0}},n=function(e){return JXG.isString(e)},r=function(e){return JXG.exists(JXG.Point.prototype.normalizeFace.call(this,e))},i=function(e){return Math.abs(e-Math.round(e))0},o=function(e){return e.length>=2&&i(e[0])&&i(e[1])},u=function(e){return e in{vml:0,svg:0,canvas:0}},a=function(e){return e>0},f=function(e){return!(e<0)},l,c={},h={attractorDistance:f,color:n,defaultDistance:JXG.isNumber,display:t,doAdvancedPlot:!1,draft:!1,drawLabels:!1,drawZero:!1,face:r,factor:JXG.isNumber,fillColor:n,fillOpacity:JXG.isNumber,firstArrow:!1,fontSize:i,dash:i,gridX:JXG.isNumber,gridY:JXG.isNumber,hasGrid:!1,highlightFillColor:n,highlightFillOpacity:JXG.isNumber,highlightStrokeColor:n,highlightStrokeOpacity:JXG.isNumber,insertTicks:!1,lastArrow:!1,majorHeight:i,maxTicksDistance:s,minorHeight:i,minorTicks:s,minTicksDistance:s,numberPointsHigh:s,numberPointsLow:s,opacity:JXG.isNumber,radius:JXG.isNumber,RDPsmoothing:!1,renderer:u,right:e,showCopyright:!1,showInfobox:!1,showNavigation:!1,size:i,snapSizeX:a,snapSizeY:a,snapWidth:JXG.isNumber,snapToGrid:!1,snatchDistance:f,straightFirst:!1,straightLast:!1,stretch:!1,strokeColor:n,strokeOpacity:JXG.isNumber,strokeWidth:i,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(l in h)c[l.toLowerCase()]=h[l];return c}(),JXG.useStandardOptions=function(e){var t=JXG.Options,n=e.hasGrid,r,i,s,o;e.options.grid.hasGrid=t.grid.hasGrid,e.options.grid.gridX=t.grid.gridX,e.options.grid.gridY=t.grid.gridY,e.options.grid.gridColor=t.grid.gridColor,e.options.grid.gridOpacity=t.grid.gridOpacity,e.options.grid.gridDash=t.grid.gridDash,e.options.grid.snapToGrid=t.grid.snapToGrid,e.options.grid.snapSizeX=t.grid.SnapSizeX,e.options.grid.snapSizeY=t.grid.SnapSizeY,e.takeSizeFromFile=t.takeSizeFromFile,o=function(e,t){e.visProp.fillcolor=t.fillColor,e.visProp.highlightfillcolor=t.highlightFillColor,e.visProp.strokecolor=t.strokeColor,e.visProp.highlightstrokecolor=t.highlightStrokeColor};for(r in e.objects){s=e.objects[r];if(s.elementClass==JXG.OBJECT_CLASS_POINT)o(s,t.point);else if(s.elementClass==JXG.OBJECT_CLASS_LINE){o(s,t.line);for(i in s.ticks)i.majorTicks=t.line.ticks.majorTicks,i.minTicksDistance=t.line.ticks.minTicksDistance,i.visProp.minorheight=t.line.ticks.minorHeight,i.visProp.majorheight=t.line.ticks.majorHeight}else s.elementClass==JXG.OBJECT_CLASS_CIRCLE?o(s,t.circle):s.type==JXG.OBJECT_TYPE_ANGLE?o(s,t.angle):s.type==JXG.OBJECT_TYPE_ARC?o(s,t.arc):s.type==JXG.OBJECT_TYPE_POLYGON?o(s,t.polygon):s.type==JXG.OBJECT_TYPE_CONIC?o(s,t.conic):s.type==JXG.OBJECT_TYPE_CURVE?o(s,t.curve):s.type==JXG.OBJECT_TYPE_SECTOR&&(s.arc.visProp.fillcolor=t.sector.fillColor,s.arc.visProp.highlightfillcolor=t.sector.highlightFillColor,s.arc.visProp.fillopacity=t.sector.fillOpacity,s.arc.visProp.highlightfillopacity=t.sector.highlightFillOpacity)}e.fullUpdate(),n&&!e.hasGrid?e.removeGrids(e):!n&&e.hasGrid&&e.create("grid",[])},JXG.useBlackWhiteOptions=function(e){var t=JXG.Options;t.point.fillColor=JXG.rgb2bw(t.point.fillColor),t.point.highlightFillColor=JXG.rgb2bw(t.point.highlightFillColor),t.point.strokeColor=JXG.rgb2bw(t.point.strokeColor),t.point.highlightStrokeColor=JXG.rgb2bw(t.point.highlightStrokeColor),t.line.fillColor=JXG.rgb2bw(t.line.fillColor),t.line.highlightFillColor=JXG.rgb2bw(t.line.highlightFillColor),t.line.strokeColor=JXG.rgb2bw(t.line.strokeColor),t.line.highlightStrokeColor=JXG.rgb2bw(t.line.highlightStrokeColor),t.circle.fillColor=JXG.rgb2bw(t.circle.fillColor),t.circle.highlightFillColor=JXG.rgb2bw(t.circle.highlightFillColor),t.circle.strokeColor=JXG.rgb2bw(t.circle.strokeColor),t.circle.highlightStrokeColor=JXG.rgb2bw(t.circle.highlightStrokeColor),t.arc.fillColor=JXG.rgb2bw(t.arc.fillColor),t.arc.highlightFillColor=JXG.rgb2bw(t.arc.highlightFillColor),t.arc.strokeColor=JXG.rgb2bw(t.arc.strokeColor),t.arc.highlightStrokeColor=JXG.rgb2bw(t.arc.highlightStrokeColor),t.polygon.fillColor=JXG.rgb2bw(t.polygon.fillColor),t.polygon.highlightFillColor=JXG.rgb2bw(t.polygon.highlightFillColor),t.sector.fillColor=JXG.rgb2bw(t.sector.fillColor),t.sector.highlightFillColor=JXG.rgb2bw(t.sector.highlightFillColor),t.curve.strokeColor=JXG.rgb2bw(t.curve.strokeColor),t.grid.gridColor=JXG.rgb2bw(t.grid.gridColor),JXG.useStandardOptions(e)},JXG.JSXGraph={licenseText:"JSXGraph v0.96 Copyright (C) see http://jsxgraph.org",boards:{},elements:{},rendererType:function(){var e=function(e){var t,n;if(JXG.rendererFiles[e]){t=JXG.rendererFiles[e].split(",");for(n=0;n0){this.board=e,this.type=n,this.elementClass=r||JXG.OBJECT_CLASS_OTHER,this.id=t.id,i=t.name,JXG.exists(i)||(i=this.board.generateName(this)),this.board.elementsByName[i]=this,this.name=i,this.needsRegularUpdate=t.needsregularupdate,JXG.clearVisPropOld(this),t=this.resolveShortcuts(t);for(s in t)this._set(s,t[s]);this.visProp.draft=t.draft&&t.draft.draft,this.visProp.gradientangle="270",this.visProp.gradientsecondopacity=this.visProp.fillopacity,this.visProp.gradientpositionx=.5,this.visProp.gradientpositiony=.5}},JXG.extend(JXG.GeometryElement.prototype,{addChild:function(e){var t,n;this.childElements[e.id]=e,this.addDescendants(e),e.ancestors[this.id]=this;for(t in this.descendants){this.descendants[t].ancestors[this.id]=this;for(n in this.ancestors)this.descendants[t].ancestors[this.ancestors[n].id]=this.ancestors[n]}for(t in this.ancestors)for(n in this.descendants)this.ancestors[t].descendants[this.descendants[n].id]=this.descendants[n];return this},addDescendants:function(e){var t;this.descendants[e.id]=e;for(t in e.childElements)this.addDescendants(e.childElements[t]);return this},countChildren:function(){var e,t=0,n;n=this.childElements;for(e in n)n.hasOwnProperty(e)&&e.indexOf("Label")<0&&t++;return t},getName:function(){return this.name},addTransform:function(){},draggable:function(){return this.isDraggable&&!this.visProp.fixed&&!this.visProp.frozen&&this.type!=JXG.OBJECT_TYPE_GLIDER},generatePolynomial:function(){return[]},animate:function(e,t,n){n=n||{};var r,i,s=this.board.options.animationDelay,o=Math.ceil(t/(s*1)),u,a=this,f=!1;this.animationData={};var l=function(e,t,n){var r,i,s,f,l;r=JXG.rgb2hsv(e),i=JXG.rgb2hsv(t),s=(i[0]-r[0])/(1*o),f=(i[1]-r[1])/(1*o),l=(i[2]-r[2])/(1*o),a.animationData[n]=new Array(o);for(u=0;u=0&&JXG.isString(t)&&t.length==9&&t.charAt(0)==="#"?(t=JXG.rgba2rgbo(t),this.visProp[e]=t[0],this.visProp[e.replace("color","opacity")]=t[1]):this.visProp[e]=t},resolveShortcuts:function(e){var t,n;for(t in JXG.Options.shortcuts)if(JXG.exists(e[t]))for(n=0;n/g,">"),this.label!==null&&this.label.content.setText(e),this},setAttribute:JXG.shortcut(JXG.GeometryElement.prototype,"setProperty"),setProperty:function(){var e,t,n,r,i,s,o={},u;for(e=0;ee&&(this.usrCoords[1]/=this.usrCoords[0],this.usrCoords[2]/=this.usrCoords[0],this.usrCoords[0]=1)},usr2screen:function(e){var t=Math.round,n=this.board,r=this.usrCoords,i=n.origin.scrCoords;e===null||e?(this.scrCoords[0]=t(r[0]),this.scrCoords[1]=t(r[0]*i[1]+r[1]*n.unitX),this.scrCoords[2]=t(r[0]*i[2]-r[2]*n.unitY)):(this.scrCoords[0]=r[0],this.scrCoords[1]=r[0]*i[1]+r[1]*n.unitX,this.scrCoords[2]=r[0]*i[2]-r[2]*n.unitY)},screen2usr:function(){var e=this.board.origin.scrCoords,t=this.scrCoords,n=this.board;this.usrCoords[0]=1,this.usrCoords[1]=(t[1]-e[1])/n.unitX,this.usrCoords[2]=(e[2]-t[2])/n.unitY},distance:function(e,t){var n=0,r,i=this.usrCoords,s=this.scrCoords,o;if(e===JXG.COORDS_BY_USER){r=t.usrCoords,o=i[0]-r[0],n=o*o;if(n>JXG.Math.eps)return Number.POSITIVE_INFINITY;o=i[1]-r[1],n+=o*o,o=i[2]-r[2],n+=o*o}else r=t.scrCoords,o=s[1]-r[1],n+=o*o,o=s[2]-r[2],n+=o*o;return Math.sqrt(n)},setCoordinates:function(e,t,n){var r=this.usrCoords,i=this.scrCoords,s=this.usrCoords.slice(0),o=this.scrCoords.slice(0);return e===JXG.COORDS_BY_USER?(t.length===2?(r[0]=1,r[1]=t[0],r[2]=t[1]):(r[0]=t[0],r[1]=t[1],r[2]=t[2],this.normalizeUsrCoords()),this.usr2screen(n)):(i[1]=t[0],i[2]=t[1],this.screen2usr()),this.triggerEventHandlers("update",s,o),this},__evt__:function(e,t){},__evt__:function(){}}),JXG.Point=function(e,t,n){this.constructor(e,n,JXG.OBJECT_TYPE_POINT,JXG.OBJECT_CLASS_POINT),t==null&&(t=[0,0]),this.coords=new JXG.Coords(JXG.COORDS_BY_USER,t,this.board),this.initialCoords=new JXG.Coords(JXG.COORDS_BY_USER,t,this.board),this.position=null,this.onPolygon=!1,this.slideObject=null,this.Xjc=null,this.Yjc=null,this.methodMap=JXG.deepCopy(this.methodMap,{move:"moveTo",glide:"makeGlider",X:"X",Y:"Y",free:"free",setPosition:"setGliderPosition"}),this.group=[],this.elType="point",this.id=this.board.setId(this,"P"),this.board.renderer.drawPoint(this),this.board.finalizeAdding(this),this.createLabel()},JXG.Point.prototype=new JXG.GeometryElement,JXG.extend(JXG.Point.prototype,{hasPoint:function(e,t){var n=this.coords.scrCoords,r;return r=parseFloat(this.visProp.size)+parseFloat(this.visProp.strokewidth)*.5,r1)for(e=0;e=0?1:-1,r=Math.abs(r),this.position=a*r/(r+1)):Math.abs(t[0])0&&Math.abs(this._smax-this._smin)>=JXG.Math.eps&&(this.position<0&&(this.position=0),this.position>1&&(this.position=1),i=this.position*(this._smax-this._smin)+this._smin,i=Math.round(i/this.visProp.snapwidth)*this.visProp.snapwidth,this.position=(i-this._smin)/(this._smax-this._smin),this.update(!0)),t=f.point1.coords.usrCoords,!f.visProp.straightfirst&&Math.abs(t[0])>JXG.Math.eps&&this.position<0&&(this.coords.setCoordinates(JXG.COORDS_BY_USER,t),this.position=0),n=f.point2.coords.usrCoords,!f.visProp.straightlast&&Math.abs(n[0])>JXG.Math.eps&&this.position>1&&(this.coords.setCoordinates(JXG.COORDS_BY_USER,n),this.position=1)}else if(f.type==JXG.OBJECT_TYPE_TURTLE)this.updateConstraint(),this.coords=JXG.Math.Geometry.projectPointToTurtle(this,f,this.board);else if(f.elementClass==JXG.OBJECT_CLASS_CURVE)if(f.type==JXG.OBJECT_TYPE_ARC||f.type==JXG.OBJECT_TYPE_SECTOR){this.coords=JXG.Math.Geometry.projectPointToCircle(this,f,this.board),h=JXG.Math.Geometry.rad(f.radiuspoint,f.center,this),l=0,c=JXG.Math.Geometry.rad(f.radiuspoint,f.center,f.anglepoint),this.position=h;if(f.visProp.type=="minor"&&c>Math.PI||f.visProp.type=="major"&&cc){this.position=c;if(hl*.5||h>c&&h>c*.5+Math.PI)this.position=l;this.updateGliderFromParent()}}else this.updateConstraint(),f.transformations.length>0?(f.updateTransformMatrix(),v=JXG.Math.inverse(f.transformMat),d=JXG.Math.matVecMult(v,this.coords.usrCoords),p=(new JXG.Coords(JXG.COORDS_BY_USER,d,this.board)).usrCoords,d=JXG.Math.Geometry.projectCoordsToCurve(p[1],p[2],this.position||0,f,this.board),this.position=d[1],this.coords=d[0]):this.coords=JXG.Math.Geometry.projectPointToCurve(this,f,this.board);else f.elementClass==JXG.OBJECT_CLASS_POINT&&(this.coords=JXG.Math.Geometry.projectPointToPoint(this,f,this.board))},updateGliderFromParent:function(){var e,t,n,r,i,s=this.slideObject,o;s.elementClass==JXG.OBJECT_CLASS_CIRCLE?(n=s.Radius(),this.coords.setCoordinates(JXG.COORDS_BY_USER,[s.center.X()+n*Math.cos(this.position),s.center.Y()+n*Math.sin(this.position)])):s.elementClass==JXG.OBJECT_CLASS_LINE?(e=s.point1.coords.usrCoords,t=s.point2.coords.usrCoords,Math.abs(t[0])1?r=(r-1)/(r-2):r=(1-r)/r,this.coords.setCoordinates(JXG.COORDS_BY_USER,[t[0]+r*e[0],t[1]+r*e[1],t[2]+r*e[2]])):(r=this.position,this.coords.setCoordinates(JXG.COORDS_BY_USER,[e[0]+r*(t[0]-e[0]),e[1]+r*(t[1]-e[1]),e[2]+r*(t[2]-e[2])]))):s.type==JXG.OBJECT_TYPE_TURTLE?(this.coords.setCoordinates(JXG.COORDS_BY_USER,[s.Z(this.position),s.X(this.position),s.Y(this.position)]),this.updateConstraint(),this.coords=JXG.Math.Geometry.projectPointToTurtle(this,s,this.board)):s.elementClass==JXG.OBJECT_CLASS_CURVE?(this.coords.setCoordinates(JXG.COORDS_BY_USER,[s.Z(this.position),s.X(this.position),s.Y(this.position)]),s.type==JXG.OBJECT_TYPE_ARC||s.type==JXG.OBJECT_TYPE_SECTOR?(o=JXG.Math.Geometry.rad([s.center.X()+1,s.center.Y()],s.center,s.radiuspoint),n=s.Radius(),this.coords.setCoordinates(JXG.COORDS_BY_USER,[s.center.X()+n*Math.cos(this.position+o),s.center.Y()+n*Math.sin(this.position+o)])):(this.updateConstraint(),this.coords=JXG.Math.Geometry.projectPointToCurve(this,s,this.board))):s.elementClass==JXG.OBJECT_CLASS_POINT&&(this.coords=JXG.Math.Geometry.projectPointToPoint(this,s,this.board))},updateRenderer:function(){if(!this.needsUpdate)return this;if(this.visProp.visible&&this.visProp.size>0){var e=this.isReal;this.isReal=!isNaN(this.coords.usrCoords[1]+this.coords.usrCoords[2]),this.isReal=Math.abs(this.coords.usrCoords[0])>JXG.Math.eps?this.isReal:!1,this.isReal?(e!=this.isReal&&(this.board.renderer.show(this),this.hasLabel&&this.label.content.visProp.visible&&this.board.renderer.show(this.label.content)),this.board.renderer.updatePoint(this)):e!=this.isReal&&(this.board.renderer.hide(this),this.hasLabel&&this.label.content.visProp.visible&&this.board.renderer.hide(this.label.content))}return this.hasLabel&&this.visProp.visible&&this.label.content&&this.label.content.visProp.visible&&this.isReal&&(this.label.content.update(),this.board.renderer.updateText(this.label.content)),this.needsUpdate=!1,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]},bounds:function(){return this.coords.usrCoords.slice(1).concat(this.coords.usrCoords.slice(1))},Dist:function(e){var t,n=e.coords.usrCoords,r=this.coords.usrCoords,i;return i=r[0]-n[0],t=i*i,i=r[1]-n[1],t+=i*i,i=r[2]-n[2],t+=i*i,Math.sqrt(t)},snapToGrid:function(){return this.handleSnapToGrid()},handleSnapToGrid:function(){var e,t,n=this.visProp.snapsizex,r=this.visProp.snapsizey;return this.visProp.snaptogrid&&(e=this.coords.usrCoords[1],t=this.coords.usrCoords[2],n<=0&&this.board.defaultAxes&&this.board.defaultAxes.x.defaultTicks&&(n=this.board.defaultAxes.x.defaultTicks.ticksDelta*(this.board.defaultAxes.x.defaultTicks.visProp.minorticks+1)),r<=0&&this.board.defaultAxes&&this.board.defaultAxes.y.defaultTicks&&(r=this.board.defaultAxes.y.defaultTicks.ticksDelta*(this.board.defaultAxes.y.defaultTicks.visProp.minorticks+1)),n>0&&r>0&&this.coords.setCoordinates(JXG.COORDS_BY_USER,[Math.round(e/n)*n,Math.round(t/r)*r])),this},handleSnapToPoints:function(){var e,t,n,r=0,i=Infinity,s=null;if(this.visProp.snaptopoints){for(e in this.board.objects)t=this.board.objects[e],t.elementClass==JXG.OBJECT_CLASS_POINT&&t!==this&&t.visProp.visible&&(n=JXG.Math.Geometry.projectPointToPoint(this,t,this.board),r=n.distance(JXG.COORDS_BY_USER,this.coords),r=this.visProp.snatchdistance&&(this.type=JXG.OBJECT_TYPE_POINT)}return this},setPositionDirectly:function(e,t){var n,r,i,s,o,u,a=this.coords,f;this.coords.setCoordinates(e,t),this.handleSnapToGrid(),this.handleSnapToPoints(),this.handleAttractors();if(!(this.group.length>0)){for(n=this.transformations.length-1;n>=0;n--)e===JXG.COORDS_BY_SCREEN?f=(new JXG.Coords(e,t,this.board)).usrCoords:(t.length===2&&(t=[1].concat(t)),f=t),this.initialCoords.setCoordinates(JXG.COORDS_BY_USER,JXG.Math.matVecMult(JXG.Math.inverse(this.transformations[n].matrix),f));this.update()}return this},setPositionByTransform:function(e,t){var n;return t=new JXG.Coords(e,t,this.board),n=this.board.create("transform",t.usrCoords.slice(1),{type:"translate"}),this.transformations.length>0&&this.transformations[this.transformations.length-1].isNumericMatrix?this.transformations[this.transformations.length-1].melt(n):this.addTransform(this,n),this.update(),this},setPosition:function(e,t){return this.setPositionDirectly(e,t)},setGliderPosition:function(e){if(this.type=JXG.OBJECT_TYPE_GLIDER)this.position=e,this.board.update();return this},makeGlider:function(e){return this.slideObject=JXG.getRef(this.board,e),this.type=JXG.OBJECT_TYPE_GLIDER,this.elType="glider",this.visProp.snapwidth=-1,this.slideObject.addChild(this),this.isDraggable=!0,this.generatePolynomial=function(){return this.slideObject.generatePolynomial(this)},this.updateGlider(),this},free:function(){var e,t;if(this.type!==JXG.OBJECT_TYPE_GLIDER){if(!!this.isDraggable)return;this.isDraggable=!0,this.type=JXG.OBJECT_TYPE_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(e in this.ancestors){this.ancestors[e].descendants[this.id]&&delete this.ancestors[e].descendants[this.id],this.ancestors[e].childElements[this.id]&&delete this.ancestors[e].childElements[this.id];for(t in this.descendants)this.ancestors[e].descendants[t]&&delete this.ancestors[e].descendants[t],this.ancestors[e].childElements[t]&&delete this.ancestors[e].childElements[t]}this.ancestors=[],this.slideObject=null,this.elType="point",this.type=JXG.OBJECT_TYPE_POINT},addConstraint:function(e){this.type=JXG.OBJECT_TYPE_CAS;var t=[],n,r,i,s,o=["X","Y"];this.isDraggable=!1;for(r=0;rJXG.Math.eps)return this.setPosition(JXG.COORDS_BY_USER,e.usrCoords),this.board.update(this);n=n||{};var r=this.board.options.animationDelay,i=Math.ceil(t/(r*1)),s=new Array(i+1),o=this.coords.usrCoords[1],u=this.coords.usrCoords[2],a=e.usrCoords[1]-o,f=e.usrCoords[2]-u,l,c=function(e){return n.effect&&n.effect=="<>"?Math.pow(Math.sin(e/(i*1)*Math.PI/2),2):e/i};if(Math.abs(a)=0;l--)s[i-l]=[e.usrCoords[0],o+a*c(l),u+f*c(l)];return this.animationPath=s,this.animationCallback=n.callback,this.board.addAnimation(this),this},visit:function(e,t,n){typeof n=="number"?n={repeat:n}:(n=n||{},typeof n.repeat=="undefined"&&(n.repeat=1));var r=this.board.options.animationDelay,i=Math.ceil(t/(r*n.repeat)),s=new Array(n.repeat*(i+1)),o=this.coords.usrCoords[1],u=this.coords.usrCoords[2],a=e[0]-o,f=e[1]-u,l,c,h=function(e){var t=e"?Math.pow(Math.sin(t*Math.PI/2),2):t};for(c=0;c=0;l--)s[c*(i+1)+i-l]=[e[0],o+a*h(l),u+f*h(l)];return this.animationPath=s,this.animationCallback=n.callback,this.board.addAnimation(this),this},_anim:function(e,t){var n,r,i,s,o,u,a=1,f,l;return this.intervalCount++,this.intervalCount>t&&(this.intervalCount=0),this.slideObject.elementClass==JXG.OBJECT_CLASS_LINE?(n=this.slideObject.point1.coords.distance(JXG.COORDS_BY_SCREEN,this.slideObject.point2.coords),r=this.slideObject.getSlope(),r!="INF"?(o=Math.atan(r),i=Math.round(this.intervalCount/t*n*Math.cos(o)),s=Math.round(this.intervalCount/t*n*Math.sin(o))):(i=0,s=Math.round(this.intervalCount/t*n)),e<0?(u=this.slideObject.point2,this.slideObject.point2.coords.scrCoords[1]-this.slideObject.point1.coords.scrCoords[1]>0?a=-1:this.slideObject.point2.coords.scrCoords[1]-this.slideObject.point1.coords.scrCoords[1]==0&&this.slideObject.point2.coords.scrCoords[2]-this.slideObject.point1.coords.scrCoords[2]>0&&(a=-1)):(u=this.slideObject.point1,this.slideObject.point1.coords.scrCoords[1]-this.slideObject.point2.coords.scrCoords[1]>0?a=-1:this.slideObject.point1.coords.scrCoords[1]-this.slideObject.point2.coords.scrCoords[1]==0&&this.slideObject.point1.coords.scrCoords[2]-this.slideObject.point2.coords.scrCoords[2]>0&&(a=-1)),this.coords.setCoordinates(JXG.COORDS_BY_SCREEN,[u.coords.scrCoords[1]+a*i,u.coords.scrCoords[2]+a*s])):this.slideObject.elementClass==JXG.OBJECT_CLASS_CURVE?(e>0?f=Math.round(this.intervalCount/t*this.board.canvasWidth):f=Math.round((t-this.intervalCount)/t*this.board.canvasWidth),this.coords.setCoordinates(JXG.COORDS_BY_SCREEN,[f,0]),this.coords=JXG.Math.Geometry.projectPointToCurve(this,this.slideObject,this.board)):this.slideObject.elementClass==JXG.OBJECT_CLASS_CIRCLE&&(e<0?o=this.intervalCount/t*2*Math.PI:o=(t-this.intervalCount)/t*2*Math.PI,l=this.slideObject.Radius(),this.coords.setCoordinates(JXG.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},setStyle:function(e){var t=["cross","cross","cross","circle","circle","circle","circle","square","square","square","plus","plus","plus"],n=[2,3,4,1,2,3,4,2,3,4,2,3,4];return this.visProp.face=t[e],this.visProp.size=n[e],this.board.renderer.changePointStyle(this),this},normalizeFace:function(e){var t={cross:"x",x:"x",circle:"o",o:"o",square:"[]","[]":"[]",plus:"+","+":"+",diamond:"<>","<>":"<>",triangleup:"^",a:"^","^":"^",triangledown:"v",v:"v",triangleleft:"<","<":"<",triangleright:">",">":">"};return t[e]},remove:function(){this.hasLabel&&this.board.renderer.remove(this.board.renderer.getElementById(this.label.content.id)),this.board.renderer.remove(this.board.renderer.getElementById(this.id))},getTextAnchor:function(){return this.coords},getLabelAnchor:function(){return this.coords},face:function(e){this.setProperty({face:e})},size:function(e){this.setProperty({size:e})},cloneToBackground:function(){var e={};return e.id=this.id+"T"+this.numTraces,this.numTraces++,e.coords=this.coords,e.visProp=JXG.deepCopy(this.visProp,this.visProp.traceattributes,!0),e.visProp.layer=this.board.options.layer.trace,e.elementClass=JXG.OBJECT_CLASS_POINT,e.board=this.board,JXG.clearVisPropOld(e),this.board.renderer.drawPoint(e),this.traces[e.id]=e.rendNode,this},getParents:function(){var e=[this.Z(),this.X(),this.Y()];return this.parents&&(e=this.parents),this.type==JXG.OBJECT_TYPE_GLIDER&&(e=[this.X(),this.Y(),this.slideObject.id]),e}}),JXG.createPoint=function(e,t,n){var r,i=!1,s,o;o=JXG.copyAttributes(n,e.options,"point");for(s=0;sthis.board.options.precision.hasPoint?!1:this.visProp.straightfirst&&this.visProp.straightlast?!0:(o=this.point1.coords,u=this.point2.coords,s=[0,n[1],n[2]],s=JXG.Math.crossProduct(s,i),s=JXG.Math.crossProduct(s,n),s[1]/=s[0],s[2]/=s[0],s[0]=1,s=(new JXG.Coords(JXG.COORDS_BY_SCREEN,s.slice(1),this.board)).usrCoords,a=o.distance(JXG.COORDS_BY_USER,u),o=o.usrCoords.slice(0),u=u.usrCoords.slice(0),a1?!1:!0)},update:function(){var e;return this.needsUpdate?(this.constrained&&(typeof this.funps!="undefined"?(e=this.funps(),e&&e.length&&e.length===2&&(this.point1=e[0],this.point2=e[1])):(typeof this.funp1=="function"&&(e=this.funp1(),JXG.isPoint(e)?this.point1=e:e&&e.length&&e.length===2&&this.point1.setPositionDirectly(JXG.COORDS_BY_USER,e)),typeof this.funp2=="function"&&(e=this.funp2(),JXG.isPoint(e)?this.point2=e:e&&e.length&&e.length===2&&this.point2.setPositionDirectly(JXG.COORDS_BY_USER,e)))),this.updateSegmentFixedLength(),this.updateStdform(),this.visProp.trace&&this.cloneToBackground(!0),this):this},updateSegmentFixedLength:function(){var e,t,n,r,i,s,o,u;if(!this.hasFixedLength)return this;e=this.point1.Dist(this.point2),t=this.fixedLength(),n=this.fixedLengthOldCoords[0].distance(JXG.COORDS_BY_USER,this.point1.coords),r=this.fixedLengthOldCoords[1].distance(JXG.COORDS_BY_USER,this.point2.coords);if(n>JXG.Math.eps||r>JXG.Math.eps||e!=t){i=this.point1.isDraggable&&this.point1.type!=JXG.OBJECT_TYPE_GLIDER&&!this.point1.visProp.fixed,s=this.point2.isDraggable&&this.point2.type!=JXG.OBJECT_TYPE_GLIDER&&!this.point2.visProp.fixed;if(e>JXG.Math.eps){if(n>r&&s||n<=r&&s&&!i)this.point2.setPositionDirectly(JXG.COORDS_BY_USER,[this.point1.X()+(this.point2.X()-this.point1.X())*t/e,this.point1.Y()+(this.point2.Y()-this.point1.Y())*t/e]),this.point2.prepareUpdate().updateRenderer();else if(n<=r&&i||n>r&&i&&!s)this.point1.setPositionDirectly(JXG.COORDS_BY_USER,[this.point2.X()+(this.point1.X()-this.point2.X())*t/e,this.point2.Y()+(this.point1.Y()-this.point2.Y())*t/e]),this.point1.prepareUpdate().updateRenderer()}else o=Math.random()-.5,u=Math.random()-.5,e=Math.sqrt(o*o+u*u),s?(this.point2.setPositionDirectly(JXG.COORDS_BY_USER,[this.point1.X()+o*t/e,this.point1.Y()+u*t/e]),this.point2.prepareUpdate().updateRenderer()):i&&(this.point1.setPositionDirectly(JXG.COORDS_BY_USER,[this.point2.X()+o*t/e,this.point2.Y()+u*t/e]),this.point1.prepareUpdate().updateRenderer());this.fixedLengthOldCoords[0].setCoordinates(JXG.COORDS_BY_USER,this.point1.coords.usrCoords),this.fixedLengthOldCoords[1].setCoordinates(JXG.COORDS_BY_USER,this.point2.coords.usrCoords)}return this},updateStdform:function(){var e=JXG.Math.crossProduct(this.point1.coords.usrCoords,this.point2.coords.usrCoords);this.stdform[0]=e[0],this.stdform[1]=e[1],this.stdform[2]=e[2],this.stdform[3]=0,this.normalize()},updateRenderer:function(){var e;return this.needsUpdate&&this.visProp.visible&&(e=this.isReal,this.isReal=!isNaN(this.point1.coords.usrCoords[1]+this.point1.coords.usrCoords[2]+this.point2.coords.usrCoords[1]+this.point2.coords.usrCoords[2])&&JXG.Math.innerProduct(this.stdform,this.stdform,3)>=JXG.Math.eps*JXG.Math.eps,this.isReal?(e!=this.isReal&&(this.board.renderer.show(this),this.hasLabel&&this.label.content.visProp.visible&&this.board.renderer.show(this.label.content)),this.board.renderer.updateLine(this)):e!=this.isReal&&(this.board.renderer.hide(this),this.hasLabel&&this.label.content.visProp.visible&&this.board.renderer.hide(this.label.content)),this.needsUpdate=!1),this.hasLabel&&this.label.content.visProp.visible&&this.isReal&&(this.label.content.update(),this.board.renderer.updateText(this.label.content)),this},generatePolynomial:function(e){var t=this.point1.symbolic.x,n=this.point1.symbolic.y,r=this.point2.symbolic.x,i=this.point2.symbolic.y,s=e.symbolic.x,o=e.symbolic.y;return[["(",n,")*(",s,")-(",n,")*(",r,")+(",o,")*(",r,")-(",t,")*(",o,")+(",t,")*(",i,")-(",s,")*(",i,")"].join("")]},getRise:function(){return Math.abs(this.stdform[2])>=JXG.Math.eps?-this.stdform[0]/this.stdform[2]:Infinity},getSlope:function(){return Math.abs(this.stdform[2])>=JXG.Math.eps?-this.stdform[1]/this.stdform[2]:Infinity},getAngle:function(){return Math.atan2(this.point2.Y()-this.point1.Y(),this.point2.X()-this.point1.X())},setStraight:function(e,t){return this.visProp.straightfirst=e,this.visProp.straightlast=t,this.board.renderer.updateLine(this),this},getTextAnchor:function(){return new JXG.Coords(JXG.COORDS_BY_USER,[.5*(this.point2.X()+this.point1.X()),.5*(this.point2.Y()+this.point1.Y())],this.board)},setLabelRelativeCoords:function(e){JXG.exists(this.label.content)&&(this.label.content.relativeCoords=new JXG.Coords(JXG.COORDS_BY_SCREEN,[e[0],-e[1]],this.board))},getLabelAnchor:function(){var e,t,n=0,r=0,i=0,s=new JXG.Coords(JXG.COORDS_BY_USER,this.point1.coords.usrCoords,this.board),o=new JXG.Coords(JXG.COORDS_BY_USER,this.point2.coords.usrCoords,this.board);(this.visProp.straightfirst||this.visProp.straightlast)&&JXG.Math.Geometry.calcStraight(this,s,o,0),s=s.scrCoords,o=o.scrCoords;if(!JXG.exists(this.label.content))return new JXG.Coords(JXG.COORDS_BY_SCREEN,[NaN,NaN],this.board);switch(this.label.content.visProp.position){case"lft":case"llft":case"ulft":s[1]<=o[1]?(e=s[1],t=s[2]):(e=o[1],t=o[2]);break;case"rt":case"lrt":case"urt":s[1]>o[1]?(e=s[1],t=s[2]):(e=o[1],t=o[2]);break;default:e=.5*(s[1]+o[1]),t=.5*(s[2]+o[2])}if(this.visProp.straightfirst||this.visProp.straightlast)JXG.exists(this.label.content)&&(r=parseFloat(this.label.content.visProp.offset[0]),i=parseFloat(this.label.content.visProp.offset[1]),n=this.label.content.visProp.fontsize),Math.abs(e)e&&e>this.board.canvasWidth-n-JXG.Math.eps?e=this.board.canvasWidth-r-n:e+=r,JXG.Math.eps+n>t&&t>-JXG.Math.eps?t=i+n:this.board.canvasHeight+JXG.Math.eps>t&&t>this.board.canvasHeight-n-JXG.Math.eps?t=this.board.canvasHeight-i:t+=i;return new JXG.Coords(JXG.COORDS_BY_SCREEN,[e,t],this.board)},cloneToBackground:function(){var e={},t,n,r;return e.id=this.id+"T"+this.numTraces,e.elementClass=JXG.OBJECT_CLASS_LINE,this.numTraces++,e.point1=this.point1,e.point2=this.point2,e.stdform=this.stdform,e.board=this.board,e.visProp=JXG.deepCopy(this.visProp,this.visProp.traceattributes,!0),e.visProp.layer=this.board.options.layer.trace,JXG.clearVisPropOld(e),n=this.getSlope(),t=this.getRise(),e.getSlope=function(){return n},e.getRise=function(){return t},r=this.board.renderer.enhancedRendering,this.board.renderer.enhancedRendering=!0,this.board.renderer.drawLine(e),this.board.renderer.enhancedRendering=r,this.traces[e.id]=e.rendNode,delete e,this},addTransform:function(e){var t,n=JXG.isArray(e)?e:[e],r=n.length;for(t=0;t0&&this.point1.transformations[this.point1.transformations.length-1].isNumericMatrix?this.point1.transformations[this.point1.transformations.length-1].melt(n):this.point1.addTransform(this.point1,n),this.point2.transformations.length>0&&this.point2.transformations[this.point2.transformations.length-1].isNumericMatrix?this.point2.transformations[this.point2.transformations.length-1].melt(n):this.point2.addTransform(this.point2,n),this},setPositionDirectly:function(e,t,n){var r,i,s=new JXG.Coords(e,t,this.board),o=new JXG.Coords(e,n,this.board);return!this.point1.draggable()||!this.point2.draggable()?this:(r=JXG.Math.Statistics.subtract(s.usrCoords,o.usrCoords),i=this.board.create("transform",r.slice(1),{type:"translate"}),i.applyOnce([this.point1,this.point2]),this)},snapToGrid:function(){return this.visProp.snaptogrid&&(this.point1.snapToGrid(),this.point2.snapToGrid()),this},X:function(e){var t=this.stdform[2],n;return n=Math.abs(this.point1.coords.usrCoords[0])>JXG.Math.eps?this.point1.coords.usrCoords[1]:this.point2.coords.usrCoords[1],e=(e-.5)*2,e<0?(e*=-1,(1-e)*n+e*t):(1-e)*n-e*t},Y:function(e){var t=this.stdform[1],n;return n=Math.abs(this.point1.coords.usrCoords[0])>JXG.Math.eps?this.point1.coords.usrCoords[2]:this.point2.coords.usrCoords[2],e=(e-.5)*2,e<0?(e*=-1,(1-e)*n-e*t):(1-e)*n+e*t},Z:function(e){var t=Math.abs(this.point1.coords.usrCoords[0])>JXG.Math.eps?this.point1.coords.usrCoords[0]:this.point2.coords.usrCoords[0];return e=(e-.5)*2,e<0&&(e*=-1),(1-e)*t},L:function(){return this.point1.Dist(this.point2)},minX:function(){return 0},maxX:function(){return 1},bounds:function(){var e=this.point1.coords.usrCoords,t=this.point2.coords.usrCoords;return[Math.min(e[1],t[1]),Math.max(e[2],t[2]),Math.max(e[1],t[1]),Math.min(e[2],t[2])]},addTicks:function(e){if(e.id==""||typeof e.id=="undefined")e.id=this.id+"_ticks_"+(this.ticks.length+1);return this.board.renderer.drawTicks(e),this.ticks.push(e),e.id},remove:function(){this.removeAllTicks(),JXG.GeometryElement.prototype.remove.call(this)},removeAllTicks:function(){var e,t;for(t=this.ticks.length;t>0;t--)this.removeTicks(this.ticks[t-1]);this.ticks=new Array,this.board.update()},removeTicks:function(e){var t,n;this.defaultTicks!=null&&this.defaultTicks==e&&(this.defaultTicks=null);for(t=this.ticks.length;t>0;t--)if(this.ticks[t-1]==e){this.board.removeObject(this.ticks[t-1]);if(this.ticks[t-1].ticks)for(n=0;n1)u=JXG.copyAttributes(n,e.options,"line","point1"),i=e.create("point",t[0],u);else if(JXG.isString(t[0])||t[0].elementClass==JXG.OBJECT_CLASS_POINT)i=JXG.getReference(e,t[0]);else if(typeof t[0]=="function"&&t[0]().elementClass==JXG.OBJECT_CLASS_POINT)i=t[0](),f=!0;else{if(typeof t[0]!="function"||!t[0]().length||t[0]().length!==2)throw new Error("JSXGraph: Can't create line with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'."+"\nPossible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]");u=JXG.copyAttributes(n,e.options,"line","point1"),i=JXG.createPoint(e,t[0](),u),f=!0}if(JXG.isArray(t[1])&&t[1].length>1)u=JXG.copyAttributes(n,e.options,"line","point2"),s=e.create("point",t[1],u);else if(JXG.isString(t[1])||t[1].elementClass==JXG.OBJECT_CLASS_POINT)s=JXG.getReference(e,t[1]);else if(typeof t[1]=="function"&&t[1]().elementClass==JXG.OBJECT_CLASS_POINT)s=t[1](),f=!0;else{if(typeof t[1]!="function"||!t[1]().length||t[1]().length!==2)throw new Error("JSXGraph: Can't create line with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'."+"\nPossible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]");u=JXG.copyAttributes(n,e.options,"line","point2"),s=JXG.createPoint(e,t[1](),u),f=!0}u=JXG.copyAttributes(n,e.options,"line"),r=new JXG.Line(e,i,s,u),f?(r.constrained=!0,r.funp1=t[0],r.funp2=t[1]):r.isDraggable=!0,r.constrained||(r.parents=[i.id,s.id])}else if(t.length==3){l=!0;for(o=0;o<3;o++)if(typeof t[o]=="number")a[o]=function(e){return function(){return e}}(t[o]);else{if(typeof t[o]!="function")throw new Error("JSXGraph: Can't create line with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"' and '"+typeof t[2]+"'."+"\nPossible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]");a[o]=t[o],l=!1}u=JXG.copyAttributes(n,e.options,"line","point1"),l?i=e.create("point",[a[2]()*a[2]()+a[1]()*a[1](),a[2]()-a[1]()*a[0]()+a[2](),-a[1]()-a[2]()*a[0]()-a[1]()],u):i=e.create("point",[function(){return(0+a[2]()*a[2]()+a[1]()*a[1]())*.5},function(){return(a[2]()-a[1]()*a[0]()+a[2]())*.5},function(){return(-a[1]()-a[2]()*a[0]()-a[1]())*.5}],u),u=JXG.copyAttributes(n,e.options,"line","point2"),l?s=e.create("point",[a[2]()*a[2]()+a[1]()*a[1](),-a[1]()*a[0]()+a[2](),-a[2]()*a[0]()-a[1]()],u):s=e.create("point",[function(){return a[2]()*a[2]()+a[1]()*a[1]()},function(){return-a[1]()*a[0]()+a[2]()},function(){return-a[2]()*a[0]()-a[1]()}],u),i.prepareUpdate().update(),s.prepareUpdate().update(),u=JXG.copyAttributes(n,e.options,"line"),r=new JXG.Line(e,i,s,u),r.isDraggable=l,l&&(r.parents=[a[0](),a[1](),a[2]()])}else if(t.length==1&&typeof t[0]=="function"&&t[0]().length==2&&t[0]()[0].elementClass==JXG.OBJECT_CLASS_POINT&&t[0]()[1].elementClass==JXG.OBJECT_CLASS_POINT){var c=t[0]();u=JXG.copyAttributes(n,e.options,"line"),r=new JXG.Line(e,c[0],c[1],u),r.constrained=!0,r.funps=t[0]}else{if(t.length!=1||typeof t[0]!="function"||t[0]().length!=3||typeof t[0]()[0]!="number"||typeof t[0]()[1]!="number"||typeof t[0]()[2]!="number")throw new Error("JSXGraph: Can't create line with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'."+"\nPossible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]");c=t[0],u=JXG.copyAttributes(n,e.options,"line","point1"),i=e.create("point",[function(){var e=c();return[(0+e[2]*e[2]+e[1]*e[1])*.5,(e[2]-e[1]*e[0]+e[2])*.5,(-e[1]-e[2]*e[0]-e[1])*.5]}],u),u=JXG.copyAttributes(n,e.options,"line","point2"),s=e.create("point",[function(){var e=c();return[e[2]*e[2]+e[1]*e[1],-e[1]*e[0]+e[2],-e[2]*e[0]-e[1]]}],u),u=JXG.copyAttributes(n,e.options,"line"),r=new JXG.Line(e,i,s,u),r.constrained=!0,r.funps=t[0]}return r},JXG.JSXGraph.registerElement("line",JXG.createLine),JXG.createSegment=function(e,t,n){var r,i,s;n.straightFirst=!1,n.straightLast=!1,s=JXG.copyAttributes(n,e.options,"segment"),r=e.create("line",t.slice(0,2),s);if(t.length==3){r.hasFixedLength=!0;if(JXG.isNumber(t[2]))r.fixedLength=function(){return t[2]};else{if(!JXG.isFunction(t[2]))throw new Error("JSXGraph: Can't create segment with third parent type '"+typeof t[2]+"'."+"\nPossible third parent types: number or function");r.fixedLength=t[2]}r.fixedLengthOldCoords=[],r.fixedLengthOldCoords[0]=new JXG.Coords(JXG.COORDS_BY_USER,r.point1.coords.usrCoords.slice(1,3),e),r.fixedLengthOldCoords[1]=new JXG.Coords(JXG.COORDS_BY_USER,r.point2.coords.usrCoords.slice(1,3),e)}return r.elType="segment",r},JXG.JSXGraph.registerElement("segment",JXG.createSegment),JXG.createArrow=function(e,t,n){var r;return n.firstArrow=!1,n.lastArrow=!0,r=e.create("line",t,n).setStraight(!1,!1),r.type=JXG.OBJECT_TYPE_VECTOR,r.elType="arrow",r},JXG.JSXGraph.registerElement("arrow",JXG.createArrow),JXG.createAxis=function(e,t,n){var r,i,s;if(!JXG.isArray(t[0])&&!JXG.isPoint(t[0])||!JXG.isArray(t[1])&&!JXG.isPoint(t[1]))throw new Error("JSXGraph: Can't create axis with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'."+"\nPossible parent types: [point,point], [[x1,y1],[x2,y2]]");r=JXG.copyAttributes(n,e.options,"axis"),i=e.create("line",t,r),i.type=JXG.OBJECT_TYPE_AXIS,i.isDraggable=!1,i.point1.isDraggable=!1,i.point2.isDraggable=!1;for(var o in i.ancestors)i.ancestors[o].type=JXG.OBJECT_TYPE_AXISPOINT;return r=JXG.copyAttributes(n,e.options,"axis","ticks"),JXG.exists(r.ticksdistance)?s=r.ticksdistance:JXG.isArray(r.ticks)?s=r.ticks:s=1,i.defaultTicks=e.create("ticks",[i,s],r),i.defaultTicks.dump=!1,i.elType="axis",i.subs={ticks:i.defaultTicks},i},JXG.JSXGraph.registerElement("axis",JXG.createAxis),JXG.createTangent=function(e,t,n){var r,i,s,o,u,a,f,l;if(t.length==1)r=t[0],i=r.slideObject;else{if(t.length!=2)throw new Error("JSXGraph: Can't create tangent with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'."+"\nPossible parent types: [glider], [point,line|curve|circle|conic]");if(JXG.isPoint(t[0]))r=t[0],i=t[1];else{if(!JXG.isPoint(t[1]))throw new Error("JSXGraph: Can't create tangent with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'."+"\nPossible parent types: [glider], [point,line|curve|circle|conic]");i=t[0],r=t[1]}}if(i.elementClass==JXG.OBJECT_CLASS_LINE)l=e.create("line",[i.point1,i.point2],n);else if(i.elementClass==JXG.OBJECT_CLASS_CURVE&&i.type!=JXG.OBJECT_TYPE_CONIC)i.visProp.curvetype!="plot"?(s=i.X,o=i.Y,l=e.create("line",[function(){return-r.X()*e.D(o)(r.position)+r.Y()*e.D(s)(r.position)},function(){return e.D(o)(r.position)},function(){return-e.D(s)(r.position)}],n),r.addChild(l),l.glider=r):(l=e.create("line",[function(){return u=Math.floor(r.position),u==i.numberPoints-1&&u--,u<0?1:i.Y(u)*i.X(u+1)-i.X(u)*i.Y(u+1)},function(){return u=Math.floor(r.position),u==i.numberPoints-1&&u--,u<0?0:i.Y(u+1)-i.Y(u)},function(){return u=Math.floor(r.position),u==i.numberPoints-1&&u--,u<0?0:i.X(u)-i.X(u+1)}],n),r.addChild(l),l.glider=r);else if(i.type==JXG.OBJECT_TYPE_TURTLE)l=e.create("line",[function(){u=Math.floor(r.position);for(a=0;a1?(o=JXG.copyAttributes(n,e.options,"circle","center"),i[s]=e.create("point",t[s],o)):i[s]=t[s];o=JXG.copyAttributes(n,e.options,"circle");if(t.length==2&&JXG.isPoint(i[0])&&JXG.isPoint(i[1]))r=new JXG.Circle(e,"twoPoints",i[0],i[1],o);else if((JXG.isNumber(i[0])||JXG.isFunction(i[0])||JXG.isString(i[0]))&&JXG.isPoint(i[1]))r=new JXG.Circle(e,"pointRadius",i[1],i[0],o);else if((JXG.isNumber(i[1])||JXG.isFunction(i[1])||JXG.isString(i[1]))&&JXG.isPoint(i[0]))r=new JXG.Circle(e,"pointRadius",i[0],i[1],o);else if(i[0].elementClass==JXG.OBJECT_CLASS_CIRCLE&&JXG.isPoint(i[1]))r=new JXG.Circle(e,"pointCircle",i[1],i[0],o);else if(i[1].elementClass==JXG.OBJECT_CLASS_CIRCLE&&JXG.isPoint(i[0]))r=new JXG.Circle(e,"pointCircle",i[0],i[1],o);else if(i[0].elementClass==JXG.OBJECT_CLASS_LINE&&JXG.isPoint(i[1]))r=new JXG.Circle(e,"pointLine",i[1],i[0],o);else if(i[1].elementClass==JXG.OBJECT_CLASS_LINE&&JXG.isPoint(i[0]))r=new JXG.Circle(e,"pointLine",i[0],i[1],o);else{if(!(t.length==3&&JXG.isPoint(i[0])&&JXG.isPoint(i[1])&&JXG.isPoint(i[2])))throw new Error("JSXGraph: Can't create circle with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'."+"\nPossible parent types: [point,point], [point,number], [point,function], [point,circle], [point,point,point]");r=JXG.createCircumcircle(e,i,n)}r.isDraggable=u,r.parents=[];for(s=0;s1)r[o]=e.create("point",t[o],a);else if(JXG.isPoint(t[o]))r[o]=JXG.getReference(e,t[o]);else if(typeof t[o]=="function"&&t[o]().elementClass===JXG.OBJECT_CLASS_POINT)r[o]=t[o]();else{if(!JXG.isString(t[o]))throw new Error("JSXGraph: Can't create Ellipse with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'."+"\nPossible parent types: [point,point,point], [point,point,number|function]");r[o]=JXG.getReference(e,t[o])}if(JXG.isNumber(t[2]))s=JXG.createFunction(t[2],e);else if(typeof t[2]=="function"&&JXG.isNumber(t[2]()))s=t[2];else{if(JXG.isPoint(t[2]))i=JXG.getReference(e,t[2]);else if(t[2].length>1)i=e.create("point",t[2],a);else if(typeof t[2]=="function"&&t[2]().elementClass==JXG.OBJECT_CLASS_POINT)i=t[2]();else{if(!JXG.isString(t[2]))throw new Error("JSXGraph: Can't create Ellipse with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"' and '"+typeof t[2]+"'."+"\nPossible parent types: [point,point,point], [point,point,number|function]");i=JXG.getReference(e,t[2])}s=function(){return i.Dist(r[0])+i.Dist(r[1])}}typeof t[4]=="undefined"&&(t[4]=1.0001*Math.PI),typeof t[3]=="undefined"&&(t[3]=-1.0001*Math.PI);var l=e.create("point",[function(){return(r[0].X()+r[1].X())*.5},function(){return(r[0].Y()+r[1].Y())*.5}],a),c=function(){var e=r[0].X(),t=r[0].Y(),n=r[1].X(),i=r[1].Y(),s,o,u,a=n-e>0?1:-1;Math.abs(n-e)>1e-7?s=Math.atan2(i-t,n-e)+(a<0?Math.PI:0):s=(i-t>0?.5:-0.5)*Math.PI,o=Math.cos(s),u=Math.sin(s);var f=[[1,0,0],[l.X(),o,-u],[l.Y(),u,o]];return f},h=e.create("curve",[function(e){return 0},function(e){return 0},t[3],t[4]],f),p=function(e,t){var n=s()*.5,i=n*n,o=r[1].Dist(r[0])*.5,a=i-o*o,f=Math.sqrt(a),p=[[1,0,0],[0,1,0],[0,0,1]],d,v;return t||(u=c(),d=l.X(),v=l.Y(),p[0][0]=u[0][0],p[0][1]=0,p[0][2]=0,p[1][0]=d*(1-u[1][1])+v*u[1][2],p[1][1]=u[1][1],p[1][2]=u[2][1],p[2][0]=v*(1-u[1][1])-d*u[1][2],p[2][1]=u[1][2],p[2][2]=u[2][2],h.quadraticform=JXG.Math.matMatMult(JXG.Math.transpose(p),JXG.Math.matMatMult([[-1+d*d/(n*n)+v*v/a,-d/i,-d/a],[-d/i,1/i,0],[-v/a,0,1/a]],p))),JXG.Math.matVecMult(u,[1,n*Math.cos(e),f*Math.sin(e)])};h.X=function(e,t){return p(e,t)[1]},h.Y=function(e,t){return p(e,t)[2]},h.midpoint=l,h.type=JXG.OBJECT_TYPE_CONIC,l.addChild(h);for(o=0;o<2;o++)JXG.isPoint(r[o])&&r[o].addChild(h);JXG.isPoint(i)&&i.addChild(h),h.parents=[];for(o=0;o1)r[o]=e.create("point",t[o],attr_focu);else if(JXG.isPoint(t[o]))r[o]=JXG.getReference(e,t[o]);else if(typeof t[o]=="function"&&t[o]().elementClass==JXG.OBJECT_CLASS_POINT)r[o]=t[o]();else{if(!JXG.isString(t[o]))throw new Error("JSXGraph: Can't create Hyperbola with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'."+"\nPossible parent types: [point,point,point], [point,point,number|function]");r[o]=JXG.getReference(e,t[o])}if(JXG.isNumber(t[2]))s=JXG.createFunction(t[2],e);else if(typeof t[2]=="function"&&JXG.isNumber(t[2]()))s=t[2];else{if(JXG.isPoint(t[2]))i=JXG.getReference(e,t[2]);else if(t[2].length>1)i=e.create("point",t[2],a);else if(typeof t[2]=="function"&&t[2]().elementClass==JXG.OBJECT_CLASS_POINT)i=t[2]();else{if(!JXG.isString(t[2]))throw new Error("JSXGraph: Can't create Hyperbola with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"' and '"+typeof t[2]+"'."+"\nPossible parent types: [point,point,point], [point,point,number|function]");i=JXG.getReference(e,t[2])}s=function(){return i.Dist(r[0])-i.Dist(r[1])}}typeof t[4]=="undefined"&&(t[4]=1.0001*Math.PI),typeof t[3]=="undefined"&&(t[3]=-1.0001*Math.PI);var l=e.create("point",[function(){return(r[0].X()+r[1].X())*.5},function(){return(r[0].Y()+r[1].Y())*.5}],a),c=function(){var e=r[0].X(),t=r[0].Y(),n=r[1].X(),i=r[1].Y(),s,o=n-e>0?1:-1;Math.abs(n-e)>1e-7?s=Math.atan2(i-t,n-e)+(o<0?Math.PI:0):s=(i-t>0?.5:-0.5)*Math.PI;var u=[[1,0,0],[l.X(),Math.cos(s),-Math.sin(s)],[l.Y(),Math.sin(s),Math.cos(s)]];return u},h=e.create("curve",[function(e){return 0},function(e){return 0},t[3],t[4]],f),p=function(e,t){var n=s()*.5,i=n*n,o=r[1].Dist(r[0])*.5,a=Math.sqrt(-n*n+o*o),f=a*a,p=[[1,0,0],[0,1,0],[0,0,1]],d,v;return t||(u=c(),d=l.X(),v=l.Y(),p[0][0]=u[0][0],p[0][1]=0,p[0][2]=0,p[1][0]=d*(1-u[1][1])+v*u[1][2],p[1][1]=u[1][1],p[1][2]=u[2][1],p[2][0]=v*(1-u[1][1])-d*u[1][2],p[2][1]=u[1][2],p[2][2]=u[2][2],h.quadraticform=JXG.Math.matMatMult(JXG.Math.transpose(p),JXG.Math.matMatMult([[-1+d*d/i+v*v/f,-d/i,v/f],[-d/i,1/i,0],[v/f,0,-1/f]],p))),JXG.Math.matVecMult(u,[1,n/Math.cos(e),a*Math.tan(e)])};h.X=function(e,t){return p(e,t)[1]},h.Y=function(e,t){return p(e,t)[2]},h.midpoint=l,h.type=JXG.OBJECT_TYPE_CONIC,l.addChild(h);for(o=0;o<2;o++)JXG.isPoint(r[o])&&r[o].addChild(h);JXG.isPoint(i)&&i.addChild(h),h.parents=[];for(o=0;o1)r=e.create("point",t[0],u);else if(JXG.isPoint(t[0]))r=JXG.getReference(e,t[0]);else if(typeof t[0]=="function"&&t[0]().elementClass==JXG.OBJECT_CLASS_POINT)r=t[0]();else{if(!JXG.isString(t[0]))throw new Error("JSXGraph: Can't create Parabola with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'."+"\nPossible parent types: [point,line]");r=JXG.getReference(e,t[0])}typeof t[3]=="undefined"&&(t[3]=10),typeof t[2]=="undefined"&&(t[2]=-10);var f=e.create("point",[function(){var t=[0,s.stdform[1],s.stdform[2]];return t=JXG.Math.crossProduct(t,r.coords.usrCoords),JXG.Math.Geometry.meetLineLine(t,s.stdform,0,e).usrCoords}],u),l=function(){var e=Math.atan(s.getSlope()),t=(f.X()+r.X())*.5,n=(f.Y()+r.Y())*.5;e+=r.Y()-f.Y()<0||r.Y()==f.Y()&&r.X()>f.X()?Math.PI:0;var i=[[1,0,0],[t*(1-Math.cos(e))+n*Math.sin(e),Math.cos(e),-Math.sin(e)],[n*(1-Math.cos(e))-t*Math.sin(e),Math.sin(e),Math.cos(e)]];return i},c=e.create("curve",[function(e){return 0},function(e){return 0},t[2],t[3]],a),h=function(e,t){var n=f.Dist(r)*.5,i=[[1,0,0],[0,1,0],[0,0,1]],s=(f.X()+r.X())*.5,u=(f.Y()+r.Y())*.5;return t||(o=l(),i[0][0]=o[0][0],i[0][1]=0,i[0][2]=0,i[1][0]=s*(1-o[1][1])+u*o[1][2],i[1][1]=o[1][1],i[1][2]=o[2][1],i[2][0]=u*(1-o[1][1])-s*o[1][2],i[2][1]=o[1][2],i[2][2]=o[2][2],c.quadraticform=JXG.Math.matMatMult(JXG.Math.transpose(i),JXG.Math.matMatMult([[-u*4*n-s*s,s,2*n],[s,-1,0],[2*n,0,0]],i))),JXG.Math.matVecMult(o,[1,e+s,e*e/(n*4)+u])};c.X=function(e,t){return h(e,t)[1]},c.Y=function(e,t){return h(e,t)[2]},c.type=JXG.OBJECT_TYPE_CONIC,f.addChild(c),JXG.isPoint(F[1])&&F[1].addChild(c),s.addChild(c),c.parents=[];for(i=0;i1)c[h]=e.create("point",t[h],m);else if(JXG.isPoint(t[h]))c[h]=JXG.getReference(e,t[h]);else if(typeof t[h]=="function"&&t[h]().elementClass==JXG.OBJECT_CLASS_POINT)c[h]=t[h]();else{if(!JXG.isString(t[h]))throw new Error("JSXGraph: Can't create Conic section with parent types '"+typeof t[h]+"'."+"\nPossible parent types: [point,point,point,point,point], [a00,a11,a22,a01,a02,a12]");c[h]=JXG.getReference(e,t[h])}else p=[[0,0,0],[0,0,0],[0,0,0]],p[0][0]=JXG.isFunction(t[2])?function(){return t[2]()}:function(){return t[2]},p[0][1]=JXG.isFunction(t[4])?function(){return t[4]()}:function(){return t[4]},p[0][2]=JXG.isFunction(t[5])?function(){return t[5]()}:function(){return t[5]},p[1][1]=JXG.isFunction(t[0])?function(){return t[0]()}:function(){return t[0]},p[1][2]=JXG.isFunction(t[3])?function(){return t[3]()}:function(){return t[3]},p[2][2]=JXG.isFunction(t[1])?function(){return t[1]()}:function(){return t[1]};var y=function(e){var t,n;for(t=0;t<3;t++)for(n=t;n<3;n++)e[t][n]+=e[n][t];for(t=0;t<3;t++)for(n=0;nn&&(a[h][n]=a[n][h]);E.quadraticform=a,i=JXG.Math.Numerics.Jacobi(a),i[0][0][0]<0&&(i[0][0][0]*=-1,i[0][1][1]*=-1,i[0][2][2]*=-1);for(n=0;n<3;n++){m=0;for(h=0;h<3;h++)m+=i[1][h][n]*i[1][h][n];m=Math.sqrt(m);for(h=0;h<3;h++);}r=i[1],u=Math.sqrt(Math.abs(i[0][0][0])),s=Math.sqrt(Math.abs(i[0][1][1])),o=Math.sqrt(Math.abs(i[0][2][2]))}return i[0][1][1]<=0&&i[0][2][2]<=0?g=JXG.Math.matVecMult(r,[1/u,Math.cos(e)/s,Math.sin(e)/o]):i[0][1][1]<=0&&i[0][2][2]>0?g=JXG.Math.matVecMult(r,[Math.cos(e)/u,1/s,Math.sin(e)/o]):i[0][2][2]<0&&(g=JXG.Math.matVecMult(r,[Math.sin(e)/u,Math.cos(e)/s,1/o])),g[1]/=g[0],g[2]/=g[0],g[0]=1,g};E.X=function(e,t){return S(e,t)[1]},E.Y=function(e,t){return S(e,t)[2]},E.midpoint=e.create("point",[function(){var e=E.quadraticform;return[e[1][1]*e[2][2]-e[1][2]*e[1][2],e[1][2]*e[0][2]-e[2][2]*e[0][1],e[0][1]*e[1][2]-e[1][1]*e[0][2]]}],m),E.type=JXG.OBJECT_TYPE_CONIC;if(d){for(h=0;h<5;h++)JXG.isPoint(c[h])&&c[h].addChild(E);E.parents=[];for(h=0;ht!=this.vertices[r].coords.scrCoords[2]>t&&e<(this.vertices[r].coords.scrCoords[1]-this.vertices[n].coords.scrCoords[1])*(t-this.vertices[n].coords.scrCoords[2])/(this.vertices[r].coords.scrCoords[2]-this.vertices[n].coords.scrCoords[2])+this.vertices[n].coords.scrCoords[1]&&(s=!s)}else{i=this.borders.length;for(n=0;nn&&(n=this.vertices[i].X()),this.vertices[i].Y()>t&&(t=this.vertices[i].Y()),this.vertices[i].Y()this.vertices.length-2)return this;for(t=1;t-1&&n-1;e--)r[s[e]]=-1,this.withLines&&s[e]-1>s[e-1]&&(o[o.length-1][1]=s[e],o.push([s[e-1]]));this.withLines&&(o[o.length-1][1]=s[0]),this.vertices=[];for(e=0;ei.length-1&&(t=i.length-1),this.board.removeObject(this.borders[t]),i[t]=-1;o[e][1]!==0&&o[e][0]!==r.length-1&&(i[o[e][0]-1]=JXG.createSegment(this.board,[r[Math.max(o[e][1]-1,0)],r[Math.min(o[e][0]+1,this.vertices.length-1)]],this.attr_line))}this.borders=[];for(e=0;e=s-2&&(c.id=c.ids[i-2]),o[i]=e.create("point",[o[i-2],u],c),o[i].type=JXG.OBJECT_TYPE_CAS,o[i].isDraggable=!0,o[i].visProp.fixed=!1);return c=JXG.copyAttributes(n,e.options,"polygon"),r=e.create("polygon",o,c),r.elType="regularpolygon",r},JXG.JSXGraph.registerElement("polygon",JXG.createPolygon),JXG.JSXGraph.registerElement("regularpolygon",JXG.createRegularPolygon),JXG.Curve=function(e,t,n){this.constructor(e,n,JXG.OBJECT_TYPE_CURVE,JXG.OBJECT_CLASS_CURVE),this.points=[],this.numberPoints=this.visProp.numberpointshigh,this.bezierDegree=1,this.dataX=null,this.dataY=null,t[0]!=null?this.varname=t[0]:this.varname="x",this.xterm=t[1],this.yterm=t[2],this.generateTerm(this.varname,this.xterm,this.yterm,t[3],t[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(),typeof this.xterm=="string"&&this.notifyParents(this.xterm),typeof this.yterm=="string"&&this.notifyParents(this.yterm)},JXG.Curve.prototype=new JXG.GeometryElement,JXG.extend(JXG.Curve.prototype,{minX:function(){if(this.visProp.curvetype=="polar")return 0;var e=new JXG.Coords(JXG.COORDS_BY_SCREEN,[0,0],this.board);return e.usrCoords[1]},maxX:function(){var e;return this.visProp.curvetype=="polar"?2*Math.PI:(e=new JXG.Coords(JXG.COORDS_BY_SCREEN,[this.board.canvasWidth,0],this.board),e.usrCoords[1])},Z:function(e){return 1},hasPoint:function(e,t,n){var r,i=Infinity,s,o,u,a,f,l,c,h,p,d,v,m,g=this.visProp.numberpointslow,y=(this.maxX()-this.minX())/g,b=this.board.options.precision.hasPoint/this.board.unitX,w,E,S=!0,x,T;b*=b,w=new JXG.Coords(JXG.COORDS_BY_SCREEN,[e,t],this.board),e=w.usrCoords[1],t=w.usrCoords[2],this.transformations.length>0&&(this.updateTransformMatrix(),x=JXG.Math.inverse(this.transformMat),T=JXG.Math.matVecMult(x,[1,e,t]),e=T[1],t=T[2]);if(this.visProp.curvetype=="parameter"||this.visProp.curvetype=="polar"||this.visProp.curvetype=="functiongraph")for(s=0,r=this.minX();s=JXG.Math.eps?(d=l*h+c*p,m=d/v,i-=m*d):m=0;if(m>=0&&m<=1&&i=JXG.Math.eps&&(a=(r*s+i*o)/u,a>0&&(a<=1?(r-=a*s,i-=a*o):(r-=s,i-=o))),f=r*r+i*i,Math.sqrt(f)};this.board.updateQuality==this.board.BOARD_QUALITY_LOW?(p=15,d=10,v=10):(p=21,d=.7,v=.7),b[0]=t-e;for(n=1;n1&&(S=x(this.points[E-2].scrCoords,[u,a],this.points[E-1].scrCoords),S<.015&&E--),this.points[E]=new JXG.Coords(JXG.COORDS_BY_SCREEN,[u,a],this.board),E++,f=u,l=a,i=r,c--,u=y[c][0],a=y[c][1],h=g[c]+1,n=m[c]*2}while(c>0&&E<5e5);return this.numberPoints=this.points.length,this},isSegmentOutside:function(e,t,n,r){return t<0&&r<0||t>this.board.canvasHeight&&r>this.board.canvasHeight||e<0&&n<0||e>this.board.canvasWidth&&n>this.board.canvasWidth},isDistOK:function(e,t,n,r){return Math.abs(e)0&&(t=JXG.Math.matVecMult(this.transformMat,e.usrCoords),e.setCoordinates(JXG.COORDS_BY_USER,[t[1],t[2]])),e},addTransform:function(e){var t,n=JXG.isArray(e)?e:[e],r=n.length;for(t=0;t0)for(s=0;s0&&this.transformations[this.transformations.length-1].isNumericMatrix?this.transformations[this.transformations.length-1].melt(n):this.addTransform(n);return this},setPositionDirectly:function(e,t,n){var r=new JXG.Coords(e,t,this.board),i=new JXG.Coords(e,n,this.board),s=JXG.Math.Statistics.subtract(r.usrCoords,i.usrCoords);return this.setPosition(JXG.COORDS_BY_USER,s),this},interpolationFunctionFromArray:function(e){var t="data"+e;return function(e,n){var r,i,s,o=this[t],u=o.length,a,f,l,c=[],h;if(isNaN(e))return NaN;if(e<0)return JXG.isFunction(o[0])?o[0]():o[0];if(this.bezierDegree==3){u/=3;if(e>=u)return JXG.isFunction(o[o.length-1])?o[o.length-1]():o[o.length-1];r=Math.floor(e)*3,f=e%1,l=1-f;for(h=0;h<4;h++)JXG.isFunction(o[r+h])?c[h]=o[r+h]():c[h]=o[r+h];return l*l*(l*c[0]+3*f*c[1])+(3*l*c[2]+f*c[3])*f*f}e>u-2?r=u-2:r=parseInt(Math.floor(e));if(r==e)return JXG.isFunction(o[r])?o[r]():o[r];for(h=0;h<2;h++)JXG.isFunction(o[r+h])?c[h]=o[r+h]():c[h]=o[r+h];return c[0]+(c[1]-c[0])*(e-r)}},generateTerm:function(e,t,n,r,i){var s,o;if(JXG.isArray(t))this.dataX=t,this.numberPoints=this.dataX.length,this.X=this.interpolationFunctionFromArray("X"),this.visProp.curvetype="plot",this.isDraggable=!0;else{this.X=JXG.createFunction(t,this.board,e);if(JXG.isString(t))this.visProp.curvetype="functiongraph";else if(JXG.isFunction(t)||JXG.isNumber(t))this.visProp.curvetype="parameter";this.isDraggable=!0}JXG.isArray(n)?(this.dataY=n,this.Y=this.interpolationFunctionFromArray("Y")):this.Y=JXG.createFunction(n,this.board,e),JXG.isFunction(t)&&JXG.isArray(n)&&(s=JXG.createFunction(n[0],this.board,""),o=JXG.createFunction(n[1],this.board,""),this.X=function(e){return t(e)*Math.cos(e)+s()},this.Y=function(e){return t(e)*Math.sin(e)+o()},this.visProp.curvetype="polar"),r!=null&&(this.minX=JXG.createFunction(r,this.board,"")),i!=null&&(this.maxX=JXG.createFunction(i,this.board,""))},notifyParents:function(e){JXG.GeonextParser.findDependencies(this,e,this.board)},getLabelAnchor:function(){var e,t,n,r=.05*this.board.canvasWidth,i=.05*this.board.canvasHeight,s=.95*this.board.canvasWidth,o=.95*this.board.canvasHeight;switch(this.visProp.label.position){case"ulft":t=r,n=i;break;case"llft":t=r,n=o;break;case"rt":t=s,n=.5*o;break;case"lrt":t=s,n=o;break;case"urt":t=s,n=i;break;case"top":t=.5*s,n=i;break;case"bot":t=.5*s,n=o;break;case"lft":default:t=r,n=.5*o}return e=new JXG.Coords(JXG.COORDS_BY_SCREEN,[t,n],this.board),JXG.Math.Geometry.projectCoordsToCurve(e.usrCoords[1],e.usrCoords[2],0,this,this.board)[0]},cloneToBackground:function(){var e={},t;return e.id=this.id+"T"+this.numTraces,e.elementClass=JXG.OBJECT_CLASS_CURVE,this.numTraces++,e.points=this.points.slice(0),e.numberPoints=this.numberPoints,e.board=this.board,e.visProp=JXG.deepCopy(this.visProp,this.visProp.traceattributes,!0),e.visProp.layer=this.board.options.layer.trace,e.visProp.curvetype=this.visProp.curvetype,JXG.clearVisPropOld(e),t=this.board.renderer.enhancedRendering,this.board.renderer.enhancedRendering=!0,this.board.renderer.drawCurve(e),this.board.renderer.enhancedRendering=t,this.traces[e.id]=e.rendNode,this},bounds:function(){var e=Infinity,t=-Infinity,n=Infinity,r=-Infinity,i=this.points.length,s;for(s=0;sthis.points[s].usrCoords[1]&&(e=this.points[s].usrCoords[1]),tthis.points[s].usrCoords[2]&&(n=this.points[s].usrCoords[2]),rMath.PI||this.visProp.type=="major"&&aJXG.Math.eps)a>=O?(i=O,a-=O):(i=a,a=0),s=Math.cos(A*i),o=Math.sin(A*i),u=[[1,0,0],[l*(1-s)+c*o,s,-o],[c*(1-s)-l*o,o,s]],p=JXG.Math.matVecMult(u,y),E=[p[0]/p[0],p[1]/p[0],p[2]/p[0]],x=y[1]-l,T=y[2]-c,N=E[1]-l,C=E[2]-c,k=Math.sqrt((x+N)*(x+N)+(T+C)*(T+C)),Math.abs(C-T)>JXG.Math.eps?S=(x+N)*(L/k-.5)/(C-T)*8/3:S=(T+C)*(L/k-.5)/(x-N)*8/3,b=[1,y[1]-S*T,y[2]+S*x],w=[1,E[1]+S*C,E[2]-S*N],this.dataX=this.dataX.concat([b[1],w[1],E[1]]),this.dataY=this.dataY.concat([b[2],w[2],E[2]]),y=E.slice(0);this.bezierDegree=3,this.updateStdform(),this.updateQuadraticform()},r.Radius=function(){return this.radiuspoint.Dist(this.center)},r.getRadius=function(){return this.Radius()},r.hasPoint=function(e,t){var n=this.board.options.precision.hasPoint/this.board.unitX,r=this.Radius(),i,s,o,u,a,f,l,c;s=new JXG.Coords(JXG.COORDS_BY_SCREEN,[e,t],this.board),this.transformations.length>0&&(this.updateTransformMatrix(),l=JXG.Math.inverse(this.transformMat),c=JXG.Math.matVecMult(l,s.usrCoords),s=new JXG.Coords(JXG.COORDS_BY_USER,c,this.board)),i=this.center.coords.distance(JXG.COORDS_BY_USER,s),o=Math.abs(i-r)Math.PI||this.visProp.type=="major"&&ff)o=!1}return o},r.hasPointSector=function(e,t){var n=new JXG.Coords(JXG.COORDS_BY_SCREEN,[e,t],this.board),r=this.Radius(),i=this.center.coords.distance(JXG.COORDS_BY_USER,n),s=iMath.PI||this.visProp.type=="major"&&aa)s=!1}return s},r.getTextAnchor=function(){return this.center.coords},r.getLabelAnchor=function(){var e,t=10/this.board.unitX,n=10/this.board.unitY,r=this.point2.coords.usrCoords,i=this.center.coords.usrCoords,s=r[1]-i[1],o=r[2]-i[2],u,a,f,l;this.label.content!=null&&(this.label.content.relativeCoords=new JXG.Coords(JXG.COORDS_BY_SCREEN,[0,0],this.board)),e=JXG.Math.Geometry.rad(this.radiuspoint,this.center,this.anglepoint);if(this.visProp.type=="minor"&&e>Math.PI||this.visProp.type=="major"&&eJXG.Math.eps)a>=A?(i=A,a-=A):(i=a,a=0),s=Math.cos(i),o=Math.sin(i),u=[[1,0,0],[l*(1-s)+c*o,s,-o],[c*(1-s)-l*o,o,s]],p=JXG.Math.matVecMult(u,y),E=[p[0]/p[0],p[1]/p[0],p[2]/p[0]],x=y[1]-l,T=y[2]-c,N=E[1]-l,C=E[2]-c,k=Math.sqrt((x+N)*(x+N)+(T+C)*(T+C)),Math.abs(C-T)>JXG.Math.eps?S=(x+N)*(L/k-.5)/(C-T)*8/3:S=(T+C)*(L/k-.5)/(x-N)*8/3,b=[1,y[1]-S*T,y[2]+S*x],w=[1,E[1]+S*C,E[2]-S*N],this.dataX=this.dataX.concat([b[1],w[1],E[1]]),this.dataY=this.dataY.concat([b[2],w[2],E[2]]),y=E.slice(0);this.dataX=this.dataX.concat([E[1]+.333*(l-E[1]),E[1]+.666*(l-E[1]),l]),this.dataY=this.dataY.concat([E[2]+.333*(c-E[2]),E[2]+.666*(c-E[2]),c]),this.bezierDegree=3},r.Radius=function(){return this.point2.Dist(this.point1)},r.getRadius=function(){return this.Radius()},r.hasPoint=function(e,t){var n=this.board.options.precision.hasPoint/this.board.unitX,r=new JXG.Coords(JXG.COORDS_BY_SCREEN,[e,t],this.board),i=this.Radius(),s=this.center.coords.distance(JXG.COORDS_BY_USER,r),o=Math.abs(s-i)f)o=!1}return o},r.hasPointSector=function(e,t){var n=new JXG.Coords(JXG.COORDS_BY_SCREEN,[e,t],this.board),r=this.Radius(),i=this.point1.coords.distance(JXG.COORDS_BY_USER,n),s=iJXG.Math.Geometry.rad(this.point2,this.point1,this.point3)&&(s=!1)),s},r.getTextAnchor=function(){return this.point1.coords},r.getLabelAnchor=function(){var e=JXG.Math.Geometry.rad(this.point2,this.point1,this.point3),t=13/this.board.unitX,n=13/this.board.unitY,r=this.point2.coords.usrCoords,i=this.point1.coords.usrCoords,s=r[1]-i[1],o=r[2]-i[2],u,a,f,l;return this.label.content!=null&&(this.label.content.relativeCoords=new JXG.Coords(JXG.COORDS_BY_SCREEN,[0,0],this.board)),u=new JXG.Coords(JXG.COORDS_BY_USER,[i[1]+Math.cos(e*.5)*s-Math.sin(e*.5)*o,i[2]+Math.sin(e*.5)*s+Math.cos(e*.5)*o],this.board),a=u.usrCoords[1]-i[1],f=u.usrCoords[2]-i[2],l=Math.sqrt(a*a+f*f),a=a*(l+t)/l,f=f*(l+n)/l,new JXG.Coords(JXG.COORDS_BY_USER,[i[1]+a,i[2]+f],this.board)},r.prepareUpdate().update(),r},JXG.JSXGraph.registerElement("sector",JXG.createSector),JXG.createCircumcircleSector=function(e,t,n){var r,i,s;if(!(JXG.isPoint(t[0])&&JXG.isPoint(t[1])&&JXG.isPoint(t[2])))throw new Error("JSXGraph: Can't create circumcircle sector with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"' and '"+typeof t[2]+"'.");return s=JXG.copyAttributes(n,e.options,"circumcirclesector","center"),i=e.create("circumcenter",[t[0],t[1],t[2]],s),i.dump=!1,s=JXG.copyAttributes(n,e.options,"circumcirclesector"),r=e.create("sector",[i,t[0],t[2],t[1]],s),r.elType="circumcirclesector",r.parents=[t[0].id,t[1].id,t[2].id],r.center=i,r.subs={center:i},r},JXG.JSXGraph.registerElement("circumcirclesector",JXG.createCircumcircleSector),JXG.createAngle=function(e,t,n){var r,i,s,o,u,a,f,l;if(!(JXG.isPoint(t[0])&&JXG.isPoint(t[1])&&JXG.isPoint(t[2])))throw new Error("JSXGraph: Can't create angle with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"' and '"+typeof t[2]+"'.");u=JXG.copyAttributes(n,e.options,"angle"),o=u.name;if(typeof o=="undefined"||o=="")o=e.generateName({type:JXG.OBJECT_TYPE_ANGLE}),u.name=o;a=JXG.copyAttributes(n,e.options,"angle","radiuspoint"),i=e.create("point",[0,1,0],a),i.dump=!1,a=JXG.copyAttributes(n,e.options,"angle","pointsquare"),s=e.create("point",[0,1,1],a),s.dump=!1,r=e.create("sector",[t[1],i,t[2]],u),r.elType="angle",r.parents=[t[0].id,t[1].id,t[2].id],r.subs={point:i,pointsquare:s},r.updateDataArraySquare=function(){var e=t[1],n,r,o,u;n=JXG.Math.crossProduct(s.coords.usrCoords,e.coords.usrCoords),r=[-i.X()*n[1]-i.Y()*n[2],i.Z()*n[1],i.Z()*n[2]],n=JXG.Math.crossProduct(i.coords.usrCoords,e.coords.usrCoords),o=[-s.X()*n[1]-s.Y()*n[2],s.Z()*n[1],s.Z()*n[2]],u=JXG.Math.crossProduct(r,o),u[1]/=u[0],u[2]/=u[0],this.dataX=[e.X(),i.X(),u[1],s.X(),e.X()],this.dataY=[e.Y(),i.Y(),u[2],s.Y(),e.Y()],this.bezierDegree=1},r.updateDataArrayNone=function(){this.dataX=[NaN],this.dataY=[NaN],this.bezierDegree=1},r.updateDataArraySector=r.updateDataArray,r.updateDataArray=function(){var e=this.visProp.type,n=JXG.Math.Geometry.trueAngle(t[0],t[1],t[2]);Math.abs(n-90)0&&(e.transformations.pop(),e.isDraggable=!0,e.parents=[]),this},r},JXG.JSXGraph.registerElement("angle",JXG.createAngle),JXG.Composition=function(e){var t=["setProperty","prepareUpdate","updateRenderer","update","highlight","noHighlight"],n=function(e){return function(){var t;for(t in r.elements)JXG.exists(r.elements[t][e])&&r.elements[t][e].apply(r.elements[t],arguments);return r}},r=this,i;for(i=0;i=3&&JXG.isPoint(t[0])&&JXG.isPoint(t[1])&&JXG.isPoint(t[2])))throw new Error("JSXGraph: Can't create incenter with parent types '"+typeof t[0]+"', '"+typeof t[1]+"' and '"+typeof t[2]+"'."+"\nPossible parent types: [point,point,point]");return s=t[0],o=t[1],u=t[2],r=e.create("point",[function(){var t,n,r;return t=Math.sqrt((o.X()-u.X())*(o.X()-u.X())+(o.Y()-u.Y())*(o.Y()-u.Y())),n=Math.sqrt((s.X()-u.X())*(s.X()-u.X())+(s.Y()-u.Y())*(s.Y()-u.Y())),r=Math.sqrt((o.X()-s.X())*(o.X()-s.X())+(o.Y()-s.Y())*(o.Y()-s.Y())),new JXG.Coords(JXG.COORDS_BY_USER,[(t*s.X()+n*o.X()+r*u.X())/(t+n+r),(t*s.Y()+n*o.Y()+r*u.Y())/(t+n+r)],e)}],n),r.elType="incenter",r.parents=[t[0].id,t[1].id,t[2].id],r},JXG.createCircumcircle=function(e,t,n){var r,i,s;try{s=JXG.copyAttributes(n,e.options,"circumcircle","center"),r=JXG.createCircumcircleMidpoint(e,t,s),r.dump=!1,JXG.exists(n.layer)||(n.layer=e.options.layer.circle),s=JXG.copyAttributes(n,e.options,"circumcircle"),i=JXG.createCircle(e,[r,t[0]],s),i.elType="circumcircle",i.parents=[t[0].id,t[1].id,t[2].id],i.subs={center:r}}catch(o){throw new Error("JSXGraph: Can't create circumcircle with parent types '"+typeof t[0]+"', '"+typeof t[1]+"' and '"+typeof t[2]+"'."+"\nPossible parent types: [point,point,point]")}return i},JXG.createIncircle=function(e,t,n){var r,i,s,o;try{s=JXG.copyAttributes(n,e.options,"incircle","center"),r=JXG.createIncenter(e,t,s),r.dump=!1,JXG.exists(n.layer)||(n.layer=e.options.layer.circle),s=JXG.copyAttributes(n,e.options,"incircle"),i=JXG.createCircle(e,[r,function(){var e=Math.sqrt((t[1].X()-t[2].X())*(t[1].X()-t[2].X())+(t[1].Y()-t[2].Y())*(t[1].Y()-t[2].Y())),n=Math.sqrt((t[0].X()-t[2].X())*(t[0].X()-t[2].X())+(t[0].Y()-t[2].Y())*(t[0].Y()-t[2].Y())),r=Math.sqrt((t[1].X()-t[0].X())*(t[1].X()-t[0].X())+(t[1].Y()-t[0].Y())*(t[1].Y()-t[0].Y())),i=(e+n+r)/2;return Math.sqrt((i-e)*(i-n)*(i-r)/i)}],s),i.elType="incircle",i.parents=[t[0].id,t[1].id,t[2].id],i.center=r,i.subs={center:r}}catch(u){throw new Error("JSXGraph: Can't create circumcircle with parent types '"+typeof t[0]+"', '"+typeof t[1]+"' and '"+typeof t[2]+"'."+"\nPossible parent types: [point,point,point]")}return i},JXG.createReflection=function(e,t,n){var r,i,s,o;if(t[0].elementClass==JXG.OBJECT_CLASS_POINT&&t[1].elementClass==JXG.OBJECT_CLASS_LINE)i=t[0],r=t[1];else{if(t[1].elementClass!=JXG.OBJECT_CLASS_POINT||t[0].elementClass!=JXG.OBJECT_CLASS_LINE)throw new Error("JSXGraph: Can't create reflection point with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'."+"\nPossible parent types: [line,point]");i=t[1],r=t[0]}return o=JXG.createTransform(e,[r],{type:"reflect"}),s=JXG.createPoint(e,[i,o],n),i.addChild(s),r.addChild(s),s.elType="reflection",s.parents=[t[0].id,t[1].id],s.prepareUpdate().update(),s.generatePolynomial=function(){var e=r.point1.symbolic.x,t=r.point1.symbolic.y,n=r.point2.symbolic.x,o=r.point2.symbolic.y,u=i.symbolic.x,a=i.symbolic.y,f=s.symbolic.x,c=s.symbolic.y,h=["((",c,")-(",a,"))*((",t,")-(",o,"))+((",e,")-(",n,"))*((",f,")-(",u,"))"].join(""),d=["((",f,")-(",e,"))^2+((",c,")-(",t,"))^2-((",u,")-(",e,"))^2-((",a,")-(",t,"))^2"].join("");return[h,d]},s},JXG.createMirrorPoint=function(e,t,n){var r,i;if(!JXG.isPoint(t[0])||!JXG.isPoint(t[1]))throw new Error("JSXGraph: Can't create mirror point with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'."+"\nPossible parent types: [point,point]");r=JXG.createPoint(e,[function(){return JXG.Math.Geometry.rotation(t[0],t[1],Math.PI,e)}],n);for(i=0;i<2;i++)t[i].addChild(r);return r.elType="mirrorpoint",r.parents=[t[0].id,t[1].id],r.prepareUpdate().update(),r},JXG.createIntegral=function(e,t,n){var r,i,s,o=0,u=0,a,f,l,c,h=1,p,d,v,m,g,y,b;if(JXG.isArray(t[0])&&t[1].elementClass==JXG.OBJECT_CLASS_CURVE)r=t[0],i=t[1];else{if(!JXG.isArray(t[1])||t[0].elementClass!=JXG.OBJECT_CLASS_CURVE)throw new Error("JSXGraph: Can't create integral with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'."+"\nPossible parent types: [[number|function,number|function],curve]");r=t[1],i=t[0]}return o=r[0],u=r[1],JXG.isFunction(o)?(a=o,f=function(){return i.Y(a())},o=a()):(a=o,f=i.Y(o)),JXG.isFunction(o)?(l=u,c=function(){return i.Y(l())},u=l()):(l=u,c=i.Y(u)),u0)return;var t=JXG.Math.Symbolic.generatePolynomials(e,i,!0).join("|");if(t===r.spe)return;r.spe=t;var n=function(e,t,n,i){r.dataX=e,r.dataY=t,r.eq=n,r.ctime=i,r.generatePolynomial=function(e){return function(t){var n="("+t.symbolic.x+")",r="("+t.symbolic.y+")",i=[],s;for(s=0;ss.usrCoords[2]-n;o-=n)r.dataX.push(i.usrCoords[1],s.usrCoords[1],NaN),r.dataY.push(o,o,NaN);for(o=i.usrCoords[1];o0&&(f=JXG.Math.Statistics.multiply(f,-1),l=f),u=i*Math.max(JXG.Math.Geometry.perpendicular(t[0],a,e)[0].distance(JXG.COORDS_BY_USER,a.coords),o),u*=r,a={coords:{usrCoords:[1,(n[0]+n[2])/2,(n[1]+n[3])/2]}},a=JXG.Math.Geometry.perpendicular(t[0],a,e)[0].usrCoords,c=[1,a[1]+f[1]*o,a[2]-f[0]*o],h=[1,a[1]-l[1]*o,a[2]+l[0]*o],this.dataX=[c[1],c[1]+f[0]*u,h[1]+l[0]*u,h[1],c[1]],this.dataY=[c[2],c[2]+f[1]*u,h[2]+l[1]*u,h[2],c[2]]};else{r=JXG.createFunction(t[0]);if(!JXG.exists(r))throw new Error("JSXGraph: Can't create area with the given parents.\nPossible parent types: [line], [function]")}return i},JXG.JSXGraph.registerElement("arrowparallel",JXG.createArrowParallel),JXG.JSXGraph.registerElement("bisector",JXG.createBisector),JXG.JSXGraph.registerElement("bisectorlines",JXG.createAngularBisectorsOfTwoLines),JXG.JSXGraph.registerElement("circumcircle",JXG.createCircumcircle),JXG.JSXGraph.registerElement("circumcirclemidpoint",JXG.createCircumcircleMidpoint),JXG.JSXGraph.registerElement("circumcenter",JXG.createCircumcircleMidpoint),JXG.JSXGraph.registerElement("incenter",JXG.createIncenter),JXG.JSXGraph.registerElement("incircle",JXG.createIncircle),JXG.JSXGraph.registerElement("integral",JXG.createIntegral),JXG.JSXGraph.registerElement("midpoint",JXG.createMidpoint),JXG.JSXGraph.registerElement("mirrorpoint",JXG.createMirrorPoint),JXG.JSXGraph.registerElement("normal",JXG.createNormal),JXG.JSXGraph.registerElement("orthogonalprojection",JXG.createOrthogonalProjection),JXG.JSXGraph.registerElement("parallel",JXG.createParallel),JXG.JSXGraph.registerElement("parallelpoint",JXG.createParallelPoint),JXG.JSXGraph.registerElement("perpendicular",JXG.createPerpendicular),JXG.JSXGraph.registerElement("perpendicularpoint",JXG.createPerpendicularPoint),JXG.JSXGraph.registerElement("perpendicularsegment",JXG.createPerpendicularSegment),JXG.JSXGraph.registerElement("reflection",JXG.createReflection),JXG.JSXGraph.registerElement("locus",JXG.createLocus),JXG.JSXGraph.registerElement("grid",JXG.createGrid),JXG.JSXGraph.registerElement("inequality",JXG.createInequality),JXG.Text=function(e,t,n,r){this.constructor(e,r,JXG.OBJECT_TYPE_TEXT,JXG.OBJECT_CLASS_OTHER);var i;this.content="",this.plaintext="",this.isDraggable=!1,this.needsSizeUpdate=!1;if(this.element=JXG.getRef(this.board,r.anchor)){var s;this.visProp.islabel?this.relativeCoords=new JXG.Coords(JXG.COORDS_BY_SCREEN,[parseFloat(n[0]),parseFloat(n[1])],this.board):this.relativeCoords=new JXG.Coords(JXG.COORDS_BY_USER,[parseFloat(n[0]),parseFloat(n[1])],this.board),this.element.addChild(this),this.X=function(){var e,t,n;return this.visProp.islabel?(e=parseFloat(this.visProp.offset[0]),n=this.element.getLabelAnchor(),t=new JXG.Coords(JXG.COORDS_BY_SCREEN,[e+this.relativeCoords.scrCoords[1]+n.scrCoords[1],0],this.board),t.usrCoords[1]):(n=this.element.getTextAnchor(),this.relativeCoords.usrCoords[1]+n.usrCoords[1])},this.Y=function(){var e,t,n;return this.visProp.islabel?(e=-parseFloat(this.visProp.offset[1]),n=this.element.getLabelAnchor(),t=new JXG.Coords(JXG.COORDS_BY_SCREEN,[0,e+this.relativeCoords.scrCoords[2]+n.scrCoords[2]],this.board),t.usrCoords[2]):(n=this.element.getTextAnchor(),this.relativeCoords.usrCoords[2]+n.usrCoords[2])},this.coords=new JXG.Coords(JXG.COORDS_BY_SCREEN,[0,0],this.board),this.isDraggable=!0}else JXG.isNumber(n[0])&&JXG.isNumber(n[1])&&(this.isDraggable=!0),this.X=JXG.createFunction(n[0],this.board,null,!0),this.Y=JXG.createFunction(n[1],this.board,null,!0),this.coords=new JXG.Coords(JXG.COORDS_BY_USER,[this.X(),this.Y()],this.board);return this.Z=JXG.createFunction(1,this.board,""),this.size=[1,1],this.id=this.board.setId(this,"T"),this.board.renderer.drawText(this),this.setText(t),this.updateSize(),this.visProp.visible||this.board.renderer.hide(this),typeof this.content=="string"&&this.notifyParents(this.content),this.elType="text",this.methodMap=JXG.deepCopy(this.methodMap,{setText:"setTextJessieCode",free:"free",move:"setCoords"}),this},JXG.Text.prototype=new JXG.GeometryElement,JXG.extend(JXG.Text.prototype,{hasPoint:function(e,t){var n,r,i,s,o=this.board.options.precision.hasPoint;return this.visProp.anchorx==="right"?n=this.coords.scrCoords[1]-this.size[0]:this.visProp.anchorx==="middle"?n=this.coords.scrCoords[1]-.5*this.size[0]:n=this.coords.scrCoords[1],r=n+this.size[0],this.visProp.anchory==="top"?s=this.coords.scrCoords[2]+this.size[1]:this.visProp.anchorx==="middle"?s=this.coords.scrCoords[2]+.5*this.size[1]:s=this.coords.scrCoords[2],i=s-this.size[1],t>=i-o&&t<=s+o&&(e>=n-o&&e<=n+2*o||e>=r-2*o&&e<=r+o)},_setText:function(e){return this.needsSizeUpdate=!1,typeof e=="function"?(this.updateText=function(){this.plaintext=e()},this.needsSizeUpdate=!0):(JXG.isNumber(e)?this.content=e.toFixed(this.visProp.digits):this.visProp.useasciimathml?(this.content="'`"+e+"`'",this.needsSizeUpdate=!0):this.content=this.generateTerm(e),this.updateText=new Function("this.plaintext = "+this.content+"; ")),this.updateText(),this.prepareUpdate().update().updateRenderer(),this},setTextJessieCode:function(e){var t;return this.visProp.castext=e,typeof e=="function"?t=function(){return e().replace(//g,">")}:JXG.isNumber(e)?t=e:t=e.replace(//g,">"),this._setText(t)},setText:function(e){this._setText(e)},updateSize:function(){var e;if(typeof document=="undefined")return this;if(this.visProp.display=="html"&&this.board.renderer.type!=="vml"&&this.board.renderer.type!=="no")this.size=[this.rendNode.offsetWidth,this.rendNode.offsetHeight];else if(this.visProp.display==="internal"&&this.board.renderer.type==="svg")try{e=this.rendNode.getBBox(),this.size=[e.width,e.height]}catch(t){}else if(this.board.renderer.type==="vml"||this.visProp.display==="internal"&&this.board.renderer.type==="canvas")this.size=[parseFloat(this.visProp.fontsize)*this.plaintext.length*.45,parseFloat(this.visProp.fontsize)*.9];return this},getSize:function(){return this.size},setCoords:function(e,t){return JXG.isArray(e)&&e.length>1&&(t=e[1],e=e[0]),this.X=function(){return e},this.Y=function(){return t},this.coords.setCoordinates(JXG.COORDS_BY_USER,[e,t]),this.prepareUpdate().update().updateRenderer(),this},free:function(){this.X=JXG.createFunction(this.X(),this.board,""),this.Y=JXG.createFunction(this.Y(),this.board,""),this.isDraggable=!0},update:function(){var e,t,n;return this.needsUpdate&&(this.updateCoords(),this.updateText(),this.needsSizeUpdate&&this.updateSize(),this.updateTransform()),this},updateCoords:function(){this.coords.setCoordinates(JXG.COORDS_BY_USER,[this.X(),this.Y()])},updateRenderer:function(){return this.needsUpdate&&(this.board.renderer.updateText(this),this.needsUpdate=!1),this},updateTransform:function(){var e;if(this.transformations.length==0)return;for(e=0;e/g,"∠"),e=e.replace(//g,"√");var i;i=e.indexOf("");var s=e.indexOf("");if(i>=0){this.needsSizeUpdate=!0;while(i>=0)n+=' + "'+JXG.GeonextParser.replaceSub(JXG.GeonextParser.replaceSup(e.slice(0,i)))+'"',r=e.slice(i+7,s),t=JXG.GeonextParser.geonext2JS(r,this.board),t=t.replace(/\\"/g,'"'),t=t.replace(/\\'/g,"'"),t.indexOf("toFixed")<0?JXG.isNumber(JXG.bind(new Function("return "+t+";"),this)())?n+="+("+t+").toFixed("+this.visProp.digits+")":n+="+("+t+")":n+="+("+t+")",e=e.slice(s+8),i=e.indexOf(""),s=e.indexOf("")}return n+=' + "'+JXG.GeonextParser.replaceSub(JXG.GeonextParser.replaceSup(e))+'"',n=n.replace(//g,""),n=n.replace(/<\/overline>/g,""),n=n.replace(//g,""),n=n.replace(/<\/arrow>/g,""),n=n.replace(/&/g,"&"),n},notifyParents:function(e){var t=null;do{var n=/([\w\s\*\/\^\-\+\(\)\[\],<>=!]+)<\/value>/;t=n.exec(e),t!=null&&(JXG.GeonextParser.findDependencies(this,t[1],this.board),e=e.substr(t.index),e=e.replace(n,""))}while(t!=null);return this},bounds:function(){var e=this.coords.usrCoords;return this.visProp.islabel?[0,0,0,0]:[e[1],e[2]+this.size[1],e[1]+this.size[0],e[2]]},setPositionDirectly:function(e,t,n){var r=new JXG.Coords(e,t,this.board),i=new JXG.Coords(e,n,this.board),s,o;return this.relativeCoords?this.visProp.islabel?(s=JXG.Math.Statistics.subtract(r.scrCoords,i.scrCoords),this.relativeCoords.scrCoords[1]+=s[1],this.relativeCoords.scrCoords[2]+=s[2]):(s=JXG.Math.Statistics.subtract(r.usrCoords,i.usrCoords),this.relativeCoords.usrCoords[1]+=s[1],this.relativeCoords.usrCoords[2]+=s[2]):(s=JXG.Math.Statistics.subtract(r.usrCoords,i.usrCoords),o=[this.Z(),this.X(),this.Y()],this.X=JXG.createFunction(o[1]+s[1],this.board,""),this.Y=JXG.createFunction(o[2]+s[2],this.board,"")),this}}),JXG.createText=function(e,t,n){var r,i=JXG.copyAttributes(n,e.options,"text");return i.anchor=i.parent||i.anchor,r=new JXG.Text(e,t[t.length-1],t,i),typeof t[t.length-1]!="function"&&(r.parents=t),JXG.evaluate(i.rotate)!=0&&i.display=="internal"&&r.addRotation(JXG.evaluate(i.rotate)),r},JXG.JSXGraph.registerElement("text",JXG.createText),JXG.Image=function(e,t,n,r,i){this.constructor(e,i,JXG.OBJECT_TYPE_IMAGE,JXG.OBJECT_CLASS_OTHER),this.initialCoords=new JXG.Coords(JXG.COORDS_BY_USER,n,this.board),!JXG.isFunction(n[0])&&!JXG.isFunction(n[1])&&(this.isDraggable=!0),this.X=JXG.createFunction(n[0],this.board,""),this.Y=JXG.createFunction(n[1],this.board,""),this.Z=JXG.createFunction(1,this.board,""),this.W=JXG.createFunction(r[0],this.board,""),this.H=JXG.createFunction(r[1],this.board,""),this.coords=new JXG.Coords(JXG.COORDS_BY_USER,[this.X(),this.Y()],this.board),this.usrSize=[this.W(),this.H()],this.size=[Math.abs(this.usrSize[0]*e.unitX),Math.abs(this.usrSize[1]*e.unitY)],this.url=t,this.elType="image",this.span=[[this.Z(),this.X(),this.Y()],[this.Z(),this.W(),0],[this.Z(),0,this.H()]],this.parent=JXG.getRef(i.anchor),this.id=this.board.setId(this,"Im"),this.board.renderer.drawImage(this),this.visProp.visible||this.board.renderer.hide(this)},JXG.Image.prototype=new JXG.GeometryElement,JXG.extend(JXG.Image.prototype,{hasPoint:function(e,t){var n=this.transformations.length,r,i,s,o,u,a,f;if(n==0)return r=e-this.coords.scrCoords[1],i=this.coords.scrCoords[2]-t,s=this.board.options.precision.hasPoint,r>=-s&&r-this.size[0]<=s&&i>=-s&&i-this.size[1]<=s?!0:!1;o=new JXG.Coords(JXG.COORDS_BY_SCREEN,[e,t],this.board),o=o.usrCoords,u=[o[0]-this.span[0][0],o[1]-this.span[0][1],o[2]-this.span[0][2]],f=JXG.Math.innerProduct,a=f(u,this.span[1]);if(0<=a&&a<=f(this.span[1],this.span[1])){a=f(u,this.span[2]);if(0<=a&&a<=f(this.span[2],this.span[2]))return!0}return!1},update:function(){return this.needsUpdate&&(this.updateCoords(),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.updateTransform(),this.updateSpan()),this},updateRenderer:function(){return this.needsUpdate&&(this.board.renderer.updateImage(this),this.needsUpdate=!1),this},updateTransform:function(){var e,t=this.transformations.length;if(t>0)for(e=0;e=0?d+=a*.5/e.unitX:d-=a*o/e.unitX,h-=a*.2/e.unitY,f=e.create("text",[d,h,r.labels[i]],r))):(m[0]=e.create("point",[c,0],g),m[1]=e.create("point",[c,d],g),m[2]=e.create("point",[p,d],g),m[3]=e.create("point",[p,0],g),JXG.exists(r.labels)&&JXG.exists(r.labels[i])&&(o=r.labels[i].toString().length,o=.6*o*a/e.unitX,d>=0?d+=a*.5/e.unitY:d-=a*1/e.unitY,f=e.create("text",[h-o*.5,d,r.labels[i]],r))),r.withlines=!1,JXG.exists(r.colors)&&JXG.isArray(r.colors)&&(v=r.colors,r.fillcolor=v[i%v.length]),s[i]=e.create("polygon",m,r),JXG.exists(r.labels)&&JXG.exists(r.labels[i])&&(s[i].text=f);return s},drawPoints:function(e,t,n,r){var i,s=[],o=r.infoboxarray;r.fixed=!0,r.name="";for(i=0;iu[i]&&(u[i]=t[r][i]),t[r][i]1&&(n.length==3?(t=this.evalParam(1),r=this.evalParam(2)):(t=n[1].X(),r=n[1].Y()),this.matrix[1][0]=t*(1-i)+r*s,this.matrix[2][0]=r*(1-i)-t*s)}):t=="shear"?(this.evalParam=JXG.createEvalFunction(e,n,1),this.update=function(){var e=this.evalParam(0);this.matrix[1][1]=Math.tan(e)}):t=="generic"&&(this.evalParam=JXG.createEvalFunction(e,n,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(e){return this.update(),arguments[1]!=null?JXG.Math.matVecMult(this.matrix,e.initialCoords.usrCoords):JXG.Math.matVecMult(this.matrix,e.coords.usrCoords)},applyOnce:function(e){var t,n,r;JXG.isArray(e)||(e=[e]),n=e.length;for(r=0;r=8192&&(this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this._attributes),this.objects.push(this.curve)),this.pos[0]+=t,this.pos[1]+=n,this.isPenDown&&(this.curve.dataX.push(this.pos[0]),this.curve.dataY.push(this.pos[1])),this.board.update(),this},back:function(e){return this.forward(-e)},right:function(e){this.dir-=e,this.dir%=360;if(!this.turtleIsHidden){var t=this.board.create("transform",[-e*Math.PI/180,this.turtle],{type:"rotate"});t.applyOnce(this.turtle2)}return this.board.update(),this},left:function(e){return this.right(-e)},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(){for(var e=0;e=8192&&(this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this._attributes),this.objects.push(this.curve)),this.pos[0]=e[0],this.pos[1]=e[1],this.isPenDown&&(this.curve.dataX.push(this.pos[0]),this.curve.dataY.push(this.pos[1])),this.board.update()}return this},fd:function(e){return this.forward(e)},bk:function(e){return this.back(e)},lt:function(e){return this.left(e)},rt:function(e){return this.right(e)},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(e,t){var n,r,i,s,o=this.objects.length;for(n=0,r=0;n=3&&(arguments[0]=[arguments[0],arguments[1],arguments[2]],arguments.length=1),e=arguments[0];if(JXG.isArray(e)){for(n=0;n<3;n++)t|=/\./.test(arguments[0][n].toString());for(n=0;n<3;n++)t&=arguments[0][n]>=0&arguments[0][n]<=1;return t?[Math.ceil(arguments[0][0]*255),Math.ceil(arguments[0][1]*255),Math.ceil(arguments[0][2]*255)]:(arguments[0].length=3,arguments[0])}typeof arguments[0]=="string"&&(e=arguments[0]),e.charAt(0)=="#"&&(e=e.substr(1,6)),e=e.replace(/ /g,"").toLowerCase();var o={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"};e=o[e]||e;var u=[{re:/^\s*rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([\d\.]{1,3})\s*\)\s*$/,example:["rgba(123, 234, 45, 0.5)","rgba(255,234,245,1.0)"],process:function(e){return[parseInt(e[1]),parseInt(e[2]),parseInt(e[3])]}},{re:/^\s*rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)\s*$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(e){return[parseInt(e[1]),parseInt(e[2]),parseInt(e[3])]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}}];for(n=0;n255?255:r,i=i<0||isNaN(i)?0:i>255?255:i,s=s<0||isNaN(s)?0:s>255?255:s,[r,i,s])},JXG.rgb2css=function(){var e,t,n;return e=JXG.rgbParser.apply(JXG.rgbParser,arguments),t=e[1],n=e[2],e=e[0],"rgb("+e+", "+t+", "+n+")"},JXG.rgb2hex=function(){var e,t,n;return e=JXG.rgbParser.apply(JXG.rgbParser,arguments),t=e[1],n=e[2],e=e[0],e=e.toString(16),t=t.toString(16),n=n.toString(16),e.length==1&&(e="0"+e),t.length==1&&(t="0"+t),n.length==1&&(n="0"+n),"#"+e+t+n},JXG.hex2rgb=function(e){var t,n,r;return e.charAt(0)=="#"&&(e=e.slice(1)),t=parseInt(e.substr(0,2),16),n=parseInt(e.substr(2,2),16),r=parseInt(e.substr(4,2),16),"rgb("+t+", "+n+", "+r+")"},JXG.hsv2rgb=function(e,t,n){var r,i,s,o,u,a,f,l,c;e=(e%360+360)%360;if(t==0){if(!(isNaN(e)||e=360?a=0:a=e,a/=60,u=Math.floor(a),o=a-u,f=n*(1-t),l=n*(1-t*o),c=n*(1-t*(1-o));switch(u){case 0:r=n,i=c,s=f;break;case 1:r=l,i=n,s=f;break;case 2:r=f,i=n,s=c;break;case 3:r=f,i=l,s=n;break;case 4:r=c,i=f,s=n;break;case 5:r=n,i=f,s=l}}return r=Math.round(r*255).toString(16),r=r.length==2?r:r.length==1?"0"+r:"00",i=Math.round(i*255).toString(16),i=i.length==2?i:i.length==1?"0"+i:"00",s=Math.round(s*255).toString(16),s=s.length==2?s:s.length==1?"0"+s:"00",["#",r,i,s].join("")},JXG.rgb2hsv=function(){var e,t,n,r,i,s,o,u,a,f,l,c,h,p;return e=JXG.rgbParser.apply(JXG.rgbParser,arguments),t=e[1],n=e[2],e=e[0],p=JXG.Math.Statistics,r=e/255,i=t/255,s=n/255,c=p.max([e,t,n]),h=p.min([e,t,n]),o=c/255,u=h/255,l=o,f=0,l>0&&(f=(l-u)/(l*1)),a=1/(o-u),f>0&&(c==e?a=(i-s)*a:c==t?a=2+(s-r)*a:a=4+(r-i)*a),a*=60,a<0&&(a+=360),c==h&&(a=0),[a,f,l]},JXG.rgb2LMS=function(){var e,t,n,r,i,s,o,u=[[.05059983,.08585369,.0095242],[.01893033,.08925308,.01370054],[.00292202,.00975732,.07145979]];return e=JXG.rgbParser.apply(JXG.rgbParser,arguments),t=e[1],n=e[2],e=e[0],e=Math.pow(e,.476190476),t=Math.pow(t,.476190476),n=Math.pow(n,.476190476),r=e*u[0][0]+t*u[0][1]+n*u[0][2],i=e*u[1][0]+t*u[1][1]+n*u[1][2],s=e*u[2][0]+t*u[2][1]+n*u[2][2],o=[r,i,s],o.l=r,o.m=i,o.s=s,o},JXG.LMS2rgb=function(e,t,n){var r,i,s,o,u=[[30.830854,-29.832659,1.610474],[-6.481468,17.715578,-2.532642],[-0.37569,-1.199062,14.273846]];r=e*u[0][0]+t*u[0][1]+n*u[0][2],i=e*u[1][0]+t*u[1][1]+n*u[1][2],s=e*u[2][0]+t*u[2][1]+n*u[2][2];var a=function(e){var t=127,n=64;while(n>0){if(Math.pow(t,.476190476)>e)t-=n;else{if(Math.pow(t+1,.476190476)>e)return t;t+=n}n/=2}return t==254&&13.994955247>4&15)+n.charAt(t&15),e="#"+r+""+r+""+r,e},JXG.rgb2cb=function(e,t){if(e=="none")return e;var n,r,i,s,o,u,a,f,l,c,h,p,d;o=JXG.rgb2LMS(e),r=o.l,i=o.m,s=o.s,t=t.toLowerCase();switch(t){case"protanopia":a=-0.06150039994295001,f=.08277001656812001,l=-0.013200141220000003,c=.05858939668799999,h=-0.07934519995360001,p=.013289415272000003,d=.6903216543277437,u=s/i,u>4&15)+v.charAt(n.r&15),e="#"+u,u=v.charAt(n.g>>4&15)+v.charAt(n.g&15),e+=u,u=v.charAt(n.b>>4&15)+v.charAt(n.b&15),e+=u,e},JXG.extend(JXG.Board.prototype,{intersection:function(e,t,n,r,i){var s;return e=JXG.getReference(this,e),t=JXG.getReference(this,t),i!=null&&(s=i.point),e.elementClass!=JXG.OBJECT_CLASS_CURVE||t.elementClass!=JXG.OBJECT_CLASS_CURVE||e.type==JXG.OBJECT_TYPE_ARC&&t.type==JXG.OBJECT_TYPE_ARC?e.type==JXG.OBJECT_TYPE_ARC&&t.elementClass==JXG.OBJECT_CLASS_LINE||t.type==JXG.OBJECT_TYPE_ARC&&e.elementClass==JXG.OBJECT_CLASS_LINE?function(){return JXG.Math.Geometry.meet(e.stdform,t.stdform,n,e.board)}:e.elementClass==JXG.OBJECT_CLASS_CURVE&&t.elementClass==JXG.OBJECT_CLASS_LINE||t.elementClass==JXG.OBJECT_CLASS_CURVE&&e.elementClass==JXG.OBJECT_CLASS_LINE?function(){return JXG.Math.Geometry.meetCurveLine(e,t,n,e.board,i)}:e.elementClass==JXG.OBJECT_CLASS_LINE&&t.elementClass==JXG.OBJECT_CLASS_LINE?function(){var r,i,o=e.visProp.straightfirst;return first2=t.visProp.straightfirst,last1=e.visProp.straightlast,last2=t.visProp.straightlast,JXG.exists(s)&&!s.visProp.alwaysintersect&&(o==0||last1==0||first2==0||last2==0)?(r=JXG.Math.Geometry.meetSegmentSegment(e.point1.coords.usrCoords,e.point2.coords.usrCoords,t.point1.coords.usrCoords,t.point2.coords.usrCoords,e.board),!o&&r[1]<0||!last1&&r[1]>1||!first2&&r[2]<0||!last2&&r[2]>1?i=[0,NaN,NaN]:i=r[0],new JXG.Coords(JXG.COORDS_BY_USER,i,e.board)):JXG.Math.Geometry.meet(e.stdform,t.stdform,n,e.board)}:function(){return JXG.Math.Geometry.meet(e.stdform,t.stdform,n,e.board)}:function(){return JXG.Math.Geometry.meetCurveCurve(e,t,n,r,e.board)}},intersectionFunc:function(e,t,n,r){return this.intersection(e,t,n,r)},otherIntersection:function(e,t,n){return e=JXG.getReference(this,e),t=JXG.getReference(this,t),function(){var r=JXG.Math.Geometry.meet(e.stdform,t.stdform,0,e.board);return Math.abs(n.X()-r.usrCoords[1])>JXG.Math.eps||Math.abs(n.Y()-r.usrCoords[2])>JXG.Math.eps||Math.abs(n.Z()-r.usrCoords[0])>JXG.Math.eps?r:JXG.Math.Geometry.meet(e.stdform,t.stdform,1,e.board)}}}),JXG.extend(JXG.Board.prototype,{angle:function(e,t,n){return JXG.Math.Geometry.angle(e,t,n)},rad:function(e,t,n){return JXG.Math.Geometry.rad(e,t,n)},distance:function(e,t){return JXG.Math.Geometry.distance(e,t)},pow:function(e,t){return JXG.Math.pow(e,t)},round:function(e,t){return e.toFixed(t)},cosh:function(e){return JXG.Math.cosh(e)},sinh:function(e){return JXG.Math.sinh(e)},sgn:function(e){return e==0?0:e/Math.abs(e)},D:function(e,t){return JXG.Math.Numerics.D(e,t)},I:function(e,t){return JXG.Math.Numerics.I(e,t)},root:function(e,t,n){return JXG.Math.Numerics.root(e,t,n)},lagrangePolynomial:function(e){return JXG.Math.Numerics.lagrangePolynomial(e)},neville:function(e){return JXG.Math.Numerics.Neville(e)},riemannsum:function(e,t,n,r,i){return JXG.Math.Numerics.riemannsum(e,t,n,r,i)},abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,ceil:Math.ceil,cos:Math.cos,exp:Math.exp,floor:Math.floor,log:Math.log,max:Math.max,min:Math.min,random:Math.random,sin:Math.sin,sqrt:Math.sqrt,tan:Math.tan,trunc:Math.ceil,factorial:function(e){return JXG.Math.factorial(e)},binomial:function(e,t){return JXG.Math.binomial(e,t)},getElement:function(e){return JXG.getReference(this,e)},intersectionOptions:["point",[[JXG.OBJECT_CLASS_LINE,JXG.OBJECT_CLASS_LINE],[JXG.OBJECT_CLASS_LINE,JXG.OBJECT_CLASS_CIRCLE],[JXG.OBJECT_CLASS_CIRCLE,JXG.OBJECT_CLASS_CIRCLE]]],pointFunc:function(){return[null]},pointOptions:["point",[[JXG.OBJECT_CLASS_POINT]]],lineFunc:function(){return arguments},lineOptions:["line",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT]]],linesegmentFunc:function(){return arguments},linesegmentOptions:["line",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT]]],linesegmentAtts:{straightFirst:!1,straightLast:!1},arrowFunc:function(){return arguments},arrowOptions:["arrow",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT]]],circleFunc:function(){return arguments},circleOptions:["circle",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT],[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_LINE],[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_CIRCLE]]],arrowparallelOptions:["arrowparallel",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_LINE]]],arrowparallelFunc:function(){return arguments},bisectorOptions:["bisector",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT]]],bisectorFunc:function(){return arguments},circumcircleOptions:["circumcircle",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT]]],circumcircleFunc:function(){return arguments},circumcirclemidpointOptions:["circumcirclemidpoint",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT]]],circumcirclemidpointFunc:function(){return arguments},integralOptions:["integral",[[]]],integralFunc:function(){return arguments},midpointOptions:["midpoint",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT],[JXG.OBJECT_CLASS_LINE]]],midpointFunc:function(){return arguments},mirrorpointOptions:["mirrorpoint",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT]]],mirrorpointFunc:function(){return arguments},normalOptions:["normal",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_LINE]]],normalFunc:function(){return arguments},parallelOptions:["parallel",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_LINE]]],parallelFunc:function(){return arguments},parallelpointOptions:["parallelpoint",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT]]],parallelpointFunc:function(){return arguments},perpendicularOptions:["perpendicular",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_LINE]]],perpendicularFunc:function(){return arguments},perpendicularpointOptions:["perpendicularpoint",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_LINE]]],perpendicularpointFunc:function(){return arguments},reflectionOptions:["reflection",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_LINE]]],reflectionFunc:function(){return arguments}}),JXG.Point.prototype.setPositionX=function(e,t){var n=e==JXG.COORDS_BY_USER?this.coords.usrCoords[2]:this.coords.scrCoords[2];this.setPosition(e,[t,n])},JXG.Point.prototype.setPositionY=function(e,t){var n=e==JXG.COORDS_BY_USER?this.coords.usrCoords[1]:this.coords.scrCoords[1];this.setPosition(e,[n,t])},JXG.Ticks=function(e,t,n){this.constructor(e.board,n,JXG.OBJECT_TYPE_TICKS,JXG.OBJECT_CLASS_OTHER),this.line=e,this.board=this.line.board,this.ticksFunction=null,this.fixedTicks=null,this.equidistant=!1;if(JXG.isFunction(t))throw this.ticksFunction=t,new Error("Function arguments are no longer supported.");JXG.isArray(t)?this.fixedTicks=t:(Math.abs(t)=1||Math.abs(r[1][0]-r[1][1])>=1)if(this.line.stdform[1]==0){if(Math.abs(t-(r[1][0]+r[1][1])*.5)<2*s&&r[0][0]-sJXG.Math.eps?(r=u.usrCoords[1]/o.usrCoords[1],a[0]*=r,a[2]*=r,this.board.setBoundingBox(a,!1)):Math.abs(this.line.stdform[2])JXG.Math.eps&&(i=u.usrCoords[2]/o.usrCoords[2],a[3]*=i,a[1]*=i,this.board.setBoundingBox(a,!1)),this):this},calculateTicksCoordinates:function(){var e=this.line.point1,t=this.line.point2,n=e.Dist(t),r=(t.coords.usrCoords[1]-e.coords.usrCoords[1])/n,i=(t.coords.usrCoords[2]-e.coords.usrCoords[2])/n,s=e.coords.distance(JXG.COORDS_BY_SCREEN,new JXG.Coords(JXG.COORDS_BY_USER,[e.coords.usrCoords[1]+r,e.coords.usrCoords[2]+i],this.board)),o=this.equidistant?this.ticksFunction(1):1,u,a,f=5,l,c,h,p,d,v,m,g,y=0,b=0,w,E=2,S=-1,x,T,N,C,k=JXG.Math.eps,L,A,O,M=this.visProp.majorheight*.5,_=this.visProp.minorheight*.5,D,P,H,B,j,F;if(this.board.canvasWidth===0||this.board.canvasHeight===0)return;this.visProp.minorheight<0?this.minStyle="infinite":this.minStyle="finite",this.visProp.majorheight<0?this.majStyle="infinite":this.majStyle="finite",this.line.visProp.straightfirst?A=Number.NEGATIVE_INFINITY:A=0+k,this.line.visProp.straightlast?O=Number.POSITIVE_INFINITY:O=n-k,D=this.line.stdform[1],P=this.line.stdform[2],H=D,B=P,j=D,F=P,T=Math.sqrt(D*D*this.board.unitX*this.board.unitX+P*P*this.board.unitY*this.board.unitY),D*=M/T*this.board.unitX,P*=M/T*this.board.unitY,H*=_/T*this.board.unitX,B*=_/T*this.board.unitY,this.removeTickLabels();if(Math.abs(j)=A&&this.fixedTicks[p]JXG.Math.eps&&(a=this._adjustTickDistance(o,s,f,e.coords,r,i),o*=a,u*=a),this.visProp.insertticks||(o/=this.visProp.minorticks+1,u/=this.visProp.minorticks+1),this.ticksDelta=o,this.symbTicksDelta=u,N=this.board.getBoundingBox(),y=(N[0]+N[2])*.5,b=(N[1]+N[3])*.5,C=[y*this.line.stdform[2]-b*this.line.stdform[1],-this.line.stdform[2],this.line.stdform[1]],x=JXG.Math.crossProduct(this.line.stdform,C),x[1]/=x[0],x[2]/=x[0],x[0]=1,l=new JXG.Coords(JXG.COORDS_BY_USER,x.slice(1),this.board),T=e.coords.distance(JXG.COORDS_BY_USER,l);if((t.X()-e.X())*(x[1]-e.X())<0||(t.Y()-e.Y())*(x[2]-e.Y())<0)T*=-1;v=Math.round(T/o)*o,Math.abs(v)>JXG.Math.eps&&(S=Math.abs(v)/v),x[1]=e.coords.usrCoords[1]+r*v,x[2]=e.coords.usrCoords[2]+i*v,c=v,v=0,m=0,h=c/this.visProp.scale,y=x[1],b=x[2],p=0,d=0;do{l=new JXG.Coords(JXG.COORDS_BY_USER,[y,b],this.board),l.major=Math.round((S*v+c)/o)%(this.visProp.minorticks+1)===0,w=this._tickEndings(l,j,F,D,P,H,B,l.major);if(w.length===3){L=S*m+h,(Math.abs(L)>=k||this.visProp.drawzero)&&L>A&&L0);this.needsUpdate=!0,this.updateRenderer()},_adjustTickDistance:function(e,t,n,r,i,s){var o,u,a=1;while(t>4*this.minTicksDistance)a/=10,o=r.usrCoords[1]+i*e*a,u=r.usrCoords[2]+s*e*a,t=r.distance(JXG.COORDS_BY_SCREEN,new JXG.Coords(JXG.COORDS_BY_USER,[o,u],this.board));while(t=0&&m[1]<=l&&(h[y]=m[1],p[y]=0,y++),m=JXG.Math.crossProduct([0,1,0],[-v*f[1]-d*f[2],v,d]),m[2]/=m[0],m[2]>=0&&m[2]<=c&&(h[y]=0,p[y]=m[2],y++),y<2&&(m=JXG.Math.crossProduct([c*c,0,-c],[-v*f[1]-d*f[2],v,d]),m[1]/=m[0],m[1]>=0&&m[1]<=l&&(h[y]=m[1],p[y]=c,y++)),y<2&&(m=JXG.Math.crossProduct([l*l,-l,0],[-v*f[1]-d*f[2],v,d]),m[2]/=m[0],m[2]>=0&&m[2]<=c&&(h[y]=l,p[y]=m[2]))),h[0]>=0&&h[0]<=l&&p[0]>=0&&p[0]<=c||h[1]>=0&&h[1]<=l&&p[1]>=0&&p[1]<=c?b=!0:b=!1,g=="finite"&&(h[0]=f[1]+d,p[0]=f[2]-v,h[1]=f[1]-d,p[1]=f[2]+v),b?[h,p,u]:[]},_makeLabel:function(e,t,n,r,i,s){var o,u,a,f=typeof e=="number";return r?(o=e.toString(),Math.abs(e)5||o.indexOf("e")!=-1)&&(o=e.toPrecision(3).toString()),f&&o.indexOf(".")>-1&&(o=o.replace(/0+$/,""),o=o.replace(/\.$/,"")),this.visProp.scalesymbol.length>0&&o==="1"?o=this.visProp.scalesymbol:this.visProp.scalesymbol.length>0&&o==="0"?o="0":o+=this.visProp.scalesymbol,a={id:i+s+"Label",isLabel:!0,layer:n.options.layer.line,highlightStrokeColor:n.options.text.strokeColor,highlightStrokeWidth:n.options.text.strokeWidth,highlightStrokeOpacity:n.options.text.strokeOpacity,visible:this.visProp.visible,priv:this.visProp.priv},a=JXG.deepCopy(a,this.visProp.label),u=JXG.createText(n,[t.usrCoords[1],t.usrCoords[2],o],a),u.isDraggable=!1,u.dump=!1,u.distanceX=this.visProp.label.offset[0],u.distanceY=this.visProp.label.offset[1],u.setCoords(t.usrCoords[1]+u.distanceX/n.unitX,t.usrCoords[2]+u.distanceY/n.unitY),u.visProp.visible=r,u):null},removeTickLabels:function(){var e;if(this.labels!=null&&(this.board.needsFullUpdate||this.needsRegularUpdate)&&(this.board.options.renderer!="canvas"||this.board.options.text.display!="internal"))for(e=0;e>=1,S==0&&(S=k(),e=S&1,S=S>>1|128),e}function O(e){var t=0,n=e;while(n--)t=t<<1|A();return e&&(t=p[t]>>8-e),t}function M(){f=0}function _(e){h++,a[f++]=e,t.push(String.fromCharCode(e)),f==32768&&(f=0)}function D(){this.b0=0,this.b1=0,this.jump=null,this.jumppos=-1}function V(){for(;;){if(z[U]>=X)return-1;if(W[z[U]]==U)return z[U]++;z[U]++}}function $(){var e=F[j],t;r&&document.write("
len:"+U+" treepos:"+j);if(U==17)return-1;j++,U++,t=V(),r&&document.write("
IsPat "+t);if(t>=0)e.b0=t,r&&document.write("
b0 "+e.b0);else{e.b0=32768,r&&document.write("
b0 "+e.b0);if($())return-1}t=V();if(t>=0)e.b1=t,r&&document.write("
b1 "+e.b1),e.jump=null;else{e.b1=32768,r&&document.write("
b1 "+e.b1),e.jump=F[j],e.jumppos=j;if($())return-1}return U--,0}function J(e,t,n,i){var s;r&&document.write("currentTree "+e+" numval "+t+" lengths "+n+" show "+i),F=e,j=0,W=n,X=t;for(s=0;s<17;s++)z[s]=0;U=0;if($())return r&&alert("invalid huffman tree\n"),-1;if(r){document.write("
Tree: "+F.length);for(var o=0;o<32;o++)document.write("Places["+o+"].b0="+F[o].b0+"
"),document.write("Places["+o+"].b1="+F[o].b1+"
")}return 0}function K(e){var t,n,i=0,s=e[i],o;for(;;){o=A(),r&&document.write("b="+o);if(o){if(!(s.b1&32768))return r&&document.write("ret1"),s.b1;s=s.jump,t=e.length;for(n=0;n>1,l>23?(l=l<<1|A(),l>199?(l-=128,l=l<<1|A()):(l-=48,l>143&&(l+=136))):l+=256;if(l<256)_(l);else{if(l==256)break;var s,c;l-=257,s=O(v[l])+d[l],l=p[O(5)]>>3,g[l]>8?(c=O(8),c|=O(g[l]-8)<<8):c=O(g[l]),c+=m[l];for(l=0;ldistanceTree");for(var T=0;T"+B[T].b0+" "+B[T].b1+" "+B[T].jump+" "+B[T].jumppos)}h=b+w,i=0;var N=-1;r&&document.write("
n="+h+" bits: "+x+"
");while(i"+N+" i:"+i+" decode: "+l+" bits "+x+"
");if(l<16)S[i++]=l;else if(l==16){var C;l=3+O(2);if(i+l>h)return M(),1;C=i?S[i-1]:0;while(l--)S[i++]=C}else{l==17?l=3+O(3):l=11+O(7);if(i+l>h)return M(),1;while(l--)S[i++]=0}}s=H.length;for(i=0;iliteralTree");for(;;){l=K(H);if(l>=256){var s,c;l-=256;if(l==0)break;l--,s=O(v[l])+d[l],l=K(B),g[l]>8?(c=O(8),c|=O(g[l]-8)<<8):c=O(g[l]),c+=m[l];while(s--){var t=a[f-c&32767];_(t)}}else _(l)}}}while(!e);return M(),L(),0}function G(){r&&alert("NEXTFILE"),t=[];var e=[];l=!1,e[0]=k(),e[1]=k(),r&&alert("type: "+e[0]+" "+e[1]),e[0]==parseInt("78",16)&&e[1]==parseInt("da",16)&&(r&&alert("GEONExT-GZIP"),Q(),r&&alert(t.join("")),o[s]=new Array(2),o[s][0]=t.join(""),o[s][1]="geonext.gxt",s++),e[0]==parseInt("1f",16)&&e[1]==parseInt("8b",16)&&(r&&alert("GZIP"),Y(),r&&alert(t.join("")),o[s]=new Array(2),o[s][0]=t.join(""),o[s][1]="file",s++);if(e[0]==parseInt("50",16)&&e[1]==parseInt("4b",16)){l=!0,e[2]=k(),e[3]=k();if(e[2]==parseInt("3",16)&&e[3]==parseInt("4",16)){e[0]=k(),e[1]=k(),r&&alert("ZIP-Version: "+e[1]+" "+e[0]/10+"."+e[0]%10),i=k(),i|=k()<<8,r&&alert("gpflags: "+i);var n=k();n|=k()<<8,r&&alert("method: "+n),k(),k(),k(),k();var u=k();u|=k()<<8,u|=k()<<16,u|=k()<<24;var a=k();a|=k()<<8,a|=k()<<16,a|=k()<<24;var f=k();f|=k()<<8,f|=k()<<16,f|=k()<<24,r&&alert("local CRC: "+u+"\nlocal Size: "+f+"\nlocal CompSize: "+a);var p=k();p|=k()<<8;var d=k();d|=k()<<8,r&&alert("filelen "+p),m=0,N=[];while(p--){var v=k();v=="/"|v==":"?m=0:m>2,o=(n&3)<<4|r>>4,u=(r&15)<<2|i>>6,a=i&63,isNaN(r)?u=a=64:isNaN(i)&&(a=64),t.push([this._keyStr.charAt(s),this._keyStr.charAt(o),this._keyStr.charAt(u),this._keyStr.charAt(a)].join(""));return t.join("")},decode:function(e,t){var n=[],r,i,s,o,u,a,f,l=0;e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(l>4,i=(u&15)<<4|a>>2,s=(a&3)<<6|f,n.push(String.fromCharCode(r)),a!=64&&n.push(String.fromCharCode(i)),f!=64&&n.push(String.fromCharCode(s));return n=n.join(""),t&&(n=JXG.Util.Base64._utf8_decode(n)),n},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");var t="";for(var n=0;n127&&r<2048?(t+=String.fromCharCode(r>>6|192),t+=String.fromCharCode(r&63|128)):(t+=String.fromCharCode(r>>12|224),t+=String.fromCharCode(r>>6&63|128),t+=String.fromCharCode(r&63|128))}return t},_utf8_decode:function(e){var t=[],n=0,r=0,i=0,s=0;while(n191&&r<224?(i=e.charCodeAt(n+1),t.push(String.fromCharCode((r&31)<<6|i&63)),n+=2):(i=e.charCodeAt(n+1),s=e.charCodeAt(n+2),t.push(String.fromCharCode((r&15)<<12|(i&63)<<6|s&63)),n+=3);return t.join("")},_destrip:function(e,t){var n=[],r,i,s=[];t==null&&(t=76),e.replace(/ /g,""),r=e.length/t;for(i=0;i255)switch(n){case 8364:n=128;break;case 8218:n=130;break;case 402:n=131;break;case 8222:n=132;break;case 8230:n=133;break;case 8224:n=134;break;case 8225:n=135;break;case 710:n=136;break;case 8240:n=137;break;case 352:n=138;break;case 8249:n=139;break;case 338:n=140;break;case 381:n=142;break;case 8216:n=145;break;case 8217:n=146;break;case 8220:n=147;break;case 8221:n=148;break;case 8226:n=149;break;case 8211:n=150;break;case 8212:n=151;break;case 732:n=152;break;case 8482:n=153;break;case 353:n=154;break;case 8250:n=155;break;case 339:n=156;break;case 382:n=158;break;case 376:n=159;break;default:}return n},JXG.Util.utf8Decode=function(e){var t=[],n=0,r=0,i=0,s=0,o;if(!JXG.exists(e))return"";while(n191&&r<224?(s=e.charCodeAt(n+1),t.push(String.fromCharCode((r&31)<<6|s&63)),n+=2):(s=e.charCodeAt(n+1),o=e.charCodeAt(n+2),t.push(String.fromCharCode((r&15)<<12|(s&63)<<6|o&63)),n+=3);return t.join("")},JXG.Util.genUUID=function(){var e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),t=new Array(36),n=0,r;for(var i=0;i<36;i++)i==8||i==13||i==18||i==23?t[i]="-":i==14?t[i]="4":(n<=2&&(n=33554432+Math.random()*16777216|0),r=n&15,n>>=4,t[i]=e[i==19?r&3|8:r]);return t.join("")},JXG.PsTricks={convert:function(e){var t=new JXG.Coords(JXG.COORDS_BY_SCREEN,[0,0],e),n=new JXG.Coords(JXG.COORDS_BY_SCREEN,[e.canvasWidth,e.canvasHeight],e),r,i,s=[];s.push("\\begin{pspicture*}("+t.usrCoords[1]+","+n.usrCoords[2]+")("+n.usrCoords[1]+","+t.usrCoords[2]+")\n");for(r in e.objects){i=e.objects[r];if(i.visProp.visible)switch(i.elementClass){case JXG.OBJECT_CLASS_CIRCLE:s.push(this.addCircle(i));break;case JXG.OBJECT_CLASS_LINE:s.push(this.addLine(i));break;case JXG.OBJECT_CLASS_POINT:s.push(this.addPoint(i));break;default:switch(i.type){case JXG.OBJECT_TYPE_ARC:s.push(this.addArc(i));break;case JXG.OBJECT_TYPE_SECTOR:s.push(this.addArc(i)),s.push(this.addSector(i));break;case JXG.OBJECT_TYPE_POLYGON:s.push(this.addPolygon(i));break;case JXG.OBJECT_TYPE_ANGLE:s.push(this.addAngle(i))}}}return s.push("\\end{pspicture*}"),s.join("\n")},setArrows:function(e){var t="";return e.visProp.firstarrow&&e.visProp.lastarrow?t="{<->}":e.visProp.firstarrow?t="{<-}":e.visProp.lastarrow&&(t="{->}"),t},drawWedge:function(e,t,n,r,i,s){var o="";return e!="none"&&t>0&&(o+="\\pswedge[linestyle=none, fillstyle=solid, fillcolor="+this.parseColor(e)+", opacity="+t.toFixed(5)+"]",o+="("+n.join(",")+"){"+r+"}{"+i+"}{"+s+"}\n"),o},addPoint:function(e){var t="\\psdot[linecolor="+this.parseColor(e.visProp.strokecolor)+",dotstyle=",n=e.normalizeFace(e.visProp.face)||"o",r=e.visProp.size>4?4:e.visProp.size,i=[0,0,"2pt 2","5pt 2","5pt 3"];return n=="x"?t+="x, dotsize="+i[r]:n=="o"?(t+="*, dotsize=",r==1?t+="2pt 2":r==2?t+="4pt 2":r==3?t+="6pt 2":r==4&&(t+="6pt 3")):n=="[]"?t+="square*, dotsize="+i[r]:n=="+"&&(t+="+, dotsize="+i[r]),t+="]("+e.coords.usrCoords.slice(1).join(",")+")\n",t+="\\rput("+(e.coords.usrCoords[1]+15/e.board.unitY)+","+(e.coords.usrCoords[2]+15/e.board.unitY)+"){\\small $"+e.name+"$}\n",t},addLine:function(e){var t=new JXG.Coords(JXG.COORDS_BY_USER,e.point1.coords.usrCoords,e.board),n=new JXG.Coords(JXG.COORDS_BY_USER,e.point2.coords.usrCoords,e.board),r="\\psline[linecolor="+this.parseColor(e.visProp.strokecolor)+", linewidth="+e.visProp.strokewidth+"px]";return(e.visProp.straightfirst||e.visProp.straightlast)&&JXG.Math.Geometry.calcStraight(e,t,n),r+=this.setArrows(e),r+="("+t.usrCoords.slice(1).join(",")+")("+n.usrCoords.slice(2).join(",")+")\n",r},addCircle:function(e){var t=e.Radius(),n="\\pscircle[linecolor="+this.parseColor(e.visProp.strokecolor)+", linewidth="+e.visProp.strokewidth+"px";return e.visProp.fillcolor!="none"&&e.visProp.fillopacity!=0&&(n+=", fillstyle=solid, fillcolor="+this.parseColor(e.visProp.fillcolor)+", opacity="+e.visProp.fillopacity.toFixed(5)),n+="]("+e.center.coords.usrCoords.slice(1).join("1")+"){"+t+"}\n",n},addPolygon:function(e){var t="\\pspolygon[linestyle=none, fillstyle=solid, fillcolor="+this.parseColor(e.visProp.fillcolor)+", opacity="+e.visProp.fillopacity.toFixed(5)+"]",n;for(n=0;n0&&(n=n[0][0]);if(typeof n!="string")return;r=window.JSON&&window.JSON.parse?window.JSON.parse(n):(new Function("return "+n))();if(r.type=="error")this.handleError(r);else if(r.type=="response"){u=r.id;for(a=0;ae&&(t[n]=parseFloat(this.data[n][e]));return t},getRow:function(e){var t,n;if(typeof e=="string")for(n=0;n-1;t--)if(JXG.exists(this.sstack[t][e]))return t;return-1},isCreator:function(e){return!!JXG.JSXGraph.elements[e]},isMathMethod:function(e){return e!=="E"&&!!Math[e]},isBuiltIn:function(e){return!!this.builtIn[e]},getvar:function(e,t){var n,r;t=JXG.def(t,!1),n=this.isLocalVariable(e);if(n>-1)return this.sstack[n][e];if(this.isCreator(e))return this.creator(e);if(this.isMathMethod(e))return Math[e];if(this.isBuiltIn(e))return this.builtIn[e];if(!t){n=JXG.getRef(this.board,e);if(n!==e)return n}return r},getvarJS:function(e,t,n){var r;t=JXG.def(t,!1),n=JXG.def(n,!1);if(JXG.indexOf(this.pstack[this.pscope],e)>-1)return e;r=this.isLocalVariable(e);if(r>-1&&!n)return"$jc$.sstack["+r+"]['"+e+"']";if(this.isCreator(e))return"(function () { var a = Array.prototype.slice.call(arguments, 0), props = "+(n?"a.pop()":"{}")+"; return $jc$.board.create.apply($jc$.board, ['"+e+"'].concat([a, props])); })";n&&this._error("Syntax error (attribute values are allowed with element creators only)");if(this.isMathMethod(e))return"Math."+e;if(this.isBuiltIn(e))return this.builtIn[e].src||this.builtIn[e];if(!t){if(JXG.isId(this.board,e))return"$jc$.board.objects['"+e+"']";if(JXG.isName(this.board,e))return"$jc$.board.elementsByName['"+e+"']";if(JXG.isGroup(this.board,e))return"$jc$.board.groups['"+e+"']"}return""},mergeAttributes:function(){var e,t={};for(e=0;e0)for(h=0;h"+e.substr(i[h].offset,30)+'<, expecting "'+s[h].join()+'"')}catch(v){throw JXG.Text.prototype.setText=l,v}JXG.Text.prototype.setText=l},snippet:function(e,t,n,r){var i,s,o,u;return i="jxg__tmp__intern_"+JXG.Util.genUUID().replace(/\-/g,""),JXG.exists(t)||(t=!0),JXG.exists(n)||(n=""),JXG.exists(r)||(r=!1),o=this.sstack[0][i],this.countLines=!1,s=i+" = "+(t?" function ("+n+") { return ":"")+e+(t?"; }":"")+";",this.parse(s,r,!0),u=this.sstack[0][i],JXG.exists(o)?this.sstack[0][i]=o:delete this.sstack[0][i],this.countLines=!0,u},replaceIDs:function(e){var t,n;e.replaced&&(n=this.board.objects[e.children[1].children[0].value],JXG.exists(n)&&JXG.exists(n)&&n.name!==""&&(e.type="node_var",e.value=n.name,e.children.length=0,delete e.replaced));if(e.children)for(t=e.children.length;t>0;t--)JXG.exists(e.children[t-1])&&(e.children[t-1]=this.replaceIDs(e.children[t-1]));return e},replaceNames:function(e){var t,n;n=e.value,e.type=="node_op"&&n=="op_lhs"&&e.children.length===1?this.isLHS=!0:e.type=="node_var"&&(this.isLHS?this.letvar(n,!0):!JXG.exists(this.getvar(n,!0))&&JXG.exists(this.board.elementsByName[n])&&(e=this.createReplacementNode(e)));if(e.children)for(t=e.children.length;t>0;t--)JXG.exists(e.children[t-1])&&(e.children[t-1]=this.replaceNames(e.children[t-1]));return e.type=="node_op"&&e.value=="op_lhs"&&e.children.length===1&&(this.isLHS=!1),e},createReplacementNode:function(e){var t=e.value,n=this.board.elementsByName[t];return e=this.createNode("node_op","op_execfun",this.createNode("node_var","$"),this.createNode("node_op","op_param",this.createNode("node_str",n.id))),e.replaced=!0,e},collectDependencies:function(e,t){var n,r,i;r=e.value,e.type=="node_var"&&(i=this.getvar(r),i&&i.visProp&&i.type&&i.elementClass&&i.id&&(t[i.id]=i)),e.type=="node_op"&&e.value=="op_execfun"&&e.children.length>1&&e.children[0].value=="$"&&e.children[1].children.length>0&&(i=e.children[1].children[0].value,t[i]=this.board.objects[i]);if(e.children)for(n=e.children.length;n>0;n--)JXG.exists(e.children[n-1])&&this.collectDependencies(e.children[n-1],t)},resolveProperty:function(e,t,n){return n=JXG.def(n,!1),e&&e.methodMap&&(t==="label"?(e=e.label,t="content"):JXG.exists(e.subs)&&JXG.exists(e.subs[t])?e=e.subs:JXG.exists(e.methodMap[t])?t=e.methodMap[t]:(e=e.visProp,t=t.toLowerCase())),JXG.exists(e)||this._error(e+" is not an object"),JXG.exists(e[t])||this._error("unknown property "+t),n&&typeof e[t]=="function"?function(){return e[t].apply(e,arguments)}:e[t]},execute:function(node){var ret,v,i,e,parents=[];ret=0;if(!node)return ret;this.line=node.line,this.col=node.col;switch(node.type){case"node_op":switch(node.value){case"op_none":node.children[0]&&this.execute(node.children[0]),node.children[1]&&(ret=this.execute(node.children[1]));break;case"op_assign":v=this.execute(node.children[0]),this.lhs[this.scope]=v[1],v[0].type&&v[0].elementClass&&v[0].methodMap&&v[1]==="label"&&this._error("Left-hand side of assignment is read-only."),v[0]!==this.sstack[this.scope]||JXG.isArray(v[0])&&typeof v[1]=="number"?this.setProp(v[0],v[1],this.execute(node.children[1])):this.letvar(v[1],this.execute(node.children[1])),this.lhs[this.scope]=0;break;case"op_noassign":ret=this.execute(node.children[0]);break;case"op_if":this.execute(node.children[0])&&(ret=this.execute(node.children[1]));break;case"op_if_else":this.execute(node.children[0])?ret=this.execute(node.children[1]):ret=this.execute(node.children[2]);break;case"op_while":while(this.execute(node.children[0]))this.execute(node.children[1]);break;case"op_do":do this.execute(node.children[0]);while(this.execute(node.children[1]));break;case"op_for":for(this.execute(node.children[0]);this.execute(node.children[1]);this.execute(node.children[2]))this.execute(node.children[3]);break;case"op_param":node.children[1]&&this.execute(node.children[1]),ret=node.children[0],this.pstack[this.pscope].push(ret),this.dpstack[this.pscope]&&this.dpstack[this.pscope].push({line:node.children[0].line,col:node.children[0].col});break;case"op_paramdef":node.children[1]&&this.execute(node.children[1]),ret=node.children[0],this.pstack[this.pscope].push(ret);break;case"op_proplst":node.children[0]&&this.execute(node.children[0]),node.children[1]&&this.execute(node.children[1]);break;case"op_proplst_val":this.propstack.push({}),this.propscope++,this.execute(node.children[0]),ret=this.propstack[this.propscope],this.propstack.pop(),this.propscope--;break;case"op_prop":this.propstack[this.propscope][node.children[0]]=this.execute(node.children[1]);break;case"op_array":var l;this.pstack.push([]),this.pscope++,this.execute(node.children[0]),ret=[],l=this.pstack[this.pscope].length;for(i=0;ithis.execute(node.children[1]);break;case"op_lot":ret=this.execute(node.children[0])=this.execute(node.children[1]);break;case"op_loe":ret=this.execute(node.children[0])<=this.execute(node.children[1]);break;case"op_or":ret=this.execute(node.children[0])||this.execute(node.children[1]);break;case"op_and":ret=this.execute(node.children[0])&&this.execute(node.children[1]);break;case"op_not":ret=!this.execute(node.children[0]);break;case"op_add":ret=JXG.Math.Statistics.add(this.execute(node.children[0]),this.execute(node.children[1]));break;case"op_sub":ret=JXG.Math.Statistics.subtract(this.execute(node.children[0]),this.execute(node.children[1]));break;case"op_div":ret=JXG.Math.Statistics.div(this.execute(node.children[0]),this.execute(node.children[1]));break;case"op_mod":ret=JXG.Math.Statistics.mod(this.execute(node.children[0]),this.execute(node.children[1]),!0);break;case"op_mul":ret=this.mul(this.execute(node.children[0]),this.execute(node.children[1]));break;case"op_exp":ret=Math.pow(this.execute(node.children[0]),this.execute(node.children[1]));break;case"op_neg":ret=this.execute(node.children[0])*-1}break;case"node_var":ret=this.getvar(node.value);break;case"node_const":ret=Number(node.value);break;case"node_const_bool":ret=node.value.toLowerCase()!=="false";break;case"node_str":ret=node.value}return ret},compile:function(e,t){var n,r,i,s;n="",JXG.exists(t)||(t=!1);if(!e)return n;switch(e.type){case"node_op":switch(e.value){case"op_none":e.children[0]&&(n=this.compile(e.children[0],t)),e.children[1]&&(n+=this.compile(e.children[1],t));break;case"op_assign":i=this.compile(e.children[0],t),t?JXG.isArray(i)?n="$jc$.setProp("+i[0]+", '"+i[1]+"', "+this.compile(e.children[1],t)+");\n":(this.isLocalVariable(i)!==this.scope&&(this.sstack[this.scope][i]=!0),n="$jc$.sstack["+this.scope+"]['"+i+"'] = "+this.compile(e.children[1],t)+";\n"):n=i+" = "+this.compile(e.children[1],t)+";\n";break;case"op_noassign":n=this.compile(e.children[0],t)+";\n";break;case"op_if":n=" if ("+this.compile(e.children[0],t)+") "+this.compile(e.children[1],t);break;case"op_if_else":n=" if ("+this.compile(e.children[0],t)+")"+this.compile(e.children[1],t),n+=" else "+this.compile(e.children[2],t);break;case"op_while":n=" while ("+this.compile(e.children[0],t)+") {\n"+this.compile(e.children[1],t)+"}\n";break;case"op_do":n=" do {\n"+this.compile(e.children[0],t)+"} while ("+this.compile(e.children[1],t)+");\n";break;case"op_for":n=" for ("+this.compile(e.children[0],t)+"; "+this.compile(e.children[1],t)+"; "+this.compile(e.children[2],t)+") {\n"+this.compile(e.children[3],t)+"\n}\n";break;case"op_param":e.children[1]&&(n=this.compile(e.children[1],t)+", "),n+=this.compile(e.children[0],t);break;case"op_paramdef":e.children[1]&&(n=this.compile(e.children[1],t)+", "),n+=e.children[0];break;case"op_proplst":e.children[0]&&(n=this.compile(e.children[0],t)+", "),n+=this.compile(e.children[1],t);break;case"op_prop":n=e.children[0]+": "+this.compile(e.children[1],t);break;case"op_proplst_val":n=this.compile(e.children[0],t);break;case"op_array":n="["+this.compile(e.children[0],t)+"]";break;case"op_extvalue":n=this.compile(e.children[0],t)+"["+this.compile(e.children[1],t)+"]";break;case"op_return":n=" return "+this.compile(e.children[0],t)+";\n";break;case"op_function":n=" function ("+this.compile(e.children[0],t)+") {\n"+this.compile(e.children[1],t)+"}";break;case"op_execfun":e.children[2]&&(i=this.compile(e.children[2],t),t&&(i="$jc$.mergeAttributes("+i+")")),e.children[0].withProps=!!e.children[2],n=this.compile(e.children[0],t)+"("+this.compile(e.children[1],t)+(e.children[2]&&t?", "+i:"")+")"+(e.children[2]&&!t?i:""),t&&e.children[0].value==="$"&&(n="$jc$.board.objects["+this.compile(e.children[1],t)+"]");break;case"op_property":t&&e.children[1]!=="X"&&e.children[1]!=="Y"?n="$jc$.resolveProperty("+this.compile(e.children[0],t)+", '"+e.children[1]+"', true)":n=this.compile(e.children[0],t)+"."+e.children[1];break;case"op_lhs":e.children.length===1?n=e.children[0]:e.children[2]==="dot"?t?n=[this.compile(e.children[1],t),e.children[0]]:n=this.compile(e.children[1],t)+"."+e.children[0]:e.children[2]==="bracket"&&(t?n=[this.compile(e.children[1],t),this.compile(e.children[0],t)]:n=this.compile(e.children[1],t)+"["+this.compile(e.children[0],t)+"]");break;case"op_use":t?n="$jc$.use(JXG.JSXGraph.boards['"+e.children[0]+"'])":n="use "+e.children[0]+";";break;case"op_delete":n="delete "+e.children[0];break;case"op_equ":n="("+this.compile(e.children[0],t)+" == "+this.compile(e.children[1],t)+")";break;case"op_neq":n="("+this.compile(e.children[0],t)+" != "+this.compile(e.children[1],t)+")";break;case"op_approx":n="("+this.compile(e.children[0],t)+" ~= "+this.compile(e.children[1],t)+")";break;case"op_grt":n="("+this.compile(e.children[0],t)+" > "+this.compile(e.children[1],t)+")";break;case"op_lot":n="("+this.compile(e.children[0],t)+" < "+this.compile(e.children[1],t)+")";break;case"op_gre":n="("+this.compile(e.children[0],t)+" >= "+this.compile(e.children[1],t)+")";break;case"op_loe":n="("+this.compile(e.children[0],t)+" <= "+this.compile(e.children[1],t)+")";break;case"op_or":n="("+this.compile(e.children[0],t)+" || "+this.compile(e.children[1],t)+")";break;case"op_and":n="("+this.compile(e.children[0],t)+" && "+this.compile(e.children[1],t)+")";break;case"op_not":n="!("+this.compile(e.children[0],t)+")";break;case"op_add":t?n="JXG.Math.Statistics.add("+this.compile(e.children[0],t)+", "+this.compile(e.children[1],t)+")":n="("+this.compile(e.children[0],t)+" + "+this.compile(e.children[1],t)+")";break;case"op_sub":t?n="JXG.Math.Statistics.subtract("+this.compile(e.children[0],t)+", "+this.compile(e.children[1],t)+")":n="("+this.compile(e.children[0],t)+" - "+this.compile(e.children[1],t)+")";break;case"op_div":t?n="JXG.Math.Statistics.div("+this.compile(e.children[0],t)+", "+this.compile(e.children[1],t)+")":n="("+this.compile(e.children[0],t)+" / "+this.compile(e.children[1],t)+")";break;case"op_mod":t?n="JXG.Math.mod("+this.compile(e.children[0],t)+", "+this.compile(e.children[1],t)+", true)":n="("+this.compile(e.children[0],t)+" % "+this.compile(e.children[1],t)+")";break;case"op_mul":t?n="$jc$.mul("+this.compile(e.children[0],t)+", "+this.compile(e.children[1],t)+")":n="("+this.compile(e.children[0],t)+" * "+this.compile(e.children[1],t)+")";break;case"op_exp":t?n="Math.pow("+this.compile(e.children[0],t)+", "+this.compile(e.children[1],t)+")":n="("+this.compile(e.children[0],t)+"^"+this.compile(e.children[1],t)+")";break;case"op_neg":n="(-"+this.compile(e.children[0],t)+")"}break;case"node_var":t?n=this.getvarJS(e.value,!1,e.withProps):n=e.value;break;case"node_const":n=e.value;break;case"node_const_bool":n=e.value;break;case"node_str":n="'"+e.value.replace(/'/g,"\\'")+"'"}return e.needsBrackets&&(n="{\n"+n+"}\n"),n},X:function(e){return e.X()},Y:function(e){return e.Y()},V:function(e){return e.Value()},L:function(e){return e.L()},dist:function(e,t){return(!JXG.exists(e)||!JXG.exists(e.Dist))&&this._error("Error: Can't calculate distance."),e.Dist(t)},mul:function(e,t){return JXG.isArray(e)*JXG.isArray(t)?JXG.Math.innerProduct(e,t,Math.min(e.length,t.length)):JXG.Math.Statistics.multiply(e,t)},use:function(e){this.board=e,this.builtIn.$board=e,this.builtIn.$board.src="$jc$.board"},findSymbol:function(e,t){var n,r;t=JXG.def(t,-1),t===-1&&(t=this.scope);for(n=t;n>=0;n--)for(r in this.sstack[n])if(this.sstack[n][r]===e)return[r,n];return[]},defineBuiltIn:function(){var e=this,t={PI:Math.PI,EULER:Math.E,X:e.X,Y:e.Y,V:e.V,L:e.L,dist:e.dist,rad:JXG.Math.Geometry.rad,deg:JXG.Math.Geometry.trueAngle,factorial:JXG.Math.factorial,trunc:JXG.trunc,$:e.getElementById,$board:e.board};return t.rad.sc=JXG.Math.Geometry,t.deg.sc=JXG.Math.Geometry,t.factorial.sc=JXG.Math,t.PI.src="Math.PI",t.EULER.src="Math.E",t.X.src="$jc$.X",t.Y.src="$jc$.Y",t.V.src="$jc$.V",t.L.src="$jc$.L",t.dist.src="$jc$.dist",t.rad.src="JXG.Math.Geometry.rad",t.deg.src="JXG.Math.Geometry.trueAngle",t.factorial.src="JXG.Math.factorial",t.trunc.src="JXG.trunc",t.$.src="(function (n) { return JXG.getRef($jc$.board, n); })",t.$board&&(t.$board.src="$jc$.board"),t},_debug:function(e){typeof console!="undefined"?console.log(e):document&&document.getElementById("debug")!==null&&(document.getElementById("debug").innerHTML+=e+"
")},_error:function(e){var t=new Error("Error("+this.line+"): "+e);throw t.line=this.line,t},_warn:function(e){typeof console!="undefined"?console.log("Warning("+this.line+"): "+e):document&&document.getElementById(this.warnLog)!==null&&(document.getElementById(this.warnLog).innerHTML+="Warning("+this.line+"): "+e+"
")},_log:function(e){typeof window=="undefined"&&typeof self!="undefined"&&self.postMessage?self.postMessage({type:"log",msg:"Log: "+e.toString()}):console.log("Log: ",arguments)}}),JXG.extend(JXG.JessieCode.prototype,{_lex:function(e){var t,n=-1,r=0,i=0,s,o;for(;;){t=0,n=-1,r=0,i=0,s=e.offset+1+(r-i);do{s--,t=0,n=-2,i=s;if(e.src.length<=i)return 68;do{o=e.src.charCodeAt(s);switch(t){case 0:o>=9&&o<=10||o==13||o==32?t=1:o==33?t=2:o==35?t=3:o==36||o>=65&&o<=67||o>=71&&o<=72||o>=74&&o<=77||o>=79&&o<=81||o==83||o==86||o>=88&&o<=90||o==95||o>=97&&o<=99||o>=103&&o<=104||o>=106&&o<=113||o==115||o==118||o>=120&&o<=122?t=4:o==37?t=5:o==40?t=6:o==41?t=7:o==42?t=8:o==43?t=9:o==44?t=10:o==45?t=11:o==46?t=12:o==47?t=13:o>=48&&o<=57?t=14:o==58?t=15:o==59?t=16:o==60?t=17:o==61?t=18:o==62?t=19:o==91?t=20:o==93?t=21:o==94?t=22:o==123?t=23:o==124?t=24:o==125?t=25:o==38?t=49:o==68||o==100?t=50:o==39?t=52:o==73||o==105?t=53:o==126?t=54:o==70||o==102?t=66:o==78?t=67:o==85||o==117?t=68:o==69||o==101?t=76:o==84||o==116?t=77:o==87||o==119?t=83:o==82||o==114?t=87:t=-1;break;case 1:t=-1,n=2,r=s;break;case 2:o==61?t=26:t=-1,n=31,r=s;break;case 3:t=-1,n=41,r=s;break;case 4:o>=48&&o<=57||o>=65&&o<=90||o==95||o>=97&&o<=122?t=4:t=-1,n=46,r=s;break;case 5:t=-1,n=35,r=s;break;case 6:t=-1,n=38,r=s;break;case 7:t=-1,n=39,r=s;break;case 8:t=-1,n=36,r=s;break;case 9:t=-1,n=32,r=s;break;case 10:t=-1,n=40,r=s;break;case 11:t=-1,n=33,r=s;break;case 12:o>=48&&o<=57?t=29:t=-1,n=44,r=s;break;case 13:t=-1,n=34,r=s;break;case 14:o>=48&&o<=57?t=14:o==46?t=29:t=-1,n=48,r=s;break;case 15:t=-1,n=42,r=s;break;case 16:t=-1,n=20,r=s;break;case 17:o==60?t=30:o==61?t=31:t=-1,n=28,r=s;break;case 18:o==61?t=32:t=-1,n=21,r=s;break;case 19:o==61?t=33:o==62?t=34:t=-1,n=27,r=s;break;case 20:t=-1,n=16,r=s;break;case 21:t=-1,n=17,r=s;break;case 22:t=-1,n=37,r=s;break;case 23:t=-1,n=18,r=s;break;case 24:o==124?t=37:t=-1,n=43,r=s;break;case 25:t=-1,n=19,r=s;break;case 26:t=-1,n=23,r=s;break;case 27:t=-1,n=30,r=s;break;case 28:t=-1,n=47,r=s;break;case 29:o>=48&&o<=57?t=29:t=-1,n=49,r=s;break;case 30:t=-1,n=14,r=s;break;case 31:t=-1,n=25,r=s;break;case 32:t=-1,n=22,r=s;break;case 33:t=-1,n=26,r=s;break;case 34:t=-1,n=15,r=s;break;case 35:o>=48&&o<=57||o>=65&&o<=90||o==95||o>=97&&o<=122?t=4:t=-1,n=6,r=s;break;case 36:o>=48&&o<=57||o>=65&&o<=90||o==95||o>=97&&o<=122?t=4:t=-1,n=3,r=s;break;case 37:t=-1,n=29,r=s;break;case 38:t=-1,n=24,r=s;break;case 39:o>=48&&o<=57||o>=65&&o<=90||o==95||o>=97&&o<=122?t=4:t=-1,n=7,r=s;break;case 40:o>=48&&o<=57||o>=65&&o<=90||o==95||o>=97&&o<=122?t=4:t=-1,n=45,r=s;break;case 41:o>=48&&o<=57||o>=65&&o<=90||o==95||o>=97&&o<=122?t=4:t=-1,n=9,r=s;break;case 42:o>=48&&o<=57||o>=65&&o<=90||o==95||o>=97&&o<=122?t=4:t=-1,n=4,r=s;break;case 43:o>=48&&o<=57||o>=65&&o<=90||o==95||o>=97&&o<=122?t=4:t=-1,n=12,r=s;break;case 44:o>=48&&o<=57||o>=65&&o<=90||o==95||o>=97&&o<=122?t=4:t=-1,n=13,r=s;break;case 45:o>=48&&o<=57||o>=65&&o<=90||o==95||o>=97&&o<=122?t=4:t=-1,n=5,r=s;break;case 46:o>=48&&o<=57||o>=65&&o<=90||o==95||o>=97&&o<=122?t=4:t=-1,n=11,r=s;break;case 47:o>=48&&o<=57||o>=65&&o<=90||o==95||o>=97&&o<=122?t=4:t=-1,n=10,r=s;break;case 48:o>=48&&o<=57||o>=65&&o<=90||o==95||o>=97&&o<=122?t=4:t=-1,n=8,r=s;break;case 49:o==38?t=27:t=-1;break;case 50:o>=48&&o<=57||o>=65&&o<=68||o>=70&&o<=78||o>=80&&o<=90||o==95||o>=97&&o<=100||o>=102&&o<=110||o>=112&&o<=122?t=4:o==79||o==111?t=35:o==69||o==101?t=84:t=-1,n=46,r=s;break;case 51:o==39?t=28:o>=0&&o<=38||o>=40&&o<=91||o>=93&&o<=254?t=52:o==92?t=56:t=-1,n=47,r=s;break;case 52:o==39?t=28:o>=0&&o<=38||o>=40&&o<=91||o>=93&&o<=254?t=52:o==92?t=56:t=-1;break;case 53:o>=48&&o<=57||o>=65&&o<=69||o>=71&&o<=90||o==95||o>=97&&o<=101||o>=103&&o<=122?t=4:o==70||o==102?t=36:t=-1,n=46,r=s;break;case 54:o==61?t=38:t=-1;break;case 55:o>=48&&o<=57||o>=65&&o<=81||o>=83&&o<=90||o==95||o>=97&&o<=113||o>=115&&o<=122?t=4:o==82||o==114?t=39:t=-1,n=46,r=s;break;case 56:o==39?t=51:o>=0&&o<=38||o>=40&&o<=91||o>=93&&o<=254?t=52:o==92?t=56:t=-1;break;case 57:o>=48&&o<=57||o>=65&&o<=77||o>=79&&o<=90||o==95||o>=97&&o<=122?t=4:o==78?t=40:t=-1,n=46,r=s;break;case 58:o>=48&&o<=57||o>=65&&o<=68||o>=70&&o<=90||o==95||o>=97&&o<=100||o>=102&&o<=122?t=4:o==69||o==101?t=41:t=-1,n=46,r=s;break;case 59:o>=48&&o<=57||o>=65&&o<=68||o>=70&&o<=90||o==95||o>=97&&o<=100||o>=102&&o<=122?t=4:o==69||o==101?t=42:t=-1,n=46,r=s;break;case 60:o>=48&&o<=57||o>=65&&o<=68||o>=70&&o<=90||o==95||o>=97&&o<=100||o>=102&&o<=122?t=4:o==69||o==101?t=43:t=-1,n=46,r=s;break;case 61:o>=48&&o<=57||o>=65&&o<=68||o>=70&&o<=90||o==95||o>=97&&o<=100||o>=102&&o<=122?t=4:o==69||o==101?t=44:t=-1,n=46,r=s;break;case 62:o>=48&&o<=57||o>=65&&o<=68||o>=70&&o<=90||o==95||o>=97&&o<=100||o>=102&&o<=122?t=4:o==69||o==101?t=45:t=-1,n=46,r=s;break;case 63:o>=48&&o<=57||o>=65&&o<=68||o>=70&&o<=90||o==95||o>=97&&o<=100||o>=102&&o<=122?t=4:o==69||o==101?t=46:t=-1,n=46,r=s;break;case 64:o>=48&&o<=57||o>=65&&o<=77||o>=79&&o<=90||o==95||o>=97&&o<=109||o>=111&&o<=122?t=4:o==78||o==110?t=47:t=-1,n=46,r=s;break;case 65:o>=48&&o<=57||o>=65&&o<=77||o>=79&&o<=90||o==95||o>=97&&o<=109||o>=111&&o<=122?t=4:o==78||o==110?t=48:t=-1,n=46,r=s;break;case 66:o>=48&&o<=57||o>=66&&o<=78||o>=80&&o<=84||o>=86&&o<=90||o==95||o>=98&&o<=110||o>=112&&o<=116||o>=118&&o<=122?t=4:o==79||o==111?t=55:o==65||o==97?t=78:o==85||o==117?t=89:t=-1,n=46,r=s;break;case 67:o>=48&&o<=57||o>=65&&o<=90||o==95||o>=98&&o<=122?t=4:o==97?t=57:t=-1,n=46,r=s;break;case 68:o>=48&&o<=57||o>=65&&o<=82||o>=84&&o<=90||o==95||o>=97&&o<=114||o>=116&&o<=122?t=4:o==83||o==115?t=58:t=-1,n=46,r=s;break;case 69:o>=48&&o<=57||o>=65&&o<=82||o>=84&&o<=90||o==95||o>=97&&o<=114||o>=116&&o<=122?t=4:o==83||o==115?t=59:t=-1,n=46,r=s;break;case 70:o>=48&&o<=57||o>=65&&o<=84||o>=86&&o<=90||o==95||o>=97&&o<=116||o>=118&&o<=122?t=4:o==85||o==117?t=60:t=-1,n=46,r=s;break;case 71:o>=48&&o<=57||o>=65&&o<=82||o>=84&&o<=90||o==95||o>=97&&o<=114||o>=116&&o<=122?t=4:o==83||o==115?t=61:t=-1,n=46,r=s;break;case 72:o>=48&&o<=57||o>=65&&o<=75||o>=77&&o<=90||o==95||o>=97&&o<=107||o>=109&&o<=122?t=4:o==76||o==108?t=62:t=-1,n=46,r=s;break;case 73:o>=48&&o<=57||o>=65&&o<=83||o>=85&&o<=90||o==95||o>=97&&o<=115||o>=117&&o<=122?t=4:o==84||o==116?t=63:t=-1,n=46,r=s;break;case 74:o>=48&&o<=57||o>=65&&o<=81||o>=83&&o<=90||o==95||o>=97&&o<=113||o>=115&&o<=122?t=4:o==82||o==114?t=64:t=-1,n=46,r=s;break;case 75:o>=48&&o<=57||o>=65&&o<=78||o>=80&&o<=90||o==95||o>=97&&o<=110||o>=112&&o<=122?t=4:o==79||o==111?t=65:t=-1,n=46,r=s;break;case 76:o>=48&&o<=57||o>=65&&o<=75||o>=77&&o<=90||o==95||o>=97&&o<=107||o>=109&&o<=122?t=4:o==76||o==108?t=69:t=-1,n=46,r=s;break;case 77:o>=48&&o<=57||o>=65&&o<=81||o>=83&&o<=90||o==95||o>=97&&o<=113||o>=115&&o<=122?t=4:o==82||o==114?t=70:t=-1,n=46,r=s;break;case 78:o>=48&&o<=57||o>=65&&o<=75||o>=77&&o<=90||o==95||o>=97&&o<=107||o>=109&&o<=122?t=4:o==76||o==108?t=71:t=-1,n=46,r=s;break;case 79:o>=48&&o<=57||o>=65&&o<=72||o>=74&&o<=90||o==95||o>=97&&o<=104||o>=106&&o<=122?t=4:o==73||o==105?t=72:t=-1,n=46,r=s;break;case 80:o>=48&&o<=57||o>=65&&o<=68||o>=70&&o<=90||o==95||o>=97&&o<=100||o>=102&&o<=122?t=4:o==69||o==101?t=73:t=-1,n=46,r=s;break;case 81:o>=48&&o<=57||o>=65&&o<=84||o>=86&&o<=90||o==95||o>=97&&o<=116||o>=118&&o<=122?t=4:o==85||o==117?t=74:t=-1,n=46,r=s;break;case 82:o>=48&&o<=57||o>=65&&o<=72||o>=74&&o<=90||o==95||o>=97&&o<=104||o>=106&&o<=122?t=4:o==73||o==105?t=75:t=-1,n=46,r=s;break;case 83:o>=48&&o<=57||o>=65&&o<=71||o>=73&&o<=90||o==95||o>=97&&o<=103||o>=105&&o<=122?t=4:o==72||o==104?t=79:t=-1,n=46,r=s;break;case 84:o>=48&&o<=57||o>=65&&o<=75||o>=77&&o<=90||o==95||o>=97&&o<=107||o>=109&&o<=122?t=4:o==76||o==108?t=80:t=-1,n=46,r=s;break;case 85:o>=48&&o<=57||o>=65&&o<=83||o>=85&&o<=90||o==95||o>=97&&o<=115||o>=117&&o<=122?t=4:o==84||o==116?t=81:t=-1,n=46,r=s;break;case 86:o>=48&&o<=57||o>=65&&o<=83||o>=85&&o<=90||o==95||o>=97&&o<=115||o>=117&&o<=122?t=4:o==84||o==116?t=82:t=-1,n=46,r=s;break;case 87:o>=48&&o<=57||o>=65&&o<=68||o>=70&&o<=90||o==95||o>=97&&o<=100||o>=102&&o<=122?t=4:o==69||o==101?t=85:t=-1,n=46,r=s;break;case 88:o>=48&&o<=57||o>=65&&o<=66||o>=68&&o<=90||o==95||o>=97&&o<=98||o>=100&&o<=122?t=4:o==67||o==99?t=86:t=-1,n=46,r=s;break;case 89:o>=48&&o<=57||o>=65&&o<=77||o>=79&&o<=90||o==95||o>=97&&o<=109||o>=111&&o<=122?t=4:o==78||o==110?t=88:t=-1,n=46,r=s}t>-1&&(o==10&&(e.line++,e.column=0,this.countLines&&(this.parCurLine=e.line)),e.column++,this.countLines&&(this.parCurColumn=e.column)),s++}while(t>-1)}while(n==2);n>-1?(e.att=e.src.substr(i,r-i),e.offset=r,n==47&&(e.att=e.att.substr(1,e.att.length-2),e.att=e.att.replace(/\\\'/g,"'"))):(e.att=new String,n=-1);break}return n},_parse:function(e,t,n){var r=[],i=[],s=0,o,u,a,f={la:0,act:0,offset:0,src:e,att:"",line:1,column:1,error_step:0},l=new Array(new Array(0,1),new Array(50,2),new Array(50,0),new Array(52,2),new Array(52,0),new Array(53,3),new Array(53,1),new Array(53,0),new Array(55,3),new Array(55,1),new Array(55,0),new Array(56,3),new Array(57,3),new Array(57,1),new Array(57,0),new Array(58,3),new Array(58,1),new Array(61,3),new Array(51,3),new Array(51,5),new Array(51,3),new Array(51,5),new Array(51,9),new Array(51,3),new Array(51,2),new Array(51,2),new Array(51,2),new Array(51,2),new Array(51,3),new Array(51,1),new Array(60,3),new Array(60,4),new Array(60,1),new Array(54,3),new Array(54,3),new Array(54,3),new Array(54,3),new Array(54,3),new Array(54,3),new Array(54,3),new Array(54,1),new Array(63,3),new Array(63,3),new Array(63,2),new Array(63,1),new Array(62,3),new Array(62,3),new Array(62,1),new Array(64,3),new Array(64,3),new Array(64,3),new Array(64,1),new Array(66,3),new Array(66,1),new Array(65,2),new Array(65,2),new Array(65,1),new Array(59,4),new Array(59,7),new Array(59,4),new Array(59,5),new Array(59,3),new Array(59,1),new Array(67,1),new Array(67,1),new Array(67,1),new Array(67,3),new Array(67,1),new Array(67,7),new Array(67,3),new Array(67,3),new Array(67,1),new Array(67,1),new Array(67,1)),c=new Array(new Array,new Array(3,3,5,4,6,5,7,6,9,7,11,8,10,9,18,12,20,13,46,17,31,18,48,22,49,23,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31,33,33,32,34),new Array,new Array(31,18,33,33,32,34,48,22,49,23,46,38,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31),new Array(31,18,33,33,32,34,48,22,49,23,46,38,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31),new Array(3,3,5,4,6,5,7,6,9,7,11,8,10,9,18,12,20,13,46,17,31,18,48,22,49,23,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31,33,33,32,34),new Array(38,41),new Array(46,42),new Array(46,43),new Array(3,3,5,4,6,5,7,6,9,7,11,8,10,9,18,12,20,13,46,17,31,18,48,22,49,23,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31,33,33,32,34),new Array(20,45),new Array(24,46,23,47,26,48,25,49,27,50,28,51,22,52,20,53),new Array,new Array,new Array(21,55),new Array(30,56,29,57),new Array(44,58,38,59,16,60,37,61),new Array(21,-32),new Array(31,18,33,33,32,34,48,22,49,23,46,38,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31),new Array(32,63,33,64),new Array,new Array(35,65,34,66,36,67),new Array,new Array,new Array(31,18,33,33,32,34,48,22,49,23,46,38,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31),new Array,new Array(38,69),new Array(46,72),new Array(31,18,33,33,32,34,48,22,49,23,46,38,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31),new Array,new Array,new Array,new Array,new Array(48,22,49,23,46,38,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31),new Array(48,22,49,23,46,38,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31),new Array,new Array(24,46,23,47,26,48,25,49,27,50,28,51,22,52,3,3,5,4,6,5,7,6,9,7,11,8,10,9,18,12,20,13,46,17,31,18,48,22,49,23,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31,33,33,32,34),new Array(44,78,38,59,16,79,37,61),new Array,new Array(24,46,23,47,26,48,25,49,27,50,28,51,22,52,3,3,5,4,6,5,7,6,9,7,11,8,10,9,18,12,20,13,46,17,31,18,48,22,49,23,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31,33,33,32,34),new Array(5,81),new Array(46,17,48,22,49,23,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31),new Array(20,84),new Array,new Array,new Array,new Array(31,18,33,33,32,34,48,22,49,23,46,38,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31),new Array(31,18,33,33,32,34,48,22,49,23,46,38,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31),new Array(31,18,33,33,32,34,48,22,49,23,46,38,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31),new Array(31,18,33,33,32,34,48,22,49,23,46,38,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31),new Array(31,18,33,33,32,34,48,22,49,23,46,38,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31),new Array(31,18,33,33,32,34,48,22,49,23,46,38,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31),new Array(31,18,33,33,32,34,48,22,49,23,46,38,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31),new Array,new Array(19,92,3,3,5,4,6,5,7,6,9,7,11,8,10,9,18,12,20,13,46,17,31,18,48,22,49,23,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31,33,33,32,34),new Array(31,18,33,33,32,34,48,22,49,23,46,38,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31),new Array(33,33,32,34,48,22,49,23,46,38,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31),new Array(33,33,32,34,48,22,49,23,46,38,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31),new Array(46,97),new Array(31,18,33,33,32,34,48,22,49,23,46,38,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31),new Array(33,33,32,34,48,22,49,23,46,38,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31),new Array(48,22,49,23,46,38,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31),new Array(30,56,29,57),new Array(33,33,32,34,48,22,49,23,46,38,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31),new Array(33,33,32,34,48,22,49,23,46,38,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31),new Array(33,33,32,34,48,22,49,23,46,38,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31),new Array(33,33,32,34,48,22,49,23,46,38,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31),new Array(33,33,32,34,48,22,49,23,46,38,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31),new Array(39,106,24,46,23,47,26,48,25,49,27,50,28,51,22,52),new Array(46,108),new Array(15,109,40,110),new Array,new Array(42,111),new Array(17,112,40,113),new Array(24,46,23,47,26,48,25,49,27,50,28,51,22,52),new Array,new Array,new Array(4,114),new Array(46,115),new Array(33,33,32,34,48,22,49,23,46,38,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31),new Array,new Array(31,18,33,33,32,34,48,22,49,23,46,38,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31),new Array(20,118),new Array(44,58,38,59,16,60),new Array,new Array(30,56,29,57),new Array(30,56,29,57),new Array(30,56,29,57),new Array(30,56,29,57),new Array(30,56,29,57),new Array(30,56,29,57),new Array(30,56,29,57),new Array,new Array,new Array(24,46,23,47,26,48,25,49,27,50,28,51,22,52),new Array(32,63,33,64),new Array(32,63,33,64),new Array(21,-30),new Array(39,119,40,113),new Array(17,120,32,63,33,64),new Array,new Array(35,65,34,66,36,67),new Array(35,65,34,66,36,67),new Array,new Array,new Array,new Array,new Array(39,121,40,122),new Array,new Array,new Array(46,72),new Array(31,18,33,33,32,34,48,22,49,23,46,38,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31),new Array,new Array(31,18,33,33,32,34,48,22,49,23,46,38,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31),new Array(3,3,5,4,6,5,7,6,9,7,11,8,10,9,18,12,20,13,46,17,31,18,48,22,49,23,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31,33,33,32,34),new Array,new Array(17,127,32,63,33,64),new Array(24,46,23,47,26,48,25,49,27,50,28,51,22,52,20,128),new Array(31,18,33,33,32,34,48,22,49,23,46,38,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31),new Array(16,131,48,22,49,23,46,38,38,24,47,25,8,26,14,27,12,29,13,30,45,31),new Array(21,-31),new Array(18,133),new Array(46,134),new Array,new Array(24,46,23,47,26,48,25,49,27,50,28,51,22,52),new Array(24,46,23,47,26,48,25,49,27,50,28,51,22,52),new Array,new Array,new Array,new Array(24,46,23,47,26,48,25,49,27,50,28,51,22,52,20,135),new Array(40,136),new Array(33,33,32,34,31,18,48,22,49,23,46,38,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31),new Array(44,78,38,59,16,79),new Array,new Array,new Array(46,17,48,22,49,23,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31),new Array(48,22,49,23,46,38,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31),new Array(17,141,32,63,33,64),new Array(19,142,3,3,5,4,6,5,7,6,9,7,11,8,10,9,18,12,20,13,46,17,31,18,48,22,49,23,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31,33,33,32,34),new Array(39,143),new Array(44,78,38,59,16,79),new Array,new Array,new Array(3,3,5,4,6,5,7,6,9,7,11,8,10,9,18,12,20,13,46,17,31,18,48,22,49,23,38,24,47,25,8,26,14,27,16,28,12,29,13,30,45,31,33,33,32,34),new Array),h=new Array(new Array(50,1),new Array(51,2,61,10,54,11,60,14,63,15,59,16,62,19,67,20,64,21,65,32,66,35),new Array,new Array(54,36,63,15,62,19,64,21,65,32,66,35,59,37,67,20),new Array(54,39,63,15,62,19,64,21,65,32,66,35,59,37,67,20),new Array(51,40,61,10,54,11,60,14,63,15,59,16,62,19,67,20,64,21,65,32,66,35),new Array,new Array,new Array,new Array(51,44,61,10,54,11,60,14,63,15,59,16,62,19,67,20,64,21,65,32,66,35),new Array,new Array,new Array(52,54),new Array,new Array,new Array,new Array,new Array,new Array(63,62,62,19,64,21,65,32,66,35,59,37,67,20),new Array,new Array,new Array,new Array,new Array,new Array(54,68,63,15,62,19,64,21,65,32,66,35,59,37,67,20),new Array,new Array,new Array(55,70,56,71),new Array(53,73,54,74,63,15,62,19,64,21,65,32,66,35,59,37,67,20),new Array,new Array,new Array,new Array,new Array(66,75,59,37,67,20),new Array(66,76,59,37,67,20),new Array,new Array(51,77,61,10,54,11,60,14,63,15,59,16,62,19,67,20,64,21,65,32,66,35),new Array,new Array,new Array(51,80,61,10,54,11,60,14,63,15,59,16,62,19,67,20,64,21,65,32,66,35),new Array,new Array(61,82,60,14,59,83,67,20),new Array,new Array,new Array,new Array,new Array(63,85,62,19,64,21,65,32,66,35,59,37,67,20),new Array(63,86,62,19,64,21,65,32,66,35,59,37,67,20),new Array(63,87,62,19,64,21,65,32,66,35,59,37,67,20),new Array(63,88,62,19,64,21,65,32,66,35,59,37,67,20),new Array(63,89,62,19,64,21,65,32,66,35,59,37,67,20),new Array(63,90,62,19,64,21,65,32,66,35,59,37,67,20),new Array(63,91,62,19,64,21,65,32,66,35,59,37,67,20),new Array,new Array(51,93,61,10,54,11,60,14,63,15,59,16,62,19,67,20,64,21,65,32,66,35),new Array(54,94,63,15,62,19,64,21,65,32,66,35,59,37,67,20),new Array(62,95,64,21,65,32,66,35,59,37,67,20),new Array(62,96,64,21,65,32,66,35,59,37,67,20),new Array,new Array(53,98,54,74,63,15,62,19,64,21,65,32,66,35,59,37,67,20),new Array(62,99,64,21,65,32,66,35,59,37,67,20),new Array(66,100,59,37,67,20),new Array,new Array(64,101,65,32,66,35,59,37,67,20),new Array(64,102,65,32,66,35,59,37,67,20),new Array(65,103,66,35,59,37,67,20),new Array(65,104,66,35,59,37,67,20),new Array(65,105,66,35,59,37,67,20),new Array,new Array(57,107),new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array(62,116,64,21,65,32,66,35,59,37,67,20),new Array,new Array(54,117,63,15,62,19,64,21,65,32,66,35,59,37,67,20),new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array(56,123),new Array(54,124,63,15,62,19,64,21,65,32,66,35,59,37,67,20),new Array,new Array(54,125,63,15,62,19,64,21,65,32,66,35,59,37,67,20),new Array(51,126,61,10,54,11,60,14,63,15,59,16,62,19,67,20,64,21,65,32,66,35),new Array,new Array,new Array,new Array(54,129,63,15,62,19,64,21,65,32,66,35,59,37,67,20),new Array(58,130,59,132,67,20),new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array,new Array(53,73,62,137,64,21,54,74,65,32,63,15,66,35,59,37,67,20),new Array,new Array(52,138),new Array,new Array(61,139,60,14,59,83,67,20),new Array(59,140,67,20),new Array,new Array(51,93,61,10,54,11,60,14,63,15,59,16,62,19,67,20,64,21,65,32,66,35),new Array,new Array,new Array,new Array,new Array(51,144,61,10,54,11,60,14,63,15,59,16,62,19,67,20,64,21,65,32,66,35),new Array),p=new Array(2,0,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,29,-1,40,53,65,-1,44,62,47,63,64,-1,67,-1,10,7,71,72,73,51,-1,-1,56,-1,53,65,-1,-1,-1,-1,24,25,26,-1,-1,-1,-1,-1,-1,-1,27,-1,-1,-1,-1,-1,7,-1,-1,43,-1,-1,-1,-1,-1,-1,14,-1,9,-1,-1,6,54,55,18,-1,-1,20,-1,-1,-1,23,39,38,37,36,35,34,33,28,3,17,42,41,61,-1,-1,52,46,45,50,49,48,66,-1,13,69,-1,-1,70,-1,-1,61,-1,-1,-1,59,57,-1,-1,8,11,5,19,57,21,-1,60,7,16,4,12,-1,-1,44,-1,-1,15,58,68,-1,22),d=new Array("Program'","ERROR_RESYNC","WHITESPACE","IF","ELSE","WHILE","DO","FOR","FUNCTION","USE","RETURN","DELETE","TRUE","FALSE","<<",">>","[","]","{","}",";","=","==","!=","~=","<=",">=",">","<","||","&&","!","+","-","/","%","*","^","(",")",",","#",":","|",".","NaN","Identifier","String","Integer","Float","Program","Stmt","Stmt_List","Param_List","Expression","Prop_List","Prop","Param_Def_List","Attr_List","ExtValue","Lhs","Assign","AddSubExp","LogExp","MulDivExp","NegExp","ExpExp","Value","$");t||(t=[]),n||(n=[]),r.push(0),i.push(0),f.la=this._lex(f);for(;;){f.act=146;for(a=0;a1&&f.act==146){r.pop(),i.pop();for(a=0;a1&&f.act!=146){while(f.la!=68){f.act=146;for(a=0;a0)r.push(f.act),i.push(f.att),f.la=this._lex(f),f.error_step>0&&f.error_step--;else{o=f.act*-1,u=void 0;switch(o){case 0:u=i[i.length-1];break;case 1:this.execute(i[i.length-1]);break;case 2:u=i[i.length-0];break;case 3:u=this.createNode("node_op","op_none",i[i.length-2],i[i.length-1]);break;case 4:u=i[i.length-0];break;case 5:u=this.createNode("node_op","op_param",i[i.length-1],i[i.length-3]);break;case 6:u=this.createNode("node_op","op_param",i[i.length-1]);break;case 7:u=i[i.length-0];break;case 8:u=this.createNode("node_op","op_proplst",i[i.length-3],i[i.length-1]);break;case 9:u=i[i.length-1];break;case 10:u=i[i.length-0];break;case 11:u=this.createNode("node_op","op_prop",i[i.length-3],i[i.length-1]);break;case 12:u=this.createNode("node_op","op_paramdef",i[i.length-1],i[i.length-3]);break;case 13:u=this.createNode("node_op","op_paramdef",i[i.length-1]);break;case 14:u=i[i.length-0];break;case 15:u=this.createNode("node_op","op_param",i[i.length-1],i[i.length-3]);break;case 16:u=this.createNode("node_op","op_param",i[i.length-1]);break;case 17:u=this.createNode("node_op","op_assign",i[i.length-3],i[i.length-1]);break;case 18:u=this.createNode("node_op","op_if",i[i.length-2],i[i.length-1]);break;case 19:u=this.createNode("node_op","op_if_else",i[i.length-4],i[i.length-3],i[i.length-1]);break;case 20:u=this.createNode("node_op","op_while",i[i.length-2],i[i.length-1]);break;case 21:u=this.createNode("node_op","op_do",i[i.length-4],i[i.length-2]);break;case 22:u=this.createNode("node_op","op_for",i[i.length-7],i[i.length-5],i[i.length-3],i[i.length-1]);break;case 23:u=this.createNode("node_op","op_use",i[i.length-2]);break;case 24:u=this.createNode("node_op","op_delete",i[i.length-1]);break;case 25:u=this.createNode("node_op","op_return",i[i.length-1]);break;case 26:u=i[i.length-2];break;case 27:u=this.createNode("node_op","op_noassign",i[i.length-2]);break;case 28:u=i[i.length-2],u.needsBrackets=!0;break;case 29:u=this.createNode("node_op","op_none");break;case 30:u=this.createNode("node_op","op_lhs",i[i.length-1],i[i.length-3],"dot");break;case 31:u=this.createNode("node_op","op_lhs",i[i.length-2],i[i.length-4],"bracket");break;case 32:u=this.createNode("node_op","op_lhs",i[i.length-1]);break;case 33:u=this.createNode("node_op","op_equ",i[i.length-3],i[i.length-1]);break;case 34:u=this.createNode("node_op","op_lot",i[i.length-3],i[i.length-1]);break;case 35:u=this.createNode("node_op","op_grt",i[i.length-3],i[i.length-1]);break;case 36:u=this.createNode("node_op","op_loe",i[i.length-3],i[i.length-1]);break;case 37:u=this.createNode("node_op","op_gre",i[i.length-3],i[i.length-1]);break;case 38:u=this.createNode("node_op","op_neq",i[i.length-3],i[i.length-1]);break;case 39:u=this.createNode("node_op","op_approx",i[i.length-3],i[i.length-1]);break;case 40:u=i[i.length-1];break;case 41:u=this.createNode("node_op","op_or",i[i.length-3],i[i.length-1]);break;case 42:u=this.createNode("node_op","op_and",i[i.length-3],i[i.length-1]);break;case 43:u=this.createNode("node_op","op_not",i[i.length-1]);break;case 44:u=i[i.length-1];break;case 45:u=this.createNode("node_op","op_sub",i[i.length-3],i[i.length-1]);break;case 46:u=this.createNode("node_op","op_add",i[i.length-3],i[i.length-1]);break;case 47:u=i[i.length-1];break;case 48:u=this.createNode("node_op","op_mul",i[i.length-3],i[i.length-1]);break;case 49:u=this.createNode("node_op","op_div",i[i.length-3],i[i.length-1]);break;case 50:u=this.createNode("node_op","op_mod",i[i.length-3],i[i.length-1]);break;case 51:u=i[i.length-1];break;case 52:u=this.createNode("node_op","op_exp",i[i.length-3],i[i.length-1]);break;case 53:u=i[i.length-1];break;case 54:u=this.createNode("node_op","op_neg",i[i.length-1]);break;case 55:u=i[i.length-1];break;case 56:u=i[i.length-1];break;case 57:u=this.createNode("node_op","op_extvalue",i[i.length-4],i[i.length-2]);break;case 58:u=this.createNode("node_op","op_extvalue",this.createNode("node_op","op_execfun",i[i.length-7],i[i.length-5]),i[i.length-2]);break;case 59:u=this.createNode("node_op","op_execfun",i[i.length-4],i[i.length-2]);break;case 60:u=this.createNode("node_op","op_execfun",i[i.length-5],i[i.length-3],i[i.length-1],!0);break;case 61:u=this.createNode("node_op","op_property",i[i.length-3],i[i.length-1]);break;case 62:u=i[i.length-1];break;case 63:u=this.createNode("node_const",i[i.length-1]);break;case 64:u=this.createNode("node_const",i[i.length-1]);break;case 65:u=this.createNode("node_var",i[i.length-1]);break;case 66:u=i[i.length-2];break;case 67:u=this.createNode("node_str",i[i.length-1]);break;case 68:u=this.createNode("node_op","op_function",i[i.length-5],i[i.length-2]);break;case 69:u=this.createNode("node_op","op_proplst_val",i[i.length-2]);break;case 70:u=this.createNode("node_op","op_array",i[i.length-2]);break;case 71:u=this.createNode("node_const_bool",i[i.length-1]);break;case 72:u=this.createNode("node_const_bool",i[i.length-1]);break;case 73:u=NaN}for(a=0;a> "}return"null";case"string":return"'"+e.replace(/(["'])/g,"\\$1")+"'";case"number":case"boolean":return new String(e);case"null":return"null"}},toJessie:function(e){var t=this.dump(e),n=[],r;for(r=0;r0&&n.push("// "+t[r].attributes.name),n.push("s"+r+" = "+t[r].type+"("+t[r].parents.join(", ")+") "+this.toJSAN(t[r].attributes).replace(/\n/,"\\n")+";"),n.push("");return n.join("\n")},toJavaScript:function(e){var t=this.dump(e),n=[],r;for(r=0;r0&&(r=this.joinTransforms(e,t),s=[r[1][1],r[2][1],r[1][2],r[2][2],r[1][0],r[2][0]].join(","),i+=" matrix("+s+") ",n.setAttributeNS(null,"transform",i))},updateImageURL:function(e){var t=JXG.evaluate(e.url);e.rendNode.setAttributeNS(this.xlinkNamespace,"xlink:href",t)},updateImageStyle:function(e,t){var n=t?e.visProp.highlightcssclass:e.visProp.cssclass;e.rendNode.setAttributeNS(null,"class",n)},appendChildPrim:function(e,t){JXG.exists(t)?t>=JXG.Options.layer.numlayers&&(t=JXG.Options.layer.numlayers-1):t=0,this.layer[t].appendChild(e)},appendNodesToElement:function(e){e.rendNode=this.getElementById(e.id)},createPrim:function(e,t){var n=this.container.ownerDocument.createElementNS(this.svgNamespace,e);return n.setAttributeNS(null,"id",this.container.id+"_"+t),n.style.position="absolute",e==="path"&&(n.setAttributeNS(null,"stroke-linecap","butt"),n.setAttributeNS(null,"stroke-linejoin","round")),n},remove:function(e){JXG.exists(e)&&JXG.exists(e.parentNode)&&e.parentNode.removeChild(e)},makeArrows:function(e){var t;if(e.visPropOld.firstarrow===e.visProp.firstarrow&&e.visPropOld.lastarrow===e.visProp.lastarrow)return;e.visProp.firstarrow?(t=e.rendNodeTriangleStart,JXG.exists(t)?this.defs.appendChild(t):(t=this._createArrowHead(e,"End"),this.defs.appendChild(t),e.rendNodeTriangleStart=t,e.rendNode.setAttributeNS(null,"marker-start","url(#"+this.container.id+"_"+e.id+"TriangleEnd)"))):(t=e.rendNodeTriangleStart,JXG.exists(t)&&this.remove(t)),e.visProp.lastarrow?(t=e.rendNodeTriangleEnd,JXG.exists(t)?this.defs.appendChild(t):(t=this._createArrowHead(e,"Start"),this.defs.appendChild(t),e.rendNodeTriangleEnd=t,e.rendNode.setAttributeNS(null,"marker-end","url(#"+this.container.id+"_"+e.id+"TriangleStart)"))):(t=e.rendNodeTriangleEnd,JXG.exists(t)&&this.remove(t)),e.visPropOld.firstarrow=e.visProp.firstarrow,e.visPropOld.lastarrow=e.visProp.lastarrow},updateEllipsePrim:function(e,t,n,r,i){e.setAttributeNS(null,"cx",t),e.setAttributeNS(null,"cy",n),e.setAttributeNS(null,"rx",Math.abs(r)),e.setAttributeNS(null,"ry",Math.abs(i))},updateLinePrim:function(e,t,n,r,i){isNaN(t+n+r+i)||(e.setAttributeNS(null,"x1",t),e.setAttributeNS(null,"y1",n),e.setAttributeNS(null,"x2",r),e.setAttributeNS(null,"y2",i))},updatePathPrim:function(e,t){t==""&&(t="M 0 0"),e.setAttributeNS(null,"d",t)},updatePathStringPoint:function(e,t,n){var r="",i=e.coords.scrCoords,s=t*Math.sqrt(3)*.5,o=t*.5;return n==="x"?r=" M "+(i[1]-t)+" "+(i[2]-t)+" L "+(i[1]+t)+" "+(i[2]+t)+" M "+(i[1]+t)+" "+(i[2]-t)+" L "+(i[1]-t)+" "+(i[2]+t):n==="+"?r=" M "+(i[1]-t)+" "+i[2]+" L "+(i[1]+t)+" "+i[2]+" M "+i[1]+" "+(i[2]-t)+" L "+i[1]+" "+(i[2]+t):n==="<>"?r=" M "+(i[1]-t)+" "+i[2]+" L "+i[1]+" "+(i[2]+t)+" L "+(i[1]+t)+" "+i[2]+" L "+i[1]+" "+(i[2]-t)+" Z ":n==="^"?r=" M "+i[1]+" "+(i[2]-t)+" L "+(i[1]-s)+" "+(i[2]+o)+" L "+(i[1]+s)+" "+(i[2]+o)+" Z ":n==="v"?r=" M "+i[1]+" "+(i[2]+t)+" L "+(i[1]-s)+" "+(i[2]-o)+" L "+(i[1]+s)+" "+(i[2]-o)+" Z ":n===">"?r=" M "+(i[1]+t)+" "+i[2]+" L "+(i[1]-o)+" "+(i[2]-s)+" L "+(i[1]-o)+" "+(i[2]+s)+" Z ":n==="<"&&(r=" M "+(i[1]-t)+" "+i[2]+" L "+(i[1]+o)+" "+(i[2]-s)+" L "+(i[1]+o)+" "+(i[2]+s)+" Z "),r},updatePathStringPrim:function(e){var t=" M ",n=" L ",r=" C ",i=t,s=5e3,o="",u,a,f=e.visProp.curvetype!=="plot",l;if(e.numberPoints<=0)return"";l=Math.min(e.points.length,e.numberPoints);if(e.bezierDegree==1){f&&e.board.options.curve.RDPsmoothing&&(e.points=JXG.Math.Numerics.RamerDouglasPeuker(e.points,.5));for(u=0;us?a[1]=s:a[1]<-s&&(a[1]=-s),a[2]>s?a[2]=s:a[2]<-s&&(a[2]=-s),o+=i+a[1]+" "+a[2],i=n)}else if(e.bezierDegree==3){u=0;while(ui?a[1]=i:a[1]<-i&&(a[1]=-i),a[2]>i?a[2]=i:a[2]<-i&&(a[2]=-i),r==t?s+=[r,a[1]+0*c*(2*u*Math.random()-u)," ",a[2]+0*c*(2*u*Math.random()-u)].join(""):s+=[r,f+(a[1]-f)*.333+c*(2*u*Math.random()-u)," ",l+(a[2]-l)*.333+c*(2*u*Math.random()-u)," ",f+2*(a[1]-f)*.333+c*(2*u*Math.random()-u)," ",l+2*(a[2]-l)*.333+c*(2*u*Math.random()-u)," ",a[1]," ",a[2]].join(""),r=n,f=a[1],l=a[2])}return s},updatePolygonPrim:function(e,t){var n="",r,i,s=t.vertices.length;e.setAttributeNS(null,"stroke","none");for(i=0;i0?n.setAttributeNS(null,"stroke-dasharray",this.dashArray[t-1]):n.hasAttributeNS(null,"stroke-dasharray")&&n.removeAttributeNS(null,"stroke-dasharray")},setGradient:function(e){var t=e.rendNode,n,r,i,s,o,u,a,f,l;r=JXG.evaluate(e.visProp.fillopacity),r=r>0?r:0,n=JXG.evaluate(e.visProp.fillcolor),e.visProp.gradient==="linear"?(i=this.createPrim("linearGradient",e.id+"_gradient"),u="0%",a="100%",f="0%",l="0%",i.setAttributeNS(null,"x1",u),i.setAttributeNS(null,"x2",a),i.setAttributeNS(null,"y1",f),i.setAttributeNS(null,"y2",l),s=this.createPrim("stop",e.id+"_gradient1"),s.setAttributeNS(null,"offset","0%"),s.setAttributeNS(null,"style","stop-color:"+n+";stop-opacity:"+r),o=this.createPrim("stop",e.id+"_gradient2"),o.setAttributeNS(null,"offset","100%"),o.setAttributeNS(null,"style","stop-color:"+e.visProp.gradientsecondcolor+";stop-opacity:"+e.visProp.gradientsecondopacity),i.appendChild(s),i.appendChild(o),this.defs.appendChild(i),t.setAttributeNS(null,"style","fill:url(#"+this.container.id+"_"+e.id+"_gradient)"),e.gradNode1=s,e.gradNode2=o):e.visProp.gradient==="radial"?(i=this.createPrim("radialGradient",e.id+"_gradient"),i.setAttributeNS(null,"cx","50%"),i.setAttributeNS(null,"cy","50%"),i.setAttributeNS(null,"r","50%"),i.setAttributeNS(null,"fx",e.visProp.gradientpositionx*100+"%"),i.setAttributeNS(null,"fy",e.visProp.gradientpositiony*100+"%"),s=this.createPrim("stop",e.id+"_gradient1"),s.setAttributeNS(null,"offset","0%"),s.setAttributeNS(null,"style","stop-color:"+e.visProp.gradientsecondcolor+";stop-opacity:"+e.visProp.gradientsecondopacity),o=this.createPrim("stop",e.id+"_gradient2"),o.setAttributeNS(null,"offset","100%"),o.setAttributeNS(null,"style","stop-color:"+n+";stop-opacity:"+r),i.appendChild(s),i.appendChild(o),this.defs.appendChild(i),t.setAttributeNS(null,"style","fill:url(#"+this.container.id+"_"+e.id+"_gradient)"),e.gradNode1=s,e.gradNode2=o):t.removeAttributeNS(null,"style")},updateGradient:function(e){var t=e.gradNode1,n=e.gradNode2,r,i;if(!JXG.exists(t)||!JXG.exists(n))return;i=JXG.evaluate(e.visProp.fillopacity),i=i>0?i:0,r=JXG.evaluate(e.visProp.fillcolor),e.visProp.gradient==="linear"?(t.setAttributeNS(null,"style","stop-color:"+r+";stop-opacity:"+i),n.setAttributeNS(null,"style","stop-color:"+e.visProp.gradientsecondcolor+";stop-opacity:"+e.visProp.gradientsecondopacity)):e.visProp.gradient==="radial"&&(t.setAttributeNS(null,"style","stop-color:"+e.visProp.gradientsecondcolor+";stop-opacity:"+e.visProp.gradientsecondopacity),n.setAttributeNS(null,"style","stop-color:"+r+";stop-opacity:"+i))},setObjectFillColor:function(e,t,n){var r,i=JXG.evaluate(t),s,o,u=JXG.evaluate(n),a;u=u>0?u:0;if(e.visPropOld.fillcolor===i&&e.visPropOld.fillopacity===u)return;JXG.exists(i)&&i!==!1&&(i.length!=9?(s=i,a=u):(o=JXG.rgba2rgbo(i),s=o[0],a=u*o[1]),r=e.rendNode,s!="none"?r.setAttributeNS(null,"fill",s):a=0,e.type===JXG.OBJECT_TYPE_IMAGE?r.setAttributeNS(null,"opacity",a):r.setAttributeNS(null,"fill-opacity",a),JXG.exists(e.visProp.gradient)&&this.updateGradient(e)),e.visPropOld.fillcolor=i,e.visPropOld.fillopacity=u},setObjectStrokeColor:function(e,t,n){var r=JXG.evaluate(t),i,s,o=JXG.evaluate(n),u,a;o=o>0?o:0;if(e.visPropOld.strokecolor===r&&e.visPropOld.strokeopacity===o)return;if(JXG.exists(r)&&r!==!1){r.length!=9?(i=r,u=o):(s=JXG.rgba2rgbo(r),i=s[0],u=o*s[1]),a=e.rendNode,e.type===JXG.OBJECT_TYPE_TEXT?e.visProp.display==="html"?(a.style.color=i,a.style.opacity=u):(a.setAttributeNS(null,"style","fill:"+i),a.setAttributeNS(null,"style","fill-opacity:"+u)):(a.setAttributeNS(null,"stroke",i),a.setAttributeNS(null,"stroke-opacity",u));if(e.type===JXG.OBJECT_TYPE_ARROW)this._setArrowAtts(e.rendNodeTriangle,i,u,e.visProp.strokewidth);else if(e.elementClass===JXG.OBJECT_CLASS_CURVE||e.elementClass===JXG.OBJECT_CLASS_LINE)e.visProp.firstarrow&&this._setArrowAtts(e.rendNodeTriangleStart,i,u,e.visProp.strokewidth),e.visProp.lastarrow&&this._setArrowAtts(e.rendNodeTriangleEnd,i,u,e.visProp.strokewidth)}e.visPropOld.strokecolor=r,e.visPropOld.strokeopacity=o},setObjectStrokeWidth:function(e,t){var n=JXG.evaluate(t),r;if(e.visPropOld.strokewidth===n)return;r=e.rendNode,this.setPropertyPrim(r,"stroked","true");if(JXG.exists(n)){this.setPropertyPrim(r,"stroke-width",n+"px");if(e.type===JXG.OBJECT_TYPE_ARROW)this._setArrowAtts(e.rendNodeTriangle,e.visProp.strokecolor,e.visProp.strokeopacity,n);else if(e.elementClass===JXG.OBJECT_CLASS_CURVE||e.elementClass===JXG.OBJECT_CLASS_LINE)e.visProp.firstarrow&&this._setArrowAtts(e.rendNodeTriangleStart,e.visProp.strokecolor,e.visProp.strokeopacity,n),e.visProp.lastarrow&&this._setArrowAtts(e.rendNodeTriangleEnd,e.visProp.strokecolor,e.visProp.strokeopacity,n)}e.visPropOld.strokewidth=n},setShadow:function(e){if(e.visPropOld.shadow===e.visProp.shadow)return;JXG.exists(e.rendNode)&&(e.visProp.shadow?e.rendNode.setAttributeNS(null,"filter","url(#"+this.container.id+"_"+"f1)"):e.rendNode.removeAttributeNS(null,"filter")),e.visPropOld.shadow=e.visProp.shadow},suspendRedraw:function(){},unsuspendRedraw:function(){},resize:function(e,t){this.svgRoot.style.width=parseFloat(e)+"px",this.svgRoot.style.height=parseFloat(t)+"px"}}),JXG.VMLRenderer=function(e){this.type="vml",this.container=e,this.container.style.overflow="hidden",this.container.onselectstart=function(){return!1},this.resolution=10,JXG.exists(JXG.vmlStylesheet)||(e.ownerDocument.namespaces.add("jxgvml","urn:schemas-microsoft-com:vml"),JXG.vmlStylesheet=this.container.ownerDocument.createStyleSheet(),JXG.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"]},JXG.VMLRenderer.prototype=new JXG.AbstractRenderer,JXG.extend(JXG.VMLRenderer.prototype,{_setAttr:function(e,t,n,r){try{document.documentMode===8?e[t]=n:e.setAttribute(t,n,r)}catch(i){JXG.debug("_setAttr: "+t+" "+n+"
\n")}},updateTicks:function(e,t,n,r,i){var s=[],o,u,a,f,l=this.resolution;u=e.ticks.length;for(o=0;o0){h=e.rendNode.style.filter.toString(),h.match(/DXImageTransform/)||(n.style.filter="progid:DXImageTransform.Microsoft.Matrix(M11='1.0', sizingMethod='auto expand') "+h),r=this.joinTransforms(e,t),i[0]=JXG.Math.matVecMult(r,e.coords.scrCoords),i[0][1]/=i[0][0],i[0][2]/=i[0][0],i[1]=JXG.Math.matVecMult(r,[1,e.coords.scrCoords[1]+e.size[0],e.coords.scrCoords[2]]),i[1][1]/=i[1][0],i[1][2]/=i[1][0],i[2]=JXG.Math.matVecMult(r,[1,e.coords.scrCoords[1]+e.size[0],e.coords.scrCoords[2]-e.size[1]]),i[2][1]/=i[2][0],i[2][2]/=i[2][0],i[3]=JXG.Math.matVecMult(r,[1,e.coords.scrCoords[1],e.coords.scrCoords[2]-e.size[1]]),i[3][1]/=i[3][0],i[3][2]/=i[3][0],u=i[0][1],f=i[0][1],a=i[0][2],l=i[0][2];for(c=1;c<4;c++)u=Math.max(u,i[c][1]),f=Math.min(f,i[c][1]),a=Math.max(a,i[c][2]),l=Math.min(l,i[c][2]);n.style.left=parseInt(f)+"px",n.style.top=parseInt(l)+"px",n.filters.item(0).M11=r[1][1],n.filters.item(0).M12=r[1][2],n.filters.item(0).M21=r[2][1],n.filters.item(0).M22=r[2][2]}},updateImageURL:function(e){var t=JXG.evaluate(e.url);this._setAttr(e.rendNode,"src",t)},appendChildPrim:function(e,t){JXG.exists(t)||(t=0),e.style.zIndex=t,this.container.appendChild(e)},appendNodesToElement:function(e,t){if(t==="shape"||t==="path"||t==="polygon")e.rendNodePath=this.getElementById(e.id+"_path");e.rendNodeFill=this.getElementById(e.id+"_fill"),e.rendNodeStroke=this.getElementById(e.id+"_stroke"),e.rendNodeShadow=this.getElementById(e.id+"_shadow"),e.rendNode=this.getElementById(e.id)},createPrim:function(e,t){var n,r=this.createNode("fill"),i=this.createNode("stroke"),s=this.createNode("shadow"),o;return this._setAttr(r,"id",this.container.id+"_"+t+"_fill"),this._setAttr(i,"id",this.container.id+"_"+t+"_stroke"),this._setAttr(s,"id",this.container.id+"_"+t+"_shadow"),e==="circle"||e==="ellipse"?(n=this.createNode("oval"),n.appendChild(r),n.appendChild(i),n.appendChild(s)):e==="polygon"||e==="path"||e==="shape"||e==="line"?(n=this.createNode("shape"),n.appendChild(r),n.appendChild(i),n.appendChild(s),o=this.createNode("path"),this._setAttr(o,"id",this.container.id+"_"+t+"_path"),n.appendChild(o)):(n=this.createNode(e),n.appendChild(r),n.appendChild(i),n.appendChild(s)),n.style.position="absolute",n.style.left="0px",n.style.top="0px",this._setAttr(n,"id",this.container.id+"_"+t),n},remove:function(e){JXG.exists(e)&&e.removeNode(!0)},makeArrows:function(e){var t;if(e.visPropOld.firstarrow===e.visProp.firstarrow&&e.visPropOld.lastarrow===e.visProp.lastarrow)return;e.visProp.firstarrow?(t=e.rendNodeStroke,this._setAttr(t,"startarrow","block"),this._setAttr(t,"startarrowlength","long")):(t=e.rendNodeStroke,JXG.exists(t)&&this._setAttr(t,"startarrow","none")),e.visProp.lastarrow?(t=e.rendNodeStroke,this._setAttr(t,"id",this.container.id+"_"+e.id+"stroke"),this._setAttr(t,"endarrow","block"),this._setAttr(t,"endarrowlength","long")):(t=e.rendNodeStroke,JXG.exists(t)&&this._setAttr(t,"endarrow","none")),e.visPropOld.firstarrow=e.visProp.firstarrow,e.visPropOld.lastarrow=e.visProp.lastarrow},updateEllipsePrim:function(e,t,n,r,i){e.style.left=parseInt(t-r)+"px",e.style.top=parseInt(n-i)+"px",e.style.width=parseInt(Math.abs(r)*2)+"px",e.style.height=parseInt(Math.abs(i)*2)+"px"},updateLinePrim:function(e,t,n,r,i,s){var o,u=this.resolution;isNaN(t+n+r+i)||(o=["m ",parseInt(u*t),", ",parseInt(u*n)," l ",parseInt(u*r),", ",parseInt(u*i)],this.updatePathPrim(e,o,s))},updatePathPrim:function(e,t,n){var r=n.canvasWidth,i=n.canvasHeight;t.length<=0&&(t=["m 0,0"]),e.style.width=r,e.style.height=i,this._setAttr(e,"coordsize",[parseInt(this.resolution*r),parseInt(this.resolution*i)].join(",")),this._setAttr(e,"path",t.join(""))},updatePathStringPoint:function(e,t,n){var r=[],i=Math.round,s=e.coords.scrCoords,o=t*Math.sqrt(3)*.5,u=t*.5,a=this.resolution;return n==="x"?r.push([" m ",i(a*(s[1]-t)),", ",i(a*(s[2]-t))," l ",i(a*(s[1]+t)),", ",i(a*(s[2]+t))," m ",i(a*(s[1]+t)),", ",i(a*(s[2]-t))," l ",i(a*(s[1]-t)),", ",i(a*(s[2]+t))].join("")):n==="+"?r.push([" m ",i(a*(s[1]-t)),", ",i(a*s[2])," l ",i(a*(s[1]+t)),", ",i(a*s[2])," m ",i(a*s[1]),", ",i(a*(s[2]-t))," l ",i(a*s[1]),", ",i(a*(s[2]+t))].join("")):n==="<>"?r.push([" m ",i(a*(s[1]-t)),", ",i(a*s[2])," l ",i(a*s[1]),", ",i(a*(s[2]+t))," l ",i(a*(s[1]+t)),", ",i(a*s[2])," l ",i(a*s[1]),", ",i(a*(s[2]-t))," x e "].join("")):n==="^"?r.push([" m ",i(a*s[1]),", ",i(a*(s[2]-t))," l ",i(a*(s[1]-o)),", ",i(a*(s[2]+u))," l ",i(a*(s[1]+o)),", ",i(a*(s[2]+u))," x e "].join("")):n==="v"?r.push([" m ",i(a*s[1]),", ",i(a*(s[2]+t))," l ",i(a*(s[1]-o)),", ",i(a*(s[2]-u))," l ",i(a*(s[1]+o)),", ",i(a*(s[2]-u))," x e "].join("")):n===">"?r.push([" m ",i(a*(s[1]+t)),", ",i(a*s[2])," l ",i(a*(s[1]-u)),", ",i(a*(s[2]-o))," l ",i(a*(s[1]-u)),", ",i(a*(s[2]+o))," l ",i(a*(s[1]+t)),", ",i(a*s[2])].join("")):n==="<"&&r.push([" m ",i(a*(s[1]-t)),", ",i(a*s[2])," l ",i(a*(s[1]+u)),", ",i(a*(s[2]-o))," l ",i(a*(s[1]+u)),", ",i(a*(s[2]+o))," x e "].join("")),r},updatePathStringPrim:function(e){var t=[],n,r,i=this.resolution,s=Math.round,o=" m ",u=" l ",a=" c ",f=o,l=e.visProp.curvetype!=="plot",c=Math.min(e.numberPoints,8192);if(e.numberPoints<=0)return"";c=Math.min(c,e.points.length);if(e.bezierDegree==1){l&&e.board.options.curve.RDPsmoothing&&(e.points=JXG.Math.Numerics.RamerDouglasPeuker(e.points,1));for(n=0;n2e4?r[1]=2e4:r[1]<-2e4&&(r[1]=-2e4),r[2]>2e4?r[2]=2e4:r[2]<-2e4&&(r[2]=-2e4),t.push([f,s(i*r[1]),", ",s(i*r[2])].join("")),f=u)}else if(e.bezierDegree==3){n=0;while(n2e4?i[1]=2e4:i[1]<-2e4&&(i[1]=-2e4),i[2]>2e4?i[2]=2e4:i[2]<-2e4&&(i[2]=-2e4),h==l?t.push([h,f(a*(i[1]+0*u*(2*r*Math.random()-r)))," ",f(a*(i[2]+0*u*(2*r*Math.random()-r)))].join("")):t.push([h,f(a*(s+(i[1]-s)*.333+u*(2*r*Math.random()-r)))," ",f(a*(o+(i[2]-o)*.333+u*(2*r*Math.random()-r)))," ",f(a*(s+2*(i[1]-s)*.333+u*(2*r*Math.random()-r)))," ",f(a*(o+2*(i[2]-o)*.333+u*(2*r*Math.random()-r)))," ",f(a*i[1])," ",f(a*i[2])].join("")),h=c,s=i[1],o=i[2])}return t.push(" e"),t},updatePolygonPrim:function(e,t){var n,r=t.vertices.length,i=this.resolution,s,o=[];this._setAttr(e,"stroked","false"),s=t.vertices[0].coords.scrCoords;if(isNaN(s[1]+s[2]))return;o.push(["m ",parseInt(i*s[1]),",",parseInt(i*s[2])," l "].join(""));for(n=1;n=0&&(e.style.width=r+"px"),i>=0&&(e.style.height=i+"px")},setPropertyPrim:function(e,t,n){var r="",i;switch(t){case"stroke":r="strokecolor";break;case"stroke-width":r="strokeweight";break;case"stroke-dasharray":r="dashstyle"}r!==""&&(i=JXG.evaluate(n),this._setAttr(e,r,i))},show:function(e){e&&e.rendNode&&(e.rendNode.style.visibility="inherit")},hide:function(e){e&&e.rendNode&&(e.rendNode.style.visibility="hidden")},setDashStyle:function(e,t){var n;t.dash>=0&&(n=e.rendNodeStroke,this._setAttr(n,"dashstyle",this.dashArray[t.dash]))},setGradient:function(e){var t=e.rendNodeFill;e.visProp.gradient==="linear"?(this._setAttr(t,"type","gradient"),this._setAttr(t,"color2",e.visProp.gradientsecondcolor),this._setAttr(t,"opacity2",e.visProp.gradientsecondopacity),this._setAttr(t,"angle",e.visProp.gradientangle)):e.visProp.gradient==="radial"?(this._setAttr(t,"type","gradientradial"),this._setAttr(t,"color2",e.visProp.gradientsecondcolor),this._setAttr(t,"opacity2",e.visProp.gradientsecondopacity),this._setAttr(t,"focusposition",e.visProp.gradientpositionx*100+"%,"+e.visProp.gradientpositiony*100+"%"),this._setAttr(t,"focussize","0,0")):this._setAttr(t,"type","solid")},setObjectFillColor:function(e,t,n){var r=JXG.evaluate(t),i,s,o=JXG.evaluate(n),u,a=e.rendNode,f;o=o>0?o:0;if(e.visPropOld.fillcolor===r&&e.visPropOld.fillopacity===o)return;JXG.exists(r)&&r!==!1&&(r.length!=9?(i=r,u=o):(s=JXG.rgba2rgbo(r),i=s[0],u=o*s[1]),i==="none"||i===!1?this._setAttr(e.rendNode,"filled","false"):(this._setAttr(e.rendNode,"filled","true"),this._setAttr(e.rendNode,"fillcolor",i),JXG.exists(u)&&e.rendNodeFill&&this._setAttr(e.rendNodeFill,"opacity",u*100+"%")),e.type===JXG.OBJECT_TYPE_IMAGE&&(f=e.rendNode.style.filter.toString(),f.match(/alpha/)?e.rendNode.style.filter=f.replace(/alpha\(opacity *= *[0-9\.]+\)/,"alpha(opacity = "+u*100+")"):e.rendNode.style.filter+=" alpha(opacity = "+u*100+")")),e.visPropOld.fillcolor=r,e.visPropOld.fillopacity=o},setObjectStrokeColor:function(e,t,n){var r=JXG.evaluate(t),i,s,o=JXG.evaluate(n),u,a=e.rendNode,f;o=o>0?o:0;if(e.visPropOld.strokecolor===r&&e.visPropOld.strokeopacity===o)return;JXG.exists(r)&&r!==!1&&(r.length!=9?(i=r,u=o):(s=JXG.rgba2rgbo(r),i=s[0],u=o*s[1]),e.type===JXG.OBJECT_TYPE_TEXT?(u=Math.round(u*100),a.style.filter=" alpha(opacity = "+u+")",a.style.color=i):(i!==!1&&(this._setAttr(a,"stroked","true"),this._setAttr(a,"strokecolor",i)),f=e.rendNodeStroke,JXG.exists(u)&&e.type!==JXG.OBJECT_TYPE_IMAGE&&this._setAttr(f,"opacity",u*100+"%"))),e.visPropOld.strokecolor=r,e.visPropOld.strokeopacity=o},setObjectStrokeWidth:function(e,t){var n=JXG.evaluate(t),r;if(e.visPropOld.strokewidth===n)return;r=e.rendNode,this.setPropertyPrim(r,"stroked","true"),JXG.exists(n)&&this.setPropertyPrim(r,"stroke-width",n),e.visPropOld.strokewidth=n},setShadow:function(e){var t=e.rendNodeShadow;if(!t||e.visPropOld.shadow===e.visProp.shadow)return;e.visProp.shadow?(this._setAttr(t,"On","True"),this._setAttr(t,"Offset","3pt,3pt"),this._setAttr(t,"Opacity","60%"),this._setAttr(t,"Color","#aaaaaa")):this._setAttr(t,"On","False"),e.visPropOld.shadow=e.visProp.shadow},suspendRedraw:function(){this.container.style.display="none"},unsuspendRedraw:function(){this.container.style.display=""}}),JXG.CanvasRenderer=function(e){var t;this.type="canvas",this.canvasRoot=null,this.suspendHandle=null,this.canvasId=JXG.Util.genUUID(),this.canvasNamespace=null,typeof document!="undefined"?(this.container=e,this.container.style.MozUserSelect="none",this.container.style.overflow="hidden",this.container.style.position===""&&(this.container.style.position="relative"),this.container.innerHTML=['<',"/canvas>"].join(""),this.canvasRoot=document.getElementById(this.canvasId),this.context=this.canvasRoot.getContext("2d")):JXG.isNode()&&(this.canvasId=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]]},JXG.CanvasRenderer.prototype=new JXG.AbstractRenderer,JXG.extend(JXG.CanvasRenderer.prototype,{_drawFilledPolygon:function(e){var t,n=e.length,r=this.context;if(n>0){r.beginPath(),r.moveTo(e[0][0],e[0][1]);for(t=0;t0&&r.lineTo(e[t][0],e[t][1]);r.lineTo(e[0][0],e[0][1]),r.fill()}},_fill:function(e){var t=this.context;t.save(),this._setColor(e,"fill")&&t.fill(),t.restore()},_rotatePoint:function(e,t,n){return[t*Math.cos(e)-n*Math.sin(e),t*Math.sin(e)+n*Math.cos(e)]},_rotateShape:function(e,t){var n,r=[],i=e.length;if(i<=0)return e;for(n=0;n0?l:0,u.length!=9?(f=u,c=l):(a=JXG.rgba2rgbo(u),f=a[0],c=l*a[1]),this.context.globalAlpha=c,this.context[n+"Style"]=f):r=!1,t==="stroke"&&(this.context.lineWidth=parseFloat(s.strokewidth)),r},_stroke:function(e){var t=this.context;t.save(),e.visProp.dash>0?t.setLineDash&&t.setLineDash(this.dashArray[e.visProp.dash]):this.context.lineDashArray=[],this._setColor(e,"stroke")&&t.stroke(),t.restore()},_translateShape:function(e,t,n){var r,i=[],s=e.length;if(s<=0)return e;for(r=0;r":u.beginPath(),u.moveTo(r[1]-n,r[2]),u.lineTo(r[1],r[2]+n),u.lineTo(r[1]+n,r[2]),u.lineTo(r[1],r[2]-n),u.closePath(),this._fill(e),this._stroke(e);break;case"triangleup":case"a":case"^":u.beginPath(),u.moveTo(r[1],r[2]-n),u.lineTo(r[1]-i,r[2]+s),u.lineTo(r[1]+i,r[2]+s),u.closePath(),this._fill(e),this._stroke(e);break;case"triangledown":case"v":u.beginPath(),u.moveTo(r[1],r[2]+n),u.lineTo(r[1]-i,r[2]-s),u.lineTo(r[1]+i,r[2]-s),u.closePath(),this._fill(e),this._stroke(e);break;case"triangleleft":case"<":u.beginPath(),u.moveTo(r[1]-n,r[2]),u.lineTo(r[1]+s,r[2]-i),u.lineTo(r[1]+s,r[2]+i),u.closePath(),this.fill(e),this._stroke(e);break;case"triangleright":case">":u.beginPath(),u.moveTo(r[1]+n,r[2]),u.lineTo(r[1]-s,r[2]-i),u.lineTo(r[1]-s,r[2]+i),u.closePath(),this._fill(e),this._stroke(e)}},updatePoint:function(e){this.drawPoint(e)},drawLine:function(e){var t=new JXG.Coords(JXG.COORDS_BY_USER,e.point1.coords.usrCoords,e.board),n=new JXG.Coords(JXG.COORDS_BY_USER,e.point2.coords.usrCoords,e.board);JXG.Math.Geometry.calcStraight(e,t,n),this.context.beginPath(),this.context.moveTo(t.scrCoords[1],t.scrCoords[2]),this.context.lineTo(n.scrCoords[1],n.scrCoords[2]),this._stroke(e),this.makeArrows(e,t,n)},updateLine:function(e){this.drawLine(e)},drawTicks:function(){},updateTicks:function(e,t,n,r,i){var s,o,u=e.ticks.length,a=this.context;a.beginPath();for(s=0;s0&&o>0&&!isNaN(t+n)&&(g.beginPath(),g.moveTo(f,m),g.bezierCurveTo(f,m-h,v-c,l,v,l),g.bezierCurveTo(v+c,l,p,m-h,p,m),g.bezierCurveTo(p,m+h,v+c,d,v,d),g.bezierCurveTo(v-c,d,f,m+h,f,m),g.closePath(),this._fill(e),this._stroke(e))},updateEllipse:function(e){return this.drawEllipse(e)},displayCopyright:function(e,t){var n=this.context;n.save(),n.font=t+"px Arial",n.fillStyle="#aaa",n.lineWidth=.5,n.fillText(e,10,2+t),n.restore()},drawInternalText:function(e){var t,n=this.context;return n.save(),this._setColor(e,"stroke","fill")&&!isNaN(e.coords.scrCoords[1]+e.coords.scrCoords[2])&&(e.visProp.fontsize&&(typeof e.visProp.fontsize=="function"?(t=e.visProp.fontsize(),n.font=(t>0?t:0)+"px Arial"):n.font=e.visProp.fontsize+"px Arial"),this.transformImage(e,e.transformations),e.visProp.anchorx==="right"?n.textAlign="right":e.visProp.anchorx==="middle"&&(n.textAlign="center"),e.visProp.anchory==="top"?n.textBaseline="top":e.visProp.anchory==="middle"&&(n.textBaseline="middle"),n.fillText(e.plaintext,e.coords.scrCoords[1],e.coords.scrCoords[2])),n.restore(),null},updateInternalText:function(e){this.drawInternalText(e)},setObjectStrokeColor:function(e,t,n){var r=JXG.evaluate(t),i,s,o=JXG.evaluate(n),u,a;o=o>0?o:0;if(e.visPropOld.strokecolor===r&&e.visPropOld.strokeopacity===o)return;JXG.exists(r)&&r!==!1&&(r.length!=9?(i=r,u=o):(s=JXG.rgba2rgbo(r),i=s[0],u=o*s[1]),a=e.rendNode,e.type===JXG.OBJECT_TYPE_TEXT&&e.visProp.display==="html"&&(a.style.color=i,a.style.opacity=u)),e.visPropOld.strokecolor=r,e.visPropOld.strokeopacity=o},drawImage:function(e){e.rendNode=new Image,e._src="",this.updateImage(e)},updateImage:function(e){var t=this.context,n=JXG.evaluate(e.visProp.fillopacity),r=JXG.bind(function(){e.imgIsLoaded=!0;if(e.size[0]<=0||e.size[1]<=0)return;t.save(),t.globalAlpha=n,this.transformImage(e,e.transformations),t.drawImage(e.rendNode,e.coords.scrCoords[1],e.coords.scrCoords[2]-e.size[1],e.size[0],e.size[1]),t.restore()},this);this.updateImageURL(e)?e.rendNode.onload=r:e.imgIsLoaded&&r()},transformImage:function(e,t){var n,r=t.length,i=this.context;r>0&&(n=this.joinTransforms(e,t),Math.abs(JXG.Math.Numerics.det(n))>=JXG.Math.eps&&i.transform(n[1][1],n[2][1],n[1][2],n[2][2],n[1][0],n[2][0]))},updateImageURL:function(e){var t;return t=JXG.evaluate(e.url),e._src!==t?(e.imgIsLoaded=!1,e.rendNode.src=t,e._src=t,!0):!1},remove:function(e){JXG.exists(e)&&JXG.exists(e.parentNode)&&e.parentNode.removeChild(e)},makeArrows:function(e,t,n){var r=Math.min(e.visProp.strokewidth/2,3),i=[[2,0],[-10,-4*r],[-10,4*r],[2,0]],s=[[-2,0],[10,-4*r],[10,4*r]],o,u,a,f,l,c=this.context;if(e.visProp.strokecolor!=="none"&&(e.visProp.lastarrow||e.visProp.firstarrow)){if(e.elementClass!==JXG.OBJECT_CLASS_LINE)return;o=t.scrCoords[1],u=t.scrCoords[2],a=n.scrCoords[1],f=n.scrCoords[2],c.save(),this._setColor(e,"stroke","fill")&&(l=Math.atan2(f-u,a-o),e.visProp.lastarrow&&this._drawFilledPolygon(this._translateShape(this._rotateShape(i,l),a,f)),e.visProp.firstarrow&&this._drawFilledPolygon(this._translateShape(this._rotateShape(s,l),o,u))),c.restore()}},updatePathStringPrim:function(e){var t="M",n="L",r="C",i=t,s=5e3,o,u,a,f,l=e.visProp.curvetype!=="plot",c,h=this.context;if(e.numberPoints<=0)return;c=Math.min(e.points.length,e.numberPoints),h.beginPath();if(e.bezierDegree==1){l&&e.board.options.curve.RDPsmoothing&&(e.points=JXG.Math.Numerics.RamerDouglasPeuker(e.points,.5));for(o=0;os?u[1]=s:u[1]<-s&&(u[1]=-s),u[2]>s?u[2]=s:u[2]<-s&&(u[2]=-s),i===t?h.moveTo(u[1],u[2]):h.lineTo(u[1],u[2]),i=n)}else if(e.bezierDegree==3){o=0;while(oi?u[1]=i:u[1]<-i&&(u[1]=-i),u[2]>i?u[2]=i:u[2]<-i&&(u[2]=-i),r==t?p.moveTo(u[1]+0*l*(2*o*Math.random()-o),u[2]+0*l*(2*o*Math.random()-o)):p.bezierCurveTo(a+(u[1]-a)*.333+l*(2*o*Math.random()-o),f+(u[2]-f)*.333+l*(2*o*Math.random()-o),a+2*(u[1]-a)*.333+l*(2*o*Math.random()-o),f+2*(u[2]-f)*.333+l*(2*o*Math.random()-o),u[1],u[2]),r=n,a=u[1],f=u[2])}this._fill(e),this._stroke(e)},updatePolygonPrim:function(e,t){var n,r,i=t.vertices.length,s=this.context,o=!0;if(i<=0)return;s.beginPath(),r=0;while(!t.vertices[r].isReal&&r0?n:0,t=JXG.evaluate(e.visProp.fillcolor)},setShadow:function(e){if(e.visPropOld.shadow===e.visProp.shadow)return;e.visPropOld.shadow=e.visProp.shadow},highlight:function(e){return e.type===JXG.OBJECT_TYPE_TEXT&&e.visProp.display==="html"?this.updateTextStyle(e,!0):(e.board.prepareUpdate(),e.board.renderer.suspendRedraw(e.board),e.board.updateRenderer(),e.board.renderer.unsuspendRedraw()),this},noHighlight:function(e){return e.type===JXG.OBJECT_TYPE_TEXT&&e.visProp.display==="html"?this.updateTextStyle(e,!1):(e.board.prepareUpdate(),e.board.renderer.suspendRedraw(e.board),e.board.updateRenderer(),e.board.renderer.unsuspendRedraw()),this},suspendRedraw:function(e){this.context.save(),this.context.clearRect(0,0,this.canvasRoot.width,this.canvasRoot.height),e&&e.showCopyright&&this.displayCopyright(JXG.JSXGraph.licenseText,12)},unsuspendRedraw:function(){this.context.restore()},resize:function(e,t){this.container?(this.canvasRoot.style.width=parseFloat(e)+"px",this.canvasRoot.style.height=parseFloat(t)+"px",this.canvasRoot.setAttribute("width",parseFloat(e)+"px"),this.canvasRoot.setAttribute("height",parseFloat(t)+"px")):(this.canvasRoot.width=parseFloat(e),this.canvasRoot.height=parseFloat(t))}}); diff --git a/ajax/libs/jsxgraph/package.json b/ajax/libs/jsxgraph/package.json index 4745c04a7..2072c29c9 100644 --- a/ajax/libs/jsxgraph/package.json +++ b/ajax/libs/jsxgraph/package.json @@ -1,7 +1,7 @@ { "name": "jsxgraph", "filename": "jsxgraphcore.js", - "version": "0.95", + "version": "0.96.0", "description": "JSXGraph is a cross-browser library for interactive geometry, function plotting, charting, and data visualization in a web browser.", "homepage": "http://jsxgraph.org/", "keywords": [ @@ -17,7 +17,11 @@ "repositories": [ { "type": "git", - "url": "https://github.com/jsxgraph/jsxgraph" - } + "url": "https://github.com/jsxgraph/jsxgraph.git" + }, + { + "type": "git", + "url": "http://git.code.sf.net/p/jsxgraph/code" + } ] } From 06cb582db921396456dd98bbf56da4f9ae8bd92a Mon Sep 17 00:00:00 2001 From: Michael Gerhaeuser Date: Thu, 6 Dec 2012 10:05:55 +0100 Subject: [PATCH 5/5] fixed version info in package.json --- ajax/libs/jsxgraph/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ajax/libs/jsxgraph/package.json b/ajax/libs/jsxgraph/package.json index 2072c29c9..232618444 100644 --- a/ajax/libs/jsxgraph/package.json +++ b/ajax/libs/jsxgraph/package.json @@ -1,7 +1,7 @@ { "name": "jsxgraph", "filename": "jsxgraphcore.js", - "version": "0.96.0", + "version": "0.96", "description": "JSXGraph is a cross-browser library for interactive geometry, function plotting, charting, and data visualization in a web browser.", "homepage": "http://jsxgraph.org/", "keywords": [