diff options
author | Karl Berry <karl@freefriends.org> | 2019-06-24 21:05:25 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-06-24 21:05:25 +0000 |
commit | 6df3fe57362cbe88636ba77df481c3329fcdd66f (patch) | |
tree | 4193e5de76d13069a1cf83f6aea42386f9a7f271 /Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic1r.cs | |
parent | 210b1a78e3075d3c7a5aefa3aac2683de9281af8 (diff) |
ketcindy (24jun19)
git-svn-id: svn://tug.org/texlive/trunk@51444 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic1r.cs')
-rw-r--r-- | Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic1r.cs | 2441 |
1 files changed, 267 insertions, 2174 deletions
diff --git a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic1r.cs b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic1r.cs index 4957f56cd83..c68a550dd11 100644 --- a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic1r.cs +++ b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic1r.cs @@ -14,9 +14,9 @@ // along with this program. If not, see <http://www.gnu.org/licenses/> // -println("KeTCindy V.3.2.5"); +println("KeTCindy V.3.2.9"); println(ketjavaversion()); -println("ketcindylibbasic1[20190311] loaded"); +println("ketcindylibbasic1[20190622] loaded"); //help:start(); @@ -58,7 +58,8 @@ Ketinit(work,sy,rangex,rangey):=(//181001to MARKLEN=0.05; MARKLENInit=MARKLEN; //180504 MARKLENNow= MARKLEN; - GENTEN=[0,0];//18.01.15until + GENTEN=[0,0];//18.01.15to + TABLECOUNT=0; //190428 KETPICLAYER=20; MilliIn=1/2.54*1000; PenThick=round(MilliIn*0.02); @@ -69,17 +70,17 @@ Ketinit(work,sy,rangex,rangey):=(//181001to YaCut=0; YasenStyle="dr,1"; Yajiristyle="tf"; KETPICCOUNT=1; KCOLOR=[0,0,0]; - GLIST=[]; + GLIST=[]; // no ketjs GCLIST=[]; -// GDATALIST=[]; //no ketjs +// GDATALIST=[]; //no ketjs on GOUTLIST=[]; - POUTLIST=[]; + POUTLIST=[]; // no ketjs off VLIST=[]; FUNLIST=[]; LETTERlist=[]; - COM0thlist=[]; + COM0thlist=[]; // no ketjs on COM1stlist=[]; - COM2ndlist=[]; + COM2ndlist=[]; // no ketjs off // COM2ndlistb=[]; //180612 ADDAXES="1"; AXSTYLE=["l","x","e","y","n","O","sw","","",""]; //181216 @@ -99,14 +100,15 @@ Ketinit(work,sy,rangex,rangey):=(//181001to GPACK="tpic"; //180817 ErrFlag=0; KETJSOP=[]; //190129 - // no ketjs on 190122 + REMOVEPTJS=[]; SLIDEFLG="Y"; //190504 + KetcindyjsDataList=[]; // setdirectory(Dirwork); if(!isstring(Fhead), // 17.10.13from, 17.11.12 Fhead=text(curkernel()); Fhead=replace(Fhead,".cdy",""); Slidename=Fhead; //17.10.24 );//17.11.12 - Dircdy=replace(Dircdy,"%E3%80%80"," ");//180405 + Dircdy=replace(Dircdy,"%E3%80%80",unicode("3000"));//190416 Namecdy=Cindyname();//180608 tmp1=Indexall(Dircdy,"%"); //180329from if(length(tmp1)>0, @@ -170,15 +172,53 @@ Ketinit(work,sy,rangex,rangey):=(//181001to ); ////%Ketinit end//// +////%Initglist start//// 190530 +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; +); +////%Initglist end//// + +////%Setglist start//// 190530 +Setglist():=( + GLISTadd=GLIST; + GCLISTadd=GCLIST; + COM0thlistadd=COM0thlist; // no ketjs on + COM1stlistadd=COM1stlist; + COM2ndlistadd=COM2ndlist; // no ketjs off +); +////%Setglist end//// + +////%Addglist start//// 190530 +Addglist():=( + GLIST=GLISTadd; + GCLIST=GCLISTadd; + COM0thlist=COM0thlist; // no ketjs on + COM1stlist=COM1stlistadd; + COM2ndlist=COM2ndlistadd; // no ketjs off +); +////%Addglist end//// + ////%Fillstore start//// Fillstore():=( regional(tmp,tmp1,out,dtL,txtL,clrL,txt,clr,nn,jj); dtL=[ //181209from ["Figure",[1,0.29,0.29]],["Parent",[1,1,0]], - ["ParaF",[0,1,1]],["Flip",[0,0,1]],["Anime",[0.51,0.95,1]], + ["ParaF",[1,0.93,0.6]],["Flip",[0,0,1]],["Anime",[0.51,0.95,1]], ["Title",[0,1,0]],["Slide",[0.47,0,0.72]],["Digest",[1,0.74,0.47]], ["KeTJS",[0,1,1]],["KeTJSoff",[0,1,1]], - ["Objview",[0,1,0]] + ["Objview",[0,1,0]], + ["Play",[1.0, 0.741, 0.467]],["Pause",[1.0, 0.741, 0.467]], //190426[2lines] + ["Rev",[1.0, 0.741, 0.467]],["Stop",[1.0, 0.741, 0.467]], + ["Skele",[1.0, 0.741, 0.467]],["Nohid",[1.0, 0.741, 0.467]] ]; txtL=apply(dtL,#_1); clrL=apply(dtL,#_2); @@ -212,7 +252,7 @@ Fillblack(str):=( tmp=select(tmp1,#.name=="Text0"); if(length(tmp)==0, forall(store, - tmp=parse(#_1); + tmp=parse(#_1+";"); tmp.fillcolor=[0,0,0]; ); , @@ -304,13 +344,13 @@ Setwindow(str):=( Putpoint("SW",Pcrd([XMIN,YMIN])); Putpoint("NE", Pcrd([XMAX,YMAX])); ); - if(msg=="y", + if(msg=="y", // no ketjs on println("Setwindow(["+XMIN+","+XMAX+"],["+YMIN+","+YMAX+"])"); ); layer(KETPICLAYER); autoclearlayer(KETPICLAYER,true); drawpoly([Pcrd([XMIN,YMIN]), Pcrd([XMAX,YMIN]), - Pcrd([XMAX,YMAX]),Pcrd([XMIN,YMAX])],color->[1,1,1]); + Pcrd([XMAX,YMAX]),Pcrd([XMIN,YMAX])],color->[1,1,1]); // no ketjs off ); Setwindow(xrange,yrange):=( //help:Setwindow([2,3],[-1,1]); @@ -787,7 +827,7 @@ Changework(dirorg):=Changework(dirorg,["Sub=y"]); Changework(dirorg,options):=( //16.10.21 //help:Changework(directory); //help:Changework(Dircdy+"fig"); -//help:Changework(options=["Sub=n"(not to make folder fig]); +//help:Changework(options=["Sub=n"<not to make folder fig>); regional(dir,subdir,tmp,,eqL,makesub); tmp=Divoptions(options); eqL=tmp_5; //180605from @@ -865,7 +905,7 @@ Changestyle(nameL,style):=( if((Noflg==0)&(color!=KCOLOR), //180904 //no ketjs on Texcom("{");Com2nd("Setcolor("+color+")");//180722 ); //no ketjs off - Ltype=GetLinestyle(text(Noflg)+Ltype,name); + Ltype=Getlinestyle(text(Noflg)+Ltype,name); if((Noflg==0)&(color!=KCOLOR), //180904 //no ketjs on Texcom("}");//180722 ); //no ketjs off @@ -896,17 +936,19 @@ Op(n,object):=( // 16.05.25 ////%Op end//// ////%Ptselected start//// -Ptselected():=Isptselected(allpoints());//180711[2lines] -Ptselected(ptlist):=Isptselected(ptlist); -Isptselected():=Isptselected(allpoints()); //180706 -Isptselected(ptlist):=( +Ptselected():=Isptselected(allpoints()); //180706 +Ptselected(ptlistorg):=( //help:Ptselected(); -//help:Isptselected(); - regional(flg); +//help:Ptselected(geopoint); + regional(ptlist,flg,Eps); + Eps=(XMAX-XMIN)/10; //190505 flg=0; + ptlist=ptlistorg; //190505[2lines] + if(!islist(ptlist),ptlist=[ptlist]); forall(ptlist, if(flg==0, - if(isselected(#),flg=1); + if(isselected(#),flg=1); // no ketjs +// if(|mouse().xy-#.xy|<Eps,flg=1); // only ketjs //190505 ); ); if(flg==0,false,true); @@ -970,7 +1012,7 @@ Dependgeo(geo):=( regional(tmp,tmp1,tmp2,out); tmp=Finddef(geo); if(!iscircle(geo), - out=[text(geo)]; + out=[geo.name]; //190505 , out=[geo]; ); @@ -1013,7 +1055,7 @@ Drawprocess(nn,options):=( ); //181030to tmp=remove(allpoints(),[NE,SW,TH,FI]); tmp1=select(tmp, - substring(text(#),length(text(#))-1,length(text(#)))!="z"); + substring(#.name,length(#.name)-1,length(#.name))!="z"); //190505 tmp1=concat(tmp1,alllines()); // tmp1=concat(tmp1,allcircles()); All=apply(tmp1,Dependgeo(#)); @@ -1149,6 +1191,20 @@ Sprintf(value,dig):=( ); ////%Sprintf end//// +////%Replaceall start//// 190507 +Replaceall(str,repL):=( + regional(tmp1,tmp2,out); + out=str; + forall(1..(length(repL)/2), + tmp1=repL_(2*#-1); + tmp2=repL_(2*#); + if(!isstring(tmp2),tmp2=text(tmp2)); + out=replace(out,tmp1,tmp2); + ); + out; +); +////%Replaceall end//// + ////%Assign start//// Assign(str):=( //190125from regional(tmp); @@ -1210,7 +1266,6 @@ Assign(funstr,varname,rep):=( ); ////%Assign end//// -////%Measuredepth start//// Measuredepth(list):=( regional(tmp,tmp1,Depth,Flg); Flg=0; @@ -1237,6 +1292,22 @@ Measuredepth(list):=( );//180501 Depth; ); + +////%Measuredepth start//// +Measuredepth(list):=( //190423 + regional(str,nn,tmp,tmp1,tmp2); + str=text(list); + tmp1=Indexall(str,"["); + tmp2=select(tmp1,!contains(tmp1,#+1)); + nn=tmp2_1; + tmp1=substring(str,nn,length(str)); + tmp=indexof(tmp1,","); + tmp1=substring(tmp1,0,tmp-1); + if(!ispoint(parse(tmp1)), + nn=nn-1; + ); + nn; +); ////%Measuredepth end//// ////%Flattenlist start//// @@ -1456,19 +1527,19 @@ Ptcrv(Num,Fig):=( ////%Invert start//// Invert(Fig):=( -//help:Invert("gr1"); +//help:Invert("gr1"); //no ketjs regional(tmp); if(isstring(Fig),tmp=parse(Fig),tmp=Fig); // 16.01.27 reverse(tmp); ); -Invert(nm,Fig):=Invert(nm,Fig,["nodisp"]); // from 16.01.27 +Invert(nm,Fig):=Invert(nm,Fig,["nodisp"]); // from 160127 Invert(nm,Fig,options):=( //help:Invert("1","gr1"); regional(name,tmp); name="-inv"+nm; tmp=Invert(Fig); Listplot(name,tmp,options); -);// until 16.01.27 +);// to 160127 ////%Invert end//// ////%Paramoncrv start//// @@ -1643,11 +1714,11 @@ Koutenseg(pA,pB,pC,pD,options):=( ///////// Start of old Intersect //////////// -////%IntersectcrvsPp start//// -IntersectcrvsPp(Gr1,Gr2):=IntersectcrvsPp(Gr1,Gr2,[]); -IntersectcrvsPp(Gr1,Gr2,options):=( -//help:IntersectcrvsPp("gr1","pa1"); -//help:IntersectcrvsPp(options=[Eps2(0.1),"Dif=0.05"]); +////%Intersectcrvspp start//// +Intersectcrvspp(Gr1,Gr2):=Intersectcrvspp(Gr1,Gr2,[]); +Intersectcrvspp(Gr1,Gr2,options):=( +//help:Intersectcrvspp("gr1","pa1"); +//help:Intersectcrvspp(options=[Eps2(0.1),"Dif=0.05"]); regional(Out,Eps,Eps2,Eps0,Flg,Data1,Data2, Tmp1,Tmp2,Tmp3,Tmp,KL1,KL2,pA,pB,Ni,Nj, pP,pQ,rT,Flg,eqL,realL,opstr,Dif); @@ -1788,14 +1859,14 @@ IntersectcrvsPp(Gr1,Gr2,options):=( ); // 15.04.06 until Out; ); -////%IntersectcrvsPp end//// +////%Intersectcrvspp end//// ////%Intersectcrvs start//// Intersectcrvs(Gr1,Gr2):=Intersectcrvs(Gr1,Gr2,[]); //help:Intersectcrvs("gr1","pa1"); Intersectcrvs(Gr1,Gr2,options):=( regional(tmp,tmp1,tmp2); - tmp1=IntersectcrvsPp(Gr1,Gr2,options); + tmp1=Intersectcrvspp(Gr1,Gr2,options); apply(tmp1,#_1); ); ////%Intersectcrvs end//// @@ -2107,11 +2178,11 @@ Collectsameseg(ptdL):=( ); ////%Collectsameseg end//// -////%IntersectcurvesPp start//// -IntersectcurvesPp(crv1org,crv2org):=IntersectcurvesPp(crv1org,crv2org,[]); -IntersectcurvesPp(crv1org,crv2org,options):=( -//help:IntersectcurvesPp(crv1,crv2); -//help:IntersectcurvesPp(options=[Eps1(0.01),Eps2(0.1),Dist(2)]) +////%Intersectcurvespp start//// +Intersectcurvespp(crv1org,crv2org):=Intersectcurvespp(crv1org,crv2org,[]); +Intersectcurvespp(crv1org,crv2org,options):=( +//help:Intersectcurvespp(crv1,crv2); +//help:Intersectcurvespp(options=[Eps1(0.01),Eps2(0.1),Dist(2)]) regional(Eps,Eps1,Eps2,Dist,crv1,crv2,ii,jj,seg1,seg2,self,loopL,out, flg,tmp,tmp1,tmp2); Eps=10^(-4); @@ -2215,7 +2286,7 @@ IntersectcurvesPp(crv1org,crv2org,options):=( ); //190221to out; ); -////%IntersectcurvesPp end//// +////%Intersectcurvespp end//// ////%Intersectcurves start//// Intersectcurves(crv1org,crv2org):=Intersectcurves(crv1org,crv2org,[]); @@ -2223,15 +2294,15 @@ Intersectcurves(crv1org,crv2org,options):=( //help:Intersectcurves(crv1,crv2); //help:Intersectcurves(options=[Eps1(0.1),Dist(2)]) regional(tmp); - tmp=IntersectcurvesPp(crv1org,crv2org,options); + tmp=Intersectcurvesop(crv1org,crv2org,options); tmp=apply(tmp,#_1); ); ////%Intersectcurves end//// ///////////End of new Intersect ////////////// -////%NearestptcrvPhy start//// -NearestptcrvPhy(point,PL):=( +////%Nearestptcrvphy start//// +Nearestptcrvphy(point,PL):=( regional(tmp,pP,plist); pP=Pcrd(point); if(isstring(PL),plist=parse(PL),plist=PL); @@ -2241,7 +2312,7 @@ NearestptcrvPhy(point,PL):=( tmp=tmp_1; [tmp_1/SCALEX,tmp_2/SCALEY]; ); -////%NearestptcrvPhy end//// +////%Nearestptcrvphy end//// ////%Nearestptcrv start//// Nearestptcrv(point,plist):=( @@ -2339,7 +2410,7 @@ Derivative(Arg1,Arg2,Arg3):=(//1807120 , tmp1=Lineplot("",[[0,v],[1,v]],["nodata"]); ); - tmp=IntersectcurvesPp(pdstr,tmp1); + tmp=Intersectcurvespp(pdstr,tmp1); if(length(tmp)==0, println(" Derivative cannot be found"); out=""; @@ -2432,7 +2503,7 @@ Tangentplot(nm,pdstr,ptinfo,optionsorg):=( , tmp1=Lineplot("",[[0,v],[1,v]],["nodata"]); ); - tmp=IntersectcurvesPp(pdstr,tmp1); + tmp=Intersectcurvespp(pdstr,tmp1); if(length(tmp)==0,//1807120 println(" Derivative cannot be calculated"); flg=1; @@ -2611,8 +2682,8 @@ IntegrateO(pltdata,rangeorg):=( range=reverse(range); pmflg=-1; ); - va1=MeetCurve(pdata,range_1,0); - va2=MeetCurve(pdata,range_2,0); + va1=Meetcurve(pdata,range_1,0); + va2=Meetcurve(pdata,range_2,0); list=select(pdata,(#_1>range_1 & #_1<range_2)); if(length(list)>0, // 16.09.25 if(list_1_1>list_(length(list))_1, //16.11.03 @@ -2850,13 +2921,6 @@ Dottedline(gstr):=( ); ////%Dottedline end//// -////%SetEnglish start//// -SetEnglish():=( -//help:SetEnglish(); - Com0th("setlanguage('en')"); -); -////%SetEnglish end//// - ////%Drawlinetype start//// Drawlinetype(name,type):=( //help:Drawlinetype("gr1","da,1"); @@ -2942,7 +3006,7 @@ Setunitlen(UI):=( Setmarklen(ratio):=( //help:Setmarklen(0.2); MARKLEN=ratio*0.2;//16.11.01 - Com2nd("Setmarklen("+Textformat(ratio,5)+")"); + Com2nd("Setmarklen("+Textformat(ratio,5)+")"); //no ketjs ); ////%Setmarklen end//// @@ -2950,14 +3014,14 @@ Setmarklen(ratio):=( Setorigin(point):=( //help:Setorigin([1,2]); GENTEN=point; //181231 - Com2nd("Setorigin("+Textformat(point,5)+")"); + Com2nd("Setorigin("+Textformat(point,5)+")"); //no ketjs ); ////%Setorigin end//// ////%Fontsize start//// Fontsize(sizestr):=( //help:Fontsize("s"); - Com2nd("Fontsize('"+sizestr+"')"); + Com2nd("Fontsize('"+sizestr+"')"); //no ketjs ); ////%Fontsize end//// @@ -2965,7 +3029,7 @@ Fontsize(sizestr):=( Setpen(width):=( //help:Setpen(2); PenThick=PenThickInit*width; // 16.04.09 - Com2nd("Setpen("+text(width)+")"); + Com2nd("Setpen("+text(width)+")"); //no ketjs ); ////%Setpen end//// @@ -3401,6 +3465,8 @@ 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 + ["cindycolor",[0.66,0,69,0.71]], //190504 ["black",[0,0,0,1]],["white",[0,0,0,0]] ]; tmp=select(dL,#_1==name); @@ -3410,13 +3476,13 @@ Colorname2rgb(name):=( //181212 code=Colorcmyk2rgb(code); , println(" "+name+" not found"); - code=[0,0,0]; + code=Assign(name); //190323 ); ); ////%Colorname2rgb end//// -////%GetLinestyle start//// -GetLinestyle(str,name):=( +////%Getlinestyle start//// +Getlinestyle(str,name):=( regional(noflg,tmp,tmp1,tmp2,Dop,Ltype,subflg); Ltype=-1; Dop=""; @@ -3483,7 +3549,7 @@ GetLinestyle(str,name):=( ); Ltype; ); -////%GetLinestyle end//// +////%Getlinestyle end//// ////%Chunderscore start//// Chunderscore(str):=( @@ -3557,7 +3623,7 @@ AddGraph(nm,pltdata,options):=( pdata=tmp1; if(Noflg<3, println("generate addgraph "+name); - tmp=name+"="+Textformat(pdata,5); + tmp=name+"="+Textformat(pdata,5)+";"; //190415 parse(tmp); if(isstring(pltdata), // 16.04.04 from if(indexof(pltdata,"]")>0, @@ -3599,14 +3665,14 @@ AddGraph(nm,pltdata,options):=( forall(1..(length(pdata)), tmp=name+"p"+Textformat(#,5)+"="; if(length(pdata_#)>1, // 15.01.22 - tmp=tmp+"Listplot("+Textformat(pdata_#,5)+")"; + tmp=tmp+"Listplot("+Textformat(pdata_#,5)+");"; //190425 , - tmp=tmp+"Pointdata("+Textformat(pdata_#_1,5)+")"; + tmp=tmp+"Pointdata("+Textformat(pdata_#_1,5)+");"; //190425 ); GLIST=append(GLIST,tmp); //no ketjs tmp1=tmp1+name+"p"+Textformat(#,5)+","; ); - tmp1=name+"="+substring(tmp1,0,length(tmp1)-1)+")"; + tmp1=name+"="+substring(tmp1,0,length(tmp1)-1)+");"; //190425 ); GLIST=append(GLIST,tmp1); //no ketjs ); @@ -3616,7 +3682,7 @@ AddGraph(nm,pltdata,options):=( if((Noflg==0)&(color!=KCOLOR), //181020 //no ketjs on Texcom("{");Com2nd("Setcolor("+color+")");//180722 ); //no ketjs off - Ltype=GetLinestyle(text(Noflg)+Ltype,name); + Ltype=Getlinestyle(text(Noflg)+Ltype,name); if((Noflg==0)&(color!=KCOLOR), //181020 //no ketjs on Texcom("}");//180722 ); //no ketjs off @@ -3701,7 +3767,7 @@ Joincrvs(nm,plotstrL,options):=( if(Noflg<3, println("generate joincurve "+name); tmp1=apply(PtL,Pcrd(#)); - tmp=name+"="+Textformat(tmp1,5); + tmp=name+"="+Textformat(tmp1,5)+";"; parse(tmp); tmp1=""; forall(plotstrL, @@ -3715,7 +3781,7 @@ Joincrvs(nm,plotstrL,options):=( if((Noflg==0)&(color!=KCOLOR), //181020 //no ketjs on Texcom("{");Com2nd("Setcolor("+color+")");//180722 ); //no ketjs off - Ltype=GetLinestyle(text(Noflg)+Ltype,name); + Ltype=Getlinestyle(text(Noflg)+Ltype,name); if((Noflg==0)&(color!=KCOLOR), //181020 //no ketjs on Texcom("}");//180722 ); //no ketjs off @@ -3791,7 +3857,7 @@ Partcrv(nm,pA,pB,PkLstr,options):=( if(Noflg<3, println("generate partcrv "+name); tmp1=apply(Ans,Pcrd(#)); - tmp=name+"="+Textformat(tmp1,5); + tmp=name+"="+Textformat(tmp1,5)+";"; //190415 parse(tmp); // GLIST=append(GLIST, // 16.04.03 if(DepthFlg==0, @@ -3808,7 +3874,7 @@ Partcrv(nm,pA,pB,PkLstr,options):=( if((Noflg==0)&(color!=KCOLOR), //181020 //no ketjs on Texcom("{");Com2nd("Setcolor("+color+")");//180722 ); //no ketjs off - Ltype=GetLinestyle(text(Noflg)+Ltype,name); + Ltype=Getlinestyle(text(Noflg)+Ltype,name); if((Noflg==0)&(color!=KCOLOR), //181020 //no ketjs on Texcom("}");//180722 ); //no ketjs off @@ -3838,8 +3904,8 @@ 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)","Inside="]); -//help:Pointdata("Inside=1(def)/ratio/rgblist/colorname/-1"]); +//help:Pointdata(options=["Size=(1)","Disp=(y)","Msg=(y)","Inside=","Color="]); +//help:Pointdata("Inside=color/ratio/no"]); regional(list,name,nameL,ptlist,opstr,opcindy,Msg, eqL,dispflg,size,thick,tmp,tmp1,tmp2,tmp3, Ltype,Noflg,color,inside); @@ -3849,9 +3915,9 @@ Pointdata(nm,listorg,options):=( Ltype=tmp_1; Noflg=tmp_2; eqL=tmp_5; - opcindy=tmp_(length(tmp)); -// opstr=tmp_(length(tmp)-1); + opstr=tmp_(length(tmp)-1); color=tmp_(length(tmp)-2); + opcindy=tmp_(length(tmp)); size=""; dispflg="Y"; inside=color; @@ -3860,27 +3926,27 @@ Pointdata(nm,listorg,options):=( tmp=Strsplit(#,"="); tmp1=Toupper(substring(tmp_1,0,1)); if(tmp1=="S", - size=Toupper(substring(tmp_2,0,1));; - opcindy=opcindy+",size->"+text(size); //181013 + size=tmp_2; //190406from + tmp1=parse(size); + opcindy=opcindy+",size->"+text(tmp1); //190409to ); if(tmp1=="D", //181030from dispflg=Toupper(substring(tmp_2,0,1)); ); - if(tmp1=="I", //181229from - if(contains(["","no"],tmp_2), - if(tmp_2=="no",inside=append(inside,-1)); + if(tmp1=="I", //190405from + if(Toupper(substring(tmp_2,0,1))=="N", + inside=[-1,-1,-1]; , - tmp2=substring(tmp_2,0,1); - if(contains(["-","0","1",".","["],tmp2), - tmp=parse(tmp_2); - if(length(tmp)==4,tmp=Colorcmyk2rgb(tmp)); //190115 - if(!isstring(tmp),tmp=[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; , - tmp=Colorname2rgb(tmp_2); + tmp3=Divoptions(["Color="+text(tmp_2)]); + inside=tmp3_(length(tmp3)-2); ); - inside=concat(inside,tmp); + opcindy=opcindy+",pointcolor->"+text(inside); ); - ); //181229to + ); //100405to if(tmp1=="M", //190206from Msg=Toupper(substring(tmp_2,0,1)); ); //190206to @@ -3891,10 +3957,11 @@ Pointdata(nm,listorg,options):=( ); ); //181030to if(isstring(listorg), - list=parse(listorg) + list=parse(listorg); , - list=listorg - ); //17.10.23 + list=listorg; + ); //17.10.23 + list=apply(list,Lcrd(#)); //190426 if(Measuredepth(list)==0,list=[list]);//180530 tmp=Measuredepth(list); if(tmp==1,ptlist=list,ptlist=list_1); //190126from @@ -3906,9 +3973,9 @@ Pointdata(nm,listorg,options):=( if(length(tmp)==1, //190301from tmp1=Textformat(tmp_1,5); ); //190301to - tmp=name+"="+tmp1; + tmp=name+"="+tmp1+";"; //190415 parse(tmp); - tmp=nameL+"="+tmp3; + tmp=nameL+"="+tmp3+";"; //190415 parse(tmp); //190126to if(Noflg<3, if(isstring(listorg), //17.10.23 @@ -3920,7 +3987,7 @@ Pointdata(nm,listorg,options):=( tmp=#; , if(ispoint(#), - tmp=text(#); + tmp=#.name; //190505 , tmp=Textformat(#,6); ); @@ -3928,7 +3995,7 @@ Pointdata(nm,listorg,options):=( tmp2=tmp2+tmp+","; ); tmp2=substring(tmp2,0,length(tmp2)-1)+")"; - //17.10.10until + //17.10.10to ); GLIST=append(GLIST,name+"=Pointdata("+tmp2+")"); //no ketjs ); @@ -3939,10 +4006,7 @@ Pointdata(nm,listorg,options):=( if(length(size)>0, Com2nd("Setpt("+size+")"); ); - thick=PenThick/PenThickInit; // 16.04.09 from - if(length(size)>0,tmp1=parse(size),tmp1=1); - tmp1=max(tmp1,1)/8; - Setpen(tmp1); // 16.04.09 until + thick=PenThick/PenThickInit; // 16.04.09 if((Noflg==0)&(color!=KCOLOR), //181020 //no ketjs on Texcom("{"); Com2nd("Setcolor("+color+")");//180711 @@ -3952,7 +4016,6 @@ Pointdata(nm,listorg,options):=( if((Noflg==0)&(color!=KCOLOR), //181020 //no ketjs on Texcom("}");//180711 ); //no ketjs off - Setpen(thick); // 16.04.09 if(length(size)>0, //no ketjs on tmp=Textformat(TenSize/TenSizeInit,1); Com2nd("Setpt("+tmp+")"); @@ -4025,7 +4088,7 @@ Listplot(nm,list,options):=( ptlist_1=ptlist_1+tmp*cutend_1; ptlist_(length(ptlist))=ptlist_(length(ptlist))-tmp*cutend_2; );//180719to - tmp=name+"="+Textformat(ptlist,5); + tmp=name+"="+Textformat(ptlist,5)+";"; //190415 parse(tmp); GLIST=append(GLIST,name+"=Listplot("+Textformat(ptlist,5)+")"); // 180719 //no ketjs ); @@ -4034,7 +4097,7 @@ Listplot(nm,list,options):=( if((Noflg==0)&(color!=KCOLOR), //181020 //no ketjs on Texcom("{");Com2nd("Setcolor("+color+")");//180711 ); //no ketjs off - Ltype=GetLinestyle(text(Noflg)+Ltype,name); + Ltype=Getlinestyle(text(Noflg)+Ltype,name); if((Noflg==0)&(color!=KCOLOR), //181020 //no ketjs on Texcom("}");//180711 ); //no ketjs off @@ -4096,7 +4159,7 @@ Lineplot(nm,list,optionorg):=( println("generate Lineplot "+name); ); tmp1=apply(Out,Pcrd(#)); - tmp=name+"="+Textformat(tmp1,5); + tmp=name+"="+Textformat(tmp1,5)+";"; //190415 parse(tmp); GLIST=append(GLIST,name+"=Lineplot("+Textformat(list,5)+opstr+")"); //no ketjs ); @@ -4105,7 +4168,7 @@ Lineplot(nm,list,optionorg):=( if((Noflg==0)&(color!=KCOLOR), //181020 //no ketjs on Texcom("{");Com2nd("Setcolor("+color+")");//180722 ); //no ketjs off - Ltype=GetLinestyle(text(Noflg)+Ltype,name); + Ltype=Getlinestyle(text(Noflg)+Ltype,name); if((Noflg==0)&(color!=KCOLOR), //181020 //no ketjs on Texcom("}");//180722 ); //no ketjs off @@ -4144,7 +4207,11 @@ Plotdata(name1,func,variable,options):=( regional(Fn,Va,tmp,tmp1,tmp2,eqL,name,Vname,x1,x2,dx, PdL,Num,Ec,Dc,Fun,Exfun,x,Ke,Eps,Pa,Msg, Ltype,Noflg,Inflg,Outflg,opstr,opcindy,color); - name="gr"+name1; + if(substring(name1,0,1)!="-", //190420from + name="gr"+name1; + , + name=substring(name1,1,length(name1)); + ); //190420to tmp=Divoptions(options); Ltype=tmp_1; Noflg=tmp_2; @@ -4297,7 +4364,7 @@ Plotdata(name1,func,variable,options):=( tmp1=append(tmp1,apply(tmp2,Pcrd(#))); ); ); - tmp=name+"="+Textformat(tmp1,5); + tmp=name+"="+Textformat(tmp1,5)+";"; parse(tmp); tmp1=replace(func,LFmark,""); //no ketjs on tmp2=replace(variable,LFmark,""); @@ -4309,7 +4376,7 @@ Plotdata(name1,func,variable,options):=( if((Noflg==0)&(color!=KCOLOR), //181020 //no ketjs on Texcom("{");Com2nd("Setcolor("+color+")");//180722 ); //no ketjs off - Ltype=GetLinestyle(text(Noflg)+Ltype,name); + Ltype=Getlinestyle(text(Noflg)+Ltype,name); if((Noflg==0)&(color!=KCOLOR), //181020 //no ketjs on Texcom("}");//180722 ); //no ketjs off @@ -4325,7 +4392,7 @@ Plotdata(name1,func,variable,options):=( if((Noflg==0)&(color!=KCOLOR), //181020 //no ketjs on Texcom("{");Com2nd("Setcolor("+color+")");//180722 ); //no ketjs off - Ltype=GetLinestyle(text(Noflg)+Ltype,name); + Ltype=Getlinestyle(text(Noflg)+Ltype,name); if((Noflg==0)&(color!=KCOLOR), //181020 //no ketjs on Texcom("}");//180722 ); //no ketjs off @@ -4362,6 +4429,7 @@ Paramplot(nm,funstr,variable,options):=( opstr=tmp_(length(tmp)-1); opcindy=tmp_(length(tmp)); eqL=tmp_5; + Msg="Y"; //190322 Num=50; Ec=[]; Exfun=""; @@ -4472,7 +4540,7 @@ Paramplot(nm,funstr,variable,options):=( tmp1=append(tmp1,apply(tmp2,Pcrd(#))); ); ); - tmp=name+"="+Textformat(tmp1,5); + tmp=name+"="+Textformat(tmp1,5)+";"; parse(tmp); tmp1=replace(funstr,LFmark,""); // 15.11.13 //no ketjs on tmp2=replace(variable,LFmark,""); @@ -4484,7 +4552,7 @@ Paramplot(nm,funstr,variable,options):=( if((Noflg==0)&(color!=KCOLOR), //181020 //no ketjs on Texcom("{");Com2nd("Setcolor("+color+")");//180722 ); //no ketjs off - Ltype=GetLinestyle(text(Noflg)+Ltype,name); + Ltype=Getlinestyle(text(Noflg)+Ltype,name); if((Noflg==0)&(color!=KCOLOR), //181020 //no ketjs on Texcom("}");//180722 ); //no ketjs off @@ -4500,7 +4568,7 @@ Paramplot(nm,funstr,variable,options):=( if((Noflg==0)&(color!=KCOLOR), //181020 //no ketjs on Texcom("{");Com2nd("Setcolor("+color+")");//180722 ); //no ketjs off - Ltype=GetLinestyle(text(Noflg)+Ltype,name); + Ltype=Getlinestyle(text(Noflg)+Ltype,name); if((Noflg==0)&(color!=KCOLOR), //181020 //no ketjs on Texcom("}");//180722 ); //no ketjs off @@ -4596,14 +4664,21 @@ Connectseg(Pdata):=( ////%Implicitplot start//// Implicitplot(name1,func,xrng,yrng):=Implicitplot(name1,func,xrng,yrng,[]); -Implicitplot(name1,func,xrng,yrng,optionsorg):=( +Implicitplot(name1,func,xrngorg,yrngorg,optionsorg):=( //help:Implicitplot("1","x^2+x*y+y^2=1","x=[-3,3]","y=[-3,3]"); -//help:Implicitplot(options=["Num=[50,50]","Msg=y(n)"]); - regional(name,options,Fn,varx,vary,rngx,rngy,Mdv,Ndv,tmp,tmp1,tmp2, - Eps,Ltype,Noflg,eqL,color,opsr,opcindy,dx,dy,out,jj,ii,kk,msg, +//help:Implicitplot(options=["Num=[50,50]","Msg=y(n)","Bisection=y(n)]); + regional(name,options,Fn,xrng,yrng,varx,vary,rngx,rngy,Mdv,Ndv,tmp,tmp1,tmp2, + Eps,Ltype,Noflg,eqL,color,opsr,opcindy,dx,dy,out,jj,ii,kk,msg,biflg,flg, yval1,yval2,xval1,xval2,eval11,eva12,eval21,eval22,pL,vL,qL); name="imp"+name1; - Eps=10^(-4); + xrng=xrngorg; yrng=yrngorg; //190622from + if(indexof(xrng,"=")==0, + xrng=xrng+"="+Textformat([XMIN,XMAX],5); + ); + if(indexof(yrng,"=")==0, + yrng=yrng+"="+Textformat([YMIN,YMAX],5); + ); //190622to + Eps=10^(-6); //190511 options=optionsorg; tmp=Divoptions(options); Ltype=tmp_1; @@ -4611,8 +4686,10 @@ Implicitplot(name1,func,xrng,yrng,optionsorg):=( eqL=tmp_5; color=tmp_(length(tmp)-2); opcindy=tmp_(length(tmp)); + opstr=tmp_(length(tmp)-1); //190406 Mdv=50;Ndv=50; msg="Y"; + biflg="Y"; forall(eqL, tmp=Strsplit(#,"="); tmp1=Toupper(substring(tmp_1,0,1)); @@ -4631,6 +4708,10 @@ Implicitplot(name1,func,xrng,yrng,optionsorg):=( msg=Toupper(substring(tmp2,0,1)); options=remove(options,[#]); ); //181112to + if(substring(#,0,1)=="B", //190509from + biflg==Toupper(substring(tmp2,0,1)); + options=remove(options,[#]); + ); //190509to ); tmp=indexof(func,"="); if(tmp==0, @@ -4646,7 +4727,7 @@ Implicitplot(name1,func,xrng,yrng,optionsorg):=( tmp=indexof(yrng,"="); vary=substring(yrng,0,tmp-1); rngy=parse(substring(yrng,tmp,length(yrng))); - tmp="Impfun("+varx+","+vary+"):="+Fn; + tmp="Impfun("+varx+","+vary+"):="+Fn+";"; parse(tmp); dx=(rngx_2-rngx_1)/Mdv; dy=(rngy_2-rngy_1)/Ndv; @@ -4673,14 +4754,46 @@ Implicitplot(name1,func,xrng,yrng,optionsorg):=( , if(vL_kk>Eps, if(vL_(kk+1)< -Eps, - tmp=1/(vL_kk-vL_(kk+1))* + if(biflg=="n", //190508 + tmp=1/(vL_kk-vL_(kk+1))* (-vL_(kk+1)*pL_kk+vL_kk*pL_(kk+1)); + , + tmp1=pL_(kk); tmp2=pL_(kk+1); //190508from + flg=0; + forall(1..20, //190511 + if(flg==0, + tmp=(tmp1+tmp2)/2; + eval11=Impfun(tmp_1,tmp_2); + if(abs(eval11)<=Eps, + flg=1; + , + if(eval11>Eps,tmp1=tmp,tmp2=tmp); + ); + ); + ); //190508to + ); qL=append(qL,tmp); ); - , + , if(vL_(kk+1)>Eps, - tmp=1/(-vL_kk+vL_(kk+1))* + if(biflg=="n", //190508 + tmp=1/(-vL_kk+vL_(kk+1))* (vL_(kk+1)*pL_kk-vL_kk*pL_(kk+1)); + , + tmp1=pL_(kk); tmp2=pL_(kk+1); //190508from + flg=0; + forall(1..20, //190511 + if(flg==0, + tmp=(tmp1+tmp2)/2; + eval11=Impfun(tmp_1,tmp_2); + if(abs(eval11)<=Eps, + flg=1; + , + if(eval11>Eps,tmp2=tmp,tmp1=tmp); + ); + ); + ); //190508to + ); qL=append(qL,tmp); ); ); @@ -4712,19 +4825,20 @@ Implicitplot(name1,func,xrng,yrng,optionsorg):=( tmp1=append(tmp1,apply(tmp2,Pcrd(#))); ); ); - tmp=name+"="+Textformat(tmp1,5); - parse(tmp); - tmp=name+"=Implicitplot('"+func+"','"+xrng+"','"+yrng+"'"+opstr+")"; //no ketjs + tmp=name+"="+Textformat(tmp1,5); //190415 + parse(tmp+";"); + tmp=name+"=Implicitplot('"+func+"','"+xrng+"','"+yrng+"'"+opstr+")"; GLIST=append(GLIST,tmp); //no ketjs +// Drawfigures(name,[name],[options]); //190508 ); if(Noflg<2, if(isstring(Ltype), if((Noflg==0)&(color!=KCOLOR), //181020 //no ketjs on Texcom("{");Com2nd("Setcolor("+color+")");//180722 ); //no ketjs off - Ltype=GetLinestyle(text(Noflg)+Ltype,name); + Ltype=Getlinestyle(text(Noflg)+Ltype,name); if((Noflg==0)&(color!=KCOLOR), //181020 //no ketjs on - Texcom("}");//180722 + Texcom("}");//180722 ); //no ketjs off , if(Noflg==1,Ltype=0); @@ -4787,6 +4901,9 @@ Circledata(nm,cenrad,options):=( if(length(cenrad)==2, Ctr=Lcrd(cenrad_1); Ptcir=Lcrd(cenrad_2); + if(!islist(Ptcir), //190323from + Ptcir=Ctr+[Ptcir,0]; + ); //190323to ra=dist(Ctr,Ptcir); , Eps=10^(-1); @@ -4805,9 +4922,9 @@ Circledata(nm,cenrad,options):=( , Ctr=1/2*(pA+pB)+1/2*d2/d1*tmp1; ra=|pA-Ctr|; - tmp=name+"center="+Ctr; + tmp=name+"center="+Textformat(Ctr,5)+";"; parse(tmp); - Defvar(name+"center",Ctr); + Defvar(name+"center",re(Ctr)); ); ); if(ra>0, @@ -4824,7 +4941,7 @@ Circledata(nm,cenrad,options):=( println("generate Circledata "+name); ); tmp1=apply(Out,Pcrd(#)); - tmp=name+"="+Textformat(tmp1,5); + tmp=name+"="+Textformat(tmp1,5)+";"; //190415 parse(tmp); if(length(cenrad)==2, //no ketjs on tmp=name+"=Circledata("+cenrad+opstr+")"; @@ -4842,7 +4959,7 @@ Circledata(nm,cenrad,options):=( if((Noflg==0)&(color!=KCOLOR), //181020 //no ketjs on Texcom("{");Com2nd("Setcolor("+color+")");//180722 ); //no ketjs off - Ltype=GetLinestyle(text(Noflg)+Ltype,name); + Ltype=Getlinestyle(text(Noflg)+Ltype,name); if((Noflg==0)&(color!=KCOLOR), //181020 //no ketjs on Texcom("}");//180722 ); //no ketjs off @@ -4883,105 +5000,32 @@ Framedata(Arg1,Arg2):=( Framedata(name,list,options); ); ); -Framedata(nm,list,optionsorg):=( +Framedata(nm,list,optionsorg):=( //190424modified //help:Framedata(); -//help:Framedata([C,A]); //help:Framedata("1",[C,A]); -//help:Framedata("1",[A,B],["corner"]); //help:Framedata("1",[C,dx,dy]); - regional(name,options,Out,tmp,tmp1,pB,x1,x2,y1,y2,dx,dy, - opcindy,Ltype,Noflg,strL,type,cent,dx,dy,color); + regional(name,options,Out,tmp,tmp1,x1,x2,y1,y2,dx,dy, + opcindy,Ltype,Noflg,strL,cent,dx,dy,color); name="fr"+nm; options=optionsorg; tmp=Divoptions(options); Ltype=tmp_1; Noflg=tmp_2; - strL=tmp_7; //180801from - type="center"; - forall(strL, - if(Toupper(#)=="CORNER", - type="corner"; - options=remove(options,[#]); - ); - if(Toupper(#)=="CENTER", - type="center"; - options=remove(options,[#]); - ); - ); - if(type=="corner", - Out=Framedata2(nm,list,options); - , //180801to - color=tmp_(length(tmp)-2); - opcindy=tmp_(length(tmp)); - if(length(list)==2, // 15.05.12 - pA=Lcrd(list_1); pB=Lcrd(list_2); - dx=abs(pB_1-pA_1); dy=abs(pB_2-pA_2); - , - pA=Lcrd(list_1); - dx=list_2; dy=list_3; - ); - x1=pA_1-dx; x2=pA_1+dx; - y1=pA_2-dy; y2=pA_2+dy; - Out=[[x1,y1],[x2,y1],[x2,y2],[x1,y2],[x1,y1]]; - if(Noflg<3, - println("generate Framedata "+name); - tmp1=apply(Out,Pcrd(#)); - tmp=name+"="+Textformat(tmp1,5); - parse(tmp); - GLIST=append(GLIST,name+"=Framedata("+pA+","+dx+","+dy+")"); //no ketjs - ); - if(Noflg<2, - if(isstring(Ltype), - if((Noflg==0)&(color!=KCOLOR), //181020 //no ketjs on - Texcom("{");Com2nd("Setcolor("+color+")");//180722 - ); //no ketjs off - Ltype=GetLinestyle(text(Noflg)+Ltype,name); - if((Noflg==0)&(color!=KCOLOR), //181020 //no ketjs on - Texcom("}");//180722 - ); //no ketjs off - , - if(Noflg==1,Ltype=0); - ); - GCLIST=append(GCLIST,[name,Ltype,opcindy]); - ); - ); - Out; -); -Framedata(nm,cent,dx,dy):=Framedata(nm,cent,dx,dy,[]); -Framedata(nm,cent,dx,dy,options):=( - regional(name,Out,tmp,tmp1,x1,y1,x2,y2,Ltype,opcindy,Noflg,color); - name="fr"+nm; - tmp=Divoptions(options); - Ltype=tmp_1; - Noflg=tmp_2; color=tmp_(length(tmp)-2); opcindy=tmp_(length(tmp)); - x1=cent.x-dx; x2=cent.x+dx; - y1=cent.y-dy; y2=cent.y+dy; - Out=[[x1,y1],[x2,y1],[x2,y2],[x1,y2],[x1,y1]]; - if(Noflg<3, - println("generate Framedata "+name); - tmp1=apply(Out,Pcrd(#)); - tmp=name+"="+Textformat(tmp1,5); - parse(tmp); - GLIST=append(GLIST,name+"=Framedata("+cent.xy+","+dx+","+dy+")"); //no ketjs - ); - if(Noflg<2, - if(isstring(Ltype), - if((Noflg==0)&(color!=KCOLOR), //180904 //no ketjs on - Texcom("{");Com2nd("Setcolor("+color+")");//180722 - ); //no ketjs off - Ltype=GetLinestyle(text(Noflg)+Ltype,name); - if((Noflg==0)&(color!=KCOLOR), //180904 //no ketjs on - Texcom("}");//180722 - ); //no ketjs off - , - if(Noflg==1,Ltype=0); - ); - GCLIST=append(GCLIST,[name,Ltype,opcindy]); + if(length(list)==2, // 15.05.12 + cent=Lcrd(list_1); tmp=Lcrd(list_2); + dx=abs(tmp_1-cent_1); dy=abs(tmp_2-cent_2); + , + cent=Lcrd(list_1); + dx=list_2; dy=list_3; ); - Out; + x1=cent_1-dx; x2=cent_1+dx; + y1=cent_2-dy; y2=cent_2+dy; + Listplot("-"+name,[[x1,y1],[x2,y1],[x2,y2],[x1,y2],[x1,y1]],options); ); +Framedata(nm,cent,dx,dy):=Framedata(nm,[cent,dx,dy],[]); +Framedata(nm,cent,dx,dy,options):=Framedata(nm,[cent,dx,dy],options); ////%Framedata end//// ////%Framedata2 start//// @@ -5042,7 +5086,7 @@ Ovaldata(nm,Pdata,options):=( if(Noflg<3, println("generate Ovaldata "+name); tmp1=apply(Graph,Pcrd(#)); - tmp=name+"="+Textformat(tmp1,5); + tmp=name+"="+Textformat(tmp1,5)+";"; //190415 parse(tmp); GLIST=append(GLIST, //no ketjs name+"=Ovaldata("+Ctr+","+Dx+","+Dy+opstr+")");//16.01.30 //no ketjs @@ -5052,7 +5096,7 @@ Ovaldata(nm,Pdata,options):=( if((Noflg==0)&(color!=KCOLOR), //180904 //no ketjs on Texcom("{");Com2nd("Setcolor("+color+")");//180722 ); //no ketjs off - Ltype=GetLinestyle(text(Noflg)+Ltype,name); + Ltype=Getlinestyle(text(Noflg)+Ltype,name); if((Noflg==0)&(color!=KCOLOR), //180904 //no ketjs on Texcom("}");//180722 ); //no ketjs off @@ -5061,7 +5105,7 @@ Ovaldata(nm,Pdata,options):=( ); GCLIST=append(GCLIST,[name,Ltype,opcindy]); tmp1=apply(Graph,Pcrd(#)); - tmp=name+"="+Textformat(tmp1,5); + tmp=name+"="+Textformat(tmp1,5)+";"; //190415 parse(tmp); tmp=Textformat(Ctr,5)+","+Textformat(Dx,5)+","+Textformat(Dy,5); ); @@ -5374,1956 +5418,5 @@ Putintersect(nm,pdata1,pdata2,ptno):=( ); ////%Putintersect end//// -////%Setarrow start//// -Setarrow():=Setarrow([]); -Setarrow(arglist):=( -//help:Setarrow([-1,-1,-1,1,0.3]); -//help:Setarrow([size(1),angle(18),position(1),cut(0),segstyle("dr,1")]); - regional(tmp); - tmp=select(arglist,isreal(#)); - if(length(tmp)==0, - println([YaSize,YaAngle,YaPosition,YaCut,YasenStyle]); - ); - if(length(tmp)>=1, - if((tmp_1>0),YaSize=tmp_1); - ); - if(length(tmp)>=2, - if((tmp_2>0)&(tmp_2<90),YaAngle=tmp_2); - ); - if(length(tmp)>=3, - if((tmp_3>=0)&(tmp_3<=1),YaPosition=tmp_3); - ); - if(length(tmp)>=4, - if((tmp_4>=0)&(tmp_4<1),YaCut=tmp_4); - ); - tmp=select(arglist,isstring(#)); - if(length(tmp)>0, - YasenStyle=tmp_1; - ); - [YaSize,YaAngle,YaPosition,YaCut,YasenStyle]; -); -////%Setarrow end//// - - -////%Arrowheaddata start//// -Arrowheaddata(point,direction):=Arrowheaddata(point,direction,[]); -Arrowheaddata(point,direction,options):=( -// help:Arrowheaddata(A,B); -// help:Arrowheaddata(options=[size(1),angle(18), "Coord=phy"]); - regional(list,ookisa,hiraki,Houkou,Str,Flg,Ev,Nv,pA,pB, - reL,eqL,coord,pP,rF,gG,Flg,Nj,Eps,scx,scy,tmp,tmp1,tmp2); - Eps=10^(-3); - coord="P"; - ookisa=0.2*YaSize; - hiraki=YaAngle; - iti=1; - kiri=0; - Futosa=0; - Str=YaStyle; - tmp=Divoptions(options); - eqL=tmp_5; //181018from - reL=tmp_6; - forall(eqL, - tmp=Strsplit(#,"="); - tmp1=substring(tmp_1,0,1); - tmp2=substring(tmp_2,0,1); - if(Toupper(tmp1)=="C", - coord=Touppera(tmp2); - ); - ); //181018to - forall(1..(length(reL)), //181110from - tmp=reL_#; - if(#==1,ookisa=ookisa*tmp); - if(#==2, - if(tmp<5, - hiraki=hiraki*tmp; - , - hiraki=tmp; - ); - ); - ); //181110to - Flg=0; - 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(coord=="P",//181018from - if(ispoint(point),pP=point.xy,pP=point); - , - pP=Pcrd(point); - if(!islist(Houkou_1), - Houkou=Pcrd(Houkou); - , - Houkou=apply(Houkou,Pcrd(#)); - ); - );//181018to - if(islist(Houkou_1), - tmp=Nearestpt(pP,Houkou); - pP=tmp_1; - rF=floor(tmp_2); - if(rF==1, - if(|Ptend(Houkou)-Ptstart(Houkou)|<Eps, - rF=Numptcrv(Houkou); - ); - ); - gG=apply(0..10,pP+ookisa*cos(hiraki)*[cos(2*pi/10*#),sin(2*pi/10*#)]); - Flg=0; - forall(1..rF,Nj, - if(Flg==0, - pB=Ptcrv(rF+1-Nj,Houkou); - tmp1=apply([pP,pB],LLcrd(#)); - tmp2=apply(gG,LLcrd(#)); - tmp=IntersectcrvsPp([pP,pB],gG); - if(length(tmp)>0, - Houkou=pP-Pcrd(tmp_1_1); - Flg=1; - ); - ); - ); - if(Flg==0, - println("Arrowhead may be too large (no intersect)"); - Flg=2; - ); - ); - if(Flg<2, - Ev=-1/|Houkou|*Houkou; - Nv=[-Ev_2, Ev_1]; - if(indexof(Str,"c")>0, - pP=pP-0.5*ookisa*cos(hiraki)*Ev; - ); - if(indexof(Str,"b")>0, - pP=pP-ookisa*cos(hiraki)*Ev; - ); - pA=pP+ookisa*cos(hiraki)*Ev+ookisa*sin(hiraki)*Nv; - pB=pP+ookisa*cos(hiraki)*Ev-ookisa*sin(hiraki)*Nv; - list=[pA,pP,pB]; - list; - ); -); -////%Arrowheaddata end//// - -////%Arrowhead start//// -Arrowhead(point,Houkou):=Arrowhead(point,Houkou,[]); //181018from -Arrowhead(Arg1,Arg2,Arg3):=( - if(isstring(Arg1), - Arrowhead(Arg1,Arg2,Arg3,[]); - , - Arrowhead(text(ArrowheadNumber),Arg1,Arg2,Arg3); - ); -); -Arrowhead(nm,point,direction,optionsorg):=(//181018from -//help:Arrowhead("1",B,B-A); -//help:Arrowhead(options=[size(1),angle(18),position(1),cut(0),"Coord=P(L)"]); -//help:Arrowhead(the default is -1 for numeric option); -//help:Arrowhead(A,"gr1"); - regional(name,Ltype,Noflg,reL,opstr,opcindy,color,eqL,coord, - options,cut,pP,Houkou,ptstr,hostr,tmp,tmp1,tmp2,list); - name="arh"+nm; //181018 - ArrowheadNumber=ArrowheadNumber+1; - options=optionsorg; - tmp=Divoptions(options); - Ltype=tmp_1; - Noflg=tmp_2; - reL=tmp_6; - color=tmp_(length(tmp)-2); - eqL=tmp_5; - coord="P"; - forall(eqL, - tmp=Strsplit(#,"="); - tmp1=substring(tmp_1,0,1); - tmp2=substring(tmp_2,0,1); - if(Toupper(tmp1)=="C", - coord=Toupper(tmp2); - options=remove(options,[#]); - ); - ); //181018to - tmp1=[YaSize,YaAngle,YaPosition,YaCut]; //181214from - forall(1..(length(reL)), - if(reL_#<0, reL_#=tmp1_#); - ); - forall((length(reL)+1)..4, - reL=append(reL,tmp1_#); - ); - cut=reL_4; - tmp=reL_(1..3); - options=select(options,!isreal(#)); - 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(coord=="P",//181018from - if(ispoint(point),pP=point.xy,pP=point); - , - pP=Pcrd(point); - if(!islist(Houkou_1), - Houkou=Pcrd(Houkou); - , - Houkou=apply(Houkou,Pcrd(#)); - ); - );//181018to - list=Arrowheaddata(pP,Houkou,options); - if(!Inwindow(LLcrd(pP)),Noflg=2);//181018 - if(Noflg<3, - tmp1=apply(list,LLcrd(#)); - tmp=name+"="+Textformat(tmp1,5); - parse(tmp); - ); - if(Noflg<2, - if(isstring(Ltype), - Listplot("-arh"+nm,apply(list,LLcrd(#)),concat(options,["notex","Msg=n"])); - ); - ); - if(Noflg==0, - tmp=Divoptions(options); - opstr=tmp_(length(tmp)-1); - opstr=opstr+","+Dqq("Cut="+format(cut,5)); - ptstr=Textformat(LLcrd(pP),5); - if(isstring(direction), //181019 - hostr=direction; - , - if(!islist(Houkou_1), - hostr=format(LLcrd(Houkou),5); - , - hostr=format(apply(Houkou,LLcrd(#)),5); - ); - ); - if((Noflg==0)&(color!=KCOLOR), //180904 //no ketjs on - Texcom("{");Com2nd("Setcolor("+color+")");//180722 - ); //no ketjs off - Com2nd("Arrowhead("+ptstr+","+hostr+opstr+")"); - if((Noflg==0)&(color!=KCOLOR), //180904 //no ketjs on - Texcom("}");//180722 - ); //no ketjs off - ); -); -////%Arrowhead end//// - -////%Arrowdata start//// -Arrowdata(ptlist):=Arrowdata(ptlist,[]); //181110from -Arrowdata(Arg1,Arg2):=( - regional(name); - if(isstring(Arg1), - Arrowdata(Arg1,Arg2,[]); - , - name=""; - forall(Arg1, - if(ispoint(#), - name=name+text(#); - ); - ); - Arrowdata(name,Arg1,Arg2); - ); -); //181110from -Arrowdata(nm,ptlist,optionsorg):=( -//help:Arrowdata("1",[A,B]); -//help:Arrowdata("1",[pt1,pt2]); -//help:Arrowdata(options=[size(1),angle(18),pos(1),cut(0),"Cutend=0,0","Coord=p/l"]); -//help:Arrowdata(optionsadded=["line"]); - regional(options,Ltype,Noflg,name,opstr,opcindy,eqL,reL,strL,color,size,coord, - flg,lineflg,cutend,tmp,tmp1,tmp2,pA,pB,angle,segpos,cut); - name="ar"+nm; - options=optionsorg; - tmp=select(options,isstring(#)); //181214from - tmp1=select(tmp,contains(["dr","da","do","id"],substring(#,0,2))); - if(length(tmp1)==0,options=append(options,YasenStyle)); //181214to - tmp=Divoptions(options); - Ltype=tmp_1; - Noflg=tmp_2; - eqL=tmp_5; - reL=tmp_6; - strL=tmp_7; - color=tmp_(length(tmp)-2); - opstr=tmp_(length(tmp)-1); - opcindy=tmp_(length(tmp)); - tmp1=[YaSize,YaAngle,YaPosition,YaCut]; //181214from - forall(1..(length(reL)), - if(reL_#<0, reL_#=tmp1_#); - ); - forall((length(reL)+1)..4, - reL=append(reL,tmp1_#); - ); - size=reL_1; - angle=reL_2; - segpos=reL_3; - cut=reL_4; - lineflg=0; - if(contains(strL,"l")%contains(strL,"L"), - lineflg=1; - );//181018from - options=remove(options,strL); - cutend=[0,0];//180719 - coord="P";//181018 - forall(eqL, - tmp=Strsplit(#,"="); - tmp1=Toupper(substring(tmp_1,0,2)); - tmp2=tmp_2; - if(tmp1=="CU",//180719from - tmp2=replace(tmp2,"[",""); - tmp2=replace(tmp2,"]",""); - cutend=tokenize(tmp2,","); - if(length(cutend)==1,cutend=[cutend_1,cutend_1]); - options=remove(options,[#]); - ); - if(tmp1=="CO",//181018from - coord=Toupper(substring(tmp2,0,1)); - options=remove(options,[#]); - ); - ); - if(|cutend|>0,//181110from - tmp=ptlist_2-ptlist_1; - tmp=tmp/|tmp|; - ptlist_1=ptlist_1+tmp*cutend_1; - ptlist_2=ptlist_2-tmp*cutend_2; - );//181110to - if(coord=="P", - pA=ptlist_1; pB=ptlist_2; - if(ispoint(pA),pA=pA.xy); - if(ispoint(pB),pB=pB.xy); - , - pA=Pcrd(ptlist_1); pB=Pcrd(ptlist_2); - );//181018to - if(Noflg<3, - println("generate Arrowdata "+name); - tmp=name+"="+Textformat([pA,pB],5); - parse(tmp); - if(lineflg==0, // 16.04.09 from - tmp=pA-0.2*size/2*(pB-pA)/|pB-pA|; // 15.06.11 - , - tmp=pB; - ); // 16.04.09 until - tmp=format([LLcrd(pA),LLcrd(tmp)],6); - ); - if(Noflg<2, - if(isstring(Ltype), - Listplot("-ar"+nm,[LLcrd(pA),LLcrd(pB)],append(options,"Msg=n")); - Arrowhead(nm,pA+segpos*(pB-pA),pB-pA,options); //181110 - , - if(Noflg==1,Ltype=0); - ); - ); - [Lcrd(pA),Lcrd(pB)]; -); -////%Arrowdata end//// - -////%Anglemark start//// -Anglemark(plist):=Anglemark(plist,[]); -Anglemark(Arg1,Arg2):=( // 2015.04.28 from - regional(nm,plist,options,tmp); - if(isstring(Arg1), - nm=Arg1; - plist=Arg2; - Anglemark(nm,plist,[]); - , - plist=Arg1; - options=Arg2; - tmp=Textformat(plist,5); - tmp=replace(tmp,",",""); - nm=substring(tmp,1,length(tmp)-1); - Anglemark(nm,plist,options); - ); -); // to -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(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,Msg); - name="ag"+nm; - Bpos="md"+name; - ra=0.5; - tmp=Divoptions(options); - Ltype=tmp_1; - Noflg=tmp_2; - color=tmp_(length(tmp)-2); - opcindy=tmp_(length(tmp)); - eqL=tmp_5; - realL=tmp_6; - 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, - 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; - if((length(plist_3)>1)%(ispoint(plist_3)), //180506from - pC=Lcrd(plist_3); - sac=pC-pA; - Rg=[arctan2(sab)+0,arctan2(sac)+0]; - , - sac=pB-pA; - Rg=[arctan2(sab)+0,arctan2(sab)+plist_3]; - ); //180506to - if(Rg_2<Rg_1,Rg_2=Rg_2+2*pi); - Out=[]; - if(ra>min(|sab|,|sac|), // 16.12.29 - println(" segments too short"); - , - forall(0..Num, - Th=Rg_1+#*(Rg_2-Rg_1)/Num; - Out=append(Out,Ctr+ra*[cos(Th),sin(Th)]); - ); - Th=(Rg_1+Rg_2)/2; //16.10.31from[moved] - tmp1=Ctr+Brat*ra*[cos(Th),sin(Th)]; - tmp="Defvar("+Dq+Bpos+"="; - tmp=tmp+Textformat(tmp1,5)+Dq+");"; - parse(tmp);//16.10.31to[moved] - if(length(Bname)>0, - parse(Bname); - ); - if(Noflg<3, - if(Msg=="Y", //190206 - println("generate anglemark "+name+" and "+Bpos); - ); - tmp1=apply(Out,Pcrd(#)); - tmp=name+"="+Textformat(tmp1,5); - parse(tmp); - tmp=Textformat(plist,5); //no ketjs on - tmp1=substring(tmp,1,length(tmp)-1); - tmp=name+"=Anglemark("+tmp1+opstr+")"; - GLIST=append(GLIST,tmp); //no ketjs off - ); - if(Noflg<2, - if(isstring(Ltype), - if((Noflg==0)&(color!=KCOLOR), //180904 //no ketjs on - Texcom("{");Com2nd("Setcolor("+color+")");//180722 - ); //no ketjs off - Ltype=GetLinestyle(text(Noflg)+Ltype,name); - if((Noflg==0)&(color!=KCOLOR), //180904 //no ketjs on - Texcom("}");//180722 - ); //no ketjs off - , - if(Noflg==1,Ltype=0); - ); - GCLIST=append(GCLIST,[name,Ltype,opcindy]); - ); - ); - Out; -); -////%Anglemark end//// - -////%Paramark start//// -Paramark(plist):=Paramark(plist,[]); -Paramark(Arg1,Arg2):=( // 17.03.27 from - regional(nm,plist,options,tmp); - if(isstring(Arg1), - nm=Arg1; - plist=Arg2; - Paramark(nm,plist,[]); - , - plist=Arg1; - options=Arg2; - tmp=Textformat(plist,5); - tmp=replace(tmp,",",""); - nm=substring(tmp,1,length(tmp)-1); - Paramark(nm,plist,options); - ); -);// to -Paramark(nm,plist,options):=( -//help:Paramark([A,B,C],["E=\theta"]); -//help:Paramark("1",[p1,p2,p3],["E=\theta"]); - regional(name,Out,pB,pA,pC,ra,sab,sac,ratio,opstr,Bname,Bpos, - Brat,tmp,tmp1,tmp2,Ltype,Noflg,eqL,realL,opcindy,color); - name="pm"+nm; - tmp=Divoptions(options); - Ltype=tmp_1; - Noflg=tmp_2; - color=tmp_(length(tmp)-2); - opstr=tmp_(length(tmp)-1); - opcindy=tmp_(length(tmp)); - eqL=tmp_5; - realL=tmp_6; - ra=0.5; - Bname=""; - Brat=1.2; - if(length(realL)>0, - tmp=realL_1; - ra=tmp*ra; - opstr=opstr+","+text(tmp); - ); - forall(eqL, - if(substring(#,0,1)=="L",Bname="Letter("); - if(substring(#,0,1)=="E",Bname="Expr("); - Bpos="md"+name; - Bname=Bname+Bpos+","+Dq+"c"+Dq+","+Dq; //180705 - 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)); - ); - ); - pB=Lcrd(plist_1); pA=Lcrd(plist_2); pC=Lcrd(plist_3); - Ctr=Lcrd(pA); - Out=[]; - Out=append(Out,pA+ra*(pB-pA)/|pB-pA|); - Out=append(Out,pA+ra*(pB-pA)/|pB-pA|+ra*(pC-pA)/|pC-pA|); - Out=append(Out,pA+ra*(pC-pA)/|pC-pA|); - if(length(Bname)>0, - tmp1=pA+Brat*ra*(pB-pA)/|pB-pA|+Brat*ra*(pC-pA)/|pC-pA|; - tmp="Defvar("+Dq+Bpos+"="+Textformat(tmp1,5)+Dq+");"; - parse(tmp); - parse(Bname); - ); - if(Noflg<3, - println("generate paramark "+name); - tmp1=apply(Out,Pcrd(#)); - tmp=name+"="+Textformat(tmp1,5); - parse(tmp); - tmp1=substring(Textformat(plist,5),1,length(Textformat(plist,5))-1); //no ketjs on - tmp=name+"=Paramark("+tmp1+opstr+")"; - GLIST=append(GLIST,tmp); //no ketjs off - ); - if(Noflg<2, - if(isstring(Ltype), - if((Noflg==0)&(color!=KCOLOR), //180904 //no ketjs on - Texcom("{");Com2nd("Setcolor("+color+")");//180722 - ); //no ketjs off - Ltype=GetLinestyle(text(Noflg)+Ltype,name); - if((Noflg==0)&(color!=KCOLOR), //180904 //no ketjs on - Texcom("}");//180722 - ); //no ketjs off - , - if(Noflg==1,Ltype=0); - ); - GCLIST=append(GCLIST,[name,Ltype,opcindy]); - ); - Out; -); -////%Paramark end//// - -////%MakeBowdata start//// -MakeBowdata(pA,pB,Hgt):=( - regional(angle,pB2,pH2,pC2,pC,tmp,Th1,Th2,ra,dMA); - angle=arctan2(pB-pA)+0; - pB2=Rotatepoint(pB,-angle,pA); - tmp=Lcrd(pA); - pH2=[(tmp_1+pB2_1)/2,tmp_2-Hgt]; - dMA=|tmp-pB2|/2; - ra=(dMA^2+Hgt^2)/(2*Hgt); - pC2=[pH2_1,pB2_2+(ra-Hgt)]; - pC=Rotatepoint(pC2,angle,pA); - Th1=arctan2(pA-pC2)+angle; - Th2=arctan2(pB2-pC2)+angle; - [pC,ra,Th1,Th2]; -); -////%MakeBowdata end//// - -////%Bowdata start//// -Bowdata(plist):=Bowdata(plist,[]); -Bowdata(plist,options):=( - regional(nm,tmp); - if(islist(plist), // 16.12.04from - tmp=Textformat(plist,5); - tmp=replace(tmp,",",""); - nm=substring(tmp,1,length(tmp)-1); - Bowdata(nm,plist,options); - , - nm=plist; - tmp=options; - Bowdata(nm,tmp,[]); - ); // 16.12.04until -); -Bowdata(nm,plist,options):=( -//help:Bowdata([C,A],[2,1.2,"Expr=10","da"]); -//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,Msg, - Th1,Th2,Noflg,Bops,Bmov,Tmov,Nmov,rev,color); - name="bw"+nm; - tmp=Divoptions(options); - Ltype=tmp_1; - Noflg=tmp_2; - color=tmp_(length(tmp)-2); - opstr=tmp_(length(tmp)-1); - opcindy=tmp_(length(tmp)); - eqL=tmp_5; - realL=tmp_6; - pA=Lcrd(plist_1); pB=Lcrd(plist_2); - Hgt=1/2*|pB-pA|*0.2; - Cut=0; - Num=24; - Bname=""; - Msg="Y"; //190206 - Tmov=0;//16.11.01from - Nmov=0; - Bmov=""; - rev=0;//16.11.01until - if(length(realL)>0, - Hgt=realL_1*Hgt; // 15.04.12 - if(length(realL)>1,Cut=realL_2); - ); - forall(eqL, - tmp=Strsplit(#,"="); - tmp1=Toupper(substring(tmp_1,0,1)); - if(tmp1=="L", - if(indexof(#,"rot")>0, - Bname="Letterrot("; - , - Bname="Letter("; - ); - Bops=tmp_2; - ); - if(tmp1=="E", - if(indexof(#,"rot")>0, - Bname="Exprrot("; - , - Bname="Expr("; - ); - Bops=tmp_2; - ); - if(tmp1=="M", //190206from - Msg=Toupper(substring(tmp_2,0,1)); - ); //190206to - ); - Ydata=MakeBowdata(pA,pB,Hgt); - pC=Ydata_1; - ra=Ydata_2; - Th=(Ydata_3+Ydata_4)*0.5; - BOWMIDDLE=[pC_1+ra*cos(Th),pC_2+ra*sin(Th)]; - Bpos="md"+name; // 16.10.31from[moved] - tmp="Defvar("+Dq+Bpos+"="+Textformat(BOWMIDDLE,5)+Dq+");"; - parse(tmp);// 16.10.31to[moved] - if(length(Bname)>0, //16.11.01from - tmp=indexof(Bops,","); - if(tmp>0, - tmp1=substring(Bops,0,tmp-1); - if(length(tmp1)>=4 & substring(tmp1,0,1)=="t" & indexof(tmp1,"n")>0, - Bmov=tmp1; - Bops=substring(Bops,tmp,length(Bops)); - ); - ); - if(length(Bmov)>0, - tmp=indexof(Bmov,"t"); - if(tmp>0, - tmp1=indexof(Bmov,"n"); - Tmov=parse(substring(Bmov,tmp,tmp1-1)); - tmp=indexof(Bmov,"r"); - if(tmp>0, - Nmov=parse(substring(Bmov,tmp1,tmp-1)); - rev=1; - , - Nmov=parse(substring(Bmov,tmp1,length(Bmov))); - ); - ); - ); - Bname=Bname+Bpos;//16.11.01 - if(abs(Tmov)+abs(Nmov)>0, - tmp=Pcrd(pA)-Pcrd(pB); - tmp1=1/Norm(tmp)*tmp; - tmp2=[-tmp1_2,tmp1_1]; - tmp=MARKLEN*(Tmov*tmp1+Nmov*tmp2); - tmp=LLcrd(tmp); - Bname=Bname+"+"+text(tmp); - ); - Bname=Bname+","; - if(indexof(Bname,"rot")>0, - if(rev==1,tmp=pB-pA,tmp=pA-pB); - Bname=Bname+Textformat(tmp,5)+","; - , - Bname=Bname+Dq+"c"+Dq+","; - ); - Bname=Bname+Dq+Bops+Dq+")"; - parse(Bname); - );//16.11.01until - if(Cut==0, - Th1=Ydata_3; - Th2=Ydata_4; - Out=[]; - forall(0..Num, - tmp=Th1+#*(Th2-Th1)/Num; - Out=append(Out,pC+ra*[cos(tmp),sin(tmp)]); - ); - , - Th1=Ydata_3; - Th2=Th-Cut/(2*ra); - tmp1=[]; - forall(0..Num/2, - tmp=Th1+#*(Th2-Th1)/(Num/2); - tmp1=append(tmp1,pC+ra*[cos(tmp),sin(tmp)]); - ); - Th1=Th+Cut/(2*ra); - Th2=Ydata_4; - tmp2=[]; - forall(0..Num/2, - tmp=Th1+#*(Th2-Th1)/(Num/2); - tmp2=append(tmp2,pC+ra*[cos(tmp),sin(tmp)]); - ); - Out=[tmp1,tmp2]; - ); - if(Noflg<3, - 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(#)); - tmp1=append(tmp1,tmp); - ); - tmp=name+"="+Textformat(tmp1,5); - parse(tmp); - tmp1=substring(Textformat(plist,5),1,length(Textformat(plist,5))-1); //no ketjs on - tmp=name+"=Bowdata("+tmp1+opstr+")"; - GLIST=append(GLIST,tmp); //no ketjs off - ); - if(Noflg<2, - if(isstring(Ltype), - if((Noflg==0)&(color!=KCOLOR), //180904 //no ketjs on - Texcom("{");Com2nd("Setcolor("+color+")");//180722 - ); //no ketjs off - Ltype=GetLinestyle(text(Noflg)+Ltype,name); - if((Noflg==0)&(color!=KCOLOR), //180904 //no ketjs on - Texcom("}");//180722 - ); //no ketjs off - , - if(Noflg==1,Ltype=0); - ); - GCLIST=append(GCLIST,[name,Ltype,opcindy]); - ); -); -////%Bowdata end//// - -////%Bowname start//// -Bowname(str):=Bowname("c",str); -Bowname(dir,str):=( - Expr([BOWMIDDLE,dir,str]); -); -////%Bowname end//// - -////%Bownamerot start//// -Bownamerot(bwdata,str):=Bownamerot(bwdata,0,0,str,1); -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); - if(tmp==1,bdata=[bwdata],bdata=bwdata); - if(length(bdata)>1, - tmp=Ptend(bdata_2)-Ptstart(bdata_1); - , - tmp=Ptend(bdata_1)-Ptstart(bdata_1); - ); - if(updown<0,tmp=-tmp); - Exprrot(BOWMIDDLE,tmp,tmov,nmov,str); -); -////%Bownamerot end//// - -////%Deqdata start//// -Deqdata(deq,rng,initt,initf,Num):=( //17.10.04 -// Deqdata("[x1,...xn]`=[f1,...fn]","t=[0,20]",0,[...],50); - regional(Eps,Inf,tname,Xname,func,t1,t2,dt,tt,X0,flg, - kl1,kl2,kl3,kl4,pdL,tmp,tmp1,tmp2); - Eps=10^(-3); - Inf=10^3; - tmp=tokenize(deq,"="); - tmp1=replace(tmp_1,"`",""); - tmp1=substring(tmp1,1,length(tmp1)-1); - Xname=tokenize(tmp1,","); - func=tmp_2; - forall(1..(length(Xname)), - func=replace(func,Xname_#,"X_"+text(#)); - ); - tmp=tokenize(rng,"="); - tname=tmp_1; - tmp=parse(tmp_2); - t1=tmp_1; - t2=tmp_2; - tmp="funP("+tname+",X):="+func+";"; - parse(tmp); - tmp="funN("+tname+",X):=-"+func+";"; - parse(tmp); - dt=(t2-t1)/Num; - tt=initt; - X0=Lcrd(initf); - pdL=[flatten([tt,X0])]; - flg=0; - forall(1..floor((t2-initt)/dt), - if(flg==0, - kl1=dt*funP(tt,X0); - kl2=dt*funP(tt+dt/2,X0+kl1/2); - kl3=dt*funP(tt+dt/2,X0+kl2/2); - kl4=dt*funP(tt+dt,X0+kl3); - X0=X0+(kl1+2*kl2+2*kl3+kl4)/6; - tt=initt+#*dt; - tmp=flatten([tt,X0]); - pdL=append(pdL,tmp); - if(|tmp|>Inf,flg=1); - ); - ); - tt=initt; - X0=Lcrd(initf); - flg=0; - forall(1..floor((initt-t1)/dt), - if(flg==0, - kl1=dt*funN(tt,X0); - kl2=dt*funN(tt+dt/2,X0+kl1/2); - kl3=dt*funN(tt+dt/2,X0+kl2/2); - kl4=dt*funN(tt+dt,X0+kl3); - X0=X0+(kl1+2*kl2+2*kl3+kl4)/6; - tt=initt-#*dt; - tmp=flatten([tt,X0]); - pdL=prepend(tmp,pdL); - if(|tmp1|>Inf,flg=1); - ); - ); - pdL; -); -////%Deqdata end//// - -////%Deqplot start//// -Deqplot(nm,deq,rng,initf):=Deqplot(nm,deq,rng,Lcrd(initf)_1,initf,[]); -Deqplot(nm,deq,rng,Arg1,Arg2):=( - regional(initt,initf,options); - if(isreal(Arg1) & !islist(Arg1), - initt=Arg1; - initf=Arg2; - options=[]; - , - initf=Lcrd(Arg1); - initt=initf_1; - options=Arg2; - ); - Deqplot(nm,deq,rng,initt,initf,options); -); -Deqplot(nm,deqorg,rngorg,initt,initf,options):=( //17.10.06 -//help:Deqplot("2","y'=y*(1-y)","x",0, 0.5,["Num=100"]); -//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,tmp3,color); - name="de"+nm; - tmp=Divoptions(options); - Ltype=tmp_1; - Noflg=tmp_2; - eqL=tmp_5; - color=tmp_(length(tmp)-2); - opcindy=tmp_(length(tmp)); - Num=50; - forall(eqL, - tmp=indexof(#,"="); - tmp2=substring(#,0,1); - tmp2=Toupper(tmp2); - tmp1=substring(#,tmp,length(#)); - if(Toupper(substring(#,0,1))=="N", - Num=parse(tmp1); - ); - ); - rng=rngorg; - if(indexof(rng,"=")==0, - rng=rng+"="+Textformat([XMIN,XMAX],6); - ); - deq=replace(deqorg,"‘","`"); //190206 - deq=replace(deq,"'","`"); //180527 - tmp3=indexof(deq,"="); - tmp1=substring(deq,0,tmp3-1); - tmp2=substring(deq,tmp3,length(deq)); - if(indexof(tmp1,"[")==0, - phase=0; - sel=[1,2]; - , - phase=1; - sel=[2,3]; - ); - 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="["; - forall(1..nn, - deq=deq+tmp1+"N"+text(#)+","; - ); - deq=substring(deq,0,length(deq)-1)+"]`=["; - forall(1..(nn-1), - deq=deq+tmp1+"N"+text(#+1)+","; - ); - forall(reverse(1..(nn)),jj, - tmp=tmp1; - forall(1..jj, - tmp=tmp+"`"; - tmp2=replace(tmp2,tmp,tmp1+"N"+text(#+1)); - ); - ); - tmp2=tmp2+"]"; - forall(1..(length(tmp2)-1), - tmp=substring(tmp2,#-1,#); - if(tmp!=tmp1, - deq=deq+tmp; - , - tmp=substring(tmp2,#,#+1); - if(tmp=="N", - deq=deq+tmp1; - , - deq=deq+tmp1+"N1" - ); - ); - ); - deq=deq+"]"; - ); - if((nn>0)&(Noflg<3), //190211 - pdL=Deqdata(deq,rng,initt,initf,Num); - if(phase==1, - pdL=apply(pdL,#_(2..3)); - ); - tmp1=apply(pdL,Pcrd(#)); - tmp=name+"="+Textformat(tmp1,5); - parse(tmp); - ); - if((nn>0)&(Noflg<1), //190211 //no ketjs on - tmp=Assign(deq); - tmp=replace(deq,"'","`"); - tmp=name+"=Deqplot('"+tmp+"','"+rng+"',"; - tmp=tmp+format(initt,6)+","+Textformat(initf,6); - tmp=tmp+","+text(sel)+",'Num="+text(Num)+"')"; - tmp=RSform(tmp); - GLIST=append(GLIST,tmp); - ); //no ketjs off - if((nn>0)&(Noflg<2), //190211 - if(isstring(Ltype), - if((Noflg==0)&(color!=KCOLOR), //180904 //no ketjs on - Texcom("{");Com2nd("Setcolor("+color+")");//180722 - ); //no ketjs off - Ltype=GetLinestyle(text(Noflg)+Ltype,name); - if((Noflg==0)&(color!=KCOLOR), //180904 //no ketjs on - Texcom("}");//180722 - ); //no ketjs off - , - if(Noflg==1,Ltype=0); - ); - GCLIST=append(GCLIST,[name,Ltype,opcindy]); - ); -); -////%Deqplot end//// - -////////// old enclosing /////////////// - -Enclosing(nm,plist):=EnclosingS(nm,plist); -Enclosing(nm,plist,options):=EnclosingS(nm,plist,options); -EnclosingS(nm,plist):=EnclosingS(nm,plist,[]); -EnclosingS(nm,plist,options):=( -// help:Enclosing("1",["sc2","crAB","sc2","Invert(sc1)"],[pt,"dr"]); - regional(name,AnsL,Start,Eps,EEps,S,Flg,Fdata,Gdata,KL,pt,qt,color - t1,t2,t3,ii,nn,tmp,tmp1,tmp2,Ltype,Noflg,realL,eqL,opstr,opcindy); - name="en"+nm; - tmp=Divoptions(options); - Ltype=tmp_1; - Noflg=tmp_2; - eqL=tmp_5; - realL=tmp_6; - color=tmp_(length(tmp)-2); - opstr=tmp_(length(tmp)-1); - opcindy=tmp_(length(tmp)); - Eps=10^(-5); // 16.12.05 - EEps=0.05; - Start=[]; - Flg=0; - forall(realL, - if(islist(#) % ispoint(#), - Start=Lcrd(#); // 15.09.12 - , - Flg=Flg+1; - if(Flg==1,Eps=#); - if(Flg==2,EEps=#); - ); - ); -// tmp1=concat([Eps,EEps],eqL); // 15.04.06 - Fdata=plist_1; - Gdata=plist_(length(plist)); - KL=IntersectcrvsPp(Fdata,Gdata); - if(length(KL)==1, - pt=KL_1_1; - t1=KL_1_2; - ); - if(length(KL)==0, - if(Numptcrv(Fdata)>Numptcrv(Gdata), - tmp=Nearestpt(Fdata,Gdata); - pt=tmp_1; - t1=tmp_2; - , - tmp=Nearestpt(Gdata,Fdata); - pt=tmp_3; - t1=tmp_4; - ); - ); - if(length(KL)>1, - if(Start==[], - err("No Start Point"); - , - pt=KL_1_1; - t1=KL_1_2; - tmp=Norm(pt-Start); - forall(2..(length(KL)),ii, // 15.04.20 - tmp1=KL_ii_1; - tmp2=Norm(tmp1-Start); // 15.04.20 - if(tmp2<tmp, - pt=tmp1; - t1=KL_ii_2; - tmp=tmp2; - ); - ); - ); - ); -// pt=Pcrd(pt); // 15.09.12 - Start=pt; - AnsL=[]; - forall(1..(length(plist)),nn, - Fdata=plist_nn; - if(nn>1, pt=qt); - if(nn==length(plist), - qt=Start; - , - Flg=0; - Gdata=plist_(nn+1); -// tmp1=concat([Eps,EEps],eqL); // 15.04.06 - KL=IntersectcrvsPp(Gdata,Fdata); - if(length(KL)==1, - tmp=KL_1; - qt=KL_1_1; - t3=KL_1_2; - Flg=10; - ); - if(length(KL)==0,Flg=1); - if(length(KL)>1, - tmp1=KL_1_1; - tmp2=KL_2_1; - tmp=|tmp1-tmp2|; - if(tmp<Eps*10, Flg=1); - ); - if(Flg==1, - if(Numptcrv(Fdata)>Numptcrv(Gdata), - tmp=Nearestpt(Fdata,Gdata); - qt=tmp_1; - t3=tmp_4; - Flg=10; - , - tmp=Nearestpt(Gdata,Fdata); - qt=tmp_3; - t3=tmp_2; - Flg=10; - ); - ); - if(Flg<10, - t2=10^6; //%inf; - forall(1..(length(KL)),ii, - tmp1=KL_ii_1; - tmp=KL_ii_3; - tmp2=Paramoncurve(tmp1,tmp,Fdata); - tmp3=KL_ii_2; - if(tmp2>t1+Eps & tmp2<t2+Eps, - qt=tmp1; - t2=tmp2; - t3=tmp3; - ); - ); - ); - ); - tmp=Partcrv("",pt,qt,Fdata,["nodata"]); - t1=t3; - if(nn==1, - AnsL=tmp; - , - AnsL=concat(AnsL,tmp_(2..(length(tmp)))); - ); - ); - AnsL=apply(AnsL,Pcrd(#)); // 15.09.12 - AnsL_(length(AnsL))=AnsL_1;//16.10.20 - if(Noflg<3, - println("generate Enclosing "+name); - tmp=name+"="+Textformat(AnsL,5); - parse(tmp); - tmp=name+"=Enclosing(";//16.11.07from //no ketjs on - tmp1="list"+PaO(); - forall(plist, - tmp1=tmp1+#+","; - ); - tmp=tmp+substring(tmp1,0,length(tmp1)-1)+")"+opstr+")"; - GLIST=append(GLIST,tmp);//16.11.07to //no ketjs off - ); - if(Noflg<2, - if(isstring(Ltype), - if((Noflg==0)&(color!=KCOLOR), //180904 //no ketjs on - Texcom("{");Com2nd("Setcolor("+color+")");//180722 - ); //no ketjs off - Ltype=GetLinestyle(text(Noflg)+Ltype,name); - if((Noflg==0)&(color!=KCOLOR), //180904 //no ketjs on - Texcom("}");//180722 - ); //no ketjs off - , - if(Noflg==1,Ltype=0); - ); - GCLIST=append(GCLIST,[name,Ltype,opcindy]); - ); - tmp=apply(AnsL,LLcrd(#));//16.10.20 - tmp; -); - -/////////// new enclosing /////////// - -////%Enclosing start//// -Enclosing(nm,plist):=Enclosing2(nm,plist,[]);//180706[2lines] -Enclosing(nm,plistorg,options):=Enclosing2(nm,plistorg,options); -Enclosing2(nm,plist):=Enclosing2(nm,plist,[]); -Enclosing2(nm,plistorg,options):=( -//help:Enclosing("1",["sg2","gr1","Invert(sg2)"]); -//help:Enclosing(options=[startpoint,epspara(1)]); - regional(name,plist,AnsL,Start,Eps,Eps1,Eps2,flg,Fdata,Gdata,KL, - t1,t2,tst,ss,ii,nn,nxtno,Ltype,Noflg,realL,eqL,opstr,opcindy, - tmp,tmp1,tmp2,color,epspara,p1,p2); - name="en"+nm; - plist=plistorg; - tmp=Divoptions(options); - Ltype=tmp_1; - Noflg=tmp_2; - eqL=tmp_5; - realL=tmp_6; - color=tmp_(length(tmp)-2); - opstr=tmp_(length(tmp)-1); - opcindy=tmp_(length(tmp)); - Eps=10^(-5); // 16.12.05 - epspara=1; //180707 - Eps1=0.01; - Eps2=0.1; - Start=[]; - flg=0; - forall(realL, - if(isList(#) % ispoint(#), - Start=Lcrd(#); // 18.02.02 - , - if(flg==0,epspara=#);//180707 - if(flg==1,Eps1=#); - if(flg==2,Eps2=#); - flg=flg+1; - ); - ); - flg=0; - AnsL=[]; - if(length(plist)==1, - Fdata=parse(plist_1); - tmp1=Fdata_1; - tmp2=Fdata_(length(Fdata)); - if(|tmp1-tmp2|<Eps, - AnsL=Fdata; - , - AnsL=append(Fdata,tmp1); - ); - flg=1; - ); - if(flg==0, - Fdata=plist_1; - Gdata=plist_(length(plist)); - KL=IntersectcurvesPp(Fdata,Gdata); - if(length(KL)==0, - tmp=parse(Gdata); - tmp1=LLcrd(Op(length(tmp),tmp)); //18.02.02from - tmp=parse(Fdata); - tmp2=LLcrd(Op(1,tmp)); - tmp=Listplot(name,[tmp1,tmp2],["nodisp"]); - plist=append(plist,"sg"+name); - Start=tmp2; - tst=1; //18.02.02to - p1=Start; - , - if(length(KL)==1, - tst=KL_1_2; - Start=Pointoncurve(tst,Fdata); - ); - if(length(KL)>1, - KL=sort(KL,[#_2]); - if(Start==[], - tst=KL_1_2; - Start=Pointoncurve(tst,Fdata); - , - tmp=apply(KL,|#_1-Start|); - tmp=min(tmp); - tmp1=select(KL,|#_1-Start|<tmp+Eps1);//180718 - tst=tmp1_1_2; - Start=Pointoncurve(tst,Fdata); - ); - ); - ); - ); - if(flg==0, - t1=tst; - p1=Pointoncurve(t1,Fdata); //180713 - println("Start point of enclosing is "+text(Start)); - forall(1..(length(plist)),nn, - Fdata=plist_nn; - if(nn==length(plist),nxtno=1,nxtno=nn+1); - Gdata=plist_nxtno; - KL=IntersectcurvesPp(Fdata,Gdata); - if(length(KL)==0, - tmp1=parse(Fdata); //18.02.02from - tmp2=parse(Gdata); - tmp2=Prepend(Op(length(tmp1),tmp),tmp2); - Gdata=replace(Gdata,"(",""); - Gdata=replace(Gdata,")",""); - tmp=Gdata+"="+Textformat(tmp2,6); - parse(tmp); - plist_nxtno=Gdata; - t2=Length(tmp1); - p2=Pointoncurve(t2,Fdata); //180713 - ss=1; //18.02.02to - , - KL=sort(KL,[#_2]);//180706 - tmp=parse(Fdata); - tmp1=t1+epspara/50*length(tmp); -// KL=select(KL,#_2>t1+epspara/50*length(tmp)); //180707 - KL=select(KL,(#_2>tmp1)%((#_2>t1)&(|#_1-p1|>Eps1))); //180713,16 - t2=KL_1_2; - ss=KL_1_3; - if(abs(t2-t1)<Eps,//180707 - if(length(KL)>1, - t2=KL_2_2; - ss=KL_2_3; - , - println(text(nn)+" and "+text(nxtno)+" not intersect"); - flg=1; - ); - ); - ); - if(flg==0, - tmp=Partcrv("",t1,t2,Fdata,["nodata"]); - if(nn==1, - AnsL=tmp; - , - AnsL=concat(AnsL,tmp_(2..(length(tmp)))); - ); - ); - t1=ss;//180706 - p1=Pointoncurve(t1,Gdata); //180713 - ); - ); - if(flg==0, - AnsL=apply(AnsL,Pcrd(#)); - ); - if(Noflg<3, - println("generate Enclosing "+name); - tmp=name+"="+Textformat(AnsL,5); - parse(tmp); - tmp=name+"=Enclosing2(";//16.11.07from - tmp1="list"+PaO(); - forall(plistorg, //18.02.02 - tmp1=tmp1+#+","; - ); - tmp=tmp+substring(tmp1,0,length(tmp1)-1)+")";//18.0706from //no ketjs on - if(length(Start)>0,tmp=tmp+","+Textformat(Start,6)); - tmp=tmp+","+text(epspara)+")";//18.0706to,180707 - GLIST=append(GLIST,tmp);//16.11.07to //no ketjs off - ); - if(Noflg<2, - if(isstring(Ltype), - if((Noflg==0)&(color!=KCOLOR), //180904 //no ketjs on - Texcom("{");Com2nd("Setcolor("+color+")");//180722 - ); //no ketjs off - Ltype=GetLinestyle(text(Noflg)+Ltype,name); - if((Noflg==0)&(color!=KCOLOR), //180904 //no ketjs on - Texcom("}");//180722 - ); //no ketjs off - , - if(Noflg==1,Ltype=0); - ); - GCLIST=append(GCLIST,[name,Ltype,opcindy]); - ); - tmp=apply(AnsL,LLcrd(#));//16.10.20 - tmp; -); -////%Enclosing end//// - -/////////// end of new enclosing /////////// - -/////////// new Hatchdata(cindy) /////////// - -////%Makehatch start//// -Makehatch(iolistorg,pt,vec,bdylist):=( - regional(Eps,iolist,sg,bdy,out,nb,tenL,ns,ne,ioL, - ii,jj,kk,nvec,nbdy,sgn1,sgn2,flg,rmL,p0,p1,p2,pL, - Scalebkup,tmp,tmp1,tmp2); - Eps=10^(-5); - nvec=[-vec_2,vec_1]; - nvec=nvec/|nvec|; - if(!islist(iolistorg),iolist=[iolistorg],iolist=iolistorg); - forall(1..(length(iolist)), - tmp=replace(iolist_#,"i","1,"); - tmp=replace(tmp,"o","0,"); - tmp="["+substring(tmp,0,length(tmp)-1)+"]"; - iolist_#=parse(tmp); - ); - Scalebkup=[SCALEX,SCALEY];//181020[2lines] - SCALEX=1; - SCALEY=1; - sg=Lineplot("",[pt,pt+vec],["nodata"]); - nb=length(bdylist); - if(nb>0, - tenL=[]; - forall(1..nb,ii, - rmL=[]; - bdy=bdylist_ii; - nbdy=length(bdy)-1; - pL=[]; - forall(1..nbdy,jj, - p1=bdy_jj; - p2=bdy_(mod(jj+1-1,nbdy)+1); - tmp=Intersectseg(sg,[p1,p2],Eps); - if(abs(tmp_1)<Eps, //18.02.01 - p0=tmp_2; t=tmp_3; s=tmp_4; - flg=0; //181003from - forall(pL, - if(flg==0, - if(Norm(#_1-p0)<Eps, - flg=1; - ); - ); - ); - if(flg==0, - pL=append(pL,[p0,t,s,ii]); - ); //181003to - ); - ); - if(length(pL)>0, - pL=sort(pL,[#_2]); - pL=apply(1..(length(pL)),append(pL_#,mod(#,2))); - tenL=concat(tenL,pL); - ); - ); - tenL=sort(tenL,[#_2]); - if(length(tenL)>0, //180619from - tmp1=tenL; tenL=[tmp1_1]; - forall(2..(length(tmp1)),ii, //180717from - tmp=tmp1_ii; - flg=0; - forall(tenL, - if((Norm(tmp_1-#_1)<Eps1)&(tmp_4==#_4), - flg=1; - ); - ); - if(flg==0, - tenL=append(tenL,tmp); - ); - );//180717to - ); //180619to - ioL=apply(1..nb,0); - ns=1; - ne=length(tenL); - if(ne>0,tmp=tenL_1_1,tmp=sg_2); - if(|sg_1-tmp|>Eps, - tmp=[sg_1,-1,1,ioL]; - tenL=prepend(tmp,tenL); - ns=ns+1; - ne=ne+1; - ); - if(|sg_2-tenL_(length(tenL))_1|>Eps, - tmp=[sg_2,-1,2,ioL]; - tenL=append(tenL,tmp); - ); - forall(ns..(ne-1),ii, //180619 ne=>ne-1 - tmp=tenL_ii; - tmp1=tmp_4; - tmp2=tmp_5; - ioL_tmp1=tmp2; - tmp=[tmp_1,tmp_2,tmp_4,ioL]; - tenL_ii=tmp; - ); - out=[]; - forall(1..(length(tenL)-1),ii, - tmp1=tenL_ii; - if(contains(iolist,tmp1_4), - tmp2=tenL_(ii+1); - tmp=Listplot("",[tmp1_1,tmp2_1],["nodata"]); - out=append(out,tmp); - ); - ); - ); - SCALEX=Scalebkup_1; //181020 - SCALEY=Scalebkup_2; - out; -); -////%Makehatch end//// - -////%Anyselected start//// -Anyselected(ptL):=( - regional(tmp,out); - out=false; - forall(ptL, - if(isstring(#),tmp=parse(#),tmp=#); - out=(out)%(isselected(tmp)); - ); - out; -); -////%Anyselected end//// - -////%Hatchdata start//// -Hatchdata(nm,iostr,bdylist):=Hatchdatacindy(nm,iostr,bdylist,[]);//180619 -Hatchdata(nm,iostr,bdylist,optionsorg):=( //181003from - regional(options,tmp,tmp1,tmp2,eqL,strL,chkL,outflg); - options=optionsorg; - tmp=Divoptions(options); - eqL=tmp_5; - strL=tmp_7; - outflg=0; - forall(eqL, - tmp=Strsplit(#,"="); - tmp1=Toupper(tmp_1); - if(substring(tmp1,0,1)=="O", - tmp2=tmp_2; - if(tmp2!="n", - outflg=1; - option=remove(options,[#]); - if((tmp2=="m")%(tmp2=="r"), - options=append(options,tmp2);; - ); - ); - ); - ); - if(outflg==0, - options=remove(options,strL); - Hatchdatacindy(nm,iostr,bdylist,options); - , - HatchdataR(nm,iostr,bdylist,options); - ); -); //181003to -Hatchdatacindy(nm,iostr,bdylist):=Hatchdata(nm,iostr,bdylist,[]); -Hatchdatacindy(nm,iostr,bdylistorg,optionsorg):=( - //help:Hatchdata("1",["ii"],[["ln1","Invert(gr1)"],["gr2","n"]]); -//help:Hatchdata(options=["Not=pointlist","File=y(/m/n)","Max=50","Check=",angle,width]); - regional(name,bdylist,bdynameL,bname,Ltype,Noflg,opstr,opcindy,reL, - options,eqL,maxnum,startP,angle,interval,vec,nvec,ctr,pt,kk,delta,sha,AnsL, - color,tmp,tmp1,tmp2,tmp3,namep,x1,y1,x2,y2,p1,p2, //180717 - fname,fileflg,mkflg,vaL,pL,nL,nn,str,is,ie); //181102 - name="ha"+nm; - fname=Fhead+name+".txt"; - bdylist=[]; - bdynameL=[]; - forall(1..(length(bdylistorg)),kk, - tmp1=bdylistorg_kk; - if(length(tmp1)==1, - bname=tmp1_1; - , - tmp=tmp1_(length(tmp1)); - if(contains(["n","s","e","w"],tmp), - namep=tmp1_1;//180717from - tmp2=parse(namep); - if(substring(namep,0,2)=="ln", //180717from - if(contains(["n","s"],tmp), - x1=tmp2_1_1; y1=tmp2_1_2; x2=tmp2_2_1; y2=tmp2_2_2; - p1=[NE.x,(y2-y1)/(x2-x1)*(NE.x-x1)+y1]; - p2=[SW.x,(y2-y1)/(x2-x1)*(SW.x-x1)+y1]; - Listplot(name+text(kk),[p1,p2],["nodisp"]); - namep="sg"+name+text(kk); - tmp2=parse(namep); - ); - if(contains(["e","w"],tmp), - x1=tmp2_1_1; y1=tmp2_1_2; x2=tmp2_2_1; y2=tmp2_2_2; - p1=[(x2-x1)/(y2-y1)*(NE.y-y1)+x1,NE.y]; - p2=[(x2-x1)/(y2-y1)*(SW.y-y1)+x1,SW.y]; - Listplot(name+text(kk),[p1,p2],["nodisp"]); - namep="sg"+name+text(kk); - tmp2=parse(namep); - ); - );//180717to - if(tmp=="s", - Listplot(name,[LLcrd(tmp2_1),[tmp2_1_1,2*YMIN-YMAX], //180717[2lines] - [tmp2_(length(tmp2))_1,2*YMIN-YMAX],LLcrd(tmp2_(length(tmp2)))], - ["nodisp"]); - Joincrvs(text(kk)+name,[namep,"sg"+name],["nodisp"]);//180717 - bname="join"+text(kk)+name; - ); - if(tmp=="n", - Listplot(name,[LLcrd(tmp2_1),[tmp2_1_1,2*YMAX-YMIN], //180717[2lines] - [tmp2_(length(tmp2))_1,2*YMAX-YMIN],LLcrd(tmp2_(length(tmp2)))], - ["nodisp"]); - Joincrvs(text(kk)+name,[namep,"sg"+name],["nodisp"]); - bname="join"+text(kk)+name; - ); - if(tmp=="e", - Listplot(name,apply([tmp2_1,[XMAX,tmp2_1_2], - [XMAX,tmp2_(length(tmp2))_2],tmp2_(length(tmp2))],LLcrd(#)),["nodisp"]); - Joincrvs(text(kk)+name,[namep,"sg"+name],["nodisp"]);//180717 - bname="join"+text(kk)+name; - ); - if(tmp=="w", - Listplot(name,apply( [tmp2_1,[XMIN,tmp2_1_2], - [XMIN,tmp2_(length(tmp2))_2],tmp2_(length(tmp2))],LLcrd(#)),["nodisp"]); - Joincrvs(text(kk)+name,[namep,"sg"+name],["nodisp"]);//180717 - bname="join"+text(kk)+name; - ); - , - Enclosing2(text(kk)+name,tmp,["nodisp"]);//180619[2lines] - bname="en"+text(kk)+name; - ); - ); - bdylist=append(bdylist,parse(bname)); - bdynameL=append(bdynameL,bname); - ); - options=optionsorg; - tmp=Divoptions(options); - Ltype=tmp_1; - Noflg=tmp_2; - eqL=tmp_5; - reL=tmp_6; - color=tmp_(length(tmp)-2); - opstr=tmp_(length(tmp)-1); - opcindy=tmp_(length(tmp)); - angle=45; -// interval=0.125*1000/2.54/MilliIn; - interval=0.25*1000/2.54/MilliIn; //180706 - startP=[(XMIN+XMAX)/2, (YMIN+YMAX)/2]; - maxnum=[50,0]; //181109changed [first,second] - fileflg="N";//181102from - mkflg=1; - chkL=[]; //181109 - forall(eqL, - tmp=Strsplit(#,"="); - tmp1=Toupper(substring(tmp_1,0,1)); - if(tmp1=="M", - maxnum=parse(tmp_2); - if(!islist(maxnum), - maxnum=[maxnum,0]; - ); - options=remove(options,[#]); - ); - if(tmp1=="F", //181102from - fileflg=Toupper(substring(tmp_2,0,1)); - options=remove(options,[#]); - ); //181102to - if(tmp1=="N", //181103from - tmp=parse(tmp_2); - if(Anyselected(tmp), - mkflg=-1; - ); - options=remove(options,[#]); - ); - if(tmp1=="C", - chkL=parse(tmp_2); - options=remove(options,[#]); - ); - );//181102,03to - tmp1=1; - forall(reL, - if(islist(#), - startP=#; - , - if(tmp1==1, - angle=#; - tmp1=tmp1+1; - , - interval= interval*#; - ); - ); - ); - if((fileflg=="Y")%(fileflg=="M")&(mkflg>-1), //181102from - wflg=1; - varL=flatten(bdylistorg); - varL=select(varL,length(#)>1); - varL=sort(varL); - pL=[]; - forall(1..(length(varL)),nn, - tmp1=varL_nn; - tmp=select(GLIST,substring(#,0,length(tmp1))==tmp1); - str=tmp_1; - varL_nn=str; - tmp1=Bracket(str,"()"); - tmp2=max(apply(tmp1,#_2)); - nL=select(1..(length(tmp1)),tmp1_#_2==tmp2); - forall(nL,nn, - is=tmp1_nn_1; ie=tmp1_(nn+1)_1; - tmp=substring(str,is,ie-1); - tmp=replace(tmp,"'",Dq); - tmp=parse("["+tmp+"]"); - tmp2=flatten(tmp); - tmp2=flatten(tmp2); - tmp2=flatten(tmp2); - forall(tmp2, - if(ispoint(#), - if(!contains(pL,text(#)), - pL=append(pL,text(#)); - ); - ); - ); - ); - ); - forall(chkL, - if(!contains(pL,#),pL=append(pL,#)); - ); - forall(pL, - tmp=#+"="+Textformat(parse(#+".xy"),5); - varL=append(varL,tmp); - ); - tmp="reL="+Textformat(reL,5); - varL=append(varL,tmp); - if(fileflg=="M", - fileflg="Y"; - , - tmp1="hatch"+nm+".txt"; - if(isexists(Dirwork,tmp1), - tmp2=load(tmp1); - tmp2=tokenize(tmp2,"//"); - tmp2=tmp2_(1..(length(tmp2)-1)); - if(tmp2==varL, - wflg=0; - if(isexists(Dirwork,fname), - mkflg=0; - ReadOutData(fname); - tmp=name+"="+Textformat(parse(name),5); - parse(tmp); - ); - ); - ); - ); - ); - if(mkflg==1, //181102to - angle=angle*pi/180; - vec=[cos(angle),sin(angle)]; - nvec=[-sin(angle),cos(angle)]; - AnsL=[]; - ctr=0;//181005[2lines] - forall(0..(maxnum_1), kk, - pt=startP+kk*interval*nvec; - sha=Makehatch(iostr,pt,vec,bdylist); - if((sha!=-1)&(length(sha)>0), - AnsL=concat(AnsL,sha); - ctr=ctr+1; //181005 - ); - ); - maxnum_2=maxnum_2+(maxnum_1-ctr); //181005 - forall(1..(maxnum_2),kk, //181005 - pt=startP-kk*interval*nvec; - sha=Makehatch(iostr,pt,vec,bdylist); - if((sha!=-1)&(length(sha)>0), - AnsL=concat(AnsL,sha); - ); - ); - tmp1=apply(AnsL,Textformat(#,5)); - tmp=name+"="+tmp1; - parse(tmp); - ); - if((Noflg<3)&(mkflg>-1), - if(fileflg!="Y", //181102 - println("generate Hatchdata "+name); - tmp=name+"="+Textformat(AnsL,5); - parse(tmp); - if(!islist(iostr),tmp1=[iostr],tmp1=iostr); //no ketjs on - tmp="c"+PaO(); - forall(tmp1, - tmp=tmp+Dq+#+Dq+","; - ); - tmp=substring(tmp,0,length(tmp)-1)+")"; - tmp2=name+"=Hatchdata("+tmp; - forall(bdynameL, - tmp2=tmp2+",list"+PaO()+#+")"; - ); - tmp2=tmp2+opstr+")"; - GLIST=append(GLIST,tmp2); //no ketjs off - , - GLIST=append(GLIST,"ReadOutData("+Dq+fname+Dq+")");//181102 //no ketjs - ); - ); - if((Noflg<2)&(mkflg>-1), - if(isstring(Ltype), - if((Noflg==0)&(color!=KCOLOR), //180904 //no ketjs on - Texcom("{");Com2nd("Setcolor("+color+")");//180722 - ); //no ketjs off - Ltype=GetLinestyle(text(Noflg)+Ltype,name); - if((Noflg==0)&(color!=KCOLOR), //180904 //no ketjs on - Texcom("}");//180722 - ); //no ketjs off - , - if(Noflg==1,Ltype=0); - ); - GCLIST=append(GCLIST,[name,Ltype,opcindy]); - ); - if(mkflg>-1, - if((fileflg=="Y")&(wflg==1), //181102from - tmp1="hatch"+nm+".txt"; - SCEOUTPUT = openfile(tmp1); - forall(varL, - println(SCEOUTPUT,#+"//"); - ); - closefile(SCEOUTPUT); - WriteOutData(fname,[name,parse(name)]); - ); //181102to - tmp2=[]; - forall(AnsL,tmp1, - tmp=apply(tmp1,LLcrd(#)); - tmp2=append(tmp2,tmp); - ); - tmp2; - ); -); -////%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,[]); -Shade(Arg1,Arg2):=( - if(!isstring(Arg1), - Shade(text(SHADECTR),Arg1,Arg2); //190222 - , - Shade(Arg1,Arg2,[]); - ); -); -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(["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; - if(isstring(plist_1), // 16.01.24 - println("output Shade of "+plist); - , - println("output Shade of lists"); - ); - tmp=Divoptions(options); - eqL=tmp_5; - reL=tmp_6; - color=tmp_(length(tmp)-2); - opstr=tmp_(length(tmp)-1); - 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); - tmp2=Toupper(tmp_2); - if(substring(tmp1,0,1)=="E", - if(substring(tmp2,0,1)=="Y", - encflg=1; - ); - if(substring(tmp2,0,1)=="N", - encflg=0; - ); - ); - if(substring(tmp1,0,1)=="T", - trim=substring(tmp2,0,1); - ); - ); - startpt=[]; - forall(reL, - if(islist(#), - startpt=#; - ); - ); //180929to - if(length(color)==4, //180602from - tmp=Colorcmyk2rgb(color); - ); - flg=0; ctr=1; - if(encflg==1, //180929from - if(length(startpt)==2, - Enclosing(nm,plist,[startpt,"nodisp"]); - , - Enclosing(nm,plist,["nodisp"]); - ); - 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; - if(isstring(tmp1),tmp=parse(tmp1),tmp=tmp1); - if(!islist(tmp), - flg=1; - , - if(!isstring(tmp1), - tmp2=[]; - forall(tmp1,if(ispoint(#),tmp=#.xy,tmp=#); - tmp2=append(tmp2,tmp); - ); - tmp1=Dqq("-"+name+text(ctr)); - tmp2=Textformat(tmp2,6)+",["+Dqq("nodisp")+"]"; - tmp=name+text(ctr)+"=Listplot("+tmp1+","+tmp2+")"; - parse(tmp); - plist_jj=name+text(ctr); - ctr=ctr+1; - ); - ); - ); - );//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("; //no ketjs on - tmp1="list"+PaO(); - forall(plist, - if(isstring(#), // from 16.01.24 - if(length(#)>1, - tmp1=tmp1+#+","; - , - tmp1=tmp1+Dq+#+Dq+","; - ); - , - tmp1=tmp1+"Listplot("+Textformat(#,5)+"),"; - ); //16.01.24to - ); - 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//// - -/////////// end of new Hatchdata(cindy) /////////// - - - - //help:end(); |