Rev 15657 | Rev 15686 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 15657 | Rev 15669 | ||
---|---|---|---|
Line 2599... | Line 2599... | ||
2599 | string_length = 1 + snprintf(NULL,0,"var draw_xml%d = {id:%d,type:'mathml',x:[%d],y:[%d],mathml:\"%s\",drag_type:%d,onclick:%d,object_cnt:%d,stroke_color:\"%s\",stroke_opacity:%.2f,fill_color:\"%s\",fill_opacity:%.2f,use_center:%d,use_snap:%d,angle:%f,fontfamily:\"%s\",transform:%s,use_affine:%d,offset:[0,0],use_slider:%s,rotation_center:%s,once:true};slidergroup[%d] = null;draw_xml(draw_xml%d);\n",drawxml_cnt,drawxml_cnt,int_data[0],int_data[1],temp,drag_type,onclick,object_cnt,stroke_color,stroke_opacity,fill_color,fill_opacity,int_data[2],use_snap,angle,font_family,doubledata2js_array(affine_matrix,6,decimals),use_affine,my_sliders,rotation_center,object_cnt,drawxml_cnt); |
2599 | string_length = 1 + snprintf(NULL,0,"var draw_xml%d = {id:%d,type:'mathml',x:[%d],y:[%d],mathml:\"%s\",drag_type:%d,onclick:%d,object_cnt:%d,stroke_color:\"%s\",stroke_opacity:%.2f,fill_color:\"%s\",fill_opacity:%.2f,use_center:%d,use_snap:%d,angle:%f,fontfamily:\"%s\",transform:%s,use_affine:%d,offset:[0,0],use_slider:%s,rotation_center:%s,once:true};slidergroup[%d] = null;draw_xml(draw_xml%d);\n",drawxml_cnt,drawxml_cnt,int_data[0],int_data[1],temp,drag_type,onclick,object_cnt,stroke_color,stroke_opacity,fill_color,fill_opacity,int_data[2],use_snap,angle,font_family,doubledata2js_array(affine_matrix,6,decimals),use_affine,my_sliders,rotation_center,object_cnt,drawxml_cnt); |
2600 | check_string_length(string_length);tmp_buffer = my_newmem(string_length); |
2600 | check_string_length(string_length);tmp_buffer = my_newmem(string_length); |
2601 | snprintf(tmp_buffer,string_length, "var draw_xml%d = {id:%d,type:'mathml',x:[%d],y:[%d],mathml:\"%s\",drag_type:%d,onclick:%d,object_cnt:%d,stroke_color:\"%s\",stroke_opacity:%.2f,fill_color:\"%s\",fill_opacity:%.2f,use_center:%d,use_snap:%d,angle:%f,fontfamily:\"%s\",transform:%s,use_affine:%d,offset:[0,0],use_slider:%s,rotation_center:%s,once:true};slidergroup[%d] = null;draw_xml(draw_xml%d);\n",drawxml_cnt,drawxml_cnt,int_data[0],int_data[1],temp,drag_type,onclick,object_cnt,stroke_color,stroke_opacity,fill_color,fill_opacity,int_data[2],use_snap,angle,font_family,doubledata2js_array(affine_matrix,6,decimals),use_affine,my_sliders,rotation_center,object_cnt,drawxml_cnt); |
2601 | snprintf(tmp_buffer,string_length, "var draw_xml%d = {id:%d,type:'mathml',x:[%d],y:[%d],mathml:\"%s\",drag_type:%d,onclick:%d,object_cnt:%d,stroke_color:\"%s\",stroke_opacity:%.2f,fill_color:\"%s\",fill_opacity:%.2f,use_center:%d,use_snap:%d,angle:%f,fontfamily:\"%s\",transform:%s,use_affine:%d,offset:[0,0],use_slider:%s,rotation_center:%s,once:true};slidergroup[%d] = null;draw_xml(draw_xml%d);\n",drawxml_cnt,drawxml_cnt,int_data[0],int_data[1],temp,drag_type,onclick,object_cnt,stroke_color,stroke_opacity,fill_color,fill_opacity,int_data[2],use_snap,angle,font_family,doubledata2js_array(affine_matrix,6,decimals),use_affine,my_sliders,rotation_center,object_cnt,drawxml_cnt); |
2602 | add_to_buffer(tmp_buffer); |
2602 | add_to_buffer(tmp_buffer); |
2603 | if(onclick != 0 ){object_cnt++;} |
2603 | if(onclick != 0 ){object_cnt++;} |
2604 | if(onclick == 1 || onclick == 2 ){object_cnt++;} |
- | |
2605 | drawxml_cnt++;/* keeps track on imported img,div,p,span,mathml,svg */ |
2604 | drawxml_cnt++;/* keeps track on imported img,div,p,span,mathml,svg */ |
2606 | break; |
2605 | break; |
2607 | default:break; |
2606 | default:break; |
2608 | } |
2607 | } |
2609 | } |
2608 | } |
Line 6302... | Line 6301... | ||
6302 | if( f == NULL ){canvas_error("I'm having trouble parsing your \"expression\" ") ;} |
6301 | if( f == NULL ){canvas_error("I'm having trouble parsing your \"expression\" ") ;} |
6303 | /* we supply the true x/y values...draw_curve() will convert these (x:y) to pixels : used for pan/scale */ |
6302 | /* we supply the true x/y values...draw_curve() will convert these (x:y) to pixels : used for pan/scale */ |
6304 | double xydata[MAX_BUFFER+1];/* hmmm */ |
6303 | double xydata[MAX_BUFFER+1];/* hmmm */ |
6305 | int lim_ymin =(int)( ymin - 4*fabs(ymin));/* 19-4-2015 replacing "abs" by "fabs"*/ |
6304 | int lim_ymin =(int)( ymin - 4*fabs(ymin));/* 19-4-2015 replacing "abs" by "fabs"*/ |
6306 | int lim_ymax =(int)( ymax + 4*fabs(ymax));/* 19-4-2015 replacing "abs" by "fabs"*/ |
6305 | int lim_ymax =(int)( ymax + 4*fabs(ymax));/* 19-4-2015 replacing "abs" by "fabs"*/ |
6307 | double c |
6306 | double c = 1.0;double s = 1.0; |
6308 | if( use_rotate == TRUE ){s = sin(angle*0.0174533);c = cos(angle*0.0174533);} |
6307 | if( use_rotate == TRUE ){s = sin(angle*0.0174533);c = cos(angle*0.0174533);} |
6309 | for ( xv = 0 ;xv < xsize ; xv = xv+xstep ){ |
6308 | for ( xv = 0 ;xv < xsize ; xv = xv+xstep ){ |
6310 | x = (double) (xv*a + xmin); |
6309 | x = (double) (xv*a + xmin); |
6311 | xorg = x; |
6310 | xorg = x; |
6312 | if( i < MAX_BUFFER - 2){ |
6311 | if( i < MAX_BUFFER - 2){ |
Line 6337... | Line 6336... | ||
6337 | void *f = eval_create(fun); |
6336 | void *f = eval_create(fun); |
6338 | assert (f); |
6337 | assert (f); |
6339 | if( f == NULL ){canvas_error("I'm having trouble parsing your \"expression\" ") ;} |
6338 | if( f == NULL ){canvas_error("I'm having trouble parsing your \"expression\" ") ;} |
6340 | double a = (double)((xmax - xmin)/plotsteps); |
6339 | double a = (double)((xmax - xmin)/plotsteps); |
6341 | double b = (double)((ymax - ymin)/plotsteps); |
6340 | double b = (double)((ymax - ymin)/plotsteps); |
6342 | double x;double y |
6341 | double x;double y;double diff; |
6343 | double xydata[MAX_BUFFER+1]; |
6342 | double xydata[MAX_BUFFER+1]; |
6344 | int i = 0; |
6343 | int i = 0; |
6345 | ymin = ymin - 1; |
6344 | ymin = ymin - 1; |
6346 | xmin = xmin - 1; |
6345 | xmin = xmin - 1; |
6347 | ymax = ymax + 1; |
6346 | ymax = ymax + 1; |
Line 6388... | Line 6387... | ||
6388 | 29/12/2020 |
6387 | 29/12/2020 |
6389 | disabled to try and synchronise curve+affine behaviour in complex scripts produced by "elec, tool circuit" (BPR) |
6388 | disabled to try and synchronise curve+affine behaviour in complex scripts produced by "elec, tool circuit" (BPR) |
6390 | int lim_ymin =(int)( ymin - 4*fabs(ymin)); |
6389 | int lim_ymin =(int)( ymin - 4*fabs(ymin)); |
6391 | int lim_ymax =(int)( ymax + 4*fabs(ymax)); |
6390 | int lim_ymax =(int)( ymax + 4*fabs(ymax)); |
6392 | */ |
6391 | */ |
6393 | double c |
6392 | double c = 1.0;double s = 1.0;if( use_rotate == TRUE ){s = sin(angle*0.0174533);c = cos(angle*0.0174533);} |
6394 | for( t = tmin ;t <= tmax ; t = t + tstep ){ |
6393 | for( t = tmin ;t <= tmax ; t = t + tstep ){ |
6395 | if( i < MAX_BUFFER - 2 ){ |
6394 | if( i < MAX_BUFFER - 2 ){ |
6396 | y = eval_t(fy, t); |
6395 | y = eval_t(fy, t); |
6397 | /* if(y > lim_ymin && y < lim_ymax){*/ |
6396 | /* if(y > lim_ymin && y < lim_ymax){*/ |
6398 | x = eval_t(fx, t); |
6397 | x = eval_t(fx, t); |