Rev 17586 | Rev 18553 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 17586 | Rev 18218 | ||
---|---|---|---|
Line 205... | Line 205... | ||
205 | if( use_animate == 1 ){animation_steps = idx;animate_this();}\ |
205 | if( use_animate == 1 ){animation_steps = idx;animate_this();}\ |
206 | };",canvas_root_id); |
206 | };",canvas_root_id); |
207 | break; |
207 | break; |
208 | 208 | ||
209 | case JS_MATH: |
209 | case JS_MATH: |
- | 210 | /* 5/2024 added exp -> e^ -> (2.718281828459045)^ */ |
|
210 | fprintf(js_include_file,"\n/* to_js_math() */\ |
211 | fprintf(js_include_file,"\n/* to_js_math() */\ |
211 | function to_js_math(math_fun){\ |
212 | function to_js_math(math_fun){\ |
212 | if(math_fun == null){return;};\ |
213 | if(math_fun == null){return;};\ |
213 | var infun=[\"sqrt\",\"^\",\"asin\",\"acos\",\"atan\",\"log\",\"pi\",\"abs\",\"sin\",\"cos\",\"tan\",\"e\"];\ |
214 | var infun=[\"exp\",\"sqrt\",\"^\",\"asin\",\"acos\",\"atan\",\"log\",\"pi\",\"abs\",\"sin\",\"cos\",\"tan\",\"e\"];\ |
214 | var outfun=[\"Math.sqrt\",\"Math.pow\",\"Math.asin\",\"Math.acos\",\"Math.atan\",\"Math.log\",\"(3.14159265358979)\",\"Math.abs\",\"Math.sin\",\"Math.cos\",\"Math.tan\",\"(2.718281828459045)\"];\ |
215 | var outfun=[\"(2.718281828459045)^\",\"Math.sqrt\",\"Math.pow\",\"Math.asin\",\"Math.acos\",\"Math.atan\",\"Math.log\",\"(3.14159265358979)\",\"Math.abs\",\"Math.sin\",\"Math.cos\",\"Math.tan\",\"(2.718281828459045)\"];\ |
215 | var len = infun.length;var in_fun;var In_Fun;var out_fun;var w_cnt;\ |
216 | var len = infun.length;var in_fun;var In_Fun;var out_fun;var w_cnt;\ |
216 | for(var p=0 ; p < len ; p++){\ |
217 | for(var p=0 ; p < len ; p++){\ |
217 | in_fun = infun[p];In_Fun = in_fun.toUpperCase();out_fun = outfun[p];w_cnt=0;\ |
218 | in_fun = infun[p]; In_Fun = in_fun.toUpperCase();out_fun = outfun[p];w_cnt=0;\ |
218 | if(math_fun.indexOf(in_fun) != -1){\ |
219 | if(math_fun.indexOf(in_fun) != -1){\ |
219 | if(in_fun == \"^\"){\ |
220 | if(in_fun == \"^\"){\ |
220 | var tab = [];var small_trick = \"___small_trick___\";\ |
221 | var tab = [];var small_trick = \"___small_trick___\";\ |
221 | while (math_fun.indexOf(\"(\") != -1){\ |
222 | while (math_fun.indexOf(\"(\") != -1){\ |
222 | math_fun = math_fun.replace(/(\\([^\\(\\)]*\\))/g, function(m, t){tab.push(t);return (small_trick + (tab.length - 1));});\ |
223 | math_fun = math_fun.replace(/(\\([^\\(\\)]*\\))/g, function(m, t){tab.push(t);return (small_trick + (tab.length - 1));});\ |