diff options
Diffstat (limited to 'graphics/ketcindy/ketcindyfolder/scripts/ketlib/ketcindylibbasic1r.cs')
-rw-r--r-- | graphics/ketcindy/ketcindyfolder/scripts/ketlib/ketcindylibbasic1r.cs | 243 |
1 files changed, 141 insertions, 102 deletions
diff --git a/graphics/ketcindy/ketcindyfolder/scripts/ketlib/ketcindylibbasic1r.cs b/graphics/ketcindy/ketcindyfolder/scripts/ketlib/ketcindylibbasic1r.cs index c68a550dd1..2dc633a782 100644 --- a/graphics/ketcindy/ketcindyfolder/scripts/ketlib/ketcindylibbasic1r.cs +++ b/graphics/ketcindy/ketcindyfolder/scripts/ketlib/ketcindylibbasic1r.cs @@ -14,9 +14,9 @@ // along with this program. If not, see <http://www.gnu.org/licenses/> // -println("KeTCindy V.3.2.9"); +println("KeTCindy V.3.3.0"); println(ketjavaversion()); -println("ketcindylibbasic1[20190622] loaded"); +println("ketcindylibbasic1[20190927] loaded"); //help:start(); @@ -38,17 +38,19 @@ println("ketcindylibbasic1[20190622] loaded"); Ch=[0]; ChNum=1; ////%Ketinit start//// -Ketinit():=Ketinit("fig",1,[-5,5],[-5,5]); //181001 +Ketinit():=Ketinit("fig",1,[-5,5],[-5,5],0.3); //190831from Ketinit(Arg):=(//181001from if(isstring(Arg), - Ketinit(Arg,1,[-5,5],[-5,5]); + Ketinit(Arg,1,[-5,5],[-5,5],0.3); , - Ketinit("fig",Arg,[-5,5],[-5,5]); + Ketinit("fig",1,[-5,5],[-5,5],Arg); ); ); -Ketinit(work,sy,rangex,rangey):=(//181001to +Ketinit(Arg1,Arg2):=Ketinit(Arg1,1,[-5,5],[-5,5],Arg2); +Ketinit(work,sy,rangex,rangey,strictsep):=(////190831to //help:Ketinit(); //help:Ketinit(""); + //help:Ketinit(0.3); //190831 regional(pt,tmp,tmp1,tmp2,letterc,boxc,shadowc,mboxc); PenThickInit=8; ULEN="1cm"; @@ -83,25 +85,26 @@ Ketinit(work,sy,rangex,rangey):=(//181001to COM2ndlist=[]; // no ketjs off // COM2ndlistb=[]; //180612 ADDAXES="1"; - AXSTYLE=["l","x","e","y","n","O","sw","","",""]; //181216 + AXSTYLE=[["l","x","e","y","n","O","sw","","",""],[]]; //190901 AXCOUNT=1; //181215 SHADECTR=1; //190222 LFmark=unicode("000a"); CRmark=unicode("000d");//16.12.13 Dq=unicode("0022"); - CommonMake=0;//180610 + CommonMake=0;//180610 //no ketjs on WaitUnit=10; CONTINUED=0; OutComList=[]; OutFileLIst=[]; // 15.10.22 - FigPdfList=[]; // 16.04.08 + FigPdfList=[]; // 16.04.08 //no ketjs off Fillstore(); //181212 - ADDPACK=[]; // 16.05.16 + ADDPACK=[]; // 16.05.16 //no ketjs on GPACK="tpic"; //180817 ErrFlag=0; KETJSOP=[]; //190129 REMOVEPTJS=[]; SLIDEFLG="Y"; //190504 - KetcindyjsDataList=[]; +// MOVETOJSLIST=[]; //190802 +// KetcindyjsDataList=[]; //190801 // setdirectory(Dirwork); if(!isstring(Fhead), // 17.10.13from, 17.11.12 Fhead=text(curkernel()); @@ -151,12 +154,15 @@ Ketinit(work,sy,rangex,rangey):=(//181001to BezierNumber=1; //15.01.03 SCALEX=1; SCALEY=sy; -// Setscaling(sy); XMIN=rangex_1/SCALEX; XMAX=rangex_2/SCALEX; YMIN=rangey_1/SCALEY; YMAX=rangey_2/SCALEY; + StrictSep=strictsep; //190831 Setwindow("Msg=n"); // 16.05.31 + forall(remove(allpoints(),[SW,NE]),Strictmove(#.name)); //190917 + KETJSOP=[]; //190916 + JSBODY=[[],[]]; //190916 // no ketjs on 190122 // for Presentation letterc=[0.98,0.13,0,0.43]; boxc=[0.2,0,0,0];//190307 [0,0.32,0.52,0]; @@ -172,24 +178,16 @@ Ketinit(work,sy,rangex,rangey):=(//181001to ); ////%Ketinit end//// -////%Initglist start//// 190530 +////%Initglist start//// 190802 Initglist():=( - GLIST=[]; // no ketjs - GCLIST=[]; - COM0thlist=[]; // no ketjs on - COM1stlist=[]; - COM2ndlist=[]; // no ketjs off - KCOLOR=[0,0,0]; - SCALEX=1; - SCALEY=1; - XMIN=SW.x; XMAX=NE.x; //190603[2lines] - YMIN=SW.y; YMAX=NE.y; + GCLISTadd=[]; //190719 + Ketinit(); //190802 ); ////%Initglist end//// ////%Setglist start//// 190530 Setglist():=( - GLISTadd=GLIST; + GLISTadd=GLIST; // no ketjs GCLISTadd=GCLIST; COM0thlistadd=COM0thlist; // no ketjs on COM1stlistadd=COM1stlist; @@ -199,7 +197,7 @@ Setglist():=( ////%Addglist start//// 190530 Addglist():=( - GLIST=GLISTadd; + GLIST=GLISTadd; // no ketjs GCLIST=GCLISTadd; COM0thlist=COM0thlist; // no ketjs on COM1stlist=COM1stlistadd; @@ -324,27 +322,23 @@ Getcdyname():=( //17.12.27 ////%Cindyname end//// ////%Setwindow start//// -Setwindow():=Setwindow("Msg=yes"); +Setwindow():=Setwindow("Msg=y"); Setwindow(str):=( regional(tmp,tmp1,tmp2,msg); - msg="y"; + msg="Y"; tmp=indexof(str,"="); // 16.02.10 - tmp1=Toupper(substring(str,tmp,tmp+1)); - if(tmp1=="N",msg="n"); + msg=Toupper(substring(str,tmp,tmp+1)); + Strictmove("SW"); Strictmove("NE");//190927 if((ispoint(SW) & ispoint(NE)), - tmp1=Lcrd(SW); - tmp2=Lcrd(NE); + tmp1=LLcrd(Ptpos(SW));//190912[2lines] + tmp2=LLcrd(Ptpos(NE)); XMIN=tmp1_1; XMAX=tmp2_1; YMIN=tmp1_2; YMAX=tmp2_2; , -// XMIN=-5; XMAX=5; -// YMIN=Lcrdy(-5); YMAX=Lcrdy(5); -// createpoint("SW",Pcrd([XMIN,YMIN])); -// createpoint("NE", Pcrd([XMAX,YMAX])); Putpoint("SW",Pcrd([XMIN,YMIN])); - Putpoint("NE", Pcrd([XMAX,YMAX])); + Putpoint("NE", Pcrd([XMAX,YMAX])); ); - if(msg=="y", // no ketjs on + if(msg=="Y", // no ketjs on println("Setwindow(["+XMIN+","+XMAX+"],["+YMIN+","+YMAX+"])"); ); layer(KETPICLAYER); @@ -358,9 +352,13 @@ Setwindow(xrange,yrange):=( XMAX=xrange_2; YMIN=yrange_1; YMAX=yrange_2; - Putpoint("SW",[XMIN,YMIN]);//181016 - Putpoint("NE",[XMAX,YMAX]);//181016 -// Ketinit(); + Ptpos(SW,Pcrd([XMIN,YMIN])); //190927from + Ptpos(NE,Pcrd([XMAX,YMAX])); + Strictmove("SW"); Strictmove("NE"); + layer(KETPICLAYER); + autoclearlayer(KETPICLAYER,true); + drawpoly([Pcrd([XMIN,YMIN]), Pcrd([XMAX,YMIN]), + Pcrd([XMAX,YMAX]),Pcrd([XMIN,YMAX])],color->[1,1,1]); //190927to ); ////%Setwindow end//// @@ -397,6 +395,20 @@ Setparent(file):=( // 17.11.27 ); ////%Setparent end//// +////%Reparse start//// +Reparse(str):=( //190803 +//help:Reparse(str); +//help:Reparse(strlist); + regional(out); + if(islist(str), + out=apply(str,re(parse(#))); + , + out=re(parse(str)); + ); + out; +); +////%Reparse end//// + ////%Dqq start//// Dqq(str):=DqDq(str); //18.02.11 ////%Dqq end//// @@ -899,8 +911,8 @@ Changestyle(nameL,style):=( Ltype=Ltypeorg; GCLIST=select(GCLIST,#_1!=name); COM2ndlist=select(COM2ndlist, //no ketjs - (indexof(#,"("+name)==0)%(indexof(#,"Shade")>0)); // 15.05.23,16.12.13 //no ketjs - if(Noflg<2, + (indexof(#,"("+name)==0)%(indexof(#,"Shade")>0)); // 15.05.23,16.12.13 //no ketjs + if(Noflg<3, if(isstring(Ltype), if((Noflg==0)&(color!=KCOLOR), //180904 //no ketjs on Texcom("{");Com2nd("Setcolor("+color+")");//180722 @@ -912,8 +924,8 @@ Changestyle(nameL,style):=( , if(Noflg==1,Ltype=0); ); - GCLIST=append(GCLIST,[name,Ltype,opcindy]); - ); + GCLIST=append(GCLIST,[name,Ltype,opcindy]); + ); ); ); ); @@ -936,7 +948,7 @@ Op(n,object):=( // 16.05.25 ////%Op end//// ////%Ptselected start//// -Ptselected():=Isptselected(allpoints()); //180706 +Ptselected():=Ptselected(allpoints()); //190805 Ptselected(ptlistorg):=( //help:Ptselected(); //help:Ptselected(geopoint); @@ -1212,20 +1224,26 @@ Assign(str):=( //190125from forall(VLIST,tmp=concat(tmp,[#_1,#_2])); Assign(str,tmp); ); //190125to -Assign(funstr,vrL):=( - regional(nn,out); - nn=length(vrL)/2; - out=funstr; - forall(1..nn, - out=Assign(out,vrL_(2*#-1),vrL_(2*#)); +Assign(funstr,vrL):=Assign(funstr,vrL,6); +Assign(funstr,Arg1,Arg2):=( //190813from + regional(vrL,precise,nn,out,tmp); + if(islist(Arg1), + vrL=Arg1; precise=Arg2; + nn=length(vrL)/2; + out=funstr; + forall(1..nn, + out=Assign(out,vrL_(2*#-1),vrL_(2*#),precise); + ); + , + out=Assign(funstr,Arg1,Arg2,6); ); out; -); -Assign(funstr,varname,rep):=( -//help:Assign("x^2+a*x","a",1.3); +); //190813to +Assign(funstr,varname,rep,precise):=( //help:Assign("a*x^2+b*x",["a",1,"b",2]); +//help:Assign("a*x^2+b*x",["a",aa,"b",bb],10(def=6)); regional(repstr,ii,jj,tmp,tmp1,tmp2,Notvar,Flg); - if(isstring(rep),repstr=rep,repstr="("+Textformat(rep,6)+")"); + if(isstring(rep),repstr=rep,repstr="("+Textformat(rep,precise)+")"); //190811to // 15.02.09, 07.06,17.08.24 tmp=[46]; // 12.20 tmp=concat(tmp,48..57); @@ -1708,7 +1726,8 @@ Koutenseg(pA,pB,pC,pD,options):=( Tmp1=pA+rT*pV; Out=[Tmp1,rT,1]; ); - Out; + if(!isstring(Out_1),Out=apply(Out,re(#))); //190802 + Out; ); ////%Koutenseg end//// @@ -2294,7 +2313,7 @@ Intersectcurves(crv1org,crv2org,options):=( //help:Intersectcurves(crv1,crv2); //help:Intersectcurves(options=[Eps1(0.1),Dist(2)]) regional(tmp); - tmp=Intersectcurvesop(crv1org,crv2org,options); + tmp=Intersectcurvespp(crv1org,crv2org,options); //190917(debugged) tmp=apply(tmp,#_1); ); ////%Intersectcurves end//// @@ -3465,9 +3484,9 @@ Colorname2rgb(name):=( //181212 ["olivegreen",[0.64,0,0.95,0.4]],["rawsienna",[0,0.72,1,0.45]], ["sepia",[0,0.83,1,0.7]],["brown",[0,0.81,1,0.6]], ["tan",[0.14,0.42,0.56,0]],["gray",[0,0,0,0.5]], - ["lightgray",[0,0,0,0.17]], //190429 + ["lightgray",[0,0,0,0.15]], //190429,0809 ["cindycolor",[0.66,0,69,0.71]], //190504 - ["black",[0,0,0,1]],["white",[0,0,0,0]] + ["black",[0,0,0,1]],["white",[0,0,0,0]],["offwhite",[0,0,0,0.03]] //190809 ]; tmp=select(dL,#_1==name); if(length(tmp)>0, @@ -3492,46 +3511,45 @@ Getlinestyle(str,name):=( ); noflg=parse(substring(str,0,1)); if(substring(name,0,3)=="sub",subflg=1,subflg=0); // 16.02.29 - tmp1=substring(str,1,3); + if(noflg<=1, //1900818from + tmp1=Toupper(substring(str,1,3)); + , + tmp1="NO"; + ); //1900818to tmp2=""; //190119from tmp=indexof(str,","); if(tmp>0, tmp2=substring(str,tmp,length(str)); ); //190119to - if(tmp1=="dr" % tmp1=="Dr", -// Ltype=0; + if(tmp1=="DR", if(length(tmp2)==0,tmp2="1"); //190125 Ltype=[0,tmp2]; //190119 if(noflg==0 & subflg==0, // 16.02.29 Drwline(name+Dop); ); ); - if(tmp1=="da" % tmp1=="Da", -// Ltype=1; + if(tmp1=="DA", if(length(tmp2)==0,tmp2="1,1"); //190125 Ltype=[1,tmp2]; //190119 if(noflg==0 & subflg==0, // 16.02.29 Dashline(name+Dop); ); ); - if(tmp1=="id" % tmp1=="Id", -// Ltype=2; // 15.11.09 - if(length(tmp2)==0,tmp2="1,1"); //190125 - Ltype=[2,tmp2]; //190119 + if(tmp1=="ID", + if(length(tmp2)==0,tmp2="1,1"); //190125 + Ltype=[2,tmp2]; //190119 if(noflg==0 & subflg==0, // 16.02.29 Invdashline(name+Dop); ); ); - if(tmp1=="do" % tmp1=="Do", -// Ltype=3; + if(tmp1=="DO", if(length(tmp2)==0,tmp2="1,1"); //190125 Ltype=[3,tmp2]; //190119 if(noflg==0 & subflg==0, // 16.02.29 Dottedline(name+Dop); ); ); - if(tmp1=="dp" % tmp1=="Dp", -// Ltype=0; + if(tmp1=="DP", if(length(tmp2)==0,tmp2="1"); //190125 Ltype=[0,tmp2]; //190119 tmp1=parse(name); @@ -3544,9 +3562,9 @@ Getlinestyle(str,name):=( Drwpt(tmp2+Dop); ); ); - if(tmp1=="no" % tmp1=="No", - Ltype=10; - ); + if(tmp1=="NO", //190818from + Ltype=[-1,"0"]; + ); //190818to Ltype; ); ////%Getlinestyle end//// @@ -3677,7 +3695,7 @@ AddGraph(nm,pltdata,options):=( GLIST=append(GLIST,tmp1); //no ketjs ); ); // 16.04.04 until - if(Noflg<2, + if(Noflg<3, //190818 if(isstring(Ltype), if((Noflg==0)&(color!=KCOLOR), //181020 //no ketjs on Texcom("{");Com2nd("Setcolor("+color+")");//180722 @@ -3776,7 +3794,7 @@ Joincrvs(nm,plotstrL,options):=( tmp1=substring(tmp1,0,length(tmp1)-1); GLIST=append(GLIST,name+"=Joincrvs("+tmp1+")"); //no ketjs ); - if(Noflg<2, + if(Noflg<3, //190818 if(isstring(Ltype), if((Noflg==0)&(color!=KCOLOR), //181020 //no ketjs on Texcom("{");Com2nd("Setcolor("+color+")");//180722 @@ -3869,7 +3887,7 @@ Partcrv(nm,pA,pB,PkLstr,options):=( +","+Textformat(Lcrd(pB),5)+","+tmp+")"; // 16.04.03 GLIST=append(GLIST,tmp1); //no ketjs ); - if(Noflg<2, + if(Noflg<3, //190818 if(isstring(Ltype), if((Noflg==0)&(color!=KCOLOR), //181020 //no ketjs on Texcom("{");Com2nd("Setcolor("+color+")");//180722 @@ -3904,11 +3922,11 @@ Pointdata(nm,list):=Pointdata(nm,list,[]); Pointdata(nm,listorg,options):=( //help:Pointdata("1",[2,4],["Size=5"]); //help:Pointdata("2",[[2,3],[4,1]]); -//help:Pointdata(options=["Size=(1)","Disp=(y)","Msg=(y)","Inside=","Color="]); -//help:Pointdata("Inside=color/ratio/no"]); +//help:Pointdata(options=["Size=(1)","Msg=(y)","Color="]); +//help:Pointdata("Inside=color/ratio/no","Border=y(n)"]); regional(list,name,nameL,ptlist,opstr,opcindy,Msg, eqL,dispflg,size,thick,tmp,tmp1,tmp2,tmp3, - Ltype,Noflg,color,inside); + Ltype,Noflg,color,inside,border); name="pt"+nm; nameL=name+"L"; tmp=Divoptions(options); @@ -3921,6 +3939,7 @@ Pointdata(nm,listorg,options):=( size=""; dispflg="Y"; inside=color; + border="Y"; Msg="Y"; forall(eqL, tmp=Strsplit(#,"="); @@ -3933,20 +3952,39 @@ Pointdata(nm,listorg,options):=( if(tmp1=="D", //181030from dispflg=Toupper(substring(tmp_2,0,1)); ); - if(tmp1=="I", //190405from - if(Toupper(substring(tmp_2,0,1))=="N", - inside=[-1,-1,-1]; + if(tmp1=="I", //190628from + tmp2=Toupper(substring(tmp_2,0,1)); + if(tmp2=="[", + tmp=parse(tmp_2); + if(length(tmp)==4, + tmp=Colorcmyk2rgb(tmp); + ); + inside=text(tmp); , - tmp3=["0","1","2","3","4","5","6","7","8","9"]; - if(contains(tmp3,substring(tmp_2,0,1)), - inside=parse(tmp_2)*color; + if(contains(["0","1"],tmp2), + tmp=[1,1,1]-color; + tmp=parse(tmp_2)*tmp; + inside=[1,1,1]-tmp; , - tmp3=Divoptions(["Color="+text(tmp_2)]); - inside=tmp3_(length(tmp3)-2); + if(tmp2=="N", + inside=[1,1,1]; + , + inside=Colorname2rgb(tmp_2); + ); ); - opcindy=opcindy+",pointcolor->"+text(inside); + tmp1=indexof(opcindy,"color->"); + tmp=substring(opcindy,tmp1,length(opcindy)); + tmp2=indexof(tmp,"]"); + tmp=substring(tmp,tmp2,length(tmp)); + opcindy=substring(opcindy,0,tmp1-1)+"color->"+text(inside)+tmp; + ); + ); //190628to + if(tmp1=="B", //1810628from + border=Toupper(substring(tmp_2,0,1)); + if(border=="N", + opcindy=opcindy+",border->false"; ); - ); //100405to + ); //1810628to if(tmp1=="M", //190206from Msg=Toupper(substring(tmp_2,0,1)); ); //190206to @@ -3999,8 +4037,9 @@ Pointdata(nm,listorg,options):=( ); GLIST=append(GLIST,name+"=Pointdata("+tmp2+")"); //no ketjs ); - if(Noflg<2, - tmp=[nameL,[0,1],opcindy]; //190126 + if(Noflg<3, //190818 + if(Noflg<2,tmp=[0,1],tmp=[-1,1]); //190819 + tmp=[nameL,tmp,opcindy]; //190126 GCLIST=append(GCLIST,tmp); if(Noflg==0, if(length(size)>0, @@ -4092,7 +4131,7 @@ Listplot(nm,list,options):=( parse(tmp); GLIST=append(GLIST,name+"=Listplot("+Textformat(ptlist,5)+")"); // 180719 //no ketjs ); - if(Noflg<2, + if(Noflg<3, //190818 if(isstring(Ltype), if((Noflg==0)&(color!=KCOLOR), //181020 //no ketjs on Texcom("{");Com2nd("Setcolor("+color+")");//180711 @@ -4163,7 +4202,7 @@ Lineplot(nm,list,optionorg):=( parse(tmp); GLIST=append(GLIST,name+"=Lineplot("+Textformat(list,5)+opstr+")"); //no ketjs ); - if(Noflg<2, + if(Noflg<3, //190818 if(isstring(Ltype), if((Noflg==0)&(color!=KCOLOR), //181020 //no ketjs on Texcom("{");Com2nd("Setcolor("+color+")");//180722 @@ -4371,7 +4410,7 @@ Plotdata(name1,func,variable,options):=( tmp=name+"=Plotdata('"+tmp1+"','"+tmp2+"'"+opstr+")"; GLIST=append(GLIST,tmp); //no ketjs off ); - if(Noflg<2, + if(Noflg<3, //190818 if(isstring(Ltype), if((Noflg==0)&(color!=KCOLOR), //181020 //no ketjs on Texcom("{");Com2nd("Setcolor("+color+")");//180722 @@ -4387,7 +4426,7 @@ Plotdata(name1,func,variable,options):=( ); PdL; , - if(Noflg<2, + if(Noflg<3, //190818 if(isstring(Ltype), if((Noflg==0)&(color!=KCOLOR), //181020 //no ketjs on Texcom("{");Com2nd("Setcolor("+color+")");//180722 @@ -4547,7 +4586,7 @@ Paramplot(nm,funstr,variable,options):=( tmp=name+"=Paramplot('"+tmp1+"','"+tmp2+"'"+opstr+")"; GLIST=append(GLIST,tmp); //no ketjs off ); - if(Noflg<2, + if(Noflg<3, //190818 if(isstring(Ltype), if((Noflg==0)&(color!=KCOLOR), //181020 //no ketjs on Texcom("{");Com2nd("Setcolor("+color+")");//180722 @@ -4563,7 +4602,7 @@ Paramplot(nm,funstr,variable,options):=( ); Out; , - if(Noflg<2, + if(Noflg<3, //190818 if(isstring(Ltype), if((Noflg==0)&(color!=KCOLOR), //181020 //no ketjs on Texcom("{");Com2nd("Setcolor("+color+")");//180722 @@ -4831,7 +4870,7 @@ Implicitplot(name1,func,xrngorg,yrngorg,optionsorg):=( GLIST=append(GLIST,tmp); //no ketjs // Drawfigures(name,[name],[options]); //190508 ); - if(Noflg<2, + if(Noflg<3, //190818 if(isstring(Ltype), if((Noflg==0)&(color!=KCOLOR), //181020 //no ketjs on Texcom("{");Com2nd("Setcolor("+color+")");//180722 @@ -4954,7 +4993,7 @@ Circledata(nm,cenrad,options):=( ); GLIST=append(GLIST,tmp); //no ketjs off ); - if(Noflg<2, + if(Noflg<3, //190818 if(isstring(Ltype), if((Noflg==0)&(color!=KCOLOR), //181020 //no ketjs on Texcom("{");Com2nd("Setcolor("+color+")");//180722 @@ -5091,7 +5130,7 @@ Ovaldata(nm,Pdata,options):=( GLIST=append(GLIST, //no ketjs name+"=Ovaldata("+Ctr+","+Dx+","+Dy+opstr+")");//16.01.30 //no ketjs ); - if(Noflg<2, + if(Noflg<3, //190818 if(isstring(Ltype), if((Noflg==0)&(color!=KCOLOR), //180904 //no ketjs on Texcom("{");Com2nd("Setcolor("+color+")");//180722 |