diff options
author | Karl Berry <karl@freefriends.org> | 2018-12-03 22:30:11 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-12-03 22:30:11 +0000 |
commit | 526cfb7ac8d644adaea426d705352af206a0d477 (patch) | |
tree | dfe6ef42917fb8d84e3f4cb105552bc768895348 /Master/texmf-dist/scripts/ketcindy/ketlib | |
parent | 5fc4d8142bde77451e56a8ebf0a2a227079639d4 (diff) |
ketcindy (3dec18)
git-svn-id: svn://tug.org/texlive/trunk@49309 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/ketcindy/ketlib')
11 files changed, 1395 insertions, 954 deletions
diff --git a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylib3dlogr.txt b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylib3dlogr.txt index 3bfe1f09635..d793d2fb12d 100644 --- a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylib3dlogr.txt +++ b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylib3dlogr.txt @@ -1,8 +1,22 @@ +// 20181108 +// Mkpointlist debugged (theta=90) +// 20181107 +// Nohiddenbyfaces changed ( frn3d,frnh3d returned, option "Disp=" added ) +// Perplane debugged ( for "draw" ) +// VertexEdgeFace changed (point name v =>V, option "Edg=n" as default ) +// 20181103 +// Skeletonparadata changed ( option "Not=","Check=" added ) +// 20181102 +// Skeletonparadata changed ( option "File=" added ) +// 20181031 +// IntersectsgpL changed ( option "Screen=" added ) +// Perpplane, Nohiddenseg changed ( for change of IntersectsgpL) // 20181030 // Mkpointlist debugged (workprocess adopted) // Parcrv3d, IntersectsgpL debugged // Ptonseg3d changed ( for non-geo point ) // Drawpoint3d changed ( color option ) +// IntersectsgpL changed ( Pointdata3d => Drawpoint3d ) // 20181029 // Mkpointlist debugged // Subgraph change diff --git a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylib3dr.cs b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylib3dr.cs index c5516db2888..dabd701c181 100644 --- a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylib3dr.cs +++ b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylib3dr.cs @@ -14,7 +14,7 @@ // along with this program. If not, see <http://www.gnu.org/licenses/> // -println("ketcindylib3d(20181030) loaded"); +println("ketcindylib3d(20181108) loaded"); //help:start(); @@ -86,7 +86,7 @@ Ketinit3d(subflg,position):=( Start3d():=Start3d([]); Start3d(ptexception):=( //help:Start3d(); -//help:Start3d(execptionptlist); +//help:Start3d(["A","B"](exceptionptlist)); regional(xmn,xMx,ymn,yMx,pt,pt3,pt2, xPos,yTh,yPh,Eps,tmp,tmp1,tmp2,tmp3,tmp4); Setfiles(Namecdy); //180608 @@ -161,8 +161,10 @@ Start3d(ptexception):=( SlideColorList=[letterc,boxc,boxc,boxc,shadowc,shadowc,6,1.3, letterc,mboxc,mboxc,mboxc,62,2,letterc]; ThinDense=0.1; //17.07.01to - Ptseg3data(ptexception); //16.08.23 - PTEXCEPTION=ptexception; //180916 + tmp=ptexception; //181106(3lines) + if(!islist(tmp),PTEXCEPTION=[tmp],PTEXCEPTION=tmp); + Ptseg3data(PTEXCEPTION); //16.08.23 + PTEXCEPTION=ptexception; //180916 ); ////%Start3d end//// @@ -246,12 +248,13 @@ Getangle():=getangle(["Disp=y"]); //180613from Getangle(option):=( regional(tmp,tmp1,dispflg,eqL); tmp=divoptions(option); - dispflg="N"; - eqL=tmp_7; + dispflg="Y"; + eqL=tmp_5; //181111 forall(eqL, - if(Toupper(#_1)=="DISP", - dispflg=Toupper(#_1); - dispflg=substring(dispflg,0,1); + tmp=Strsplit(#,"="); //181111(4lines) + tmp1=Toupper(substring(tmp_1,0,1)); + if(tmp1=="D", + dispflg=Toupper(substring(tmp_2,0,1)); ); ); tmp=[THETA*180/pi, PHI*180/pi]; @@ -265,8 +268,11 @@ Getangle(option):=( ////%Angleselected start//// Angleselected():=IsAngle(); //180713 //isAngle():=Isangle(); //180517 +////%Angleselected end//// +////%Isangle start//// Isangle():=isselected(TH)%isselected(FI); //180517 ////%Angleselected end//// +////%Isangle end//// ////%Changestyle3d start//// Changestyle3d(nameL,style):=( @@ -482,7 +488,8 @@ Projpara(ptdata,optionsorg):=( msgflg=0; //180602from forall(eqL, tmp=Strsplit(#,"="); - if(Toupper(tmp_1)=="MSG", + tmp1=Toupper(substring(tmp_1,0,1)); //181111 + if(tmp=="M", tmp=substring(tmp_2,0,1); if(Toupper(tmp)=="Y", msgflg=1); options=remove(options,[#]); @@ -635,10 +642,11 @@ Spaceline(Arg1,Arg2):=( name="-"+replace(tmp,",",""); Spaceline(name,Arg1,Arg2); ); -); // 16.02.22 until +); // 16.02.22 to Spaceline(nm,ptlistorg,optionorg):=( //help:Spaceline("1",[[2,5,1],[4,2,3]]); //help:Spaceline([A,B]); +//help:Spaceline(options=["Msg=y(n)"]); regional(name2,name3,options,Out,tmp,tmp1,tmp2, opstr,opcindy,Ltype,Noflg,eqL,ptlist, Msg,color); ptlist=apply(ptlistorg,if(ispoint(#),parse(text(#)+"3d"),#)); // 16.02.10 @@ -749,8 +757,8 @@ Spacecurve(nm,funstr,variable,optionorg):=( tmp=substring(#,0,1); if(Toupper(tmp)=="M", tmp=indexof(#,"="); - tmp1=substring(#,tmp,tmp+2); - if(Toupper(tmp1)=="NO", + tmp1=substring(#,tmp,tmp+1); + if(Toupper(tmp1)=="N", Msg=0; ); ); @@ -1291,6 +1299,7 @@ Embed(nm,Pd2str,funstr,varstr,options):=( Out; ); +////%Rotatepoint3d start//// Rotate3pt(point,w1,w2):=Rotatepoint3d(point,w1,w2,[0,0,0]); Rotate3pt(point,w1,w2,center):=Rotatepoint3d(point,w1,w2,center); Rotatepoint3d(point,w1,w2):=Rotatepoint3d(point,w1,w2,[0,0,0]);//180809 @@ -1378,7 +1387,9 @@ Rotatepoint3d(point,w1,w2,center):=( ); Ans; ); +////%Rotatepoint3d end//// +////%Rotatedata3d start//// Rotatedata3d(nm,P3data,w1,w2):=Rotatedata3d(nm,P3data,w1,w2,[]); Rotatedata3d(nm,P3data,w1,w2,options):=( //help:Rotatedata3d("1",["sl3d1","sc3d2"],[0,0,1],pi/3); @@ -1450,7 +1461,9 @@ Rotatedata3d(nm,P3data,w1,w2,options):=( ); Out; ); +////%Rotatedata3d end//// +////%Translatepoint3d start//// Translate3pt(point,w1):=Translatepoint3d(point,w1); Translatepoint3d(point,w1):=( //help:Translatepoint3d(pt3d,[1,2,3]); @@ -1479,7 +1492,9 @@ Translatepoint3d(point,w1):=( ); Ans; ); +////%Translatepoint3d end//// +////%Translatedata3d start//// Translatedata3d(nm,P3data,w1):=Translatedata3d(nm,P3data,w1,[]); Translatedata3d(nm,P3data,w1,options):=( //help:Translatedata3d("1",["sl3d1"],[1,2,3]); @@ -1543,7 +1558,9 @@ Translatedata3d(nm,P3data,w1,options):=( ); Out; ); +////%Translatedata3d end//// +////%Reflectpoint3d start//// Reflect3pt(point,vecL):=Reflectpoint3d(point,vecL); Reflectpoint3d(point,vecL):=( //help:Reflectpoint3d(pt3d,[v1,v2,v3]); @@ -1569,7 +1586,9 @@ Reflectpoint3d(point,vecL):=( ); ans; ); +////%Reflectpoint3d end//// +////%Reflectdata3d start//// Reflectdata3d(nm,P3data,vecL):=Reflectdata3d(nm,P3data,vecL,[]); Reflectdata3d(nm,P3data,vecL,options):=( //help:Reflectdata3d("1",["sl3d1"],[v1,v2,v3]); @@ -1636,8 +1655,10 @@ Reflectdata3d(nm,P3data,vecL,options):=( ); Out; ); +////%Reflectdata3d end//// // 180806 +////%Scalepoint3d start//// Scale3pt(point,ratio,center):=Scalepoint3d(point,ratio,center); Scalepoint3d(point,ratio):=Scalepoint3d(point,ratio,[0,0,0]);//180809 Scalepoint3d(point,ratio,center):=( @@ -1656,8 +1677,10 @@ Scalepoint3d(point,ratio,center):=( Z2=Cz+ra3*(Z1-Cz); [X2,Y2,Z2]; ); +////%Scalepoint3d end//// // 180808 +////%Scaledata3d start//// Scaledata3d(nm,P3data,ratio):=Scaledata3d(nm,P3data,ratio,[]); Scaledata3d(nm,P3data,ratio,options):=( //help:Scaledata3d("1",["sl3d1"],[v1,v2,v3]); @@ -1728,6 +1751,7 @@ Scaledata3d(nm,P3data,ratio,options):=( ); Out; ); +////%Scaledata3d end//// ////%Xyzcoord start//// Xyzcoord(pm,ps):=Xyzcoord(pm_1,pm_2,ps); //181028from @@ -1753,16 +1777,17 @@ PutonCurve3d(name,pdstr):=( pt=Xyzcoord(pt,tmp2); // 15.03.13 tmp=name+"z.xy="+textformat(tmp2,5); parse(tmp); - VLIST=select(VLIST,#_1!=name+"3d"); + // VLIST=select(VLIST,#_1!=name+"3d"); Defvar(name+"3d",pt); ); ////%Mkpointlist start//// Mkpointlist():=Mkpointlist([]); //16.11.12 Mkpointlist(options):=( //181030 - regional(Eps,pos,worklist,plist,pt,ptstr,pt3,ptz,par, - vlistpre, + regional(Eps,dp,mv,pos,worklist,plist,pt,ptstr,pt3,ptz,par, tmp,tmp1,tmp2,tmp3,tmp4,p1,p2,flg); + dp=pi/24; + mv=NE.x-SW.x; Eps=10^(-4); pos=[NE.x+1,NE.y]; worklist=Workprocess(); //181030 @@ -1779,7 +1804,6 @@ Mkpointlist(options):=( //181030 VLIST=remove(VLIST,tmp); ); ); //181029to -// vlistpre=VLIST; //181015 if(SUBSCR==0,plist=[]); forall(plist,ptstr, pt=parse(ptstr); @@ -1790,23 +1814,27 @@ Mkpointlist(options):=( //181030 tmp=Finddef(pt); tmp=select(VLIST,#_1==text(pt)+"3d"); if(length(tmp)==0, - if(abs(cos(THETA))>Eps,//181028from - tmp1=Mainsubpt3d(pt.xy,0); - tmp=Parasubpt(tmp1); - Putpoint(ptz,tmp,[tmp_1,parse(ptz+".y")]); - pt3=Mainsubpt3d(pt.xy,parse(ptz+".xy")); + tmp=parse(ptz); //181108from + if(ispoint(tmp), + pt3=Mainsubpt3d(pt.xy,tmp.xy); //181108to , - if(abs(sin(PHI))>abs(cos(PHI)), //181029from - tmp=Parasubpt([-pt.x/sin(PHI),0,pt.y]); + if(abs(cos(THETA))>Eps,//181028from + tmp1=Mainsubpt3d(pt.xy,0); + tmp=Parasubpt(tmp1); + Putpoint(ptz,tmp,[tmp_1,parse(ptz+".y")]); + pt3=Mainsubpt3d(pt.xy,parse(ptz+".xy")); , - tmp=Parasubpt([0,pt.x/cos(PHI),pt.y]); + if(abs(sin(PHI))>abs(cos(PHI)), //181029from + tmp=Parasubpt([-pt.x/sin(PHI),0,pt.y]); + , + tmp=Parasubpt([0,pt.x/cos(PHI),pt.y]); + ); + Putpoint(ptz,tmp,[parse(ptz+".x"),pt.y]);//181029t + pt3=Mainsubpt3d(pt.xy,parse(ptz+".xy")); ); - Putpoint(ptz,tmp,[parse(ptz+".x"),pt.y]);//181029to - pt3=Mainsubpt3d(pt.xy,parse(ptz+".xy")); ); //181028to Defvar(text(pt)+"3d",pt3); Defvar(text(pt)+"fix",0); -// vlistpre=VLIST; //16.08.20 ); flg=0; if(isstring(ptz),ptz=parse(ptz));//181029from @@ -1817,32 +1845,37 @@ Mkpointlist(options):=( //181030 if(parse(text(pt)+"fix")!=1, tmp=select(VLIST,#_1==text(pt)+"3d"); tmp1=tmp_1_2; - tmp2=Mainsubpt3d(pt.xy,ptz.xy); //181029 - if(Norm(tmp1-tmp2)>Eps, - VLIST=select(VLIST,#_1!=text(pt)+"3d"); - Defvar(text(pt)+"3d",tmp2); -// vlistpre=VLIST; //16.08.20 + pt3=Mainsubpt3d(pt.xy,ptz.xy); //181029 + Putpoint(text(ptz),Parasubpt(pt3)); + if(Norm(tmp1-pt3)>Eps, + Defvar(text(pt)+"3d",pt3); ); - Putpoint(text(ptz),Parasubpt(tmp2)); - pt3=tmp2; flg=1; ); ); - if(isselected(ptz), -// tmp=select(vlistpre,#_1==text(pt)+"3d"); //16.08.20 - tmp=select(VLIST,#_1==text(pt)+"3d"); //181030 + if(isselected(ptz),//181108from + tmp=select(VLIST,#_1==text(pt)+"3d"); tmp1=tmp_1_2; - tmp2=Mainsubpt3d(pt.xy,ptz.xy); - if(Norm(tmp1-tmp2)>Eps, + tmp=Parasubpt(tmp1); //181108from if(abs(cos(THETA))>Eps, - tmp2=[tmp1_1,tmp1_2,tmp2_3]; - , - ); //181028to - VLIST=select(VLIST,#_1!=text(pt)+"3d"); - Defvar(text(pt)+"3d",tmp2); - ); - Putpoint(text(ptz),Parasubpt(tmp2)); - pt3=tmp2; + tmp=text(ptz)+".x="+format(tmp_1,6); + parse(tmp); + tmp=Parapt([tmp1_1,tmp1_2,ptz.y]); + Putpoint(text(pt),tmp); + , + tmp=text(ptz)+".y="+format(tmp_2,6); + parse(tmp); + if(abs(sin(PHI+dp))>abs(cos(PHI+dp)), //181108 + tmp=-(ptz.x-mv-tmp1_2*cos(PHI+dp))/sin(PHI+dp); + tmp=Parapt([tmp,tmp1_2,tmp1_3]); + , + tmp=(ptz.x-mv+tmp1_1*sin(PHI+dp))/cos(PHI+dp); //181109pm + tmp=Parapt([tmp1_1,tmp,tmp1_3]); + ); + Putpoint(text(pt),tmp); + ); + pt3=Mainsubpt3d(pt.xy,ptz.xy); + Defvar(text(pt)+"3d",pt3);//181108to flg=2; ); if(isselected(TH) % isselected(FI), //181029 @@ -1857,7 +1890,6 @@ Mkpointlist(options):=( //181030 ); if(flg==0, //181030from pt3=Mainsubpt3d(pt.xy,ptz.xy); - VLIST=select(VLIST,#_1!=text(pt)+"3d"); Defvar(text(pt)+"3d",pt3); ); //181030to if(isselected(pt) % isselected(ptz), @@ -1930,12 +1962,15 @@ Ptseg3data(options):=( tmp=select(VLIST,#_1==tmp1+"3d"); //17.10.07 if(length(tmp)>0, pt3=tmp_1_2; - tmp=tmp1+".xy=Parapt("+pt3+")_[1,2];"; + tmp=tmp1+".xy="+Textformat(Parapt(pt3),6);//181107 parse(tmp); if(SUBSCR==1, - tmp=tmp1+"z"+".x=NE.x-SW.x+"+tmp1+".x"; + tmp=tmp1+"z"+".xy="+Textformat(Parasubpt(pt3),6);//181107 parse(tmp); ); + , + tmp=Mainsubpt3d(parse(pt+".xy"),parse(tmp1+"z.xy")); //181107(2lines) + Defvar(tmp1+"3d",tmp); ); ); , @@ -2054,9 +2089,7 @@ Putpoint3d(Arg1,Arg2,Arg3):=( inspect(parse(tmp1),"textsize",TSIZE); if(SUBSCR==1, tmp2=tmp1+"z"; - tmp=[pt.x+NE.x-SW.x,pt3_3]; - tmp1="[NE.x-SW.x+"+tmp1+".x,"+tmp2+"y]"; - Putpoint(tmp2,tmp,parse(tmp1)); + Putpoint(tmp2,Parasubpt(pt3)); inspect(parse(tmp2),"ptsize",3); inspect(parse(tmp2),"color",3); inspect(parse(tmp2),"textsize",TSIZEZ); @@ -2122,7 +2155,7 @@ Putperp(name,ptstr,pLstr,option):=( N3d=pP+tmp; Defvar("tmp3d",N3d); // temporary sgstr=ptstr+"-tmp"; - tmp=IntersectsgpL(name,sgstr,pLstr,"none"); + tmp=IntersectsgpL(name,sgstr,pLstr,["Screen=n"]); //181031 VLIST=select(VLIST,#_1!="tmp3d"); out=tmp_1; Defvar(name+"3d",tmp_1); @@ -2161,7 +2194,11 @@ Perpplane(name,ptstr,nstr,option):=( th,ph,pA,pB,tmp,tmp1,tmp2); Eps=10^(-4); if(isstring(nstr),nvec=parse(nstr+"3d"),nvec=nstr); - pP=parse(ptstr+"3d"); + if(indexof(ptstr,"3d")==0, //181107from + pP=parse(ptstr+"3d"); + , + pP=parse(ptstr); + ); //181107to v3=nvec/|nvec|; th=THETA; ph=PHI; tmp=findangle(v3); @@ -2169,16 +2206,19 @@ Perpplane(name,ptstr,nstr,option):=( v1=Cancoordpara([1,0,0]); v2=Cancoordpara([0,1,0]); THETA=th; PHI=ph; + tmp=indexof(name,"-"); + tmp1=substring(name,0,tmp-1); + tmp2=substring(name,tmp,length(name)); tmp=indexof(pLstr,"-"); pA=pP+v1; pB=pP+v2; if(islist(option),tmp=option_1,tmp=option); tmp=Toupper(substring(tmp,0,1)); // 16.06.19 if(tmp=="P", - tmp=indexof(name,"-"); - tmp1=substring(name,0,tmp-1); - tmp2=substring(name,tmp,length(name)); Putpoint3d([tmp1,pA,tmp2,pB],["fix"]); + , + Defvar(tmp1+"3d",pA); //181107(2lines) + Defvar(tmp2+"3d",pB); ); if(tmp=="D", Drawpoint3d(pA); @@ -2238,13 +2278,13 @@ Putaxes3d(size):=( ////%IntersectsgpL start//// IntersectsgpL(name,sgstr,pLstr):= - IntersectsgpL(name,sgstr,pLstr,["Draw=ie"]); + IntersectsgpL(name,sgstr,pLstr,["ie"]); IntersectsgpL(name,sgstr,pLstr,optionsorg):=( //help:IntersectsgpL("R","P-Q","A-B-C"); //help:IntersectsgpL("",[p1,p2],[p3,p4,p5]); -//help:IntersectsgpL(options=["draw(put)","ie"+pointoptions]); - regional(options,strL,ptflg,out,pP,pQ,pA,pB,pC,pH,pK,pR,tseg,tt,ss,Eps, - flg,nvec,tmp,tmp1,tmp2,tmp3,tmp4); +//help:IntersectsgpL(options=["draw(put)","ie","Screen=n"+pointoptions]); + regional(options,eqL, strL,ptflg,out,pP,pQ,pA,pB,pC,pH,pK,pR,tseg,tt,ss,Eps, + flg,scrflg,nvec,tmp,tmp1,tmp2,tmp3,tmp4); options=optionsorg; //181026from tmp1=""; if(isstring(options), @@ -2253,6 +2293,7 @@ IntersectsgpL(name,sgstr,pLstr,optionsorg):=( ); options=remove(options,["draw","Draw"]); tmp=Divoptions(options); + eqL=tmp_5; strL=tmp_7; if(length(tmp1)>0, strL=append(strL,tmp1); @@ -2271,7 +2312,16 @@ IntersectsgpL(name,sgstr,pLstr,optionsorg):=( ); ); ); - options=remove(options,strL); + options=remove(options,strL); + scrflg="Y"; //181031from + forall(eqL, + tmp=Strsplit(#,"="); + tmp1=Toupper(substring(tmp_1,0,1)); //181111 + if(tmp1=="S", + scrflg=Toupper(substring(tmp_2,0,1)); + options=remove(options,[#]); + ); + ); //181031to tmp=select(options,substring(#,0,1)=="C"); if(length(tmp)==0,options=append(options,"Color=green"));//181026to Eps=10^(-4); @@ -2326,12 +2376,12 @@ IntersectsgpL(name,sgstr,pLstr,optionsorg):=( tmp=ptflg_2; tmp1=(tmp1)%(substring(tmp,0,1)=="e"); //181025from tmp2=(tmp2)%(substring(tmp,1,2)=="e"); - if(tmp1&tmp2, + if(tmp1&tmp2&(scrflg=="Y"), //181031 if(ptflg_1=="P", //181025 Putpoint3d([name,pR]); Fixpoint3d([name,pR]); , - Pointdata3d(name,pR,options); + Drawpoint3d(pR,options); ); // println(" pt"+name+" data:"+format(out,5)); , @@ -2506,7 +2556,7 @@ Mkbezierptcrv3(ptdata,options):=( //17.10.08 greatly changed Out; ); -/////////////////////////////////////////// +//////////old version /////////////////////////////// Readobj(filename):=Readobj(filename,[]); Readobj(filename,options):=( @@ -2539,8 +2589,8 @@ Readobj(filename,options):=( [vL,fnL]; ); -///////////////////////////////////////// - +//////////new version /////////////////////////////// +////%Readobj start//// Readobj(filename,options):=( //help:Readobj("file.obj",["size=-3"]); regional(eqL,size,vL,fnL,dtL,numer,flg,flg2, @@ -2644,6 +2694,7 @@ Readobj(filename,options):=( ); [vL,fnL]; ); +////%Readobj end//// Concatobj(objL):=Concatobj(objL,[]); Concatobj(objL,options):=( @@ -2750,15 +2801,14 @@ Mkobjfile(path,fnameorg,objL):=( ); -VertexandEdge(nm,vfnL):=VertexEdgeFace(nm,vfnL,[]); -VertexandEdge(nm,vfnL,options):=VertexEdgeFace(nm,vfnL,options); +////%VertexEdgeFace start//// VertexEdgeFace(nm,vfnL):=VertexEdgeFace(nm,vfnL,[]); // 16.02.10 +VertexEdgeFace(nm,vfnLorg,optionorg):=( //help:VertexEdgeFace("1",[vL,fnL]); //help:VertexEdgeFace("1",["A","B","C"]); -//help:VertexEdgeFace(options=["Pt=fix","Vtx=geo","Edg=geo"]); -VertexEdgeFace(nm,vfnLorg,optionorg):=( +//help:VertexEdgeFace(options=["Pt=fix","Vtx=n(y)","Edg=n(y)"]); regional(name3,namev,namee,namef,vfnL,options,Noflg,eqL,strL, - vL,eL,enL,face,edge,vtx,vname,fixflg,vtxflg, edgflg,tmp,tmp1,tmp2); + vL,eL,enL,face,edge,vtx,vname,fixflg,vtxflg, edgflg,dispflg,tmp,tmp1,tmp2); name3="phvef"+nm; namev="phv3d"+nm; namee="phe3d"+nm; @@ -2776,24 +2826,35 @@ VertexEdgeFace(nm,vfnLorg,optionorg):=( eqL=tmp_5; strL=tmp_7; fixflg=1; - vtxflg=1; //180905 - edgflg=1; + vtxflg=0; //180905 + edgflg=0; + dispflg=1; //181106 forall(eqL, - tmp1=Toupper(substring(#,0,1)); - tmp=indexof(#,"="); - tmp2=Toupper(substring(#,tmp,length(#))); + tmp=Strsplit(#,"="); + tmp1=Toupper(substring(tmp_1,0,1)); + tmp2=Toupper(substring(tmp_2,0,1)); if(tmp1=="P", - if(tmp2=="FREE", fixflg=0); + if(tmp2=="F", fixflg=0); options=remove(options,[#]); ); if(tmp1=="V", //180905from - if(substring(tmp2,0,1)=="N", vtxflg=0); + if((tmp2=="Y")%(tmp2==G), //181107 + vtxflg=1; + ); options=remove(options,[#]); ); //180905to if(tmp1=="E", - if(substring(tmp2,0,1)=="N", edgflg=0); + if((tmp2=="Y")%(tmp2=="G"),//181107(2lines) + if(vtxflg==1,edgflg=1); + ); options=remove(options,[#]); ); + if(tmp1=="D", //181106from + if(substring(tmp2,0,1)=="N", + dispflg=0; vtxflg=0; edgflg=0; + ); + options=remove(options,[#]); + ); //181106to ); forall(strL, if(Toupper(#)=="FREE", @@ -2808,14 +2869,13 @@ VertexEdgeFace(nm,vfnLorg,optionorg):=( if(ispoint(vtx), tmp=parse(text(vtx)+"3d"); vname=text(vtx); -// tmp=parse(text(vtx)+"3d"); -// tmp="v"+text(#)+"3d="+textformat(tmp,5); -// parse(tmp); , - vname="v"+text(#); + vname="V"+text(#); //181107 if(vtxflg==1, //180905 if(fixflg==1, - Putpoint3d([vname,vtx],"fix"); + Putpoint3d([vname,vtx],"fix"); + , + Putpoint3d([vname,vtx]); ); , //180905from tmp=vname+"3d="+format(vtx,6); @@ -2824,7 +2884,9 @@ VertexEdgeFace(nm,vfnLorg,optionorg):=( tmp=vname+"2d=Parapt("+vname+"3d)"; parse(tmp); Defvar(vname+"2d",parse(vname+"2d")); - drawtext(parse(vname+"2d"),vname); + if(dispflg==1, //181106 + drawtext(parse(vname+"2d"),vname); + ); ); //180905to ); vL=append(vL,vname); // 16.02.10 until @@ -2841,8 +2903,6 @@ VertexEdgeFace(nm,vfnLorg,optionorg):=( if(tmp2<tmp1, tmp=tmp2; tmp2=tmp1; tmp1=tmp; ); -// tmp1="v"+text(tmp1)+"3d"; -// tmp2="v"+text(tmp2)+"3d"; tmp1=vL_tmp1+"3d"; tmp2=vL_tmp2+"3d"; tmp=select(eL,#==[tmp1,tmp2] % #==[tmp2,tmp1]); @@ -2875,6 +2935,7 @@ VertexEdgeFace(nm,vfnLorg,optionorg):=( tmp1=replace(edge_1,"3d",""); tmp2=replace(edge_2,"3d",""); tmp=tmp1+tmp2; + tmp=replace(tmp,"V","v"); create([tmp],"Segment",[parse(tmp1),parse(tmp2)]); enL=append(enL,tmp+"3d");//16.02.29 ); @@ -2912,7 +2973,9 @@ VertexEdgeFace(nm,vfnLorg,optionorg):=( ); [namev,namee,namef]; ); +////%VertexEdgeFace end//// +////%Phparadata start//// Phparadata(nm,nmvf):=( regional(tmp1,tmp2); tmp1=parse("phv3d"+nmvf); @@ -3016,7 +3079,9 @@ Phparadata(nm,nmvf,vfL,options):=( ); ); ); +////%Phparadata end//// +////%Nohiddenseg start//// Nohiddenseg(seg,rng,triang,Eps):=( // help:Nohiddenseg("1",seg1,[0,1],["v1","v2","v3"]); regional(pA3,pB3,pC3,pA,pB,pC,sg1,sg2,ss1,ss2,parL,flgL,flg1,flg2, @@ -3057,15 +3122,13 @@ Nohiddenseg(seg,rng,triang,Eps):=( ); tmp1=Crossprod(pB3-pA3,pC3-pA3); if(abs(Dotprod(tmp1,sg2-sg1))>Eps, - tmp=IntersectsgpL("",[sg1,sg2],[pA3,pB3,pC3],["nodisp"]);//180815 - if(tmp_2>-Eps & tmp_2<1+Eps, - if(tmp_3>-Eps & tmp_4>-Eps & tmp_3+tmp_4<1+Eps, - tmp1=select(parL,abs(tmp_2-#)<Eps); - if(length(tmp1)==0, - parL=sort(append(parL,tmp_2)); - ); + tmp=IntersectsgpL("",[sg1,sg2],[pA3,pB3,pC3],["Screen=n"]);//181031from + if(tmp_2&tmp_3, + tmp1=select(parL,abs(tmp_4-#)<Eps); + if(length(tmp1)==0, + parL=sort(append(parL,tmp_4)); ); - ); + );//181031to ); flgL=[]; forall(parL, @@ -3073,7 +3136,7 @@ Nohiddenseg(seg,rng,triang,Eps):=( tmp=Projcoordpara(tmp1); tmp_3=tmp_3+1; tmp2=Cancoordpara(tmp); - tmp=IntersectsgpL("",[tmp1,tmp2],[pA3,pB3,pC3],["nodisp"]);//180815 + tmp=IntersectsgpL("",[tmp1,tmp2],[pA3,pB3,pC3],["Screen=n"]);//181031 tmp1=Projcoordpara(tmp1); tmp2=Projcoordpara(tmp_1); flg1=0; @@ -3149,7 +3212,9 @@ Nohiddenseg(seg,rng,triang,Eps):=( sgnoh=apply(sgnoh,rng_1+#*(rng_2-rng_1)); sgnoh; ); +////%Nohiddenseg end//// +////%Nohiddensegs start//// Nohiddensegs(seg,range,faceno,vtxL,Eps):=( regional(rng,face,vtx,out,ra,rb,tmp,tmp1,tmp2); // Eps=10^(-2); @@ -3188,7 +3253,9 @@ Nohiddensegs(seg,range,faceno,vtxL,Eps):=( ); rng; ); +////%Nohiddensegs end//// +////%Nohiddenbyfaces start//// Nohiddenbyfaces(nm,facestr):= Nohiddenbyfaces(nm,Datalist3d(),facestr,[],["do"]); Nohiddenbyfaces(nm,Arg1,Arg2):=( @@ -3298,8 +3365,8 @@ Nohiddenbyfaces(nm,segstr,faceL,vtxL,optionorg,optionsh):=( opcindy=tmp_(length(tmp)); forall(eqL, //180815from tmp=Strsplit(#,"="); - tmp1=Toupper(tmp_1); - if(substring(tmp1,0,3)=="EPS", + tmp1=Toupper(substring(tmp_1,0,1)); //181111 + if(substring(tmp1,0,3)=="E", Eps=parse(tmp_2); options=remove(options,[#]); ); @@ -3358,8 +3425,11 @@ Nohiddenbyfaces(nm,segstr,faceL,vtxL,optionorg,optionsh):=( tmp="frh3d"+nm+"="+text(tmp1); parse(tmp); println(" generate totally "+"frh3d"+nm); + [frnL,frhL]; //181106 ); +////%Nohiddenbyfaces end//// +////%Faceremovaldata start//// Faceremovaldata(nm,vfdata,crvdata):=Faceremovaldata(nm,vfdata,crvdata,[]); Faceremovaldata(nm,vfdata,crvdata,options):=( regional(name2,name3,nameh2,nameh3,Ltype,Noflg,eqL,Hidden, @@ -3444,6 +3514,7 @@ Faceremovaldata(nm,vfdata,crvdata,options):=( ); ); ); +////%Faceremovaldata end//// Fullformfunc(FdL):=( regional(Out,nn,ii,Jrg,flg,Urg,Vrg,kk,Uname, @@ -3638,8 +3709,8 @@ SfbdparadataR(nm,fd):= SfbdparadataR(nm,fd,options):= SfbdparadataR(nm,fd,options,["nodisp"]); SfbdparadataR(nm,fdorg,optionorg,optionsh):=( -//help:SfbdparadataR("1",Fd); -//help:SfbdparadataR(options2=["Wait=60",division(c(50,50)),Eps1(0.01), Eps2(0.05)]); +// help:SfbdparadataR("1",Fd); +// help:SfbdparadataR(options2=["Wait=60",division(c(50,50)),Eps1(0.01), Eps2(0.05)]); regional(fd,options,name3,name3h,waiting, eqL,reL,strL,fname,tmp,tmp1,tmp2,flg,wflg); tmp=ConvertFdtoC(fdorg);//180430(2lines) @@ -3743,8 +3814,8 @@ CrvsfparadataR(nm,crv,sf,fd):= CrvsfparadataR(nm,crv,sf,fd,options):= CrvsfparadataR(nm,crv,sf,fd,options,["nodisp"]); CrvsfparadataR(nm,crvstr,sfstr,fdorg,optionorg,optionsh):=( -//help:CrvsfparadataR("1","ax3d","sfbd3d1",fd); -//help:CrvsfparadataR(options2=[division(c(50,50)),Eps1(0.01), Eps2(0.05)]); +// help:CrvsfparadataR("1","ax3d","sfbd3d1",fd); +// help:CrvsfparadataR(options2=[division(c(50,50)),Eps1(0.01), Eps2(0.05)]); regional(gd,out,fd,options,name3,name3h, eqL,reL,strL,fname,rfname,waiting,tmp,tmp1,tmp2,tmp3,flg,wflg); tmp=replace(crvstr,"3d","2d"); @@ -3847,8 +3918,8 @@ Crv3onsfparadataR(nm,crv3d,sf,fd):= Crv3onsfparadataR(nm,crv3d,sf,fd,options):= Crv3onsfparadataR(nm,crv3d,sf,fd,options,["nodisp"]); Crv3onsfparadataR(nm,crv3dstr,sfstr,fdorg,optionorg,optionsh):=( -//help:Crv3onsfparadataR("1","sc1","sfbd3d1",fd); -//help:Crv3onsfparadataR(options2=[division(c(50,50)),Eps1(0.01), Eps2(0.05)]); +// help:Crv3onsfparadataR("1","sc1","sfbd3d1",fd); +// help:Crv3onsfparadataR(options2=[division(c(50,50)),Eps1(0.01), Eps2(0.05)]); regional(gd,out,fd,options,name3,name3h, eqL,reL,strL,fname,rfname,waiting,tmp,tmp1,tmp2,tmp3,flg,wflg); tmp1=replace(crv3dstr,"3d","2d"); @@ -3949,8 +4020,8 @@ Crv2onsfparadataR(nm,crv2d,sf,fd):= Crv2onsfparadataR(nm,crv2d,sf,fd,options):= Crv2onsfparadataR(nm,crv2d,sf,fd,options,["nodisp"]); Crv2onsfparadataR(nm,crv2dstr,sfstr,fdorg,optionorg,optionsh):=( -//help:Crv2onsfparadataR("1","pa1","sfbd3d1",fd); -//help:Crv2onsfparadataR(options2=[division(c(50,50)),Eps1(0.01), Eps2(0.05)]); +//help :Crv2onsfparadataR("1","pa1","sfbd3d1",fd); +//help :Crv2onsfparadataR(options2=[division(c(50,50)),Eps1(0.01), Eps2(0.05)]); regional(gd,out,fd,options,name3,name3h, eqL,reL,strL,fname,rfname,waiting,tmp,tmp1,tmp2,tmp3,flg,wflg); Changestyle(crv2dstr,["nodisp"]); @@ -4052,8 +4123,8 @@ WireparadataR(nm,sf,wr1,wr2,fd):= WireparadataR(nm,sf,fd,wr1,wr2,options):= WireparadataR(nm,sf,fd,wr1,wr2,options,["nodisp"]); WireparadataR(nm,sfstr,fdorg,wr1,wr2,optionorg,optionsh):=( -//help:WireparadataR("1","sfbd3d1",fd,5,5); -//help:WireparadataR(options2=[division(c(50,50)),Eps1(0.01), Eps2(0.05)]); +// help:WireparadataR("1","sfbd3d1",fd,5,5); +// help:WireparadataR(options2=[division(c(50,50)),Eps1(0.01), Eps2(0.05)]); regional(fd,options,name3,name3h,outreg, eqL,reL,strL,fname,rfname,waiting,tmp,tmp1,tmp2,flg,wflg); name3="wire3d"+nm; @@ -4159,9 +4230,9 @@ IntersectcrvsfR(nm,crv,fd,Arg):=( ); ); IntersectcrvsfR(nm,crvstr,fdorg,bdyeq,optionorg):=( -//help:IntersectcrvsfR("1",curve,fd); -//help:IntersectcrvsfR("1",curve,fd,curveequation); -//help:IntersectcrvsfR(options=[Np([50,50]),Eps(0.01)]); +// help:IntersectcrvsfR("1",curve,fd); +// help:IntersectcrvsfR("1",curve,fd,curveequation); +// help:IntersectcrvsfR(options=[Np([50,50]),Eps(0.01)]); regional(name,crv,fd,options,reL,fname,crvfname,argR, waiting,tmp,tmp1,tmp2,flg,wflg,pts); name="crvsf"+nm; name="crvsf"+nm; @@ -4245,8 +4316,8 @@ SfcutparadataR(nm,eqstr,sf,fd):= SfcutparadataR(nm,eqstr,sf,fd,options):= SfcutparadataR(nm,eqstr,sf,fd,options,["nodisp"]); SfcutparadataR(nm,eqstrorg,sf,fdorg,optionorg,optionsh):=( -//help:SfcutparadataR("1","x+y+z=1","sfbd3d1",fd); -//help:SfcutparadataR(options2=[Division(c(50,50)),Eps1(0.01), Eps2(0.05)]); +// help:SfcutparadataR("1","x+y+z=1","sfbd3d1",fd); +// help:SfcutparadataR(options2=[Division(c(50,50)),Eps1(0.01), Eps2(0.05)]); regional(gd,out,fd,options,name3,name3h,eqstr, eqL,reL,strL,fname,rfname,waiting,tmp,tmp1,tmp2,tmp3,flg,wflg); tmp=Strsplit(eqstrorg,"="); @@ -4546,6 +4617,7 @@ Makeskeletondata(ObjL,PltL,R0):=( ////////////// current skeleton 2018.01.04 //////////////// +////%Skeletonparadata start//// Skeletondatacindy(nm):=Skeletondatacindy(nm,[]); Skeletondatacindy(nm,options):=( regional(tmp); @@ -4554,15 +4626,17 @@ Skeletondatacindy(nm,options):=( ); Skeletondatacindy(nm,pltdata1,pltdata2):= Skeletondatacindy(nm,pltdata1,pltdata2,[]); -Skeletondatacindy(nm,pltdata1org,pltdata2org,options):=( +Skeletondatacindy(nm,pltdata1org,pltdata2org,optionsorg):=( //help:Skeletondatacindy("1"); //help:Skeletondatacindy("1",[pdata1,pdata2],[pdata3]); -//help:Skeletondatacindy(options2=[1(width)]); - regional(Eps,Eps2,name2,name3,Ltype,Noflg,reL,opcindy, +//help:Skeletondatacindy(options=[1(width),"File=y(/m/n)","Not=ptlist","Check=ptlist"]); + regional(Eps,Eps2,name2,name3,options,Ltype,Noflg,reL,eqL,opcindy, Out,ObjL,Plt3L,Rr,pltdata1,pltdata2,Plt2L,ObjL,ii,Data, - Obj3,jj,Gd,PtD,size,tmp,tmp1,tmp2,color); + Obj3,jj,Gd,PtD,size,tmp,tmp1,tmp2,color, + fileflg,wflg,mkflg,fname,varL,nn,chkL); //181101 name2="sk2d"+nm; name3="sk3d"+nm; + fname=Fhead+"sk"+nm+".txt"; //181102 pltdata1=[];// 16.01.31 forall(pltdata1org,tmp1, tmp=parse(tmp1); @@ -4573,65 +4647,140 @@ Skeletondatacindy(nm,pltdata1org,pltdata2org,options):=( tmp=parse(tmp1); pltdata2=append(pltdata2,tmp); ); + options=optionsorg; tmp=Divoptions(options); Ltype=tmp_1; Noflg=tmp_2; + eqL=tmp_5; reL=tmp_6; //16.02.28 color=tmp_(length(tmp)-2); opcindy=tmp_(length(tmp)); Rr=0.075*1000/2.54/MilliIn; size=1; Eps2=0.05; + fileflg="N"; + mkflg=1; if(length(reL)>0, //16.02.28 size=reL_1; Rr=size*Rr; if(length(reL)>1,Eps2=reL_2); ); + forall(eqL, //181101from + tmp=Strsplit(#,"="); + tmp1=Toupper(substring(tmp_1,0,1)); + if(tmp1=="FI", + fileflg=Toupper(substring(tmp_2,0,1)); + options=remove(options,[#]); + ); + if(tmp1=="N", + tmp=parse(tmp_2); + if(Anyselected(tmp), + mkflg=-1; + ); + options=remove(options,[#]); + ); + if(tmp1=="C", + chkL=parse(tmp_2); + options=remove(options,[#]); + ); + ); Eps=10^(-4); ObjL=Flattenlist(pltdata1); Plt3L=Flattenlist(pltdata2); tmp=apply(Plt3L,ProjcoordCurve(#)); Plt2L=Flattenlist(tmp); -/////////// tmp=apply(pltdata1,replace(#,"3d","2d")); - Out=[]; - forall(1..(length(ObjL)),ii, - Obj3=ObjL_ii; - tmp=ProjcoordCurve(Obj3); - Data=Makeskeletondata([tmp],Plt2L,Rr,Eps2); - forall(1..(length(Data)),jj, - Gd=Data_jj; - if((length(Gd)>1) - & (Norm(Ptcrv(1,Gd)-Ptcrv(2,Gd))>Eps), - PtD=[]; - forall(1..(length(Gd)), - tmp=Gd_#; - tmp1=Invparapt(tmp,Obj3); - PtD=append(PtD,tmp1); + if((fileflg=="Y")%(fileflg=="M")&(mkflg>-1), //181101from, 181103 + wflg=1; + tmp=flatten(pltdata1org); + varL=tmp; + tmp1=flatten(pltdata2org); + forall(tmp1, + if(!contains(varL,#), + varL=append(varL,#); + ); + ); + varL=sort(varL); + forall(1..(length(varL)),nn, + tmp1=varL_nn; + tmp=select(GLIST,substring(#,0,length(tmp1))==tmp1); + varL_nn=tmp_1; + ); + tmp=["THETA="+format(THETA,5),"PHI="+format(PHI,5)]; + varL=concat(tmp,varL); + forall(chkL, + tmp=#+"="+Textformat(parse(#+".xy"),5); + varL=append(varL,tmp); + ); + if(fileflg=="M", + fileflg="Y"; + , + tmp1="skeleton"+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=name3+"="+Textformat(parse(name3),5); + parse(tmp); + tmp=name2+"="+Textformat(parse(name2),5); + parse(tmp); + ); ); - Out=append(Out,PtD); ); ); ); - Out=select(Out,length(Projcurve(#))>0); // 16.12.19 - tmp1=apply(Out,textformat(#,5)); - tmp=name3+"="+tmp1; - parse(tmp); - tmp=name2+"=Projcurve("+tmp1+");"; - parse(tmp); - Changestyle3d(pltdata1org,["nodisp"]); - if(Noflg<3, - println("generate skeleton :"+name3); - tmp1=text(pltdata1org); - tmp1="list("+substring(tmp1,1,length(tmp1)-1)+")"; - tmp2=text(pltdata2org); - tmp2="list("+substring(tmp2,1,length(tmp2)-1)+")"; - tmp=name3+"=Skeletonpara3data("+tmp1+","+tmp2+","; - tmp=tmp+text(size)+")"; - GLIST=append(GLIST,tmp); - tmp=name2+"=Projpara("+name3+")"; - GLIST=append(GLIST,tmp); + if(mkflg==1, //181102 +///////////// tmp=apply(pltdata1,replace(#,"3d","2d")); + Out=[]; + forall(1..(length(ObjL)),ii, + Obj3=ObjL_ii; + tmp=ProjcoordCurve(Obj3); + Data=Makeskeletondata([tmp],Plt2L,Rr,Eps2); + forall(1..(length(Data)),jj, + Gd=Data_jj; + if((length(Gd)>1) + & (Norm(Ptcrv(1,Gd)-Ptcrv(2,Gd))>Eps), + PtD=[]; + forall(1..(length(Gd)), + tmp=Gd_#; + tmp1=Invparapt(tmp,Obj3); + PtD=append(PtD,tmp1); + ); + Out=append(Out,PtD); + ); + ); + ); + Out=select(Out,length(Projcurve(#))>0); // 16.12.19 + tmp1=apply(Out,textformat(#,5)); + tmp=name3+"="+tmp1; + parse(tmp); + tmp=name2+"=Projcurve("+tmp1+");"; + parse(tmp); + ); + if(mkflg>-1, + Changestyle3d(pltdata1org,["nodisp"]); + ); + if((Noflg<3)&(mkflg>-1), //181103 + if(fileflg!="Y", //181102 + println("generate skeleton :"+name3); + tmp1=text(pltdata1org); + tmp1="list("+substring(tmp1,1,length(tmp1)-1)+")"; + tmp2=text(pltdata2org); + tmp2="list("+substring(tmp2,1,length(tmp2)-1)+")"; + tmp=name3+"=Skeletonpara3data("+tmp1+","+tmp2+","; + tmp=tmp+text(size)+")"; + GLIST=append(GLIST,tmp); + tmp=name2+"=Projpara("+name3+")"; + GLIST=append(GLIST,tmp); + , + GLIST=append(GLIST,"ReadOutData("+Dq+fname+Dq+")");//181102 + ); ); - if(Noflg<2, + if((Noflg<2)&(mkflg>-1), //181103 if(isstring(Ltype), if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Ltype=GetLinestyle(text(Noflg)+Ltype,name2); @@ -4644,9 +4793,22 @@ Skeletondatacindy(nm,pltdata1org,pltdata2org,options):=( Subgraph(name3,opcindy); ); ); - Out; + if(mkflg>-1, + if((fileflg=="Y")&(wflg==1), //181102from + tmp1="skeleton"+nm+".txt"; + SCEOUTPUT = openfile(tmp1); + forall(varL, + println(SCEOUTPUT,#+"//"); + ); + closefile(SCEOUTPUT); + WriteOutData(fname,[name3,parse(name3),name2,parse(name2)]); + ); //181102to + Out; + ); ); +////%Skeletonparadata end//// +////%Makeskeletondata start//// Makeskeletondata(Obj2L,Plt2L,R0,Eps2):=( regional(Allres,Eps,Dmat,Dind,ii,Dt,nn1,nn2,Nind,Nobj, Plt2,PhL,ClipL,ns,pt1,pt2,pt,pta,ptb,za,zb,z1,z2,t1,t2,te, @@ -4849,7 +5011,9 @@ Makeskeletondata(Obj2L,Plt2L,R0,Eps2):=( ); Allres; ); +////%Makeskeletondata end//// +////%Kukannozoku start//// Kukannozoku(Jokyo,KukanL):=( regional(Res,Eps,nn,ii,t1,t2,Ku,Flg,contflg,tmp,tmp1); Eps=10^(-6); @@ -4902,6 +5066,7 @@ Kukannozoku(Jokyo,KukanL):=( ); Res; ); +////%Kukannozoku end//// ////////////////// end of current skeleton////////////// diff --git a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic1logr.txt b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic1logr.txt index 921167a0311..6f0e1a2326e 100644 --- a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic1logr.txt +++ b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic1logr.txt @@ -1,3 +1,21 @@ +// 20181125 +// Fillstore,Fillblack,Fillrestore added +// 2018111 +// Connectseg debugged ( concat ) +// 20181112 +// Connectseg debugged ( concat ) +// Implicitplot changed ( "Msg=" added) +// 20181111 +// eqL : Only the1st character used (basic2,... ) +// 20181110 +// Arrowdata,Arrowheaddata debugged ( option position,cut ) +// Arrowdata changed ( automatic naming supported) +// Arrowhead changed ( cut option supported) +// 20181109 +// Hatchdata changed (Default of "Max" changed to 50) +// 20181103 +// Anyselected added +// Hatchdata changed (option "File=", "Not=","Check=" added) // 20181030 // Drawprocess,Workprocess changed (dispflg added) // 20181026 diff --git a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic1r.cs b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic1r.cs index d466f9fe530..be7bd1adedf 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.2(20181030)"); +println("KeTCindy V.3.2.3(20181201)"); println(ketjavaversion()); -println("ketcindylibbasic1(20181030) loaded"); +println("ketcindylibbasic1(20181125) loaded"); //help:start(); @@ -132,7 +132,11 @@ Ketinit(work,sy,rangex,rangey):=(//181001to if(iswindows(), Batparent="\kc.bat"; , - Shellparent="/kc.sh"; + if(ismacosx(), //181125from + Shellparent="/kc.command"; + , + Shellparent="/kc.sh"; + ); //181125to if(!isexists(Dirwork,""), println(Dirwork+" not exists"); , @@ -174,6 +178,67 @@ Ketinit(work,sy,rangex,rangey):=(//181001to ); ////%Ketinit end//// +////%Fillstore start//// +Fillstore():=( + regional(tmp,tmp1,out); + tmp1=allelements(); + tmp1=select(tmp1,indexof(#.name,"Text")>0); + out=apply(tmp1,[#.name,#.fillcolor]); + out; +); +////%Fillstore end//// + +////%Fillblack start//// +Fillblack():=Fillblack("Running"); +Fillblack(str):=( + regional(tmp,tmp1,store); + tmp1=allelements(); + tmp1=select(tmp1,indexof(#.name,"Text")>0); + store=apply(tmp1,[#.name,#.fillcolor,#.text]); + tmp=select(tmp1,#.name=="Text0"); + if(length(tmp)==0, + forall(store, + tmp=parse(#_1); + tmp.fillcolor=[0,0,0]; + ); + , + Text0.text=str; + ); + store; +); +////%Fillblack end//// + +////%Fillrestore start//// +Fillrestore(store):=( + regional(tmp); + tmp=select(store,#_1=="Text0"); + if(length(tmp)==0, + forall(store, + tmp=parse(#_1); + tmp.fillcolor=#_2; + ); + , + tmp=tmp_1; + Text0.text=tmp_3; + ); +); +////%Fillrestore end//// + +////%Readlines start//// +Readlines(file):=Readlines(Dirwork,file); //181126 +Readlines(path,file):=( +//help:Readlines(path,file); + regional(tmp,out); + out=readfile2str(path,file); + out=tokenize(out,"/LF/"); + tmp=out_(length(out)); + if(length(tmp)==0, + out=out_(1..(length(out)-1)); + ); + out; +); +////%Readlines end//// + ////%Changesetting start//// Changesetting(dir):=( //181017 regional(fname); @@ -646,7 +711,8 @@ Changework(dirorg,options):=( //16.10.21 makesub=1; forall(eqL, tmp=Strsplit(#,"="); - if(Toupper(tmp_1)=="SUB", + tmp1=Toupper(substring(#,0,1)); //181111 + if(tmp1=="S", tmp=Toupper(tmp_2); if(substring(tmp,0,1)=="N", makesub=0; @@ -688,9 +754,9 @@ Changework(dirorg,options):=( //16.10.21 setdirectory(Dirwork); if(!iswindows(), //17.04.11 if(!iskcexists(Dirwork), - SCEOUTPUT = openfile("/kc.sh"); + SCEOUTPUT = openfile("/kc.command"); //181125 closefile(SCEOUTPUT); - println(setexec(Dirwork,"/kc.sh")); + println(setexec(Dirwork,"/kc.command")); //181125 ); ); ); @@ -4431,7 +4497,7 @@ Connectseg(Pdata):=( ); ); if(flg==0, - PlotL=concat(PlotL,Pdata_(vL_1)); + PlotL=concat(PlotL,[Pdata_(vL_1)]); //181112 vL=remove(vL,[vL_1]); ); ); @@ -4441,14 +4507,15 @@ Connectseg(Pdata):=( ////%Implicitplot start//// Implicitplot(name1,func,xrng,yrng):=Implicitplot(name1,func,xrng,yrng,[]); -Implicitplot(name1,func,xrng,yrng,options):=( +Implicitplot(name1,func,xrng,yrng,optionsorg):=( //help:Implicitplot("1","x^2+x*y+y^2=1","x=[-3,3]","y=[-3,3]"); -//help:Implicitplot(options=["Num=[50,50]"]); - regional(name,Fn,varx,vary,rngx,rngy,Mdv,Ndv,tmp,tmp1,tmp2, - Eps,Ltype,Noflg,eqL,color,opsr,opcindy,dx,dy,out,jj,ii,kk, +//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, yval1,yval2,xval1,xval2,eval11,eva12,eval21,eval22,pL,vL,qL); name="imp"+name1; Eps=10^(-4); + options=optionsorg; tmp=Divoptions(options); Ltype=tmp_1; Noflg=tmp_2; @@ -4457,10 +4524,11 @@ Implicitplot(name1,func,xrng,yrng,options):=( opstr=tmp_(length(tmp)-1); opcindy=tmp_(length(tmp)); Mdv=50;Ndv=50; + msg="Y"; forall(eqL, - tmp=indexof(#,"="); - tmp1=Toupper(substring(#,0,tmp-1)); - tmp2=substring(#,tmp,length(#)); + tmp=Strsplit(#,"="); + tmp1=Toupper(substring(tmp_1,0,1)); + tmp2=tmp_2; opstr=opstr+",'"+#+"'"; if(substring(#,0,1)=="N", Mdv=parse(tmp2); @@ -4471,6 +4539,10 @@ Implicitplot(name1,func,xrng,yrng,options):=( Mdv=Mdv_1; ); ); + if(substring(#,0,1)=="M", //181112from + msg=Toupper(substring(tmp2,0,1)); + options=remove(options,[#]); + ); //181112to ); tmp=indexof(func,"="); if(tmp==0, @@ -4541,7 +4613,9 @@ Implicitplot(name1,func,xrng,yrng,options):=( out=out_1; ); if(Noflg<3, - println("generate Implicitplotdata "+name); + if(msg=="Y", //181112 + println("generate Implicitplotdata "+name); + ); if(MeasureDepth(out)==1, tmp1=apply(out,Pcrd(#)); , @@ -4922,14 +4996,14 @@ Drawsegmark(nm,ptlist,options):=( tmp=indexof(#,"="); tmp1=substring(#,tmp,length(#)); tmp1=parse(tmp1); - tmp=substring(#,0,1); - if(tmp=="S" % tmp=="s", + tmp=Toupper(substring(#,0,1)); + if(tmp=="S", size=size*tmp1; ); - if(tmp=="W" % tmp=="w", + if(tmp=="W", wid=wid*tmp1; ); - if(tmp=="T" % tmp=="t", + if(tmp=="T", tp=tmp1; ); ); @@ -5209,13 +5283,15 @@ Putintersect(nm,pdata1,pdata2,ptno):=( Arrowheaddata(point,direction):=Arrowheaddata(point,direction,[]); Arrowheaddata(point,direction,options):=( // help:Arrowheaddata(A,B); -// help:Arrowheaddata(options=[1,18,"Coord=phy"]); - regional(list,Ookisa,Hiraki,Futosa,Houkou,Str,Flg,Ev,Nv,pA,pB, +// 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; + ookisa=0.2*YaSize; + hiraki=YaAngle; + iti=1; + kiri=0; Futosa=0; Str=YaStyle; tmp=Divoptions(options); @@ -5229,17 +5305,19 @@ Arrowheaddata(point,direction,options):=( coord=Touppera(tmp2); ); ); //181018to - if(length(reL)>0,Ookisa=Ookisa*reL_1); - if(length(reL)>1, - tmp=reL_2; - if(tmp<5, - Hiraki=Hiraki*tmp; - , - Hiraki=tmp; + 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; + 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); @@ -5262,7 +5340,7 @@ Arrowheaddata(point,direction,options):=( rF=Numptcrv(Houkou); ); ); - gG=apply(0..10,pP+Ookisa*cos(Hiraki)*[cos(2*pi/10*#),sin(2*pi/10*#)]); + 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, @@ -5285,13 +5363,13 @@ Arrowheaddata(point,direction,options):=( Ev=-1/|Houkou|*Houkou; Nv=[-Ev_2, Ev_1]; if(indexof(Str,"c")>0, - pP=pP-0.5*Ookisa*cos(Hiraki)*Ev; + pP=pP-0.5*ookisa*cos(hiraki)*Ev; ); if(indexof(Str,"b")>0, - pP=pP-Ookisa*cos(Hiraki)*Ev; + 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; + 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; ); @@ -5309,10 +5387,10 @@ Arrowhead(Arg1,Arg2,Arg3):=( ); Arrowhead(nm,point,direction,optionsorg):=(//181018from //help:Arrowhead("1",B,B-A); -//help:Arrowhead(options=[1.5,30,"Coor=P(L)"]); +//help:Arrowhead(options=[size(1),angle(18),position(1),cut(0),"Coor=P(L)"]); //help:Arrowhead(A,"gr1"); regional(name,Ltype,Noflg,reL,opstr,opcindy,color,eqL,coord, - options,pP,Houkou,ptstr,hostr,tmp,tmp1,tmp2,list); + options,cut,pP,Houkou,ptstr,hostr,tmp,tmp1,tmp2,list); name="arh"+nm; //181018 ArrowheadNumber=ArrowheadNumber+1; options=optionsorg; @@ -5328,10 +5406,17 @@ Arrowhead(nm,point,direction,optionsorg):=(//181018from tmp1=substring(tmp_1,0,1); tmp2=substring(tmp_2,0,1); if(Toupper(tmp1)=="C", - coord=Touppera(tmp2); + coord=Toupper(tmp2); options=remove(options,[#]); ); ); //181018to + cut=0; //181110from + if(length(reL)>3, + cut=reL_4; + tmp=reL_(1..3); + options=remove(options,reL); + options=concat(options,tmp); + ); //181110from if(ispoint(direction),Houkou=direction.xy); //181018 if(isstring(direction),Houkou=parse(direction),Houkou=direction); if(MeasureDepth(Houkou)==2,Houkou=Houkou_1); @@ -5360,6 +5445,7 @@ Arrowhead(nm,point,direction,optionsorg):=(//181018from 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; @@ -5382,13 +5468,27 @@ Arrowhead(nm,point,direction,optionsorg):=(//181018from ////%Arrowhead end//// ////%Arrowdata start//// -Arrowdata(nm,ptlist):=Arrowdata(nm,ptlist,[]); +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=[1,18,pos(1),cut(0),"Cutend=0,0","Coord=p/n"]); +//help:Arrowdata(options=[size(1),angle(18),pos(1),cut(0),"Cutend=0,0","Coord=p/l"]); regional(options,Ltype,Noflg,name,opstr,opcindy,eqL,reL,strL,color,size,coord, - flg,lineflg,cutend,tmp,tmp1,tmp2,pA,pB,angle,segpos); + flg,lineflg,cutend,tmp,tmp1,tmp2,pA,pB,angle,segpos,cut); name="ar"+nm; options=optionsorg; tmp=Divoptions(options); @@ -5403,15 +5503,16 @@ Arrowdata(nm,ptlist,optionsorg):=( size=1; // 15.06.11 angle=18; segpos=1; - if(length(reL)>0, - size=relL_1; - if(length(reL)>1, //180719from - angle=reL_2; - if(length(reL)>2, - segpos=reL_3; - ); - );//180719to - ); + cut=0; //181110from + forall(1..(length(reL)), + tmp=reL_#; + if(#==1,size=tmp); + if(#==2,angle=tmp); + if(#==3, + segpos=tmp; + ); + if(#==4,cut=tmp); + ); //181110to lineflg=0; if(contains(strL,"l")%contains(strL,"L"), lineflg=1; @@ -5435,6 +5536,12 @@ Arrowdata(nm,ptlist,optionsorg):=( 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); @@ -5444,12 +5551,6 @@ Arrowdata(nm,ptlist,optionsorg):=( );//181018to if(Noflg<3, println("generate Arrowdata "+name); - if(|cutend|>0,//180719from - tmp=ptlist_2-ptlist_1; - tmp=tmp/|tmp|; - ptlist_1=ptlist_1+tmp*cutend_1; - ptlist_2=ptlist_2-tmp*cutend_2; - );//180719to tmp=name+"="+Textformat([pA,pB],5); parse(tmp); if(lineflg==0, // 16.04.09 from @@ -5461,15 +5562,8 @@ Arrowdata(nm,ptlist,optionsorg):=( ); if(Noflg<2, if(isstring(Ltype), -// if((Noflg==0)&(color!=KCOLOR), //180904 -// Texcom("{");Com2nd("Setcolor("+color+")");//180722 -// ); Listplot("-ar"+nm,[LLcrd(pA),LLcrd(pB)],append(options,"Msg=n")); - Arrowhead(nm,pB,pB-pA,options); -// Ltype=GetLinestyle(text(Noflg)+Ltype,name); -// if((Noflg==0)&(color!=KCOLOR), //180904 -// Texcom("}");//180722 -// ); + Arrowhead(nm,pA+segpos*(pB-pA),pB-pA,options); //181110 , if(Noflg==1,Ltype=0); ); @@ -6524,10 +6618,22 @@ Makehatch(iolistorg,pt,vec,bdylist):=( ); ////%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,outflg); + regional(options,tmp,tmp1,tmp2,eqL,strL,chkL,outflg); options=optionsorg; tmp=Divoptions(options); eqL=tmp_5; @@ -6555,13 +6661,15 @@ Hatchdata(nm,iostr,bdylist,optionsorg):=( //181003from ); ); //181003to Hatchdatacindy(nm,iostr,bdylist):=Hatchdata(nm,iostr,bdylist,[]); -Hatchdatacindy(nm,iostr,bdylistorg,options):=( +Hatchdatacindy(nm,iostr,bdylistorg,optionsorg):=( //help:Hatchdata("1",["ii"],[["ln1","Invert(gr1)"],["gr2","n"]]); -//help:Hatchdata(options=["Out=n(//m/r)","Maxnum=20",angle,width]); +//help:Hatchdata(options=["Not=pointlist","File=y(/m/n)","Max=50","Check=",angle,width]); regional(name,bdylist,bdynameL,bname,Ltype,Noflg,opstr,opcindy,reL, - 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 + 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, @@ -6625,6 +6733,7 @@ Hatchdatacindy(nm,iostr,bdylistorg,options):=( bdylist=append(bdylist,parse(bname)); bdynameL=append(bdynameL,bname); ); + options=optionsorg; tmp=Divoptions(options); Ltype=tmp_1; Noflg=tmp_2; @@ -6637,17 +6746,36 @@ Hatchdatacindy(nm,iostr,bdylistorg,options):=( // interval=0.125*1000/2.54/MilliIn; interval=0.25*1000/2.54/MilliIn; //180706 startP=[(XMIN+XMAX)/2, (YMIN+YMAX)/2]; - maxnum=[30,0]; //181005 [first,second] + maxnum=[50,0]; //181109changed [first,second] + fileflg="N";//181102from + mkflg=1; + chkL=[]; //181109 forall(eqL, tmp=Strsplit(#,"="); - tmp1=Toupper(tmp_1); - if(substring(tmp1,0,1)=="M", + tmp1=Toupper(substring(tmp_1,0,1)); + if(tmp1=="M", maxnum=parse(tmp_2); if(!islist(maxnum), maxnum=[maxnum,0]; ); + options=remove(options,[#]); ); - );//181003to + 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(#), @@ -6661,45 +6789,114 @@ Hatchdatacindy(nm,iostr,bdylistorg,options):=( ); ); ); - 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 + 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(#)); + ); + ); + ); + ); ); - ); - 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); + 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(Noflg<3, - println("generate Hatchdata "+name); - tmp=name+"="+textformat(AnsL,5); - parse(tmp); - if(!islist(iostr),tmp1=[iostr],tmp1=iostr); - tmp="c("; - forall(tmp1, - tmp=tmp+Dq+#+Dq+","; + 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); + ); ); - tmp=substring(tmp,0,length(tmp)-1)+")"; - tmp2=name+"=Hatchdata("+tmp; - forall(bdynameL, - tmp2=tmp2+",list("+#+")"; + 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); + tmp="c("; + forall(tmp1, + tmp=tmp+Dq+#+Dq+","; + ); + tmp=substring(tmp,0,length(tmp)-1)+")"; + tmp2=name+"=Hatchdata("+tmp; + forall(bdynameL, + tmp2=tmp2+",list("+#+")"; + ); + tmp2=tmp2+opstr+")"; + GLIST=append(GLIST,tmp2); + , + GLIST=append(GLIST,"ReadOutData("+Dq+fname+Dq+")");//181102 ); - tmp2=tmp2+opstr+")"; - GLIST=append(GLIST,tmp2); ); - if(Noflg<2, + if((Noflg<2)&(mkflg>-1), if(isstring(Ltype), if((Noflg==0)&(color!=KCOLOR), //180904 Texcom("{");Com2nd("Setcolor("+color+")");//180722 @@ -6713,12 +6910,23 @@ Hatchdatacindy(nm,iostr,bdylistorg,options):=( ); GCLIST=append(GCLIST,[name,Ltype,opcindy]); ); - tmp2=[]; - forall(AnsL,tmp1, - tmp=apply(tmp1,LLcrd(#)); - tmp2=append(tmp2,tmp); + 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; ); - tmp2; ); ////%Hatchdata end//// diff --git a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic2logr.txt b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic2logr.txt index aec118d8bfa..ab1ae5703e7 100644 --- a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic2logr.txt +++ b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic2logr.txt @@ -1,3 +1,10 @@ +// 20181125 +// Mkslides, Mksldesummary chanded (Fillblack added ) +// Presentation changed ( load => readfile2str ) +// 20181106 +// WritetoRS changed ( Abnormal point ignored ) +// 20181030 +// ReadOutData debugged (option Disp= ) // 20181024 // ReadOutData changed (option Disp= ) // 20181021 diff --git a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic2r.cs b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic2r.cs index db5421162a5..e96e1d36cce 100644 --- a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic2r.cs +++ b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic2r.cs @@ -14,7 +14,7 @@ // along with this program. If not, see <http://www.gnu.org/licenses/> // -println("ketcindybasic2(20181024) loaded"); +println("ketcindybasic2(20181125) loaded"); //help:start(); @@ -1775,7 +1775,6 @@ Periodfun(defL,reporg,optionorg):=( // 16.11.24 tmp=indexof(#,"=");//180725from tmp=[substring(#,0,tmp-1),substring(#,tmp,length(#))]; if(Toupper(substring(tmp_1,0,3))=="CON", - println([1658,tmp_2]); tmp1=Toupper(Op(1,tmp_2)); if(tmp1=="N", connect=[]; @@ -1891,9 +1890,9 @@ Tabledatalight(nm,xLst,yLst,rmvL,optionorg):=( rng="Y"; forall(eqL, tmp=indexof(#,"="); - tmp1=Toupper(substring(#,0,2)); + tmp1=Toupper(substring(#,0,1)); //181111 tmp2=Toupper(substring(#,tmp,tmp+1)); - if(tmp1=="RN", + if(tmp1=="R", rng=tmp2; options=remove(options,[#]); ); @@ -1987,9 +1986,9 @@ Tabledata(nm,xLst,yLst,rmvL,optionorg):=( rng="Y"; forall(eqL, tmp=indexof(#,"="); - tmp1=Toupper(substring(#,0,2)); + tmp1=Toupper(substring(#,0,1)); //181111 tmp2=Toupper(substring(#,tmp,tmp+1)); - if(tmp1=="RN", + if(tmp1=="R", rng=tmp2; options=remove(options,[#]); ); @@ -2743,12 +2742,16 @@ WritetoRS(filename,shchoice):=( Plist=[]; Pnamelist=[]; forall(remove(allpoints(),[SW,NE]), - tmp=Lcrd(#); - tmp1=format(re(tmp_1),6);// 15.02.05 - tmp2=format(re(tmp_2),6); - tmp=#.name+"="+"c("+tmp1+","+tmp2+");"; - tmp=tmp+"Assignadd('"+#.name+"',"+#.name+")"; - Plist=append(Plist,tmp); + if(indexof(#.name,"[")==0, //181106 + tmp=Lcrd(#); + tmp1=format(re(tmp_1),6);// 15.02.05 + tmp2=format(re(tmp_2),6); + tmp=#.name+"="+"c("+tmp1+","+tmp2+");"; + tmp=tmp+"Assignadd('"+#.name+"',"+#.name+")"; + Plist=append(Plist,tmp); + , + println("Remove the abnormal poiint "+#.name); //181106 + ); ); SCEOUTPUT = openfile(filename); tmp=Datetime(); @@ -2808,6 +2811,7 @@ WritetoRS(filename,shchoice):=( forall(Plist, println(SCEOUTPUT,#); ); + VLIST=select(VLIST,substring(#_1,0,1)!="["); //181107 forall(VLIST, tmp=#_1; tmp1=#_2; @@ -2827,7 +2831,7 @@ WritetoRS(filename,shchoice):=( // tmp=substring(tmp,0,length(tmp)-1); println(SCEOUTPUT,"Assignadd('"+tmp+"',"+tmp+")"); ); - forall(FUNLIST, + forall(FUNLIST, println(SCEOUTPUT,#); ); forall(GLIST, @@ -3011,14 +3015,21 @@ RemoveOut(pltlist):=( ////%ReadOutData start//// ReadOutData():=ReadOutData(Fnameout); ReadOutData(filename):=ReadOutData("",filename); //16.03.07 -ReadOutData(path,filename):=ReadOutData(path,filename,[]);//181024(2lines) -ReadOutData(pathorg,filenameorg,options):=( +ReadOutData(Arg1,Arg2):=( //181030from + if(islist(Arg2), + ReadOutData("",Arg1,Arg2); + , + ReadOutData(Arg1,Arg2,[]); + ); +); //181030to +ReadOutData(pathorg,filenameorg,optionsorg):=( //help:ReadOutData(); //help:ReadOutData("file.txt"); //help:ReadOutData("/datafolder","file.txt"); //help:ReadOutdata(options=["Disp=n(/y)]"); - regional(path,filename,varname,varL,ptL,pts,tmp,tmp1,tmp2,tmp3,tmp4, + regional(options,path,filename,varname,varL,ptL,pts,tmp,tmp1,tmp2,tmp3,tmp4, nmbr,cmdall,cmd,cmdorg,outdt,goutdt,eqL,dispflg); + options=optionsorg; dispflg=1; tmp=Divoptions(options); //181024from eqL=tmp_5; @@ -3028,6 +3039,7 @@ ReadOutData(pathorg,filenameorg,options):=( tmp2=substring(tmp_2,0,1); tmp2=Toupper(tmp2); if(tmp1=="D", if(tmp2=="N",dispflg=0); + options=remove(options,[#]); //181030 ); ); //181024to path=pathorg; //16.03.07 from @@ -3036,8 +3048,8 @@ ReadOutData(pathorg,filenameorg,options):=( if(indexof(path,"\")>0,tmp1="\",tmp1="/"); tmp=substring(path,length(path)-1,length(path)); if(tmp!=tmp1,path=path+tmp1); - ); //16.03.07 until - filename=filenameorg; // 16.04.17 + ); //16.03.07to + filename=filenameorg; // 16.04.17 if(indexof(filename,".")==0,filename=filename+".txt"); tmp=load(filename); cmdall=tokenize(tmp,"//"); @@ -3110,6 +3122,8 @@ ReadOutData(pathorg,filenameorg,options):=( print("readoutdata from "+tmp+" : "); if(dispflg==1, //181024from println(varL); + , + println(""); ); //181024to varL; ); @@ -4563,9 +4577,12 @@ Presentation(texfile,txtfile):=( paractr=0; //16.12.31 if(indexof(texfile,".")==0,file=texfile+".tex",file=texfile); if(indexof(txtfile,".")==0,tmp1=txtfile+".txt",tmp1=txtfile); - tmp=load(tmp1); - tmp=replace(tmp,"////","||||");// 16.05.11, 06.24(reactivated) - slideL=tokenize(tmp,"//"); +// tmp=load(tmp1); //181125from + tmp=readfile2str(Dirwork,tmp1); + tmp=replace(tmp,"////","||||"); + tmp=replace(tmp,"/LF/::","::"); + tmp=replace(tmp,"///LF/","/LF/"); + slideL=tokenize(tmp,"/LF/"); //181125to slideorgL=slideL; // 16.07.11 slideL=apply(slideL,Removespace(#)); tmp=select(1..length(slideL),length(slideL_#)>0); // 16.07.11from @@ -5210,7 +5227,8 @@ Presentation(texfile,txtfile):=( ////%Mkslides start//// Mkslides():=( - regional(sep,parent,texparentorg,tmp,tmp1,tmp2,tmp3,tmp4,flg); + regional(store,sep,parent,texparentorg,tmp,tmp1,tmp2,tmp3,tmp4,flg); + store=Fillblack();//181125 tmp4=Fhead; Fhead=""; if(!iswindows(), //17.10.13 @@ -5271,6 +5289,7 @@ Mkslides():=( setdirectory(Dirwork); Fhead=tmp4; Texparent=texparentorg;//17.04.10 + Fillrestore(store);//181125 ); ////%Mkslides end//// @@ -5288,7 +5307,8 @@ Mkslidesummary(fin,fout):= Mkslidesummary(fin,fout,["m","Wait=3"]); Mkslidesummary(inputfile,outputfile,options):=( //help:Mkslidesummary(fin,fout,options); - regional(fin,fout,out,figflg,dirworkorg,dirtop,tmp); + regional(store,fin,fout,out,figflg,dirworkorg,dirtop,tmp); + store=Fillblack();//181125 dirworkorg=Dirwork;//17.04.10from dirtop=replace(Dirwork,pathsep()+"fig",""); Changework(dirtop);//17.04.10uptp @@ -5338,6 +5358,7 @@ Mkslidesummary(inputfile,outputfile,options):=( ); kc(); Changework(dirworkorg);//17.04.10 + Fillstore(store);//181125 ); ////%Mkslidesummary end//// @@ -5410,13 +5431,13 @@ BBdata(fname,optionorg):=( ); forall(eqL, tmp=indexof(#,"="); - tmp1=Toupper(substring(#,0,2)); + tmp1=Toupper(substring(#,0,1)); //181111 tmp2=substring(#,tmp,length(#)); - if(tmp1=="W=", + if(tmp1=="W", addop=addop+",width="+tmp2; options=remove(options,[#]); ); - if(tmp1=="H=", + if(tmp1=="H", addop=addop+",height="+tmp2; options=remove(options,[#]); ); @@ -5427,7 +5448,11 @@ BBdata(fname,optionorg):=( if(iswindows(), kcfile="kc.bat"; , - kcfile="kc.sh"; + if(macosx(), + kcfile="kc.command"; + , + kcfile="kc.sh"; + ); ); if(flg==0, tmp=load(fout); // diff --git a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibmvlogr.txt b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibmvlogr.txt index 3b86853918f..5a8170e32c5 100644 --- a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibmvlogr.txt +++ b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibmvlogr.txt @@ -1,3 +1,7 @@ +// 20181128 +// Mkviewobj changed (Fillblack added) +// 20181125 +// Mkflipanime,Mkanimation,Parafolder changed (Fillblack added) // 20180711 // Setpara changed ("Mag" removed ) // 20180617 diff --git a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibmvr.cs b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibmvr.cs index 96e79b3f532..2c297051bf2 100755 --- a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibmvr.cs +++ b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibmvr.cs @@ -14,10 +14,11 @@ // along with this program. If not, see <http://www.gnu.org/licenses/> // -println("ketcindymv(20180711) loaded"); +println("ketcindymv(20181125) loaded"); //help:start(); +////%Setpara start//// Setpara(path,fstr,sL):=Setpara(path,fstr,sL,[],[]); Setpara(pathorg,fstr,sL,options):= Setpara(pathorg,fstr,sL,options,[]); @@ -98,7 +99,9 @@ Setpara(pathorg,fstr,sL,options,optionsanim):=( ); COM2ndlistback=ctmp; ); +////%Setpara end//// +////%Parafolder start//// Parafolder():=Parafolder(ParaFstr,ParaSL,ParaOp); Parafolder(fstr,sL):=Parafolder(fstr,sL,[]); Parafolder(fstr,sL,optionorg):=( @@ -109,8 +112,9 @@ Parafolder(fstr,sL,optionorg):=( //help:Parafolder(optionsadd=[""Outfile=n",Pause=10(ms)"]); //help:Paraslide(para=folder:layery:pos:input,scale); //help:Paraslide(para=folder:layery:pos:include:[width=100]); - regional(nn,tmp,tmp1,tmp2,strL,eqL,waiting,outflg,pause, + regional(store,nn,tmp,tmp1,tmp2,strL,eqL,waiting,outflg,pause, mkr,mktex,options,sfL,dirbkup,pfile,ctr,flg,varL,waitingR,timeC,timeR); + store=Fillblack(); //181125 tmp=indexof(fstr,"("); tmp1=substring(fstr,tmp,length(fstr)); tmp=indexof(tmp1,")"); @@ -258,8 +262,11 @@ Parafolder(fstr,sL,optionorg):=( ); //180617to Changework(Dirworkbkup); Setfiles(Fheadbkup); + Fillrestore(store); //181125 ); +////%Parafolder end//// +////%Animatefile start//// Animatefile():=Animatefile(Dirwork,ParaPath); Animatefile(path,folder):=( //help:Animatefile(); @@ -272,16 +279,16 @@ Animatefile(path,folder):=( OpA="loop,controls,buttonsize=3mm"; remflg=0; forall(eqL, - tmp1=Toupper(substring(#,0,2)); + tmp1=Toupper(substring(#,0,1)); //181111 tmp=indexof(#,"="); tmp2=substring(#,tmp,length(#)); - if(tmp1=="FR", + if(tmp1=="F", FRate=tmp2; ); - if(tmp1=="SC", + if(tmp1=="S", Scale=tmp2; ); - if(tmp1=="OP", // 17.12.07from + if(tmp1=="O", // 17.12.07from if(length(tmp2)>0, tmp2=replace(tmp2,"[",""); tmp2=replace(tmp2,"]",""); @@ -333,7 +340,9 @@ Animatefile(path,folder):=( closefile(SCEOUTPUT); println(fname+" has been generated"); ); +////%Animatefile end//// +////%Mkanimation start//// Mkanimation():=( regional(remflg,tmp,eqL,tmp1,tmp2); if(!isexists(Dirwork,ParaPath), //17.10.14from @@ -346,8 +355,9 @@ Mkanimation(folder):=Mkanimation(Dirwork,folder); Mkanimation(path,folder):=( //help:Mkanimation(); //help:Mkanimation(path,folder); - regional(Fheadbkup,Pathpdfbkup,tex,article,parent, + regional(store,Fheadbkup,Pathpdfbkup,tex,article,parent, eqL,mag,title,tmp,tmp1,tmp2,tmp3,flg); + store=Fillblack(); //181125 tmp=Divoptions(ParaOpAnim); //17.11.25from eqL=tmp_5; mag="1600"; @@ -479,8 +489,11 @@ Mkanimation(path,folder):=( ); Fhead=Fheadbkup; Pathpdf= Pathpdfbkup; + Fillrestore(store); //181125 ); +////%Mkanimation end//// +////%Mkflipanime start//// Mkflipanime():=( regional(remflg,tmp,eqL,tmp1,tmp2); if(!isexists(Dirwork,ParaPath), //17.10.14from @@ -492,8 +505,9 @@ Mkflipanime(folder):=Mkflipanime(Dirwork,folder); Mkflipanime(path,folder):=( //help:Mkfilpanime(); //help:Mkflipanime(path,folder); - regional(Fheadbkup,tex,article,parent,eqL,mag,title, + regional(store,Fheadbkup,tex,article,parent,eqL,mag,title, tmp,tmp1,tmp2,tmp3,texfiles,flg); + store=Fillblack(); //181125 tmp=Divoptions(ParaOpAnim); //17.11.25from eqL=tmp_5; mag="1600"; @@ -634,7 +648,9 @@ Mkflipanime(path,folder):=( kc(); ); Fhead=Fheadbkup; + Fillrestore(store); //181125 ); +////%Mkflipanime end//// //help:end(); diff --git a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindyliboutlogr.txt b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindyliboutlogr.txt index aa7eb97c1e9..e8d2d6fba0a 100644 --- a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindyliboutlogr.txt +++ b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindyliboutlogr.txt @@ -1,3 +1,29 @@ +// 201811230 +// Mkviewobj debugged ( Out=n ) +// CalcbyR changed ( for cat ) +// 201811225 +// Readcsv majorly changed ( readfile2str used ) +// 20181116 +// Startsurf changed ( case of 4 argments added ) +// 20181114 +// Execcmd debugged ( Changestye3d for sfcut,wire ) +// Sfbdparadata,... changed ("Color=.." copied to optionh if no color option ) +// 20181112 +// Sfcutparadatacdy added +// Sfcutparadatacdy debugged (case of MeasureDepth==1) +// 20181107 +// Cform debugged (integer => integer.0) +// global StyleListC added ( to Sfbdparadata,... ) +// 20181106 +// Cform debugged (new version made) +// ExeccmdC changed (subgraph added ) +// 20181105 +// Crvsfparadata changed ( multi surface supported ) +// 20181101 +// CalcbyC chanded (wflg retured) +// ExeccmdC changed ( WritedataC added when necessary ) +// Contsurf added +// ExeccmdC changed ( for Contsurf ) // 20181029 // in ReadOutData C callings, option=["Disp=n"] added // 20181020 diff --git a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindyliboutr.cs b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindyliboutr.cs index 8f6a399f617..904f5dfd369 100644 --- a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindyliboutr.cs +++ b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindyliboutr.cs @@ -14,7 +14,7 @@ // along with this program. If not, see <http://www.gnu.org/licenses/> // -println("ketcindylibout(20181029 loaded"); +println("ketcindylibout(20181130 loaded"); //help:start(); @@ -48,6 +48,7 @@ WritetoS(fname,cmdL):=( closefile(SCEOUTPUT); ); +////%kcS start//// kcS(path,fname):=kcS(path,fname,[]); kcS(path,fname,optionorg):=( //help:kcS(PathS,"boxdata"); @@ -114,7 +115,11 @@ kcS(path,fname,optionorg):=( closefile(SCEOUTPUT); println(kc(Dirwork+Batparent,Dirlib,Fnametex));// 16.05.29, 0605 , - SCEOUTPUT = openfile("kc.sh"); + if(ismacosx(), //181125from + SCEOUTPUT = openfile("kc.command"); + , + SCEOUTPUT = openfile("kc.sh"); + ); //181125to println(SCEOUTPUT,"#!/bin/sh"); println(SCEOUTPUT,"cd "+Dq+Dirwork+Dq); tmp=Dq+path+Dq+" -nwni -f "+filename; @@ -127,6 +132,7 @@ kcS(path,fname,optionorg):=( setdirectory(Dirwork); ); ); +////%kcS end//// SetpathS():=( regional(tmp,tmp1); @@ -209,29 +215,29 @@ CalcbyS(name,path,cmd,optionorg):=( wfile=""; forall(eqL, tmp=indexof(#,"="); - tmp1=Toupper(substring(#,0,2)); + tmp1=Toupper(substring(#,0,1)); tmp2=substring(#,tmp,length(#)); - if(tmp1=="CA", + if(tmp1=="C", cat=Toupper(substring(tmp2,0,1));// 16.11.24 options=remove(options,[#]); ); - if(tmp1=="NC", + if(tmp1=="N", ncoL=parse(tmp2); options=remove(options,[#]); ); - if(tmp1=="EX", + if(tmp1=="E", if(indexof(tmp2,".")==0,ext="."+tmp2,ext=tmp2); options=remove(options,[#]); ); - if(tmp1=="WA", + if(tmp1=="W", waiting=parse(tmp2); options=remove(options,[#]); ); - if(tmp1=="DI", + if(tmp1=="D", dig=parse(tmp2); options=remove(options,[#]); ); - if(tmp1=="FI", // 16.06.26from + if(tmp1=="F", // 16.06.26from wfile=tmp2; options=remove(options,[#]); ); // 16.06.26until @@ -442,9 +448,9 @@ Scifun(name,fun,argL,optionorg):=( eqL=tmp_5; forall(eqL, tmp=indexof(#,"="); - tmp1=Toupper(substring(#,0,3)); + tmp1=Toupper(substring(#,0,1)); //181111 tmp2=substring(#,tmp,length(#)); - if((tmp1=="DIS") % (tmp1=="DSP") , + if(tmp1=="D" , tmp=Toupper(substring(tmp2,0,1)); if((tmp=="F") % (tmp=="N"), disp=0; @@ -602,7 +608,11 @@ kcR(path,fname,optionorg):=( closefile(SCEOUTPUT); println(kc(Dirwork+Batparent,Dirlib,Fnametex));// 16.05.29,06.05 , - SCEOUTPUT = openfile("kc.sh"); + if(ismacosx(), //181125from + SCEOUTPUT = openfile("kc.command"); + , + SCEOUTPUT = openfile("kc.sh"); + ); //181125to println(SCEOUTPUT,"#!/bin/sh"); println(SCEOUTPUT,"cd "+Dq+Dirwork+Dq); if(PathR=="",tmp="R",tmp=PathR);//16.10.20 @@ -730,6 +740,7 @@ MkprecommandR(prec,chstr):=( cmdL; ); +////%CalcbyR start//// CalcbyR(name,cmd):=CalcbyR(name,PathR,cmd,[]); CalcbyR(name,Arg1,Arg2):=( if(isstring(Arg1), @@ -740,7 +751,7 @@ CalcbyR(name,Arg1,Arg2):=( ); CalcbyR(name,path,cmd,optionorg):=( //help:CalcbyR(name,cmd); -//help:CalcbyR(options=["m/r","Wait=2","Out=yes","Pre=PVOFG","Res=" ]); +//help:CalcbyR(options=["m/r","Wait=2","Out=y/n","Pre=PVOFG"]); //help:CalcbyR(options2=["Pre=!G" ]); regional(options,tmp,tmp1,tmp2,tmp3,realL,strL,eqL, cat,dig,prestr,flg,wflg,file,nc,arg,cmdR,cmdlist,wfile,waiting); @@ -750,7 +761,17 @@ CalcbyR(name,path,cmd,optionorg):=( realL=tmp_6; strL=tmp_7; dig=5; - cat="Y"; + tmp=cmd_(length(cmd)-1); //181130from + if(indexof(tmp,"=")+indexof(tmp,"::")>0, + cat="Y"; + , + tmp=cmd_(length(cmd)); + if(length(tmp)>0, + cat="Y"; + , + cat="N"; + ); + ); //181130to wfile=""; prestr="PVOFG"; //180508 waiting=30; //180608 @@ -1056,6 +1077,7 @@ CalcbyR(name,path,cmd,optionorg):=( ); ); ); +////%CalcbyR end//// Rfun(name,fun,argL):=Rfun(name,fun,argL,[]);//16.10.22 Rfun(name,fun,argL,optionorg):=( @@ -1074,9 +1096,9 @@ Rfun(name,fun,argL,optionorg):=( eqL=tmp_5; forall(eqL, tmp=indexof(#,"="); - tmp1=Toupper(substring(#,0,3)); + tmp1=Toupper(substring(#,0,1)); //181111 tmp2=substring(#,tmp,length(#)); - if((tmp1=="DIS") % (tmp1=="DSP") , + if(tmp1=="D", tmp=Toupper(substring(tmp2,0,1)); if((tmp=="F") % (tmp=="N"), disp=0; @@ -1099,6 +1121,7 @@ Rfun(name,fun,argL,optionorg):=( parse(nm); ); +////%Readcsv start//// Readcsv(file):=Readcsv(Dirwork,file,[]); Readcsv(Arg1,Arg2):=( if(isstring(Arg2), @@ -1108,9 +1131,9 @@ Readcsv(Arg1,Arg2):=( ); ); Readcsv(pathorg,file,optionorg):=( -//help:Readcsv("ex.csv"); -//help:Readcsv(directory,"ex.csv"); -//help:Readcsv(options=["Head=yes","Sep=-999","Flat=no","Use=R"]); +// help:Readcsv("ex.csv"); +// help:Readcsv(directory,"ex.csv"); +// help:Readcsv(options=["Head=yes","Sep=-999","Flat=no","Use=R"]); regional(path,fname,fout,options,eqL,header,cmdL,sep, dt,nrow,tmp,tmp1,tmp2,csv,use,flat); options=optionorg; @@ -1125,31 +1148,31 @@ Readcsv(pathorg,file,optionorg):=( tmp=indexof(#,"="); tmp1=substring(#,0,tmp-1); tmp2=substring(#,tmp,length(#)); - tmp=Toupper(substring(tmp1,0,2)); - if(tmp=="HE", + tmp=Toupper(substring(tmp1,0,1)); //181111 + if(tmp=="H", tmp=Toupper(substring(tmp2,0,1)); if(tmp=="F" % tmp=="N", header=0; options=remove(options,[#]); ); ); -// if(tmp=="WA", // removed:17.02.19 +// if(tmp=="W", // removed:17.02.19 // waiting=parse(tmp2); // options=remove(options,[#]); // ); - if(tmp=="SE", + if(tmp=="S", sep=tmp2; options=remove(options,[#]); ); - if(tmp=="CS", + if(tmp=="C", csv=Toupper(substring(tmp2,0,1)); options=remove(options,[#]); ); - if(tmp=="US", + if(tmp=="U", use=Toupper(substring(tmp2,0,1)); options=remove(options,[#]); ); - if(tmp=="FL", + if(tmp=="F", flat=Toupper(substring(tmp2,0,1)); options=remove(options,[#]); ); @@ -1239,6 +1262,22 @@ Readcsv(pathorg,file,optionorg):=( ); ); ); +// New readcsv (181125) +Readcsv(file):=Readcsv(Dirwork,file); +Readcsv(path,file):=( +//help:Readcsv("ex.csv"); +//help:Readcsv(directory,"ex.csv"); +//help:Readcsv(options=["Head=yes","Sep=-999","Flat=no","Use=R"]); + regional(dt); + dt=readfile2str(path,file); + dt=tokenize(dt,"/LF/"); + if(dt_(length(dt))=="", + dt=dt_(1..(length(dt)-1)); + ); + dt=apply(dt,tokenize(#,",")); + dt; +); +////%Readcsv end//// Writecsv(nmL,data,file):=Writecsv(nmL,data,file,[]); Writecsv(nmL,dataorg,file,optionorg):=( @@ -1459,6 +1498,7 @@ PlotdataR(name1,path,func,variable,optionorg):=( ); ////%PlotdataR end//// +////%PlotdiscR start//// PlotdiscR(nm,fun,varrng):=PlotdiscR(nm,fun,varrng,[]); PlotdiscR(nm,fun,varrng,options):=( //help:PlotdiscR("1","dbinom(k,10,0.4)","k=[0,10]"); @@ -1489,7 +1529,9 @@ PlotdiscR(nm,fun,varrng,options):=( Listplot(name,tmp,options); ); ); +////%PlotdiscR end//// +////%Boxplot start//// Boxplot(nm,dataorg,ypos,dy):=Boxplot(nm,dataorg,ypos,dy,[]); Boxplot(nm,dataorg,ypos,dy,optionorg):=( //help:Boxplot("1",dt,2,1/2,[""]); @@ -1648,7 +1690,9 @@ Boxplot(nm,dataorg,ypos,dy,optionorg):=( [bp_(1..5),out]; ); ); +////%Boxplot end//// +////%Histplot start// Histplot(nm,dataorg):=Histplot(nm,dataorg,[]); Histplot(nm,dataorg,optionorg):=( //help:Histplot("1",data(fillename)); @@ -1665,11 +1709,11 @@ Histplot(nm,dataorg,optionorg):=( relative=0; waiting=3; forall(eqL, - tmp=indexof(#,"="); - tmp1=substring(#,tmp,length(#)); - if(Toupper(substring(#,0,1))=="B", - if(substring(tmp1,0,1)=="[", - tmp1="c("+substring(tmp1,1,length(tmp1)-1)+")"; + tmp=Strsplit(#,"="); + tmp1=Toupper(substring(tmp_1,0,1)); + if(tmp1=="B", + if(substring(tmp_2,0,1)=="[", + tmp1="c("+substring(tmp_2,1,length(tmp_2)-1)+")"; //181104 ); breaks="breaks="+tmp1; options=remove(options,[#]); @@ -1827,6 +1871,7 @@ Histplot(nm,dataorg,optionorg):=( [bdata,cdata]; ); ); +////%Histplot end// ////%Scatterplot start//// Scatterplot(nm,file):=Scatterplot(nm,file,[],[]); @@ -2338,6 +2383,7 @@ WritetoA(fname,cmdL):=( closefile(SCEOUTPUT); ); +////%kcA start//// kcA(fname):=kcA(fname,[]); kcA(fname,optionorg):=( //help:kcA("boxdata"); @@ -2407,7 +2453,11 @@ kcA(fname,optionorg):=( tmp=replace(filename,".rr",".txt"); println(kc(Dirwork+Batparent,Dirlib,tmp)); // 16.05.29,06.05 , - SCEOUTPUT = openfile("kc.sh"); + if(ismacosx(), //181125from + SCEOUTPUT = openfile("kc.command"); + , + SCEOUTPUT = openfile("kc.sh"); + ); //181125to println(SCEOUTPUT,"#!/bin/sh"); println(SCEOUTPUT,"cd "+Dq+Dirwork+Dq); tmp="rm "+replace(filename,".rr",".txt"); @@ -2424,7 +2474,9 @@ kcA(fname,optionorg):=( setdirectory(Dirwork); ); ); +////%kcA end//// +////%CalcbyA start//// CalcbyA(name,cmd):=CalcbyA(name,cmd,[]); CalcbyA(name,cmd,optionorg):=( //help:CalcbyA("a",cmd); @@ -2611,6 +2663,7 @@ CalcbyA(name,cmd,optionorg):=( println(" CalcbyA succeeded "+name+" ("+text(tmp2)+" sec)"); ); ); +////%CalcbyA end//// AsfunO(name,fun,argL):=AsirfunO(name,fun,argL); // 16.02.03 AsfunO(name,fun,argL,options):=AsirfunO(name,fun,argL,options); @@ -2625,9 +2678,9 @@ AsirfunO(name,fun,argLorg,options):=( argL=argLorg; forall(eqL, tmp=indexof(#,"="); - tmp1=Toupper(substring(#,0,3)); + tmp1=Toupper(substring(#,0,1)); tmp2=substring(#,tmp,length(#)); - if(tmp1=="PRO", // 16.05.26from + if(tmp1=="P", // 16.05.26from tmp=Toupper(substring(tmp2,0,1)); if((tmp=="T") % (tmp=="Y"), tmp1=argL_(length(argL)); @@ -2654,13 +2707,13 @@ Asirfun(name,fun,argL,optionorg):=( eqL=tmp_5; forall(eqL, tmp=indexof(#,"="); - tmp1=Toupper(substring(#,0,3)); + tmp1=Toupper(substring(#,0,1)); //181111 tmp2=substring(#,tmp,length(#)); - if(tmp1=="PRE", + if(tmp1=="P", precise=parse(tmp2); options=remove(options,[#]); ); - if((tmp1=="DIS") % (tmp1=="DSP"), + if(tmp1=="D", tmp=Toupper(substring(tmp2,0,1)); if((tmp=="F") % (tmp=="N"), disp=0; @@ -2772,6 +2825,7 @@ WritetoM(fname,cmdL,allflg):=( closefile(SCEOUTPUT); ); +////%kcM start//// kcM(fname):=kcM(fname,[]); kcM(fname,optionorg):=( //help:kcM("boxdata"); @@ -2852,7 +2906,11 @@ kcM(fname,optionorg):=( tmp=replace(filename,".max",".txt"); println(kc(Dirwork+Batparent,Mackc+Dirlib,tmp));// 16.05.29,06.05 , - SCEOUTPUT = openfile("kc.sh"); + if(ismacosx(), //181125from + SCEOUTPUT = openfile("kc.command"); + , + SCEOUTPUT = openfile("kc.sh"); + ); //181125to println(SCEOUTPUT,"#!/bin/sh"); println(SCEOUTPUT,"cd "+Dq+Dirwork+Dq); tmp="rm "+replace(filename,".max",".txt"); @@ -2868,7 +2926,9 @@ kcM(fname,optionorg):=( setdirectory(Dirwork); ); ); +////%kcM end//// +////%CalcbyM start//// CalcbyM(name,cmd):=CalcbyM(name,cmd,[]); CalcbyM(name,cmd,optionorg):=( //help:CalcbyM("a",cmdL); @@ -3127,7 +3187,9 @@ CalcbyM(name,cmd,optionorg):=( ); ); ); +////%CalcbyM end//// +////%Mxfun start//// Mxfun(name,fun,argL):=Mxfun(name,fun,argL,[]); Mxfun(name,fun,argL,optionorg):=( //help:Mxfun("ca1","diff",["sin(x)^3","x"],[""]); @@ -3144,13 +3206,13 @@ Mxfun(name,fun,argL,optionorg):=( eqL=tmp_5; forall(eqL, tmp=indexof(#,"="); - tmp1=Toupper(substring(#,0,3)); + tmp1=Toupper(substring(#,0,1)); tmp2=substring(#,tmp,length(#)); - if(tmp1=="PRE", + if(tmp1=="P", precise=parse(tmp2); options=remove(options,[#]); ); - if((tmp1=="DIS") % (tmp1=="DSP") , + if(tmp1=="DIS" , tmp=Toupper(substring(tmp2,0,1)); if((tmp=="F") % (tmp=="N"), disp=0; @@ -3195,7 +3257,9 @@ Mxfun(name,fun,argL,optionorg):=( ); parse(nm); ); +////%Mxfun end//// +////%Mxtex start//// Mxtex(nm,ex):=Mxtex(nm,ex,[]); Mxtex(nm,ex,optionorg):=( //help:Mxtex("1","sin(x)/x"); @@ -3210,9 +3274,9 @@ Mxtex(nm,ex,optionorg):=( set=[]; forall(eqL, tmp=indexof(#,"="); - tmp1=Toupper(substring(#,0,3)); + tmp1=Toupper(substring(#,0,1)); tmp2=substring(#,tmp,length(#)); - if((tmp1=="DIS") % (tmp1=="DSP") , + if(tmp1=="D" , tmp=Toupper(substring(tmp2,0,1)); if((tmp=="F") % (tmp=="N"), disp=0; @@ -3257,7 +3321,9 @@ Mxtex(nm,ex,optionorg):=( parse(tmp); out; ); +////%Mxtex end//// +////%MxtexL start//// MxtexL(nm,exlist):=MxtexL(nm,exlist,[]); // 16.05.27 MxtexL(nm,exlist,options):=( regional(out,tmp,tmp1); @@ -3287,7 +3353,9 @@ Mxbatch(file):=( ); out; ); +////%MxtexL end//// +////%Mxload start//// Mxload(file):=( //17.06.16 //help:Mxload(["rkfun.lispp"]); regional(figL,out,path,tmp,tmp1,tmp2); @@ -3302,7 +3370,9 @@ Mxload(file):=( //17.06.16 ); out; ); +////%Mxload end//// +////%Maxima2Cindydata start//// Maxima2Cindydata(str):=( //17.10.24 regional(out,numstr,eL,nn,ne,flg,tmp); numstr="-0123456789"; @@ -3333,7 +3403,9 @@ Maxima2Cindydata(str):=( //17.10.24 ); parse(out); ); +////%Maxima2Cindydata end//// +////%kcV3 start//// kcV3(fname):=kcV3(Dirwork,fname); kcV3(path,fname):=( //help:kcV3(path,"ex.obj"); @@ -3363,7 +3435,11 @@ kcV3(path,fname):=( closefile(SCEOUTPUT); println(kc(Dirwork+Batparent,Dirlib,Fnametex));// 16.05.29,06.05 , - SCEOUTPUT = openfile("kc.sh"); + if(ismacosx(), //181125from + SCEOUTPUT = openfile("kc.command"); + , + SCEOUTPUT = openfile("kc.sh"); + ); //181125to println(SCEOUTPUT,"#!/bin/sh"); println(SCEOUTPUT,"cd "+Dq+Dirwork+Dq); tmp=Dq+PathV3+Dq+" "+tmp1+filename; @@ -3379,6 +3455,7 @@ kcV3(path,fname):=( ); ); +////%Changeobjscale start//// Changeobjscale(fname):=( regional(fout); fout=replace(fname,".obj",""); @@ -3478,7 +3555,9 @@ Changeobjscale(unitlen,fnameorg,foutorg,optionorg):=( CalcbyR("cs",cmdL,options); println("Scale of "+fname+" changed"); ); +////%Changeobjscale end//// +////%Mkviewobj start//// Mkviewobj(fname,cmdL):=Mkviewobj(Dirwork,fname,cmdL,[]); Mkviewobj(Arg1,Arg2,Arg3):=( if(!isstring(OCNAME), //17.04.13from @@ -3496,9 +3575,10 @@ Mkviewobj(pathorg,fnameorg,cmdLorg,optionorg):=( //help:Mkviewobj(fname,cmdlist); //help:Mkviewobj(fname,[]); //help:Mkviewobj(path,fname,cmdlist); -//help:Mkviewobj(options=["M/R","V","Unit=in","Wait=5"]); +//help:Mkviewobj(options=["M/R","V","Unit=in","Wait=(10)"]); regional(path,cmdL,eqL,strL,flg,fname,options,make,view,cmdlist, - vtx,face,unit,tmp,tmp1,tmp2); + vtx,face,unit,tmp,tmp1,tmp2,store); + store=Fillblack(); //181128 path=replace(pathorg,"\","/"); if(substring(path,length(path)-1,length(path))!="/",path=path+"/"); fname=fnameorg; @@ -3569,13 +3649,12 @@ Mkviewobj(pathorg,fnameorg,cmdLorg,optionorg):=( cmdlist=MkprecommandR(); cmdlist=concat(cmdlist,["Openobj",[Dq+path+fname+Dq]]); cmdlist=concat(cmdlist,cmdL); - tmp=["Closeobj()",[],""+Dq+"||||"+Dq,[]];//16.12.26 + tmp=["Closeobj()",[]];//181130 cmdlist=concat(cmdlist,tmp); - tmp=append(options,"Cat=y"); - tmp1=apply(tmp,Toupper(substring(#,0,1))); // 16.04.23from + tmp1=apply(options,Toupper(substring(#,0,1))); // 16.04.23from tmp1=select(tmp1,#=="W"); if(length(tmp1)==0, - tmp=append(tmp,"Wait=5"); + tmp=append(tmp,"Wait=10"); );// 16.04.23to CalcbyR("",cmdlist,tmp); //180902 wait(WaitUnit*100); // 16.03.18 @@ -3617,8 +3696,11 @@ Mkviewobj(pathorg,fnameorg,cmdLorg,optionorg):=( ViewFile=fname; ); // 16.03.14 until ); + Fillrestore(store); //181128 ); +////%Mkviewobj end//// +////%Setobj start//// //Objname(str):=Objname(str,["m","v"]); //180906from //Objname(str,options):=Setobj(str,options); Setobj():=Setobj(Fhead,["m","v"]); //180901 @@ -3646,7 +3728,9 @@ Setobj(str,optionsorg):=( //180906to ); //17.12.23until println("generate OBJCMD. name="+OCNAME+", option="+OCOPTION); ); +////%Setobj end//// +////%Mkobjcmd start//// Mkobjcmd(nm,fd):=Mkobjcmd(nm,fd,[40,40,"+"]); Mkobjcmd(nm,fd,options):=( //help:Mkobjcmd("1",fd,[40,40,"+"]); @@ -3698,7 +3782,9 @@ Mkobjcmd(nm,fd,options):=( OBJCMD=concat(OBJCMD,out);//16.11.29 out; ); +////%Mkobjcmd end//// +////%Mkobjnrm start//// Mkobjnrm(nm,fd):=Mkobjnrm(nm,fd,[]); Mkobjnrm(nm,fd,optionorg):=( //help:Mkobjnrm("1",fd1,["Disp=y"]); @@ -3792,7 +3878,9 @@ Mkobjnrm(nm,fd,optionorg):=( ); // 16.05.02until out; ); +////%Mkobjnrm end//// +////%Mkobjthickcmd start//// Mkobjthickcmd(nm,fd):=Mkobjthickcmd(nm,fd,"",[40,40,"+"]); Mkobjthickcmd(nm,fd,Arg):=( if(islist(Arg), @@ -3898,7 +3986,10 @@ Mkobjthickcmd(nm,fd,fnrm,optionorg):=( OBJCMD=concat(OBJCMD,out);//16.11.29 out; ); +////%Mkobjthickcmd end//// + +////%Mkobjpolycmd start//// Mkobjpolycmd(nm,pd):=Mkobjpolycmd(nm,pd,[]); Mkobjpolycmd(nm,pd,optionorg):=( //help:Mkobjpolycmd("1",pd); @@ -3968,7 +4059,9 @@ Mkobjpolycmd(nm,pd,optionorg):=( OBJCMD=concat(OBJCMD,out);//16.11.29 out; ); +////%Mkobjpolycmd end//// +////%Mkobjplatecmd start//// Mkobjplatecmd(nm,pd):=Mkobjplatecmd(nm,pd,[]); Mkobjplatecmd(nm,pdorg,optionorg):=( // 16.06.18 //help:Mkobjplatecmd("1",pd); @@ -4045,7 +4138,9 @@ Mkobjplatecmd(nm,pdorg,optionorg):=( // 16.06.18 OBJCMD=concat(OBJCMD,out);//16.11.29 out; ); +////%Mkobjplatecmd end//// +////%Mkobjcrvcmd start//// Mkobjcrvcmd(nm,pst):=Mkobjcrvcmd(nm,pst,[]); Mkobjcrvcmd(nm,pstorg,options):=( //help:Mkobjcrvcmd("1","sc3d1",[0.02,6,"xy"]); @@ -4117,7 +4212,9 @@ Mkobjcrvcmd(nm,pstorg,options):=( OBJCMD=concat(OBJCMD,out);//16.11.29 out; ); +////%Mkobjcrvcmd end//// +////%Mkobjsymbcmd start//// Mkobjsymbcmd(symb,size,rot,dir,pos):= Mkobjsymbcmd("",symb,size,rot,dir,pos,[]); Mkobjsymbcmd(Ar1,Ar2,Ar3,Ar4,Ar5,Ar6):=( @@ -4246,7 +4343,9 @@ Mkobjsymbcmd(path,symborg,size,rot,dir,pos,optionorg):=( OBJCMD=concat(OBJCMD,out);//16.11.29 out; ); +////%Mkobjsymbcmd end//// +////%Concatcmd start//// Concatcmd(cmdlist):=( //help:Concatcmd([cmdL1,cmdL2]); regional(out); @@ -4256,6 +4355,7 @@ Concatcmd(cmdlist):=( ); out; ); +////%Concatcmd end//// WritetoF(fname,cmdL):=( // help:WritetoF("outdata",cmdL); @@ -4353,7 +4453,12 @@ kcF(fname,optionorg):=( println(SCEOUTPUT,tmp); println(SCEOUTPUT,"exit 0"); closefile(SCEOUTPUT); - SCEOUTPUT = openfile("kc.sh"); + , + if(ismacosx(), //181125from + SCEOUTPUT = openfile("kc.command"); + , + SCEOUTPUT = openfile("kc.sh"); + ); //181125to Lf=unicode("10",base->10); print(SCEOUTPUT,"#!/bin/sh"+Lf); tmp1=replace(Dirwork,"\","/"); @@ -4373,7 +4478,11 @@ kcF(fname,optionorg):=( closefile(SCEOUTPUT); println(kc(Dirwork+Batparent,Dirlib,Fnametex));// 16.05.29,06.05 , - SCEOUTPUT = openfile("kc.sh"); + if(ismacosx(), //181125from + SCEOUTPUT = openfile("kc.command"); + , + SCEOUTPUT = openfile("kc.sh"); + ); //181125to println(SCEOUTPUT,"#!/bin/sh"); println(SCEOUTPUT,"cd "+Dq+Dirwork+Dq); tmp=Dq+PathF+Dq+" -nox -eval "+Dq+")read "+filename+Dq; @@ -4586,9 +4695,9 @@ Frifun(name,fun,argL,optionorg):=( eqL=tmp_5; forall(eqL, tmp=indexof(#,"="); - tmp1=Toupper(substring(#,0,3)); + tmp1=Toupper(substring(#,0,1)); tmp2=substring(#,tmp,length(#)); - if((tmp1=="DIS") % (tmp1=="DSP") , + if(tmp1=="D" , tmp=Toupper(substring(tmp2,0,1)); if((tmp=="F") % (tmp=="N"), disp=0; @@ -4745,13 +4854,14 @@ Mkketcindyjs(libname,options):=( //17.11.18 ///////////////// C function ////////////////// -Cform(strorg):=( +Cformold(strorg):=( //help:Cform(str); - regional(str,ter,out,hat,ns,ne,nn,jj,flg, + regional(str,ter,out,hat,pare,ns,ne,nn,jj,flg,flg2, lv,str1,str2,tmp,tmp1,tmp2); ter=["+","-","*","/","(",")","="]; //180517 str=replace(strorg,"pi","M_PI"); hat=Indexall(str,"^"); + pare=Bracket(str,"()"); out=""; ns=0; forall(hat,nn, @@ -4841,6 +4951,104 @@ Cform(strorg):=( out; ); +////%Cform start//// +Cform(strorg):=( //181106 +//help:Cform(str); + regional(str,str2,out,ter,num,hat,pare,jj,ns,ne,nsa,nea,flg,flg2,tmp,tmp1,tmp2); + ter=["+","-","*","/","(",")","="]; //180517 + str=replace(strorg,"pi","M_PI"); + num=apply(0..9,text(#)); //181107from + num=append(num,"."); + flg=0; + tmp1=str+"/"; + tmp2=""; + str=""; + forall(1..(length(tmp1)), + tmp=substring(tmp1,#-1,#); + if(contains(num,tmp), + if(flg==0, + tmp2=tmp; + flg=1; + , + tmp2=tmp2+tmp; + ); + , + if(flg==1, + if(indexof(tmp2,".")==0, tmp2=tmp2+".0"); + str=str+tmp2+tmp; + flg=0; + , + str=str+tmp; + ); + ); + ); + str=substring(str,0,length(str)-1); //181107to + out=""; + flg=0; + forall(1..100,jj, + if(flg==0, + hat=indexof(str,"^"); + if(hat==0, + out=out+str; + flg=1; + , + ne=hat-1; + if(substring(str,ne-1,ne)==")", + ne=ne-1; + pare=Bracket(str,"()"); + tmp=select(pare,#_1==hat-1); + tmp=tmp_1_2; + tmp1=select(pare,(#_1<hat)&(#_2==-tmp)); + ns=tmp1_(length(tmp1))_1+1; + nsa=ns-1; + , + flg2=0; + forall(reverse(1..ne), + if(flg2==0, + if(contains(ter,substring(str,#-1,#)), + ns=#+1; + flg2=1; + ); + ); + ); + if(flg2==0,ns=1); + nsa=ns; + ); + str2="pow("+substring(str,ns-1,ne)+","; + ns=hat; + if(substring(str,ns,ns+1)=="(", + ns=ns+2; + pare=Bracket(str,"()"); + tmp=select(pare,#_1==hat+1); + tmp=tmp_1_2; + tmp1=select(pare,(#_1>hat)&(#_2==-tmp)); + ne=tmp1_1_1-1; + nea=ne+1; + , + ns=ns+1; + flg2=0; + forall(ns..(length(str)), + if(flg2==0, + if(contains(ter,substring(str,#-1,#)), + ne=#-1; + flg2=1; + ); + ); + ); + if(flg2==0,ne=length(str)); + nea=ne; + ); + str2=str2+substring(str,ns-1,ne)+")"; + out=out+substring(str,0,nsa-1)+str2; + str=substring(str,nea,length(str)); + ); + ); + ); + out; +); +////%Cform end//// + +////%ConvertFdtoC start//// ConvertFdtoC(Fd):=ConvertFdtoC(Fd,["x","y","z"]); ConvertFdtoC(Fd,name):=( //help:ConvertFd(Fd); @@ -4857,9 +5065,12 @@ ConvertFdtoC(Fd,name):=( FdC=concat(FdC,[Cform(tmp1_4),Cform(tmp1_5)]); FdC=concat(FdC,[tmp1_6]); ); +////%ConvertFdtoC end//// +////%Startsurf start//// Startsurf():=StartsurfC(); Startsurf(Arg):=StartsurfC(Arg); +Startsurf(Nplist,Dsizelist,Epslist):=StartsurfC("",Nplist,Dsizelist,Epslist); //181116 Startsurf(restr,Nplist,Dsizelist,Epslist):=StartsurfC(restr,Nplist,Dsizelist,Epslist); StartsurfC():=StartsurfC("",[50,50],[1500,500,200],[0.01,0.1]);//180611renewed StartsurfC(Arg):=( @@ -4886,6 +5097,7 @@ StartsurfC(restr,Nplist,Dsizelist,Epslist):=(//180501 //help:Startsurf([50,50],[1500,500,200],[0.01,0.1]); //help:Startsurf([50],[1500,500],[0.01,0.1]); regional(divL,sizeL,epsL); + StyleListC=[]; //181107 CommandListC=[];//180608(2lines) FuncListC=[]; if(substring(restr,0,1)=="R", //180611(3lines) @@ -4903,511 +5115,24 @@ StartsurfC(restr,Nplist,Dsizelist,Epslist):=(//180501 epsL=prepend(0.00001,epsL); ConstantListC=[divL,sizeL,epsL]; ); +////%Startsurf end//// -Cheader():=Cheader(FdC,FheadC+"header.h"); -Cheader(fdc,fname):=( - regional(tmp,tmp1,tmp2,j, dW,dE,dS,dN,dstr, - DsizeLL,DsizeL,DsizeM,DsizeS,Eps,Eps1,Eps2,Eps3); - Mdv=50; Ndv=50; - DsizeLL=15000; DsizeL=1500; DsizeM=500; DsizeS=200; - Eps=0.00001; Eps1=0.05; Eps2=0.2; Eps3=1; - SCEOUTPUT = openfile(fname); - tmp=indexof(fdc_2,"="); - tmp1=substring(fdc_2,tmp,length(fdc_2)); - tmp1=replace(tmp1,"[","{"); - tmp1=replace(tmp1,"]","}"); - tmp=indexof(fdc_3,"="); - tmp2=substring(fdc_3,tmp,length(fdc_3)); - tmp2=replace(tmp2,"[","{"); - tmp2=replace(tmp2,"]","}"); - tmp="const double Urng[2]="+tmp1+", Vrng[2]="+tmp2; - println(SCEOUTPUT,tmp+";"); - tmp="const double XMIN="+Sprintf(XMIN,6); - tmp=tmp+",XMAX="+Sprintf(XMAX,6); - println(SCEOUTPUT,tmp+";"); - tmp="const double THETA="+Sprintf(THETA,6); - tmp=tmp+",PHI="+Sprintf(PHI,6); - println(SCEOUTPUT,tmp+";"); - tmp=" //THETA:"+Sprintf(THETA*180/pi,2); - tmp=tmp+", PHI:"+Sprintf(PHI*180/pi,2); - println(SCEOUTPUT,tmp+";"); - dstr=fdc_4; - if(indexof(dstr,"w")>0,dW=1,dW=0); - if(indexof(dstr,"e")>0,dE=1,dE=0); - if(indexof(dstr,"s")>0,dS=1,dS=0); - if(indexof(dstr,"n")>0,dN=1,dN=0); - tmp="const int DrawW="+text(dW)+", DrawE="+text(dE); - tmp=tmp+", DrawS="+text(dS)+", DrawN="+text(dN); - println(SCEOUTPUT,tmp+";"); - forall(j=5..(length(fdc)), - tmp=fdc_#; //17.05.21from - if(length(tmp)==2, - if(tmp_1>1, //17.05.24from - Mdv=tmp_1; Ndv=tmp_2; - , - if(length(tmp_1)>0, Eps1=tmp_1); - if(length(tmp_1)>0, Eps2=tmp_2); - ); //17.05.24until - ); - if(length(tmp)==3, - if(length(tmp_1)>0, DsizeLL=tmp_1);//17.06.09(3lines) - if(length(tmp_2)>0, DsizeL=tmp_2); - if(length(tmp_3)>0, DsizeM=tmp_3); - ); - if(length(tmp)==4, - if(min(tmp)<1, - if(length(tmp_1)>0, Eps=tmp_1); - if(length(tmp_2)>0, Eps1=tmp_2); - if(length(tmp_3)>0, Eps2=tmp_3); - if(length(tmp_4)>0, Eps3=tmp_4); - , - if(length(tmp_1)>0, DsizeLL=tmp_1); - if(length(tmp_2)>0, DsizeL=tmp_2); - if(length(tmp_3)>0, DsizeM=tmp_3); - if(length(tmp_4)>0, DsizeS=tmp_4); - ) - );//17.05.21until - ); - tmp1=text(fdc_5_1); - tmp2=text(fdc_5_2); - tmp="const int Mdv="+text(Mdv)+", Ndv="+text(Ndv); - println(SCEOUTPUT,tmp+";"); - tmp="#define DsizeLL "+text(DsizeLL);//17.05.21 - println(SCEOUTPUT,tmp); - tmp="#define DsizeL "+text(DsizeL); - println(SCEOUTPUT,tmp); - tmp="#define DsizeM "+text(DsizeM); - println(SCEOUTPUT,tmp); - tmp="#define DsizeS "+text(DsizeS); - println(SCEOUTPUT,tmp); - tmp="const double Eps="+format(Eps,7); - tmp=tmp+", Eps1="+format(Eps1,7); - tmp=tmp+", Eps2="+format(Eps2,7); - tmp=tmp+", Eps3= "+format(Eps3,7); - println(SCEOUTPUT,tmp+";"); - tmp="void surffun(double u, double v, double pt[3]){"; - println(SCEOUTPUT,tmp); - forall(fdc_1, - tmp1=replace(#,"x=","pt[0]="); - tmp1=replace(tmp1,"y=","pt[1]="); - tmp1=replace(tmp1,"z=","pt[2]="); - println(SCEOUTPUT," "+tmp1+";"); - ); - println(SCEOUTPUT,"}"); - closefile(SCEOUTPUT); -); - -Cmain():=Cmain(FheadC+".c",MainC); -Cmain(fname,cmdLorg):=( -//help:MainC(writesfbd("sfbd");) -//help:MainC(writeax("ax");) -//help:MainC(writewire("wire" (,2), [10,10]);) -//help:MainC(writewire("wire", [[0.5,1],[0,1,2]]]);) -//help:MainC(writecut("sfcut","x+y+2*z-4");) -//help:MainC(writesc("sl3d1");) -//help:MainC(skeleton("sk",[objlist],[pltlist] (,width));) -//help:MainC(writewire ptincrease (=2) are optional);) - regional(cmdL, tmp,tmp1,tmp2,tmp3,tmp4,nL, nn,kk,jj, num, en,cmd, - ax1,ax2,ax3,path, var,varh,file,fileh, flg, cutctr); - path=Dirwork+"/"; //17.05.29from - path=replace(path,"\","/"); - cmdL=cmdLorg;// 17.05.26from - nL=select(1..(length(cmdL)),cmdL_#=="writeax"); - cmd=[]; - if(length(nL)>0,tmp3=cmdL_(1..(nL_1-1)),tmp3=[]); - forall(1..(length(nL)), - tmp2=cmdL_(nL_#+1); - if(length(tmp2)==1,tmp2=append(tmp2,"Surf")); - tmp=tmp2_1; // 17.06.08(5lines) - if(substring(tmp,length(tmp)-2,length(tmp))!="3d", - tmp=tmp+"3d"; - ); - tmp1=parse(tmp); - tmp="axx="+textformat(tmp1_1,5); - parse(tmp); - tmp="axy="+textformat(tmp1_2,5); - parse(tmp); - tmp="axz="+textformat(tmp1_3,5); - parse(tmp); - tmp3=concat(tmp3,[ - "double "+tmp2_1+"[DsizeL][3];",[], //17.06.07(2lines) - "double axx[3][3], axy[3][3], axz[3][3];",[], - "spaceline",["axx"], - "spaceline",["axy"], - "spaceline",["axz"], - tmp2_1+"[0][0]=0;",[], - "appendd3(2,1,2,axx,"+tmp2_1+");",[], - "appendd3(2,1,2,axy,"+tmp2_1+");",[], - "appendd3(2,1,2,axz,"+tmp2_1+");",[], - "writecrv",[tmp2_1,tmp2_2] //17.06.07 - ]); - cmd=concat(cmd,tmp3); - if(#<length(nL), - tmp3=cmdL_((nL_#+2)..(nL_(#+1)-1)); - , - tmp3=cmdL_((nL_#+2)..(length(cmdL))); - cmdL=concat(cmd,tmp3); - ); - ); - nL=select(1..(length(cmdL)),cmdL_#=="writesc"); - cmd=[]; - if(length(nL)>0,tmp3=cmdL_(1..(nL_1-1)),tmp3=[]); - forall(1..(length(nL)), - tmp2=cmdL_(nL_#+1); - if(length(tmp2)==1, - tmp2=[tmp2_1,"Surf"]; - ); - tmp3=concat(tmp3,[ - "double "+tmp2_1+"[DsizeL][3];",[], //17.06.07(2lines) - "double "+tmp2_1+"h[DsizeL][3];",[], - "spaceline",[tmp2_1], - "writecrv",[tmp2_1,tmp2_2] //17.06.07 - ]); - cmd=concat(cmd,tmp3); - if(#<length(nL), - tmp3=cmdL_((nL_#+2)..(nL_(#+1)-1)); - , - tmp3=cmdL_((nL_#+2)..(length(cmdL))); - cmdL=concat(cmd,tmp3); - ); - ); - nL=select(1..(length(cmdL)),cmdL_#=="writesfbd"); - cmd=[]; - if(length(nL)>0,tmp3=cmdL_(1..(nL_1-1)),tmp3=[]); - forall(1..(length(nL)), - tmp2=cmdL_(nL_#+1); - if(length(tmp2)==1,tmp2=append(tmp2,"Surf")); - var=Dq+tmp2_1+"3d"+Dq; - varh=Dq+tmp2_1+"h3d"+Dq; - file=Dq+path+FheadC+tmp2_1+".txt"+Dq; - fileh=Dq+path+FheadC+tmp2_1+"h.txt"+Dq; - tmp="Borderhiddendata"; - tmp3=concat(tmp3,[ - "double "+tmp2_1+"[DsizeL][3];",[], //17.06.09(6lines) - "sfbdparadata",[tmp2_1], - "output3h",["w",var, varh,file,tmp2_1], - "dataindexd3",[3,tmp2_1,"din"], - tmp2_2+"[0][0]=0;",[], - "appendd3",[2,"din[1][0]","din[1][1]",tmp2_1,tmp2_2] - ]); - cmd=concat(cmd,tmp3); - if(#<length(nL), - tmp3=cmdL_((nL_#+2)..(nL_(#+1)-1)); - , - tmp3=cmdL_((nL_#+2)..(length(cmdL))); - cmdL=concat(cmd,tmp3); - ); - ); - nL=select(1..(length(cmdL)),cmdL_#=="writecrv"); - cmd=[]; - if(length(nL)>0,tmp3=cmdL_(1..(nL_1-1)),tmp3=[]); - forall(1..(length(nL)), - tmp2=cmdL_(nL_#+1); - if(length(tmp2)==1,tmp2=append(tmp2,"Surf")); - var=Dq+tmp2_1+"3d"+Dq; - varh=Dq+tmp2_1+"h3d"+Dq; - file=Dq+path+FheadC+tmp2_1+".txt"+Dq; - tmp3=concat(tmp3,[ - "crvsfparadata",[tmp2_1,tmp2_2,1,"Crvdata"], - tmp2_1+"[0][0]=0;",[], //17.06.09(3lines) - "appendd3",[0,1,"length3(Crvdata)","Crvdata",tmp2_1], - "output3h",["w",var, varh, file,tmp2_1] - ]); - cmd=concat(cmd,tmp3); - if(#<length(nL), - tmp3=cmdL_((nL_#+2)..(nL_(#+1)-1)); - , - tmp3=cmdL_((nL_#+2)..(length(cmdL))); - cmdL=concat(cmd,tmp3); - ); - ); - nL=select(1..(length(cmdL)),cmdL_#=="writescrvonsf"); - cmd=[]; - if(length(nL)>0,tmp3=cmdL_(1..(nL_1-1)),tmp3=[]); - forall(1..(length(nL)), - tmp2=cmdL_(nL_#+1); - if(length(tmp2)==1,tmp2=append(tmp2,"Surf")); - var=Dq+tmp2_1+"3d"+Dq; - varh=Dq+tmp2_1+"h3d"+Dq; //17.06.09(8lines) - file=Dq+path+FheadC+tmp2_1+".txt"+Dq; - tmp3=concat(tmp3,[ - "double "+tmp2_1+"[DsizeL][3];",[], - " crv3onsfparadata",[tmp2_1,tmp2_2,1,"Crvdata"], - tmp2_1+"[0][0]=0;",[], - "appendd3",[0,1,"length3(Crvdata)","Crvdata",tmp2_1], - "output3h",["w",var,varh, file ,tmp2_1] - ]); - cmd=concat(cmd,tmp3); - if(#<length(nL), - tmp3=cmdL_((nL_#+2)..(nL_(#+1)-1)); - , - tmp3=cmdL_((nL_#+2)..(length(cmdL))); - cmdL=concat(cmd,tmp3); - ); - ); - nL=select(1..(length(cmdL)),cmdL_#=="writecut"); - cmd=[]; - if(length(nL)>0,tmp3=cmdL_(1..(nL_1-1)),tmp3=[]); - cutctr=0; - forall(1..(length(nL)), - cutctr=#; - tmp2=cmdL_(nL_#+1); - if(length(tmp2)==2, - tmp2=[tmp2_1,"Surf",tmp2_2]; - ); - var=Dq+tmp2_1+"3d"+Dq; - varh=Dq+tmp2_1+"h3d"+Dq; //17.06.09(10lines) - file=Dq+path+FheadC+tmp2_1+".txt"+Dq; - tmp3=concat(tmp3,[ - "cutfun",[tmp2_3], - "double "+tmp2_1+"[DsizeL][3];",[], - "sfcutdata",[text(cutctr),"out"], //17.06.02 - "crv3onsfparadata",["out",tmp2_2,"Crvdata"], - tmp2_1+"[0][0]=0;",[], - "appendd3",[0,1,"length3(Crvdata)","Crvdata",tmp2_1], - "output3h",["w",var, varh, file, tmp2_1] - ]); - cmd=concat(cmd,tmp3); - if(#<length(nL), - tmp3=cmdL_((nL_#+2)..(nL_(#+1)-1)); - , - tmp3=cmdL_((nL_#+2)..(length(cmdL))); - cmdL=concat(cmd,tmp3); - ); - ); - nL=select(1..(length(cmdL)),cmdL_#=="writewire"); - cmd=[]; - if(length(nL)>0,tmp3=cmdL_(1..(nL_1-1)),tmp3=[]); - forall(1..(length(nL)), - tmp2=cmdL_(nL_#+1); - if(!isstring(tmp2_2), - tmp2=[tmp2_1,"Surf",tmp2_2,tmp2_3]; - ); - var=Dq+tmp2_1+"3d"+Dq; - varh=Dq+tmp2_1+"h3d"+Dq; //17.06.09 - file=Dq+path+FheadC+tmp2_1+".txt"+Dq; - tmp4=tmp2_(length(tmp2)); num=2; - if(!islist(tmp4), - num=tmp4; tmp4=tmp2_(length(tmp2)-1); - ); - if(!islist(tmp4_1), - tmp3=concat(tmp3,[ - "double udv[2]={-1,"+text(tmp4_1)+"};",[] - ]); - , - len=length(tmp4_1); - tmp="double udv["+text(len+1)+"]={"+text(len)+","; - forall(tmp4_1, - tmp=tmp+format(#,5)+","; - ); - tmp=substring(tmp,0,length(tmp)-1)+"};"; - tmp3=concat(tmp3,[tmp,[]]); - ); - if(!islist(tmp4_2), - tmp3=concat(tmp3,[ - "double vdv[2]={-1,"+text(tmp4_2)+"};",[] - ]); - , - len=length(tmp4_2); - tmp="double vdv["+text(len+1)+"]={"+text(len)+","; - forall(tmp4_2, - tmp=tmp+format(#,5)+","; - ); - tmp=substring(tmp,0,length(tmp)-1)+"};"; - tmp3=concat(tmp3,[tmp,[]]); - ); - tmp3=concat(tmp3,[ - "double "+tmp2_1+"[DsizeLL][3];",[], //17.06.09(5lines) - "wireparadata",["Surf", "udv","vdv", num, "Wiredata"], - tmp2_1+"[0][0]=0;",[], - "appendd3",[0,1,"length3(Wiredata)","Wiredata",tmp2_1], - "output3h",["w",var, varh, file, tmp2_1] - ]); - cmd=concat(cmd,tmp3); - if(#<length(nL), - tmp3=cmdL_((nL_#+2)..(tmp_(#+1)-1)); - , - tmp3=cmdL_((nL_#+2)..(length(cmdL))); - cmdL=concat(cmd,tmp3); - ); - );// 17.05.29until - nL=select(1..(length(cmdL)),cmdL_#=="skeleton");// 17.06.05from - cmd=[]; - if(length(nL)>0, - tmp3=cmdL_(1..(nL_1-1)); - tmp3=concat(tmp3,["double sk[DsizeLL][3];",[]]);//17.06.13 - , - tmp3=[]; - ); - forall(1..(length(nL)),nn, - tmp2=cmdL_(nL_nn+1); - var=Dq+tmp2_1+"3d"+Dq; - file=Dq+path+FheadC+tmp2_1+".txt"+Dq; - tmp3=concat(tmp3,[ //17.06.08from - "data[0][0]=0;",[] - ]); - forall(tmp2_2, - if(substring(#,length(#)-1,length(#))!="h", - tmp1=#; - tmp=[0,"din[1][0]","din[1][1]",tmp1,"data"]; - , - tmp1=substring(#,0,length(#)-1); - tmp=[0,"din[2][0]","din[2][1]",tmp1,"data"]; - ); - tmp3=concat(tmp3,[ - "dataindexd3",[3,tmp1,"din"], - "appendd3",tmp - ]); - ); - forall(1..(length(tmp2_3)), - if(substring(tmp2_3_#,length(tmp2_3_#)-1,length(tmp2_3_#))!="h", - tmp1=tmp2_3_#; - tmp=[0,"din[1][0]","din[1][1]",tmp1,"data"]; - , - tmp1=substring(tmp2_3_#,0,length(tmp2_3_#)-1); - tmp=[0,"din[2][0]","din[2][1]",tmp1,"data"]; - ); - tmp3=concat(tmp3,[ - "push3",["Inf",3,0,"data"], - "dataindexd3",[3,tmp1,"din"], - "appendd3",tmp - ]); - ); - if(length(tmp2)<=3,tmp=1,tmp=tmp2_4); - tmp3=concat(tmp3,[ - "skeletondata3",["data", tmp, "Eps1","Eps2","sk"],//17.06.13 - "output3",["w",var, file, 2, "sk"] - ]); - cmd=concat(cmd,tmp3); - if(nn<length(nL), - tmp3=cmdL_((nL_nn+2)..(nL_(nn+1)-1)); - , - tmp3=cmdL_((nL_nn+2)..(length(cmdL))); - cmdL=concat(cmd,tmp3); - );//17.06.08until - );// 17.06.05until - path=DirlibC+"/"; - path=replace(path,"\","/"); - cmd=[ - "#include <stdio.h>", "#include <math.h>", - "#include "+Dq+FheadC+"header.h"+Dq, - "#include "+Dq+path+"ketcommon.h"+Dq, - "#include "+Dq+path+"surflibhead.h"+Dq, - "#include "+Dq+path+"surflib.h"+Dq, - "int main(void){", - " double out[DsizeL][3], data[DsizeLL][3];", //17.06.10 - " int i, j, nall, din[DsizeS][2];" //17.06.09 - ]; -// tmp=select(cmdL,#=="cutfun"); -// if(length(tmp)==0, - if(cutctr==0, //17.06.02 - cmdL=prepend(["1"],cmdL); - cmdL=prepend("cutfun",cmdL); - );// 17.05.26until - cutctr=0; - forall(1..(floor(length(cmdL))/2),nn, - tmp1=cmdL_(2*nn-1); tmp2=cmdL_(2*nn); - flg=0; // 17.05.26from - if(tmp1=="cutfun", - cutctr=cutctr+1; - tmp=select(1..(length(cmd)), indexof(cmd_#,"main")>0); - tmp3=cmd_((tmp_1)..(length(cmd))); - cmd=cmd_(1..(tmp_1-1)); - cmd=append(cmd,"double cutfun"+text(cutctr)+"(double u, double v){"); - cmd=append(cmd," double p[3],val;"); - cmd=append(cmd," surffun(u,v,p);"); - tmp=" val="+assign(tmp2_1,["x","p[0]","y","p[1]","z","p[2]"])+";"; - cmd=concat(cmd, [tmp," return val;", "}"]); - cmd=concat(cmd, tmp3); - flg=1; - ); - if(tmp1=="xyzax3data", - tmp=" "+tmp1+"("; - tmp=tmp+textformat(tmp2_1_1_1_1,5)+","; - tmp=tmp+textformat(tmp2_1_1_2_1,5)+","; - tmp=tmp+textformat(tmp2_1_2_1_2,5)+","; - tmp=tmp+textformat(tmp2_1_2_2_2,5)+","; - tmp=tmp+textformat(tmp2_1_3_1_3,5)+","; - tmp=tmp+textformat(tmp2_1_3_2_3,5)+","; - tmp=tmp+tmp2_2+");"; - cmd=append(cmd,tmp); - flg=1; - ); - if(tmp1=="spaceline", - if(!isstring(tmp2_1), - println(tmp2_1+" should be assgined as a string"); - , - tmp3=parse(tmp2_1); - tmp=text(length(tmp3)+1); -// cmd=append(cmd, " double "+tmp2_1+"["+tmp+"][3];"); - tmp=text(length(tmp3)); - cmd=append(cmd, " "+tmp2_1+"[0][0]="+tmp+";"); - forall(1..(length(tmp3)), - tmp=" "+tmp2_1+"["+text(#)+"][0]="+textformat(tmp3_#_1,5)+","; - tmp=tmp+tmp2_1+"["+text(#)+"][1]="+textformat(tmp3_#_2,5)+","; - tmp=tmp+tmp2_1+"["+text(#)+"][2]="+textformat(tmp3_#_3,5)+";"; - cmd=append(cmd,tmp); - ); - ); - flg=1; - ); - if(flg==0, - tmp=" "+tmp1; - if(length(tmp2)>0, - tmp=tmp+"("; - forall(1..length(tmp2),kk, - if(isstring(tmp2_kk), - if((kk==1)&(substring(tmp1,0,5)=="write"), - file=path+FheadC+tmp2_kk+".txt"; - fileh=path+FheadC+tmp2_kk+"h.txt"; - tmp=tmp+Dq+tmp2_kk+Dq+","+Dq+file+Dq+","+Dq+fileh+Dq; - , - tmp=tmp+tmp2_kk; - ); - , - if(!islist(tmp2_kk), - tmp=tmp+textformat(tmp2_kk,5); - , - ); - ); - if(kk<length(tmp2), - tmp=tmp+","; - , - tmp=tmp+");"; - ); - ); - ); - cmd=append(cmd, tmp);// 17.05.26until - ); - ); - tmp=select(1..(length(cmd)), indexof(cmd_#,"main")>0);//17.06.02from - tmp3=cmd_((tmp_1)..(length(cmd))); - cmd=cmd_(1..(tmp_1-1)); - cmd=append(cmd,"double cutfun(int ch, double u, double v){"); - cmd=append(cmd," double val;"); - forall(1..cutctr, - tmp=text(#); - cmd=append(cmd," if(ch=="+tmp+"){val=cutfun"+tmp+"(u,v);}"); - ); - cmd=concat(cmd,[" return val;", "}"]); - cmd=concat(cmd, tmp3);//17.06.02until - cmd=concat(cmd, [" return 0;", "}"]); - SCEOUTPUT = openfile(fname); - forall(cmd, - println(SCEOUTPUT,#); +////%Contsurf start//// +Contsurf():=ContsurfC(""); +Contsurf(restr):=ContsurfC(restr); +ContsurfC(restr):=(//181101 +//help:Contsurf(); + regional(cL,tmp,tmp1,tmp2); + if(substring(restr,0,1)=="R", + GLIST=[]; ); - closefile(SCEOUTPUT); - tmp=fileslist(Dirwork); // 17.05.20from - tmp=tokenize(tmp,","); - tmp=select(tmp,indexof(#,".txt")>0); - tmp=select(tmp,indexof(#,FheadC)>0); - forall(tmp, - SCEOUTPUT = openfile(#); - println(SCEOUTPUT,""); - closefile(SCEOUTPUT); - ); // 17.05.20until + cL=CommandListC; + cL=cL_(1..(length(cL)-1)); + CommandListC=cL; ); +////%Contsurf end//// +////%kcC start//// kcC():=kcC(FheadC); kcC(cname):=( regional(tmp, tmp1,flg,rfile); @@ -5430,7 +5155,11 @@ kcC(cname):=( tmp=cname+".txt"; println(kc(Dirwork+Batparent,Mackc+Dirlib,tmp)); , - SCEOUTPUT = openfile("kc.sh"); + if(ismacosx(), //181125from + SCEOUTPUT = openfile("kc.command"); + , + SCEOUTPUT = openfile("kc.sh"); + ); //181125to println(SCEOUTPUT,"#!/bin/sh"); println(SCEOUTPUT,"cd "+Dq+Dirwork+Dq); tmp=PathC+" -lm "+cname+".c -o main.out"; //180612 @@ -5461,6 +5190,7 @@ kcC(cname):=( println("kcC succeeded"); ); ); +////%kcC end//// ReaddataCold(var, fname):=ReaddataC(var, fname,[]); ReaddataC(var, fname,options):=( @@ -5488,6 +5218,7 @@ ReaddataC(var, fname,options):=( );//17.06.16until ); +////%ReaddataC start//// ReaddataC(fnameorg):=( regional(tmp,tmp1,fname,data,out); fname=fnameorg; @@ -5510,7 +5241,9 @@ ReaddataC(fnameorg):=( if(length(tmp1)>0,out=append(out,tmp1)); out; ); +////%ReaddataC end//// +////%WritedataC start//// WritedataC(fnameorg,dataorg):=( //help:WritedataC(filename, 3ddata); regional(tmp,fname,data,kk,nn,pt); @@ -5536,6 +5269,7 @@ WritedataC(fnameorg,dataorg):=( ); closefile(SCEOUTPUT); ); +////%WritedataC end//// DisplayC():=DisplayC(DispC); DisplayC(name,options):=DisplayC([name,options]); @@ -5556,7 +5290,7 @@ DisplayC(dispc):=( eqL=tmp_5; opcindy=tmp_(length(tmp)); forall(eqL, - if(Toupper(substring(#,0,2))=="CO", + if(Toupper(substring(#,0,1))=="C", tmp=indexof(#,"="); color=substring(#,tmp,length(#)); if(substring(color,0,1)=="[", @@ -5584,6 +5318,7 @@ DisplayC(dispc):=( ); ); +////%Cheadsurf start//// Cheadsurf():=( regional(cmd,jj,divL,sizeL,epsL,nf,var1,var2,tmp,tmp1,tmp2); divL=ConstantListC_1; @@ -5672,7 +5407,9 @@ Cheadsurf():=( cmd=append(cmd,"}"); cmd; ); +////%Cheadsurf end//// +////%Ctopsurf start//// Ctopsurf(name):=Ctopsurf(name,CutFunList); Ctopsurf(name,cutfunLorg):=( regional(cutfunL,path,cmd,tmp,tmp1,tmp2); @@ -5716,7 +5453,9 @@ Ctopsurf(name,cutfunLorg):=( ]); cmd; ); +////%Ctopsurf end//// +////%WritetoC start//// WritetoC(nm,header,main):=( regional(hfile,mfile,top,body,tmp,tmp1,tmp2); hfile=Fhead+nm+"header.h"; @@ -5740,7 +5479,9 @@ WritetoC(nm,header,main):=( println(SCEOUTPUT,"}"); closefile(SCEOUTPUT); ); +////%WritetoC end//// +////%CalcbyC start//// CalcbyC(name,cmd):=CalcbyC(name,PathC,cmd,[]); CalcbyC(name,Arg1,Arg2):=( if(isstring(Arg1), @@ -5849,8 +5590,11 @@ CalcbyC(name,path,cmd,optionorg):=( ); ); );//180615to + wflg; //181101 ); +////%CalcbyC end//// +////%ExeccmdC start//// ExeccmdC(nm):=ExeccmdC(nm,[],["do"]); //180531 ExeccmdC(nm,options):=ExeccmdC(nm,options,["do"]); ExeccmdC(nm,optionorg,optionhorg):=( @@ -5858,7 +5602,7 @@ ExeccmdC(nm,optionorg,optionhorg):=( //help:ExeccmdC(options1=["dr(/da/do)","m/r","Wait=30"]); //help:ExeccmdC(options2=["do(/nodisp/da/do)"]); regional(options,optionsh,name2,name3,waiting,dirbkup, - eqL,reL,strL,fname,tmp,tmp1,tmp2,flg,wflg,varL); + eqL,reL,strL,fname,cL,tmp,tmp1,tmp2,flg,wflg,varL); fname=Fhead+nm+".txt"; options=optionorg; optionsh=optionhorg; @@ -5884,7 +5628,8 @@ ExeccmdC(nm,optionorg,optionhorg):=( ); forall(eqL, tmp=Strsplit(#,"="); - if(Toupper(tmp_1)=="WAIT", + tmp1=Toupper(substring(tmp_1,0,1)); //181111 + if(tmp1=="W", waiting=parse(tmp_2); options=remove(options,[#]); ); @@ -5903,8 +5648,24 @@ ExeccmdC(nm,optionorg,optionhorg):=( if(wflg==-1,tmp1=append(options,"r")); tmp1=append(tmp1,"Wait="+text(waiting)); tmp1=append(tmp1,"Disp=n"); //181024 - CommandListC=prepend(" char fnameall[]="+Dqq(fname)+";",CommandListC); - CommandListC=prepend(" printf("+Dqq("%s\n")+","+Dqq(Fhead)+");",CommandListC); //180608 + cL=CommandListC; //181101from + tmp2=" char fnameall[]="+Dqq(fname)+";"; + tmp=select(1..(length(cL)),indexof(cL_#,"char fnameall[]=")>0); + if(length(tmp)==0, + CommandListC=prepend(tmp2,CommandListC); + , + tmp=tmp_1; + CommandListC_tmp=tmp2; + ); + cL=CommandListC; + tmp2=" printf("+Dqq("%s\n")+","+Dqq("Execcmd "+nm)+");"; + tmp=select(1..(length(cL)),indexof(cL_#,"printf("+Dqq("%s\n")+","+Dq+"Execcmd ")>0); + if(length(tmp)==0, + CommandListC=prepend(tmp2,CommandListC); + , + tmp=tmp_1; + CommandListC_tmp=tmp2; + ); //181101to tmp=select(CommandListC,indexof(#,"outputend")>0); if(length(tmp)==0, CommandListC=append(CommandListC," outputend(dirfname);"); @@ -5945,19 +5706,37 @@ ExeccmdC(nm,optionorg,optionhorg):=( ); varL=select(varL,length(parse(#))>0); if(length(addpath)>0,Changework(dirbkup,["Sub=n"])); //180605 + if(SUBSCR==1, // 15.02.11 + forall(varL, //181106from + Subgraph(#,""); + ); + ); //181106to + tmp=StyleListC; //181107from + tmp1=apply(1..(length(tmp)/2),[tmp_(2*#-1),tmp_(2*#)]); + forall(tmp1,tmp2, + strL=select(varL,indexof(#,tmp2_1)>0); //181114from + forall(strL, + if((length(parse(#))>0)&(length(tmp2_2))>0, + Changestyle3d(#,tmp2_2); + ); + ); //181114to + ); //181107to varL; ); +////%ExeccmdC end//// +////%Sfbdparadata start//// Sfbdparadata(nm,fd):=SfbdparadataC(nm,fd); Sfbdparadata(nm,fd,options):=SfbdparadataC(nm,fd,options); Sfbdparadata(nm,fdorg,optionorg,optionsh):=SfbdparadataC(nm,fdorg,optionorg,optionsh); -SfbdparadataC(nm,fd):= - SfbdparadataC(nm,fd,[],["nodisp"]); +SfbdparadataC(nm,fd):=( + SfbdparadataC(nm,fd,[],["do"]); +); SfbdparadataC(nm,fd,options):= - SfbdparadataC(nm,fd,options,["nodisp"]); -SfbdparadataC(nm,fdorg,optionorg,optionsh):=( + SfbdparadataC(nm,fd,options,["do"]); +SfbdparadataC(nm,fdorg,optionorg,optionshorg):=( //help:Sfbdparadata("1",Fd); - regional(funnm,fd,options,name2,name3,name2h,name3h,waiting, + regional(funnm,fd,options,optionsh,name2,name3,name2h,name3h,waiting, eqL,reL,strL,fname,tmp,tmp1,tmp2,flg,wflg,cmdflg); if(ChNumber==0,ChNumber=Ch); fd=ConvertFdtoC(fdorg); @@ -5978,6 +5757,7 @@ SfbdparadataC(nm,fdorg,optionorg,optionsh):=( name3h="sfbdh3d"+nm; fname=Fhead+"sfbd"+nm+".txt"; options=optionorg; + optionsh=select(optionshorg,length(#)>0); //181107 tmp=Divoptions(options); eqL=tmp_5; reL=tmp_6; @@ -6002,9 +5782,24 @@ SfbdparadataC(nm,fdorg,optionorg,optionsh):=( options=remove(options,[#]); ); ); - options=remove(options,eqL); options=remove(options,reL); options=select(options,length(#)>0); + tmp1=select(options, + (indexof(#,"=")>0)&(Toupper(substring(#,0,1))=="C")); //181114from + if(length(tmp1)>0, + tmp1=tmp1_1; + tmp2=select(optionsh, + (indexof(#,"=")>0)&(Toupper(substring(#,0,1))=="C")); + if(length(tmp2)==0, + if(length(optionsh)==0, + optionsh=["do",tmp1]; + , + optionsh=append(optionsh,tmp1); + ); + ); + ); //181114to + StyleListC=concat(StyleListC,[name3,options,name3h,optionsh]); //181107 + options=remove(options,eqL); cmdL=[ " char fname"+nm+"[]="+Dqq(fname)+";", " rangeUV("+funnm+");", @@ -6021,7 +5816,7 @@ SfbdparadataC(nm,fdorg,optionorg,optionsh):=( if(length(tmp)>0, tmp=replace(cmdL_6,Dqq("w"),Dqq("a"));cmdL_6=tmp; ); //180601from - cmdL=remove(cmdL,[cmdL_1,cmdL_(length(cmdL))]); + cmdL=cmdL_(2..(length(cmdL)-1)); //181113 CommandListC=concat(CommandListC,cmdL); //180531to , if(wflg==1,tmp1=append(options,"m")); @@ -6060,19 +5855,22 @@ SfbdparadataC(nm,fdorg,optionorg,optionsh):=( ); ); ); +////%Sfbdparadata end//// +////%Crvsfparadata start//// Crvsfparadata(nm,fk,sfbd,fd):=CrvsfparadataC(nm,fk,sfbd,fd); Crvsfparadata(nm,fk,sfbd,fd,options):=CrvsfparadataC(nm,fk,sfbd,fd,options); Crvsfparadata(nm,Fk,sfbdorg,fdorg,optionorg,optionsh):= CrvsfparadataC(nm,Fk,sfbdorg,fdorg,optionorg,optionsh); CrvsfparadataC(nm,fk,sfbd,fd):= - CrvsfparadataC(nm,fk,sfbd,fd,[],["nodisp"]); + CrvsfparadataC(nm,fk,sfbd,fd,[],["do"]); CrvsfparadataC(nm,fk,sfbd,fd,options):= - CrvsfparadataC(nm,fk,sfbd,fd,options,["nodisp"]); -CrvsfparadataC(nm,Fk,sfbdorg,fdorg,optionorg,optionsh):=( + CrvsfparadataC(nm,fk,sfbd,fd,options,["do"]); +CrvsfparadataC(nm,Fk,sfbdorg,fdorg,optionorg,optionshorg):=( //help:Crvsfparadata("1","ax3d","sfbd3d1",Fd); - regional(funnm,sfbd,fd,options,name2,name3,name2h,name3h,waiting, - eqL,reL,strL,fname,tmp,tmp1,tmp2,flg,wflg,flg,ii,jj,eps,cmdlfg); +//help:Crvsfparadata(options=["Use=y(/n)"]; + regional(funnm,sfbd,fd,options,optionsh,name2,name3,name2h,name3h,waiting, + eqL,reL,strL,fname,tmp,tmp1,tmp2,flg,wflg,useflg,cmdlfg,ii,jj,eps); eps=10^(-5); sfbd=replace(sfbdorg,"bdy","sfbd"); fd=ConvertFdtoC(fdorg); @@ -6084,6 +5882,7 @@ CrvsfparadataC(nm,Fk,sfbdorg,fdorg,optionorg,optionsh):=( name3h="crvsfh3d"+nm; fname=Fhead+"crvsf"+nm+".txt"; options=optionorg; + optionsh=select(optionshorg,length(#)>0); //181107 tmp=Divoptions(options); eqL=tmp_5; reL=tmp_6; @@ -6108,50 +5907,91 @@ CrvsfparadataC(nm,Fk,sfbdorg,fdorg,optionorg,optionsh):=( options=remove(options,[#]); ); ); - options=remove(options,eqL); + useflg="N"; //181105from + forall(eqL, + tmp=Strsplit(#,"="); + tmp1=Toupper(substring(tmp_1,0,1)); + if(tmp1=="U", + useflg=Toupper(substring(tmp_2,0,1)); + ); + ); //181105to options=remove(options,reL); options=select(options,length(#)>0); - tmp2=parse(Fk); - flg=0; - tmp=Fhead+Fk+".dat"; - if(!isexists(Dirwork,tmp),flg=1); - if(flg==0, - tmp1=ReaddataC(tmp); - if(length(tmp1)!=length(tmp2),flg=1); - if(flg==0, - forall(1..(length(tmp1)),ii, - if(length(tmp1_ii)!=length(tmp2_ii),flg=1); - forall(1..(length(tmp1_ii)),jj, - if(flg==0, - if(Norm(tmp1_ii_jj-tmp2_ii_jj)>eps,flg=1); - ); - ); + tmp1=select(options, + (indexof(#,"=")>0)&(Toupper(substring(#,0,1))=="C")); //181114from + if(length(tmp1)>0, + tmp1=tmp1_1; + tmp2=select(optionsh, + (indexof(#,"=")>0)&(Toupper(substring(#,0,1))=="C")); + if(length(tmp2)==0, + if(length(optionsh)==0, + optionsh=["do",tmp1]; + , + optionsh=append(optionsh,tmp1); ); ); - ); - if(flg==1,WritedataC(tmp,Fk)); + ); //181114to + StyleListC=concat(StyleListC,[name3,options,name3h,optionsh]); //181107 + options=remove(options,eqL); + if(useflg=="N", +// flg=0; +// tmp=Fhead+Fk+".dat"; +// if(!isexists(Dirwork,tmp),flg=1); +// if(flg==0, +// tmp1=ReaddataC(tmp); +// tmp2=parse(Fk); +// if(length(tmp1)==length(tmp2), +// forall(1..(length(tmp1)),ii, +// if(length(tmp1_ii)!=length(tmp2_ii),flg=1); +// forall(1..(length(tmp1_ii)),jj, +// if(flg==0, +// if(Norm(tmp1_ii_jj-tmp2_ii_jj)>eps,flg=1); +// ); +// ); +// ); +// ); +// ); +// if(flg==1, + if((islist(parse(Fk))), + tmp=Fhead+Fk+".dat"; + WritedataC(tmp,Fk); + , + useflg="Y"; + ); +// ); + ); //181105to if(cmdflg==1, EraseList=append(EraseList,Fk); , Changestyle3d(Fk,["nodisp"]); ); cmdL=[ - " char fname"+nm+"[]="+Dqq(fname)+";", + " char fname"+nm+"[]="+Dqq(fname)+";", " rangeUV("+funnm+");", - " boundary("+funnm+");", - " readdataC("+Dqq(Fhead+Fk+".dat")+",data);", - " readoutdata3("+Dqq(Fhead+replace(sfbd,"3d","")+".txt")+","+Dqq(sfbd)+",sfbd);", //180531 + " boundary("+funnm+");" + ]; + if(useflg=="N", //181105from + cmdL=concat(cmdL,[ + " readdataC("+Dqq(Fhead+Fk+".dat")+",data);" + ]); + , + cmdL=concat(cmdL,[ + " readoutdata3(dirfname,"+Dqq(Fk)+",data);" + ]); + ); + cmdL=concat(cmdL,[ + " readoutdata3("+Dqq(Fhead+replace(sfbd,"3d","")+".txt")+","+Dqq(sfbd)+",sfbd);", " crvsfparadata("+funnm+",data,sfbd, 0, out);", " sprintf(dirfname,"+Dqq("%s%s")+",Dirname,fname"+nm+");", " output3h("+Dqq("w")+","+Dqq("crvsf3d"+nm)+","+Dqq("crvsfh3d"+nm)+",dirfname,out);", " outputend(dirfname);" - ]; + ]); //181105to if(cmdflg==1,//180531from println(" ExeccmdC will generate "+ name3+","+name3h); - cmdL_5=" readoutdata3(fnameall,"+Dqq(sfbd)+",sfbd);"; - cmdL_7=" sprintf(dirfname,"+Dqq("%s%s")+",Dirname,fnameall);"; //180607 + cmdL_(length(cmdL)-4)=" readoutdata3(fnameall,"+Dqq(sfbd)+",sfbd);"; //181105(2lines) + cmdL_(length(cmdL)-2)=" sprintf(dirfname,"+Dqq("%s%s")+",Dirname,fnameall);"; tmp=replace(cmdL_(length(cmdL)-1),Dqq("w"),Dqq("a")); cmdL_(length(cmdL)-1)=tmp; - cmdL=remove(cmdL,[cmdL_(length(cmdL))]); + cmdL=cmdL_(1..(length(cmdL)-1)); //181113 CommandListC=concat(CommandListC,cmdL); //180531to , if(wflg==1,tmp1=append(options,"m")); @@ -6190,18 +6030,20 @@ CrvsfparadataC(nm,Fk,sfbdorg,fdorg,optionorg,optionsh):=( ); ); ); +////%Crvsfparadata end//// +////%Crv3onsfparadata start//// Crv3onsfparadata(nm,crv3d,sfbd,fd):=Crv3onsfparadataC(nm,crv3d,sfbd,fd); Crv3onsfparadata(nm,crv3d,sfbd,fd,options):=Crv3onsfparadataC(nm,crv3d,sfbd,fd,options); Crv3onsfparadata(nm,crv3d,sfbdorg,fdorg,optionorg,optionsh):= Crv3onsfparadataC(nm,crv3d,sfbdorg,fdorg,optionorg,optionsh); Crv3onsfparadataC(nm,crv3d,sfbd,fd):= - Crv3onsfparadataC(nm,crv3d,sfbd,fd,[],["nodisp"]); + Crv3onsfparadataC(nm,crv3d,sfbd,fd,[],["do"]); Crv3onsfparadataC(nm,crv3d,sfbd,fd,options):= - Crv3onsfparadataC(nm,crv3d,sfbd,fd,options,["nodisp"]); -Crv3onsfparadataC(nm,crv3d,sfbdorg,fdorg,optionorg,optionsh):=( + Crv3onsfparadataC(nm,crv3d,sfbd,fd,options,["do"]); +Crv3onsfparadataC(nm,crv3d,sfbdorg,fdorg,optionorg,optionshorg):=( //help:Crv3onsfparadata("1","sc3","sfbd3d1",fd); - regional(funnm,sfbd,fd,options,name3,name3h,name2,name2h,waiting, + regional(funnm,sfbd,fd,options,optionsh,name3,name3h,name2,name2h,waiting, eqL,reL,strL,fname,tmp,tmp1,tmp2,flg,wflg,flg,ii,jj,eps,cmdflg); tmp1=replace(crv3d,"3d","2d"); tmp=apply(GCLIST,#_1); @@ -6225,6 +6067,7 @@ Crv3onsfparadataC(nm,crv3d,sfbdorg,fdorg,optionorg,optionsh):=( tmp=apply(fdorg,if(isstring(#),Dqq(#),#)); tmp=text(tmp); options=optionorg; + optionsh=select(optionshorg,length(#)>0); //181107 tmp=Divoptions(options); eqL=tmp_5; reL=tmp_6; @@ -6249,9 +6092,24 @@ Crv3onsfparadataC(nm,crv3d,sfbdorg,fdorg,optionorg,optionsh):=( options=remove(options,[#]); ); ); - options=remove(options,eqL); options=remove(options,reL); options=select(options,length(#)>0); + tmp1=select(options, + (indexof(#,"=")>0)&(Toupper(substring(#,0,1))=="C")); //181114from + if(length(tmp1)>0, + tmp1=tmp1_1; + tmp2=select(optionsh, + (indexof(#,"=")>0)&(Toupper(substring(#,0,1))=="C")); + if(length(tmp2)==0, + if(length(optionsh)==0, + optionsh=["do",tmp1]; + , + optionsh=append(optionsh,tmp1); + ); + ); + ); //181114to + StyleListC=concat(StyleListC,[name3,options,name3h,optionsh]); //181107 + options=remove(options,eqL); tmp2=parse(crv3d); flg=0; tmp=Fhead+crv3d+".dat"; @@ -6287,7 +6145,8 @@ Crv3onsfparadataC(nm,crv3d,sfbdorg,fdorg,optionorg,optionsh):=( cmdL_7=" sprintf(dirfname,"+Dqq("%s%s")+",Dirname,fnameall);"; //180607 tmp=replace(cmdL_(length(cmdL)-1),Dqq("w"),Dqq("a")); cmdL_(length(cmdL)-1)=tmp; cmdL_5=" readoutdata3(fnameall,"+Dqq(sfbd)+",sfbd);"; - cmdL=remove(cmdL,[cmdL_1,cmdL_(length(cmdL))]); + cmdL=cmdL_(2..(length(cmdL)-1)); //181113 +// cmdL=remove(cmdL,[cmdL_1,cmdL_(length(cmdL))]); CommandListC=concat(CommandListC,cmdL); //180531to , if(wflg==1,tmp1=append(options,"m")); @@ -6326,7 +6185,9 @@ Crv3onsfparadataC(nm,crv3d,sfbdorg,fdorg,optionorg,optionsh):=( ); ); ); +////%Crv3onsfparadata end//// +////%Crv2onsfparadata start//// Crv2onsfparadata(nm,crv2d,sfbd,fd):=Crv2onsfparadataC(nm,crv2d,sfbd,fd); Crv2onsfparadata(nm,crv2d,sfbd,fd,options):=Crv2onsfparadataC(nm,crv2d,sfbd,fd,options); Crv2onsfparadata(nm,crv2d,sfbd,fdorg,options,optionsh):= @@ -6357,18 +6218,20 @@ Crv2onsfparadataC(nm,crv2d,sfbd,fdorg,options,optionsh):=( parse(tmp); Crv3onsfparadataC(nm,crv3d,sfbd,fdorg,options,optionsh); ); +////%Crv2onsfparadata end//// +////%Wireparadata start//// Wireparadata(nm,sfbd,fd,wr1,wr2):=WireparadataC(nm,sfbd,fd,wr1,wr2); Wireparadata(nm,sfbd,fd,wr1,wr2,options):=WireparadataC(nm,sfbd,fd,wr1,wr2,options); Wireparadata(nm,sfbd,fdorg,wr1,wr2,optionorg,optionsh):= WireparadataC(nm,sfbd,fdorg,wr1,wr2,optionorg,optionsh); WireparadataC(nm,sfbd,fd,wr1,wr2):= - WireparadataC(nm,sfbd,fd,wr1,wr2,[],["nodisp"]); + WireparadataC(nm,sfbd,fd,wr1,wr2,[],["do"]); WireparadataC(nm,sfbd,fd,wr1,wr2,options):= - WireparadataC(nm,sfbd,fd,wr1,wr2,options,["nodisp"]); -WireparadataC(nm,sfbd,fdorg,wr1,wr2,optionorg,optionsh):=( + WireparadataC(nm,sfbd,fd,wr1,wr2,options,["do"]); +WireparadataC(nm,sfbd,fdorg,wr1,wr2,optionorg,optionshorg):=( //help:Wireparadata("1","sfbd3d1",fd,5,5); - regional(funnm,fd,options,name2,name3,name2h,name3h,waiting, + regional(funnm,fd,options,optionsh,name2,name3,name2h,name3h,waiting, eqL,reL,strL,fname,fnameh,tmp,tmp1,tmp2,flg,wflg,flg,ii,jj,eps,udata,vdata,cmdflg); eps=10^(-5); fd=ConvertFdtoC(fdorg); @@ -6381,6 +6244,7 @@ WireparadataC(nm,sfbd,fdorg,wr1,wr2,optionorg,optionsh):=( fname=Fhead+"wire"+nm+".txt"; fnameh=replace(fname,".txt","h.txt"); options=optionorg; + optionsh=select(optionshorg,length(#)>0); //181107 tmp=Divoptions(options); eqL=tmp_5; reL=tmp_6; @@ -6407,9 +6271,24 @@ WireparadataC(nm,sfbd,fdorg,wr1,wr2,optionorg,optionsh):=( options=remove(options,[#]); ); ); - options=remove(options,eqL); options=remove(options,reL); options=select(options,length(#)>0); + tmp1=select(options, + (indexof(#,"=")>0)&(Toupper(substring(#,0,1))=="C")); //181114from + if(length(tmp1)>0, + tmp1=tmp1_1; + tmp2=select(optionsh, + (indexof(#,"=")>0)&(Toupper(substring(#,0,1))=="C")); + if(length(tmp2)==0, + if(length(optionsh)==0, + optionsh=["do",tmp1]; + , + optionsh=append(optionsh,tmp1); + ); + ); + ); //181114to + StyleListC=concat(StyleListC,[name3,options,name3h,optionsh]); //181107 + options=remove(options,eqL); if(islist(wr1), udata=prepend(length(wr1),wr1); , @@ -6454,7 +6333,9 @@ WireparadataC(nm,sfbd,fdorg,wr1,wr2,optionorg,optionsh):=( tmp=replace(tmp,"fname","fnameall"); cmdL_8=tmp; cmdL_7=" readoutdata3(fnameall,"+Dqq(sfbd)+",sfbd);"; cmdL=append(cmdL," outputend(dirfname);"); - cmdL=remove(cmdL,[cmdL_3,cmdL_4]); //180827 + tmp=remove(1..(length(cmdL)),[3,4]); //181113(2lines) + cmdL=cmdL_tmp; +// cmdL=remove(cmdL,[cmdL_3,cmdL_4]); //180827 CommandListC=concat(CommandListC,cmdL); //180531to , if(wflg==1,tmp1=append(options,"m")); @@ -6495,7 +6376,9 @@ WireparadataC(nm,sfbd,fdorg,wr1,wr2,optionorg,optionsh):=( ); ); ); +////%Wireparadata end//// +////%Intersectcrvsf start//// Intersectcrvsf(nm,crv,fd):=IntersectcrvsfC(nm,crv,fd); Intersectcrvsf(nm,crv,fd,Arg):=IntersectcrvsfC(nm,crv,fd,Arg); Intersectcrvsf(nm,crv3d,fdorg,bdyeq,optionorg):= @@ -6577,8 +6460,10 @@ IntersectcrvsfC(nm,crv3d,fdorg,bdyeq,optionorg):=( ]; if(cmdflg==1,//180531from cmdL_6=" intersectcrvsf("+Dqq("a")+","+funnm+",crv3d,fnameall);"; - cmdL=remove(cmdL,[cmdL_2]); - cmdL=remove(cmdL,[cmdL_(length(cmdL))]); + tmp=remove(1..(length(cmdL)),[2,length(cmdL)]); //181113(2lines) + cmdL=cmdL_tmp; +// cmdL=remove(cmdL,[cmdL_2]); +// cmdL=remove(cmdL,[cmdL_(length(cmdL))]); CommandListC=concat(CommandListC,cmdL); //180531to , if(wflg==1,tmp1=append(options,"m")); @@ -6596,20 +6481,72 @@ IntersectcrvsfC(nm,crv3d,fdorg,bdyeq,optionorg):=( parse(name); ); ); +////%Intersectcrvsf end//// +////%Sfcutparadatacdy start//// 181112 +Sfcutparadatacdy(nm,cutfun,fd):= + Sfcutparadatacdy(nm,cutfun,fd,[]); +Sfcutparadatacdy(nm,cutfun,fd,options):=( +//help:Sfcutparadatacdy("1","2*x+3*y+z=1","sfbd3d",fd,options); + regional(out3,out2,name3,name2,eps,fdL,rep,jj,pL,vn1,vn2, + tmp,tmp1,tmp2); + eps=10^(-5); + name2="sfcc2d"+nm; + name3="sfcc3d"+nm; + fdL=Fullformfunc(fd); + tmp=Strsplit(fdL_5,"="); + vn1=tmp_1; + tmp=Strsplit(fdL_6,"="); + vn2=tmp_1; + rep=["x",fdL_2,"y",fdL_3,"z",fdL_4]; + tmp=Assign(cutfun,rep); + Implicitplot("sfc"+nm,tmp,fd_5,fd_6,["Msg=n","nodisp"]); + out3=[]; out2=[]; + tmp1=parse("impsfc"+nm); + if(MeasureDepth(tmp1)==1,tmp1=[tmp1]); + forall(1..(length(tmp1)),jj, + pL=tmp1_jj; + tmp2=[]; + forall(pL, + tmp=Assign("[x,y,z]",rep); + tmp=Assign(tmp,[vn1,#_1,vn2,#_2]); + tmp=parse(tmp); + tmp2=append(tmp2,tmp); + ); + Spaceline("-sfc"+nm+"n"+text(jj),tmp2,append(options,"Msg=n")); + out3=append(out3,tmp2); + tmp=Projcurve(tmp2); + out2=append(out2,tmp); + ); + tmp=name3+"=["; tmp1=name3+"=["; + forall(1..(length(out3)), + tmp=tmp+"sfc"+nm+"n"+text(#)+"3d"+","; + tmp1=tmp1+Dqq("sfc"+nm+"n"+text(#)+"3d")+","; + ); + tmp=substring(tmp,0,length(tmp)-1)+"]"; + parse(tmp); + tmp1=substring(tmp1,0,length(tmp1)-1)+"]"; + println("generate sfcutparadata "+tmp1); + tmp=name2+"="+Textformat(out2,6); + parse(tmp); + out3; +); +////%Sfcutparadatacdy end//// + +////%Sfcutparadata start//// Sfcutparadata(nm,cutfunL,sfbd,fd):=SfcutparadataC(nm,cutfunL,sfbd,fd); Sfcutparadata(nm,cutfunL,sfbd,fd,options):=SfcutparadataC(nm,cutfunL,sfbd,fd,options); Sfcutparadata(nm,cutfunLorg,sfbd,fdorg,optionorg,optionsh):= SfcutparadataC(nm,cutfunLorg,sfbd,fdorg,optionorg,optionsh); SfcutparadataC(nm,cutfunL,sfbd,fd):=(//180505 - SfcutparadataC(nm,cutfunL,sfbd,fd,[],["nodisp"]); + SfcutparadataC(nm,cutfunL,sfbd,fd,[],["do"]); ); SfcutparadataC(nm,cutfunL,sfbd,fd,options):= SfcutparadataC(nm,cutfunL,sfbd,fd,options,["nodisp"]); -SfcutparadataC(nm,cutfunLorg,sfbd,fdorg,optionorg,optionsh):=( +SfcutparadataC(nm,cutfunLorg,sfbd,fdorg,optionorg,optionshorg):=( //help:Sfcutparadata("1","2*x+3*y+z=1","sfbd3d",fd); - regional(funnm,cutfunL,fd,options,name2,name3,name2h,name3h,waiting, - eqL,reL,strL,fname,fnameh,tmp,tmp1,tmp2,flg,wflg,flg,ii,jj,eps,cmdflg); + regional(funnm,cutfunL,fd,options,optionsh,name2,name3,name2h,name3h, + waiting,eqL,reL,strL,fname,fnameh,tmp,tmp1,tmp2,flg,wflg,flg,ii,jj,eps,cmdflg); eps=10^(-5); fd=ConvertFdtoC(fdorg); tmp=select(1..(length(FuncListC)),FuncListC_#==fd); @@ -6631,6 +6568,7 @@ SfcutparadataC(nm,cutfunLorg,sfbd,fdorg,optionorg,optionsh):=( fname=Fhead+"sfcut"+nm+".txt"; fnameh=replace(fname,".txt","h.txt"); options=optionorg; + optionsh=select(optionshorg,length(#)>0); //181107 tmp=Divoptions(options); eqL=tmp_5; reL=tmp_6; @@ -6657,9 +6595,24 @@ SfcutparadataC(nm,cutfunLorg,sfbd,fdorg,optionorg,optionsh):=( options=remove(options,[#]); ); ); - options=remove(options,eqL); options=remove(options,reL); options=select(options,length(#)>0); + tmp1=select(options, + (indexof(#,"=")>0)&(Toupper(substring(#,0,1))=="C")); //181114from + if(length(tmp1)>0, + tmp1=tmp1_1; + tmp2=select(optionsh, + (indexof(#,"=")>0)&(Toupper(substring(#,0,1))=="C")); + if(length(tmp2)==0, + if(length(optionsh)==0, + optionsh=["do",tmp1]; + , + optionsh=append(optionsh,tmp1); + ); + ); + ); //181114to + StyleListC=concat(StyleListC,[name3,options,name3h,optionsh]); //181107 + options=remove(options,eqL); tmp1=text(length(cutfunL)); cmdL=[ " char fname[]="+Dqq(fname)+";", @@ -6675,7 +6628,8 @@ SfcutparadataC(nm,cutfunLorg,sfbd,fdorg,optionorg,optionsh):=( tmp=replace(tmp,"fname","fnameall"); cmdL_6=tmp; cmdL_5=" readoutdata3(fnameall,"+Dqq(sfbd)+",sfbd);"; cmdL=append(cmdL," outputend(dirfname);"); - cmdL=remove(cmdL,[cmdL_1,cmdL_2]); //180827 + cmdL=cmdL_(3..(length(cmdL))); //181113 +// cmdL=remove(cmdL,[cmdL_1,cmdL_2]); //180827 CommandListC=concat(CommandListC,cmdL); //180531to , if(wflg==1,tmp1=append(options,"m")); @@ -6716,6 +6670,7 @@ SfcutparadataC(nm,cutfunLorg,sfbd,fdorg,optionorg,optionsh):=( ); ); ); +////%Sfcutparadata end//// //help:end(); diff --git a/Master/texmf-dist/scripts/ketcindy/ketlib/ketpiccurrent.r b/Master/texmf-dist/scripts/ketcindy/ketlib/ketpiccurrent.r index 160710e857b..b177e4245bb 100755 --- a/Master/texmf-dist/scripts/ketcindy/ketlib/ketpiccurrent.r +++ b/Master/texmf-dist/scripts/ketcindy/ketlib/ketpiccurrent.r @@ -16,10 +16,14 @@ ######################################### -ThisVersion<- "KeTpic for R v5_2_4(20181024)" +ThisVersion<- "KeTpic for R v5_2_4(20181128)" print(ThisVersion) +# 20181128 +# Objthicksurf debugged +# 20181031 +# space before # removed # 20181024 # Wireparadata debugged ( for DuL(DvL)=c(..) ) # Nohiddenpara2 debugged (for SeL=Null ) @@ -964,8 +968,8 @@ Arrowdata<- function(...) # 2013.11.13 No Intersect debugged Arrowhead<-function(...){ - ## Scaling is implemented - ## 12.01.08 Kirikomi +## Scaling is implemented +## 12.01.08 Kirikomi Eps=10^(-3) varargin<-list(...) Nargs<-length(varargin) @@ -11954,25 +11958,25 @@ Objsurf<- function(...){ #17.12.18 Objthicksurf<- function(...){ Args=list(...) Nargs=length(Args) - Sel=Args[[Nargs]]; Nargs=Nargs-1 + Sel=Args[[Nargs]]; Nargs=Nargs-1 #181128from Selsurf=substring(Sel,1,1) Selside=c("0","0","0","0") - Tmp=grep("w",Sel,fixed=TRUE) - if(length(Tmp)>0){ - Selside[1]="w" - } - Tmp=grep("e",Sel,fixed=TRUE) - if(length(Tmp)>0){ - Selside[2]="e" - } - Tmp=grep("s",Sel,fixed=TRUE) - if(length(Tmp)>0){ - Selside[3]="s" - } - Tmp=grep("n",Sel,fixed=TRUE) - if(length(Tmp)>0){ - Selside[4]="n" - } + Tmp=strsplit(Sel,"w");Tmp=Tmp[[1]] + if(length(Tmp)==2){ + Selside[[1]]=substr(Tmp[2],1,1) + } + Tmp=strsplit(Sel,"e");Tmp=Tmp[[1]] + if(length(Tmp)==2){ + Selside[[2]]=substr(Tmp[2],1,1) + } + Tmp=strsplit(Sel,"s");Tmp=Tmp[[1]] + if(length(Tmp)==2){ + Selside[[3]]=substr(Tmp[2],1,1) + } + Tmp=strsplit(Sel,"n");Tmp=Tmp[[1]] + if(length(Tmp)==2){ + Selside[[4]]=substr(Tmp[2],1,1) + } #181128to Nfth=Args[[Nargs-2]] Thick1=Args[[Nargs-1]] Thick2=Args[[Nargs]] @@ -12058,21 +12062,20 @@ Objthicksurf<- function(...){ } Dt2=Objsurf(F2,U,V,Tmp); Out=list(Dt1,Dt2); - - if(Selside[1]!="0"){ - Dt=Objrecs(Op(3,Dt1),Op(3,Dt2),Selside[1]) + if(Selside[[1]]!="0"){ + Dt=Objrecs(Op(3,Dt1),Op(3,Dt2),Selside[[1]]) Out=c(Out,list(Dt)) } - if(Selside[2]!="0"){ - Dt=Objrecs(Op(4,Dt1),Op(4,Dt2),Selside[2]) + if(Selside[[2]]!="0"){ + Dt=Objrecs(Op(4,Dt1),Op(4,Dt2),Selside[[2]]) Out=c(Out,list(Dt)) } - if(Selside[3]!="0"){ - Dt=Objrecs(Op(5,Dt1),Op(5,Dt2),Selside[3]) + if(Selside[[3]]!="0"){ + Dt=Objrecs(Op(5,Dt1),Op(5,Dt2),Selside[[3]]) Out=c(Out,list(Dt)) } - if(Selside[4]!="0"){ - Dt=Objrecs(Op(6,Dt1),Op(6,Dt2),Selside[4]) + if(Selside[[4]]!="0"){ + Dt=Objrecs(Op(6,Dt1),Op(6,Dt2),Selside[[4]]) Out=c(Out,list(Dt)) } OBJJOIN<<- Join |