diff options
Diffstat (limited to 'Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic1r.cs')
-rw-r--r-- | Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic1r.cs | 501 |
1 files changed, 332 insertions, 169 deletions
diff --git a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic1r.cs b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic1r.cs index e473027def3..4957f56cd83 100644 --- a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic1r.cs +++ b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic1r.cs @@ -16,7 +16,7 @@ println("KeTCindy V.3.2.5"); println(ketjavaversion()); -println("ketcindylibbasic1[20190131] loaded"); +println("ketcindylibbasic1[20190311] loaded"); //help:start(); @@ -80,10 +80,11 @@ Ketinit(work,sy,rangex,rangey):=(//181001to COM0thlist=[]; COM1stlist=[]; COM2ndlist=[]; - COM2ndlistb=[]; //180612 + // COM2ndlistb=[]; //180612 ADDAXES="1"; AXSTYLE=["l","x","e","y","n","O","sw","","",""]; //181216 AXCOUNT=1; //181215 + SHADECTR=1; //190222 LFmark=unicode("000a"); CRmark=unicode("000d");//16.12.13 Dq=unicode("0022"); @@ -99,7 +100,7 @@ Ketinit(work,sy,rangex,rangey):=(//181001to ErrFlag=0; KETJSOP=[]; //190129 // no ketjs on 190122 - setdirectory(Dirwork); +// setdirectory(Dirwork); if(!isstring(Fhead), // 17.10.13from, 17.11.12 Fhead=text(curkernel()); Fhead=replace(Fhead,".cdy",""); @@ -125,36 +126,23 @@ Ketinit(work,sy,rangex,rangey):=(//181001to ); ); Userhome=Homehead+pathsep()+getname(); //190128 - Changesetting(); //190128 - Changework(Dircdy+pathsep()+work); //180329to,181001 - Fnametex=Fhead+".tex"; - FnameR=Fhead+".r"; - FnamebodyR=Fhead+"body.r"; - Fnameout=Fhead+".txt"; // 17.10.13until - if(!isstring(Mackc),// 16.06.07 - Mackc="sh"; - ); if(iswindows(), Batparent="\kc.bat"; , if(ismacosx(), //181125from Shellparent="/kc.command"; + Mackc="open"; //190222 , Shellparent="/kc.sh"; - Mackc="sh"; //190116 + Mackc="bash"; //190222 ); //181125to - if(!isexists(Dirwork,""), - println(Dirwork+" not exists"); - , - if(!iskcexists(Dirwork), - setdirectory(Dirwork); - SCEOUTPUT = openfile(Shellparent); - closefile(SCEOUTPUT); - println(Shellparent+" generated"); - ); - println(setexec(Dirwork,Shellparent)); - ); ); + Changesetting(); //190128 + Changework(Dircdy+pathsep()+work); //180329to,181001 + Fnametex=Fhead+".tex"; + FnameR=Fhead+".r"; + FnamebodyR=Fhead+"body.r"; + Fnameout=Fhead+".txt"; // 17.10.13to // no ketjs off 190122 ArrowlineNumber=1; // 15.01.05 ArrowheadNumber=1; @@ -169,7 +157,7 @@ Ketinit(work,sy,rangex,rangey):=(//181001to Setwindow("Msg=n"); // 16.05.31 // no ketjs on 190122 // for Presentation - letterc=[0.98,0.13,0,0.43]; boxc=[0,0.32,0.52,0]; + letterc=[0.98,0.13,0,0.43]; boxc=[0.2,0,0,0];//190307 [0,0.32,0.52,0]; shadowc=[0,0,0,0.5]; mboxc="yellow"; //17.03.02 regional debugged SlideColorList=[letterc,boxc,boxc,boxc,shadowc,shadowc,6,1.3, letterc,mboxc,mboxc,mboxc,62,2,letterc]; @@ -834,9 +822,6 @@ Changework(dirorg,options):=( //16.10.21 , println("Directory "+dir+" not exist, so "+Dqq(Dirwork)+" not changed"); ); //180618to -// println("Directory "+dir+" not exist, so set to "+Dircdy);//180604[2lines] -// Dirwork=Dircdy; -// ErrFlag=-1; , if(length(subdir)>0, //180605 if(makesub==1,//180606from @@ -849,9 +834,9 @@ Changework(dirorg,options):=( //16.10.21 setdirectory(Dirwork); if(!iswindows(), //17.04.11 if(!iskcexists(Dirwork), - SCEOUTPUT = openfile("/kc.command"); //181125 + SCEOUTPUT = openfile(Shellparent); //190221 closefile(SCEOUTPUT); - println(setexec(Dirwork,"/kc.command")); //181125 + println(setexec(Dirwork,Shellparent)); //190221 ); ); ); @@ -1225,8 +1210,8 @@ Assign(funstr,varname,rep):=( ); ////%Assign end//// -////%MeasureDepth start//// -MeasureDepth(list):=( +////%Measuredepth start//// +Measuredepth(list):=( regional(tmp,tmp1,Depth,Flg); Flg=0; Depth=0; @@ -1252,19 +1237,19 @@ MeasureDepth(list):=( );//180501 Depth; ); -////%MeasureDepth end//// +////%Measuredepth end//// ////%Flattenlist start//// Flattenlist(pltlist):=( //help:Flattenlist([[2,3],[[1,2],[5,6]]]); regional(Out,nn,Dt,ii,tmp,flg); Out=[]; - if(MeasureDepth(pltlist)==1, + if(Measuredepth(pltlist)==1, Out=[pltlist]; , forall(1..(length(pltlist)),nn, Dt=pltlist_nn; - if(MeasureDepth(Dt)<2, + if(Measuredepth(Dt)<2, Out=append(Out,Dt); , forall(1..(length(Dt)),ii, @@ -1414,7 +1399,7 @@ Crossprod(a,b):=( ////%Mvprod start//// Mvprod(mat,vec):=( //190127 regional(vecL); - if(MeasureDepth(vec)==0,vecL=[vec],vecL=vec); + if(Measuredepth(vec)==0,vecL=[vec],vecL=vec); Mvprod(mat,vecL,length(vecL)); ); Mvprod(mat,vecL,nn):=( @@ -1489,9 +1474,9 @@ Invert(nm,Fig,options):=( ////%Paramoncrv start//// Paramoncrv(pP,Gdata):=Paramoncurve(pP,Gdata);//180723 ////%Paramoncrv end//// -////%ParamonCurve start//// -ParamonCurve(point,Gdata):=( -//help:ParamonCurve(A,"gr1");//180723[3lines] +////%Paramoncurve start//// +Paramoncurve(point,Gdata):=( +//help:Paramoncurve(A,"gr1");//180723[3lines] regional(Tmp,PtL,pP); if(ispoint(point),pP=point.xy,pP=point); // Eps=10^(-8); @@ -1499,8 +1484,8 @@ ParamonCurve(point,Gdata):=( Tmp=Nearestpt(pP,PtL); Tmp_2; ); -ParamonCurve(pP,nN,plist):=( -//help:ParamonCurve(A,10,"gr1"); +Paramoncurve(pP,nN,plist):=( +//help:Paramoncurve(A,10,"gr1"); regional(PtL,Out,Pa,Pb,vV,vW,sS); if(isstring(plist),PtL=parse(plist),PtL=plist); PtL=apply(PtL,LLcrd(#));//16.10.16 @@ -1517,14 +1502,14 @@ ParamonCurve(pP,nN,plist):=( ); Out; ); -////%ParamonCurve end//// +////%Paramoncurve end//// ////%Pointoncrv start//// -Pointoncrv(tT,PtL):=PointonCurve(tT,PtL); +Pointoncrv(tT,PtL):=Pointoncurve(tT,PtL); ////%Pointoncrv end//// -////%PointonCurve start//// -PointonCurve(tTorg,Gdata):=( -//help:PointonCurve(20.5,"gr1"); +////%Pointoncurve start//// +Pointoncurve(tTorg,Gdata):=( +//help:Pointoncurve(20.5,"gr1"); regional(tT,Out,Eps,nN,sS,Pa,Pb,PtL); if(isstring(Gdata),PtL=parse(Gdata),PtL=Gdata); if(length(PtL)==1,PtL=PtL_1); @@ -1542,7 +1527,7 @@ PointonCurve(tTorg,Gdata):=( ); Out; ); -////%PointonCurve end//// +////%Pointoncurve end//// ////%Koutenseg start//// Koutenseg(pA,pB,pC,pD):=Koutenseg(pA,pB,pC,pD,[]); @@ -1690,8 +1675,8 @@ IntersectcrvsPp(Gr1,Gr2,options):=( Flg=0; if(isstring(Gr1),Data1=parse(Gr1),Data1=Gr1); if(isstring(Gr2),Data2=parse(Gr2),Data2=Gr2); - if(MeasureDepth(Data1)==2,Data1=Data1_1); - if(MeasureDepth(Data2)==2,Data2=Data2_1); + if(Measuredepth(Data1)==2,Data1=Data1_1); + if(Measuredepth(Data2)==2,Data2=Data2_1); Data1=apply(Data1,LLcrd(#)); Data2=apply(Data2,LLcrd(#)); if(length(Data1)==length(Data2), @@ -2225,6 +2210,9 @@ IntersectcurvesPp(crv1org,crv2org,options):=( out_ii=tmp2; ); ); + if(length(out)>0, //190221from + out=sort(out,[#_2]); + ); //190221to out; ); ////%IntersectcurvesPp end//// @@ -2247,7 +2235,7 @@ NearestptcrvPhy(point,PL):=( regional(tmp,pP,plist); pP=Pcrd(point); if(isstring(PL),plist=parse(PL),plist=PL); - if(MeasureDepth(plist)==2,plist=plist_1); + if(Measuredepth(plist)==2,plist=plist_1); plist=apply(plist,#); // 14.12.18 tmp=Nearestpt(pP,plist); tmp=tmp_1; @@ -2271,7 +2259,7 @@ Nearestpt(point,PL2):=( a1,b1,a2,b2,v1,v2,x1,x2,Tmp,rT,pP,sS,Lm,Pm,Sm,Flg); //help:Nearestpt("gr1","gr2"); if(isstring(point),PL1=parse(point),PL1=point); - if(MeasureDepth(PL1)==2,PL1=PL1_1); + if(Measuredepth(PL1)==2,PL1=PL1_1); if(!islist(PL1_1), PL1=[PL1]; Flg=0; @@ -2279,7 +2267,7 @@ Nearestpt(point,PL2):=( Flg=1; ); if(isstring(PL2),PL=parse(PL2),PL=PL2); - if(MeasureDepth(PL)==2,PL=PL_1); + if(Measuredepth(PL)==2,PL=PL_1); Eps=10^(-6); Ans=[PL1_1,1,PL_1,1,|PL1_1-PL_1|]; forall(1..(length(PL1)),Nn, // 16.05.04 @@ -2306,7 +2294,7 @@ Nearestpt(point,PL2):=( ); sS=|pP-pA|; if(sS<Sm-Eps, - Tmp=ParamonCurve(pP,Ni,PL); + Tmp=Paramoncurve(pP,Ni,PL); Pm=pP; Lm=Tmp; Sm=sS; ); ); @@ -2503,7 +2491,7 @@ Integratedt(pltdata,range,options):=( Sm= IntegrateO(pltdata,range); , if(isstring(pltdata),pdata=parse(pltdata),pdata=pltdata); - if(MeasureDepth(pdata)==2,pdata=pdata_1); + if(Measuredepth(pdata)==2,pdata=pdata_1); va1=MeetCurve(pdata,range_1,0); va2=MeetCurve(pdata,range_2,0); list=select(pdata,(#_1>range_1 & #_1<range_2)); @@ -2616,7 +2604,7 @@ IntegrateO(pltdata,rangeorg):=( , pdata=pltdata; ); - if(MeasureDepth(pdata)==2,pdata=pdata_1); + if(Measuredepth(pdata)==2,pdata=pdata_1); range=rangeorg; pmflg=1; if(range_2<range_1, @@ -2801,17 +2789,11 @@ Com1st(String):=( ////%Com1st end//// ////%Com2nd start//// -Com2nd(String):=Com2nd(String,["a"]);//180612 -Com2nd(String,option):=( -// help:Com2nd(str,["before"]); +Com2nd(String):=( +// help:Com2nd(str); regional(str,tmp); str=replace(String,LFmark,""); - tmp=substring(option_1,0,1);//180612from - if(Toupper(tmp)=="B", - COM2ndlistb=append(COM2ndlistb,str); - , - COM2ndlist=append(COM2ndlist,str); - );//180612to + COM2ndlist=append(COM2ndlist,str); ); ////%Com2nd end//// @@ -3610,7 +3592,7 @@ AddGraph(nm,pltdata,options):=( ); GLIST=append(GLIST,name+"="+tmp1); //no ketjs , - if(MeasureDepth(pdata)==1, + if(Measuredepth(pdata)==1, tmp1=name+"=Listplot("+Textformat(pdata,5)+")"; , tmp1="list"+PaO(); @@ -3756,7 +3738,7 @@ Partcrv(nm,pA,pB,PkLstr,options):=( name="part"+nm; if(isstring(PkLstr),PkL=parse(PkLstr),PkL=PkLstr); DepthFlg=0; - if(MeasureDepth(PkL)==2, + if(Measuredepth(PkL)==2, PkL=PkL_1; DepthFlg=1; ); @@ -3858,7 +3840,7 @@ Pointdata(nm,listorg,options):=( //help:Pointdata("2",[[2,3],[4,1]]); //help:Pointdata(options=["Size=(1)","Disp=(y)","Inside="]); //help:Pointdata("Inside=1(def)/ratio/rgblist/colorname/-1"]); - regional(list,name,nameL,ptlist,opstr,opcindy, + regional(list,name,nameL,ptlist,opstr,opcindy,Msg, eqL,dispflg,size,thick,tmp,tmp1,tmp2,tmp3, Ltype,Noflg,color,inside); name="pt"+nm; @@ -3873,6 +3855,7 @@ Pointdata(nm,listorg,options):=( size=""; dispflg="Y"; inside=color; + Msg="Y"; forall(eqL, tmp=Strsplit(#,"="); tmp1=Toupper(substring(tmp_1,0,1)); @@ -3898,22 +3881,31 @@ Pointdata(nm,listorg,options):=( inside=concat(inside,tmp); ); ); //181229to + if(tmp1=="M", //190206from + Msg=Toupper(substring(tmp_2,0,1)); + ); //190206to ); if(dispflg=="Y", - println("generate pointdata "+name); + if(Msg=="Y", //190206 + println("generate pointdata "+name); + ); ); //181030to if(isstring(listorg), list=parse(listorg) , list=listorg ); //17.10.23 - if(MeasureDepth(list)==0,list=[list]);//180530 - tmp=MeasureDepth(list); + if(Measuredepth(list)==0,list=[list]);//180530 + tmp=Measuredepth(list); if(tmp==1,ptlist=list,ptlist=list_1); //190126from tmp=apply(ptlist,[Textformat(Pcrd(#),5)]); tmp1=text(tmp); tmp2=substring(tmp1,1,length(tmp1)-1); tmp3=tmp1; + tmp=parse(tmp1); + if(length(tmp)==1, //190301from + tmp1=Textformat(tmp_1,5); + ); //190301to tmp=name+"="+tmp1; parse(tmp); tmp=nameL+"="+tmp3; @@ -4006,27 +3998,23 @@ Listplot(nm,list,options):=( eqL=tmp_5; color=tmp_(length(tmp)-2); opcindy=tmp_(length(tmp)); - Msg=1; // 15.09.17 + Msg="Y"; //190206 cutend=[0,0];//180719 forall(eqL, tmp=Strsplit(#,"="); tmp1=Toupper(substring(tmp_1,0,1)); - tmp2=tmp_2; if(tmp1=="M", - tmp=Toupper(substring(tmp2,0,1)); - if(tmp=="N", // 16.06.28 - Msg=0; - ); + Msg=Toupper(substring(tmp_2,0,1)); ); if(tmp1=="C",//180719from - tmp2=replace(tmp2,"[",""); + tmp2=replace(tmp_2,"[",""); tmp2=replace(tmp2,"]",""); cutend=tokenize(tmp2,","); if(length(cutend)==1,cutend=[cutend_1,cutend_1]); );//180719to ); if(Noflg<3, - if(Msg==1, + if(Msg=="Y", //190206 println("generate Listplot "+name); ); if(isstring(list_1),tmp=apply(list,parse(#)),tmp=list); // 15.03.24 @@ -4061,20 +4049,33 @@ Listplot(nm,list,options):=( ////%Listplot end//// ////%Lineplot start//// -Lineplot(nm,list,options):=( +Lineplot(nm,list,optionorg):=( //help:Lineplot([A,B]); //help:Lineplot("1",[[2,1],[3,3]]); - regional(name,Out,tmp,tmp1,opstr,opcindy,Mag,Semi, - Vec,pA,pB,Ltype,Noflg,color); + regional(name,Out,tmp,tmp1,tmp2,opstr,opcindy,Mag,Semi, + Vec,pA,pB,options,Ltype,Noflg,color,Msg,eqL); name="ln"+nm; + options=optionorg; Mag=100; Semi=""; + Msg="Y"; tmp=Divoptions(options); Ltype=tmp_1; Noflg=tmp_2; color=tmp_(length(tmp)-2); opcindy=tmp_(length(tmp)); opstr=tmp_(length(tmp)-1); + eqL=tmp_5; + forall(eqL, + tmp=Strsplit(#,"="); + tmp1=Toupper(substring(tmp_1,0,1)); + if(tmp1=="M", //190206from + Msg=Toupper(substring(tmp_2,0,1)); + options=remove(options,[#]); + ); //190206to + ); + tmp=Divoptions(options); + opstr=tmp_(length(tmp)-1); tmp1=tmp_6; if(length(tmp1)>0,Mag=tmp1_1); tmp1=tmp_7; @@ -4091,7 +4092,9 @@ Lineplot(nm,list,options):=( ); ); if(Noflg<3, - println("generate Lineplot "+name); + if(Msg=="Y", //190206 + println("generate Lineplot "+name); + ); tmp1=apply(Out,Pcrd(#)); tmp=name+"="+Textformat(tmp1,5); parse(tmp); @@ -4139,7 +4142,7 @@ Plotdata(name1,func,variable,options):=( //help:Plotdata("2","x^2","x=[-1,1]"); //help:Plotdata("3","Fout(x)","x",["out"]); regional(Fn,Va,tmp,tmp1,tmp2,eqL,name,Vname,x1,x2,dx, - PdL,Num,Ec,Dc,Fun,Exfun,x,Ke,Eps,Pa, + PdL,Num,Ec,Dc,Fun,Exfun,x,Ke,Eps,Pa,Msg, Ltype,Noflg,Inflg,Outflg,opstr,opcindy,color); name="gr"+name1; tmp=Divoptions(options); @@ -4155,17 +4158,18 @@ Plotdata(name1,func,variable,options):=( Ec=[]; Exfun=""; Dc=1000; + Msg="Y"; forall(eqL, - tmp=indexof(#,"="); - tmp1=substring(#,tmp,length(#)); - if(substring(#,0,1)=="N", - Num=parse(tmp1); + tmp=Strsplit(#,"="); + tmp1=Toupper(substring(#,0,1)); + if(tmp1=="N", + Num=parse(tmp_2); opstr=opstr+","+Dqq(#); ); - if(substring(#,0,1)=="E", - if(substring(tmp1,0,1)=="[", //180817from - Ec=parse(tmp1); - tmp1=replace(tmp1,"[","c"+PaO()); + if(tmp1=="E", + if(substring(tmp_2,0,1)=="[", //180817from + Ec=parse(tmp_2); + tmp1=replace(tmp_2,"[","c"+PaO()); tmp1=replace(tmp1,",",".0,"); tmp1=replace(tmp1,"]",".0)"); opstr=opstr+","+Dqq("Exc="+tmp1); //180817to @@ -4175,9 +4179,12 @@ Plotdata(name1,func,variable,options):=( ); ); if(substring(#,0,1)=="D", - Dc=parse(tmp1); + Dc=parse(tmp_2); opstr=opstr+","+Dqq(#); ); + if(tmp1=="M", //190206from + Msg=Toupper(substring(tmp_2,0,1)); + ); //190206to ); if(Inflg==0 & Outflg==0, Eps=10^(-3); @@ -4279,8 +4286,10 @@ Plotdata(name1,func,variable,options):=( PdL=PdL_1; ); if(Noflg<3, - println("generate Plotdata "+name); - if(MeasureDepth(PdL)==1, + if(Msg=="Y", //190206 + println("generate Plotdata "+name); + ); + if(Measuredepth(PdL)==1, tmp1=apply(PdL,Pcrd(#)); , tmp1=[]; @@ -4335,7 +4344,7 @@ Plotdata(name1,func,variable,options):=( Paramplot(nm,funstr,variable):=Paramplot(nm,funstr,variable,[]); Paramplot(nm,funstr,variable,options):=( //help:Paramplot("1","[2*cos(t),sin(t)]","t=[0,2*pi]"); - regional(name,Out,tmp,tmp1,tmp2,vname,func,str,Rng,Num, + regional(name,Out,tmp,tmp1,tmp2,vname,func,str,Rng,Num,Msg, Ec,Exfun,Dc,eqL,Fntmp,Vatmp,t1,t2,dt,tt,pa,ke, pt, //190103 Ltype,Noflg,Inflg,Outflg,opstr,opcindy,color); if(substring(nm,0,1)=="-", // 180928from @@ -4358,16 +4367,16 @@ Paramplot(nm,funstr,variable,options):=( Exfun=""; Dc=1000; forall(eqL, - tmp=indexof(#,"="); - tmp1=substring(#,tmp,length(#)); - if(substring(#,0,1)=="N", - Num=parse(tmp1); + tmp=Strsplit(#,"="); + tmp1=Toupper(substring(tmp_1,0,1)); + if(tmp1=="N", + Num=parse(tmp_2); opstr=opstr+","+Dqq(#); ); - if(substring(#,0,1)=="E", - if(substring(tmp1,0,1)=="[", //180817from - Ec=parse(tmp1); - tmp1=replace(tmp1,"[","c"+PaO()); + if(tmp1=="E", + if(substring(tmp_2,0,1)=="[", //180817from + Ec=parse(tmp_2); + tmp1=replace(tmp_2,"[","c"+PaO()); tmp1=replace(tmp1,",",".0,"); tmp1=replace(tmp1,"]",".0)"); opstr=opstr+","+Dqq("Exc="+tmp1); //180817to @@ -4377,9 +4386,12 @@ Paramplot(nm,funstr,variable,options):=( ); ); if(substring(#,0,1)=="D", - Dc=parse(tmp1); + Dc=parse(tmp_2); opstr=opstr+","+Dqq(#); ); + if(tmp1=="M", //190206from + Msg=Toupper(substring(tmp_2,0,1)); + ); //190206to ); if(Inflg==0 & Outflg==0, tmp=indexof(variable,"="); @@ -4449,8 +4461,10 @@ Paramplot(nm,funstr,variable,options):=( Out=Out_1; ); if(Noflg<3, - println("generate Paramplot "+name); - if(MeasureDepth(Out)==1, + if(Msg=="Y", //190206 + println("generate Paramplot "+name); + ); + if(Measuredepth(Out)==1, tmp1=apply(Out,Pcrd(#)); , tmp1=[]; @@ -4596,7 +4610,6 @@ Implicitplot(name1,func,xrng,yrng,optionsorg):=( Noflg=tmp_2; eqL=tmp_5; color=tmp_(length(tmp)-2); - opstr=tmp_(length(tmp)-1); opcindy=tmp_(length(tmp)); Mdv=50;Ndv=50; msg="Y"; @@ -4604,7 +4617,6 @@ Implicitplot(name1,func,xrng,yrng,optionsorg):=( tmp=Strsplit(#,"="); tmp1=Toupper(substring(tmp_1,0,1)); tmp2=tmp_2; - opstr=opstr+",'"+#+"'"; if(substring(#,0,1)=="N", Mdv=parse(tmp2); if(!islist(Mdv), @@ -4613,6 +4625,7 @@ Implicitplot(name1,func,xrng,yrng,optionsorg):=( Ndv=Mdv_2; Mdv=Mdv_1; ); + opstr=",'"+#+"'"; ); if(substring(#,0,1)=="M", //181112from msg=Toupper(substring(tmp2,0,1)); @@ -4691,7 +4704,7 @@ Implicitplot(name1,func,xrng,yrng,optionsorg):=( if(msg=="Y", //181112 println("generate Implicitplotdata "+name); ); - if(MeasureDepth(out)==1, + if(Measuredepth(out)==1, tmp1=apply(out,Pcrd(#)); , tmp1=[]; @@ -4743,8 +4756,8 @@ Circledata(para1,para2):=( Circledata(name,cenrad,options); ); Circledata(nm,cenrad,options):=( - regional(name,Out,Ctr,Ptcir,ra,Num,Rg,opstr,opcindy,color, - tmp,tmp1,tmp1,Th,Ltype,Noflg,eqL,pA,pB,pC,d1,d2,Eps); + regional(name,Out,Ctr,Ptcir,ra,Num,Rg,opstr,opcindy,color,Msg, + tmp,tmp1,tmp2,Th,Ltype,Noflg,eqL,pA,pB,pC,d1,d2,Eps); name="cr"+nm; tmp=Divoptions(options); Ltype=tmp_1; @@ -4755,16 +4768,21 @@ Circledata(nm,cenrad,options):=( opcindy=tmp_(length(tmp)); Num=50; Rg=[0,2*pi]; + Msg="Y"; forall(eqL, - tmp=indexof(#,"="); - tmp1=substring(#,tmp,length(#)); - opstr=opstr+",'"+#+"'"; + tmp=Strsplit(#,"="); + tmp1=Toupper(substring(tmp_1,0,1)); if(substring(#,0,1)=="N", - Num=parse(tmp1); + Num=parse(tmp_2); + opstr=opstr+",'"+#+"'"; ); if(substring(#,0,1)=="R", - Rg=parse(tmp1); + Rg=parse(tmp_2); + opstr=opstr+",'"+#+"'"; ); + if(tmp1=="M", //190206from + Msg=Toupper(substring(tmp_2,0,1)); + ); //190206to ); if(length(cenrad)==2, Ctr=Lcrd(cenrad_1); @@ -4802,7 +4820,9 @@ Circledata(nm,cenrad,options):=( Out=Lineplot("1",[pA,pB],["nodata"]); ); if(Noflg<3, - println("generate Circledata "+name); + if(Msg=="Y", //190206 + println("generate Circledata "+name); + ); tmp1=apply(Out,Pcrd(#)); tmp=name+"="+Textformat(tmp1,5); parse(tmp); @@ -4839,7 +4859,7 @@ Circledata(nm,cenrad,options):=( Framedata():=Framedata(["dr"]);//16.10.29from Framedata(list):=( regional(pA,pB); - if(MeasureDepth(list)==0, + if(Measuredepth(list)==0, pA=LLcrd((SW+NE)/2); // 15.09.17 pB=LLcrd(NE); Framedata("win",[pA,pB],list); @@ -5426,7 +5446,7 @@ Arrowheaddata(point,direction,options):=( hiraki=hiraki*pi/180; if(ispoint(direction),Houkou=direction.xy); //181018 if(isstring(direction),Houkou=parse(direction),Houkou=direction); - if(MeasureDepth(Houkou)==2,Houkou=Houkou_1); + if(Measuredepth(Houkou)==2,Houkou=Houkou_1); if(coord=="P",//181018from if(ispoint(point),pP=point.xy,pP=point); , @@ -5530,7 +5550,7 @@ Arrowhead(nm,point,direction,optionsorg):=(//181018from options=concat(options,tmp); //181214to if(ispoint(direction),Houkou=direction.xy); //181018 if(isstring(direction),Houkou=parse(direction),Houkou=direction); - if(MeasureDepth(Houkou)==2,Houkou=Houkou_1); + if(Measuredepth(Houkou)==2,Houkou=Houkou_1); if(coord=="P",//181018from if(ispoint(point),pP=point.xy,pP=point); , @@ -5687,7 +5707,7 @@ Arrowdata(nm,ptlist,optionsorg):=( ////%Anglemark start//// Anglemark(plist):=Anglemark(plist,[]); -Anglemark(Arg1,Arg2):=( // 2015.04.28 from +Anglemark(Arg1,Arg2):=( // 2015.04.28 from regional(nm,plist,options,tmp); if(isstring(Arg1), nm=Arg1; @@ -5705,17 +5725,16 @@ Anglemark(Arg1,Arg2):=( // 2015.04.28 from Anglemark(nm,plist,options):=( //help([A,B,C],["E=\theta",2]); //help:Anglemark("1",[A,B,C],["E=1.2,\theta",2]); -//help:Anglemark("1",[A,B,2*pi]); +// help:Anglemark("1",[A,B,2*pi]); //help:Anglemark(options=[size,"E/L=(sep,)letter"]); regional(name,Out,pB,pA,pC,Ctr,ra,sab,sac,ratio,opstr,Bname,Bpos,color, - Brat,tmp,tmp1,tmp2,Num,opcindy,Ltype,eqL,realL,Rg,Th,Noflg); + Brat,tmp,tmp1,tmp2,Num,opcindy,Ltype,eqL,realL,Rg,Th,Noflg,Msg); name="ag"+nm; Bpos="md"+name; ra=0.5; tmp=Divoptions(options); Ltype=tmp_1; Noflg=tmp_2; -// opstr=tmp_(length(tmp)-1);//180530 color=tmp_(length(tmp)-2); opcindy=tmp_(length(tmp)); eqL=tmp_5; @@ -5723,21 +5742,28 @@ Anglemark(nm,plist,options):=( Bname=""; Brat=1.2; //180530 Num=20; + Msg="Y"; opstr=""; if(length(realL)>0, ra=realL_1*ra; opstr=","+text(realL_1);//180530 ); forall(eqL, - if(substring(#,0,1)=="L",Bname="Letter("); - if(substring(#,0,1)=="E",Bname="Expr("); - Bname=Bname+Bpos+","+Dq+"c"+Dq+","+Dq;//16.10.29 - tmp=substring(#,indexof(#,"="),length(#)); - tmp1=indexof(tmp,","); - Bname=Bname+substring(tmp,tmp1,length(tmp))+Dq+")"; - if(tmp1>0, - Brat=parse(substring(tmp,0,tmp1-1)); + tmp=Strsplit(#,"="); + tmp1=Toupper(substring(tmp_1,0,1)); + if((tmp1=="L")%(tmp1=="E"), + if(tmp1=="L",Bname="Letter("); + if(tmp1=="E",Bname="Expr("); + Bname=Bname+Bpos+","+Dq+"c"+Dq+","+Dq;//16.10.29 + tmp1=indexof(tmp_2,","); + Bname=Bname+substring(tmp_2,tmp1,length(tmp_2))+Dq+")"; //190219 + if(tmp1>0, + Brat=parse(substring(tmp_2,0,tmp1-1)); + ); ); + if(tmp1=="M", //190206from + Msg=Toupper(substring(tmp_2,0,1)); + ); //190206to ); pB=Lcrd(plist_1); pA=Lcrd(plist_2); sab=pB-pA; Ctr=pA; @@ -5767,7 +5793,9 @@ Anglemark(nm,plist,options):=( parse(Bname); ); if(Noflg<3, - println("generate anglemark "+name+" and "+Bpos); + if(Msg=="Y", //190206 + println("generate anglemark "+name+" and "+Bpos); + ); tmp1=apply(Out,Pcrd(#)); tmp=name+"="+Textformat(tmp1,5); parse(tmp); @@ -5922,7 +5950,7 @@ Bowdata(nm,plist,options):=( //help:Bowdata([A,B],["Expr=t0n3,a"]); //help:Bowdata([A,B],["Exprrot=t0n2r,a"]); regional(name,Out,pB,pA,pC,ra,tmp,tmp1,tmp2,Ltype,eqL,realL, - Bname,Bpos,Th,Cut,Num,Hgt,opstr,opcindy,Ydata,pC, + Bname,Bpos,Th,Cut,Num,Hgt,opstr,opcindy,Ydata,pC,Msg, Th1,Th2,Noflg,Bops,Bmov,Tmov,Nmov,rev,color); name="bw"+nm; tmp=Divoptions(options); @@ -5938,6 +5966,7 @@ Bowdata(nm,plist,options):=( Cut=0; Num=24; Bname=""; + Msg="Y"; //190206 Tmov=0;//16.11.01from Nmov=0; Bmov=""; @@ -5947,23 +5976,27 @@ Bowdata(nm,plist,options):=( if(length(realL)>1,Cut=realL_2); ); forall(eqL, - tmp=substring(#,0,1); - if(tmp=="L" % tmp=="l", + tmp=Strsplit(#,"="); + tmp1=Toupper(substring(tmp_1,0,1)); + if(tmp1=="L", if(indexof(#,"rot")>0, Bname="Letterrot("; , Bname="Letter("; ); + Bops=tmp_2; ); - if(tmp=="E" % tmp=="e", + if(tmp1=="E", if(indexof(#,"rot")>0, Bname="Exprrot("; , Bname="Expr("; ); + Bops=tmp_2; ); - tmp=indexof(#,"="); - Bops=substring(#,tmp,length(#)); // 16.11.01 + if(tmp1=="M", //190206from + Msg=Toupper(substring(tmp_2,0,1)); + ); //190206to ); Ydata=MakeBowdata(pA,pB,Hgt); pC=Ydata_1; @@ -6041,8 +6074,10 @@ Bowdata(nm,plist,options):=( Out=[tmp1,tmp2]; ); if(Noflg<3, - println("generate bowdata "+name+" and "+Bpos);//16.10.31 - if(MeasureDepth(Out)==1,Out=[Out]); + if(Msg=="Y", //190206 + println("generate bowdata "+name+" and "+Bpos);//16.10.31 + ); + if(Measuredepth(Out)==1,Out=[Out]); tmp1=[]; forall(Out,tmp2, tmp=apply(tmp2,Pcrd(#)); @@ -6084,7 +6119,7 @@ Bownamerot(bwdata,str,updown):=Bownamerot(bwdata,0,0,str,updown); Bownamerot(bwdata,tmov,nmov,str):=Bownamerot(bwdata,tmov,nmov,str,1); Bownamerot(bwdata,tmov,nmov,str,updown):=( regional(bdata,tmp); - tmp=MeasureDepth(bwdata); + tmp=Measuredepth(bwdata); if(tmp==1,bdata=[bwdata],bdata=bwdata); if(length(bdata)>1, tmp=Ptend(bdata_2)-Ptstart(bdata_1); @@ -6178,7 +6213,7 @@ Deqplot(nm,deqorg,rngorg,initt,initf,options):=( //17.10.06 //help:Deqplot("1","y''=-y","x",0, [1,0]); //help:Deqplot("3","[x,y]'=[x*(1-y),0.3*y*(x-1)]","t=[0,20]",0,[1,0.5]); regional(deq,rng,Ltype,Noflg,eqL,opcindy,Num,name,nn,pdL,phase, - sel,tmp,tmp1,tmp2,color); + sel,tmp,tmp1,tmp2,tmp3,color); name="de"+nm; tmp=Divoptions(options); Ltype=tmp_1; @@ -6200,10 +6235,11 @@ Deqplot(nm,deqorg,rngorg,initt,initf,options):=( //17.10.06 if(indexof(rng,"=")==0, rng=rng+"="+Textformat([XMIN,XMAX],6); ); - deq=deqorg; + deq=replace(deqorg,"‘","`"); //190206 deq=replace(deq,"'","`"); //180527 - tmp=indexof(deq,"="); - tmp1=substring(deq,0,tmp-1); + tmp3=indexof(deq,"="); + tmp1=substring(deq,0,tmp3-1); + tmp2=substring(deq,tmp3,length(deq)); if(indexof(tmp1,"[")==0, phase=0; sel=[1,2]; @@ -6211,14 +6247,32 @@ Deqplot(nm,deqorg,rngorg,initt,initf,options):=( //17.10.06 phase=1; sel=[2,3]; ); - tmp2=substring(deq,tmp,length(deq)); nn=length(Indexall(tmp1,"`")); + if(nn==0, //190211from + println(" Lhs of equation has no single/back quotation "+tmp1); + ); + if(nn>0, + tmp=Indexall(tmp1,"`"); + if(tmp_(length(tmp))!=tmp3-1, + nn=0; + , + forall(reverse(2..(length(tmp))), + if((nn>0)&(!contains(tmp,tmp_#-1)), + nn=0; + ); + ); + ); + if(nn==0, + println(" Lhs of equation is not correct"); + ); + ); //190211to if(nn==1, if(indexof(tmp1,"[")==0, tmp1="["+replace(tmp1,"`","]`"); deq=tmp1+"="+tmp2; ); - , + ); + if(nn>1, tmp=indexof(tmp1,"`"); tmp1=substring(tmp1,0,tmp-1); deq="["; @@ -6252,7 +6306,7 @@ Deqplot(nm,deqorg,rngorg,initt,initf,options):=( //17.10.06 ); deq=deq+"]"; ); - if(Noflg<3, + if((nn>0)&(Noflg<3), //190211 pdL=Deqdata(deq,rng,initt,initf,Num); if(phase==1, pdL=apply(pdL,#_(2..3)); @@ -6261,7 +6315,7 @@ Deqplot(nm,deqorg,rngorg,initt,initf,options):=( //17.10.06 tmp=name+"="+Textformat(tmp1,5); parse(tmp); ); - if(Noflg<1, //no ketjs on + if((nn>0)&(Noflg<1), //190211 //no ketjs on tmp=Assign(deq); tmp=replace(deq,"'","`"); tmp=name+"=Deqplot('"+tmp+"','"+rng+"',"; @@ -6270,7 +6324,7 @@ Deqplot(nm,deqorg,rngorg,initt,initf,options):=( //17.10.06 tmp=RSform(tmp); GLIST=append(GLIST,tmp); ); //no ketjs off - if(Noflg<2, + if((nn>0)&(Noflg<2), //190211 if(isstring(Ltype), if((Noflg==0)&(color!=KCOLOR), //180904 //no ketjs on Texcom("{");Com2nd("Setcolor("+color+")");//180722 @@ -6399,7 +6453,7 @@ EnclosingS(nm,plist,options):=( forall(1..(length(KL)),ii, tmp1=KL_ii_1; tmp=KL_ii_3; - tmp2=ParamonCurve(tmp1,tmp,Fdata); + tmp2=Paramoncurve(tmp1,tmp,Fdata); tmp3=KL_ii_2; if(tmp2>t1+Eps & tmp2<t2+Eps, qt=tmp1; @@ -7043,23 +7097,114 @@ Hatchdatacindy(nm,iostr,bdylistorg,optionsorg):=( ); ////%Hatchdata end//// +////%Shadein start//// +Shadein(pstrorg):=( //190220 + regional(pstr,ptL,pL,crv,nn, + tmp,tmp1,tmp2,pm1,pm2,p1,p2,flg); + if(islist(pstrorg),pstr=pstrorg_1,pstr=pstrorg); + crv=[]; + Framedata(["nodisp"]); + ptL=IntersectcurvesPp(pstr,frwin); + if(length(ptL)>0, + pL=apply(ptL,#_2); + forall(1..(length(pL)),nn, + if(nn<length(pL), + tmp1=pL_nn; + tmp2=pL_(nn+1); + tmp=Pointoncrv((tmp1+tmp2)/2,pstr); + , + tmp1=pL_nn; + tmp2=pL_1; + tmp=parse(pstr); + if(pL_nn==length(tmp), + tmp=tmp_1; + , + tmp=tmp_(length(tmp)); + ); + ); + if(Inwindow(tmp), + tmp=Partcrv("",tmp1,tmp2,pstr,["nodata"]); + , + tmp1=Pointoncrv(tmp1,pstr); + tmp2=Pointoncrv(tmp2,pstr); + pm1=Paramoncrv(tmp1,frwin); + pm2=Paramoncrv(tmp2,frwin); + if(floor(pm1)==floor(pm2), + tmp=Listplot("",[tmp1,tmp2],["nodata"]); + , + tmp=floor(pm1); + p1=Pointoncrv(tmp,"frwin"); + p2=Pointoncrv(mod(tmp,4)+1,"frwin"); + tmp=p1-10*(p2-p1); + Listplot("frwin",[p1,tmp],["nodisp","Msg=n"]); + tmp=IntersectcurvesPp("sgfrwin",pstr); + if(mod(length(tmp),2)==0, //190223from + if(pm2<pm1,pm2=pm2+4); + tmp=[tmp1]; + pm1=floor(pm1)+1; + flg=0; + forall(1..3, + if(flg==0, + if(pm1<pm2, + p1=Pointoncrv(mod(pm1-1,4)+1,"frwin"); + tmp=append(tmp,p1); + pm1=pm1+1; + , + flg=1; + ); + ); + ); + if(pm1-1<pm2,tmp=append(tmp,tmp2)); + , + if(pm2>pm1,pm2=pm2-4); + tmp=[tmp1]; + pm1=floor(pm1); + flg=0; + forall(1..3, + if(flg==0, + if(pm1>pm2, + p1=Pointoncrv(mod(pm1-1,4)+1,"frwin"); + tmp=append(tmp,p1); + pm1=pm1-1; + , + flg=1; + ); + ); + ); + if(pm1+1>pm2,tmp=append(tmp,tmp2)); + ); //190223to + ); + ); + if(length(crv)==0, + crv=tmp; + , + crv=Joincrvs("",[crv,tmp],["nodata"]); + ); + ); + , + if(Inwindow(parse(pstr+"_1")),crv=pstr,crv=frwin); + ); + crv; +); +////%Shadein end//// + ////%Shade start//// -Shade(plist):=Shade("",plist,[]); //180613from +Shade(plist):=Shade(plist,[]); Shade(Arg1,Arg2):=( - if(isstring(Arg1), - Shade(Arg1,Arg2,[]); + if(!isstring(Arg1), + Shade(text(SHADECTR),Arg1,Arg2); //190222 , - Shade("",Arg1,Arg2); + Shade(Arg1,Arg2,[]); ); ); -Shade(nm,plistorg,options):=( //180613to -//help:Shade(["gr"],[0.5]); -//help:Shade(["gr"],["Color=red"]); -//help:Shade(["gr2","sg1"],["Color=[0,0,0,0.5]"]); -//help:Shade(["gr2","sg1"],["Color=[1,0,0]"]); +Shade(nm,plistorg,options):=( +//help:Shade(["gr1"],[0.5]); +//help:Shade(["gr1"],["Color=red"]); +//help:Shade(["gr1"],["Trim=y(n)"]); //190224 +// help:Shade(["gr1","sg1"],["Color=[1,0,0]"]); // help:Shade([[A,B,C,A]]); -//help:Shade("1",["gr2","Invert(sg1)"],["Enc=y",startpt]]); - regional(name,plist,jj,tmp,tmp1,tmp2, +//help:Shade(["gr2","Invert(sg1)"],["Enc=y",(Startpoint)]); + regional(name,plist,jj,nn,trim,tmp,tmp1,tmp2, opstr,opcindy,eqL,reL,Str,G2,flg,encflg,startpt,color,ctr); name="shade"+nm; plist=plistorg; @@ -7076,6 +7221,7 @@ Shade(nm,plistorg,options):=( //180613to opcindy=tmp_(length(tmp)); tmp=select(plist,indexof(#,"Invert")>0); //180929from if(length(tmp)>0,encflg=1,encflg=0); + trim="N"; forall(eqL, tmp=Strsplit(#,"="); tmp1=Toupper(tmp_1); @@ -7088,6 +7234,9 @@ Shade(nm,plistorg,options):=( //180613to encflg=0; ); ); + if(substring(tmp1,0,1)=="T", + trim=substring(tmp2,0,1); + ); ); startpt=[]; forall(reL, @@ -7107,6 +7256,9 @@ Shade(nm,plistorg,options):=( //180613to ); plist=["en"+nm]; ); //180929to + if((length(plist)==1)&(trim=="Y"), //190220from,109224 + plist=[Shadein(plist)]; + ); //190220to forall(1..(length(plist)),jj, //180613from if(flg==0, tmp1=plist_jj; @@ -7131,13 +7283,13 @@ Shade(nm,plistorg,options):=( //180613to );//180613to if(flg==1, println(" some data not defined properly"); - , + , G2=Joincrvs("1",plist,["nodata"]); G2=apply(G2,Pcrd(#)); tmp1="fillpoly("+Textformat(G2,5)+opcindy+");"; parse(tmp1); ); - Str="Shade("; + Str="Shade("; //no ketjs on tmp1="list"+PaO(); forall(plist, if(isstring(#), // from 16.01.24 @@ -7150,10 +7302,21 @@ Shade(nm,plistorg,options):=( //180613to tmp1=tmp1+"Listplot("+Textformat(#,5)+"),"; ); //16.01.24to ); - Str=Str+substring(tmp1,0,length(tmp1)-1)+")"+")"; //180929 - Com2nd("Texcom("+Dqq("{")+")",["before"]);Com2nd("Setcolor("+color+")",["before"]);//180722 //no ketjs on - Com2nd(Str,["before"]); - Com2nd("Texcom("+Dqq("}")+")",["before"]);//180722 //no ketjs off + Str=Str+substring(tmp1,0,length(tmp1)-1)+")"+")"; //180929 + nn=length(COM2ndlist); //190311from + jj=nn; + forall(plist,tmp1, + tmp=select(1..nn,indexof(COM2ndlist_#,tmp1)>0); + jj=min(append(tmp,jj)); + ); + tmp1=["Texcom("+Dqq("{")+")","Setcolor("+color+")",Str,"Texcom("+Dqq("}")+")"]; + tmp2=COM2ndlist_(1..(jj-1)); + tmp=COM2ndlist_(jj..(length(COM2ndlist))); + if(!islist(tmp),tmp=[tmp]); + COM2ndlist=concat(tmp2,tmp1); + COM2ndlist=concat(COM2ndlist,tmp); //190311to + //no ketjs off + SHADECTR=SHADECTR+1; ); ////%Shade end//// |