diff options
author | Norbert Preining <preining@logic.at> | 2018-06-14 06:17:13 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2018-06-14 06:17:13 +0000 |
commit | 5c25b51ce087f0f8464448ac3ad03f16c16b35be (patch) | |
tree | ae3fe9521878d9807dff023b0e75a3cd2355bf40 /Master/texmf-dist/scripts/ketcindy | |
parent | 4d4bd63ff233db4e2269bde8909633cc914d38f8 (diff) |
ketcindy 20180614.2
git-svn-id: svn://tug.org/texlive/trunk@48014 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/ketcindy')
30 files changed, 3810 insertions, 2029 deletions
diff --git a/Master/texmf-dist/scripts/ketcindy/data/polyhedrons_obj/Counter-etching convex polyhedron.pdf b/Master/texmf-dist/scripts/ketcindy/data/polyhedrons_obj/Counter-etching convex polyhedron.pdf Binary files differnew file mode 100644 index 00000000000..e2b52ddd5ee --- /dev/null +++ b/Master/texmf-dist/scripts/ketcindy/data/polyhedrons_obj/Counter-etching convex polyhedron.pdf diff --git a/Master/texmf-dist/scripts/ketcindy/dirhead.txt b/Master/texmf-dist/scripts/ketcindy/ketcindy.ini index e87a8005629..10b9a05fc01 100644 --- a/Master/texmf-dist/scripts/ketcindy/dirhead.txt +++ b/Master/texmf-dist/scripts/ketcindy/ketcindy.ini @@ -1,6 +1,7 @@ Dirhead=Dircdy; Dirwork=gethome()+pathsep()+"ketcindy"; Dircdy=Dirwork; +Dirhead=gettexmfdist()+pathsep()+"scripts"+pathsep()+"ketcindy"; setdirectory(Dirhead); import("setketcindy.txt"); import("ketoutset.txt"); diff --git a/Master/texmf-dist/scripts/ketcindy/ketcindy.sh b/Master/texmf-dist/scripts/ketcindy/ketcindy.sh index 23465f4b927..7fecac2ff68 100755 --- a/Master/texmf-dist/scripts/ketcindy/ketcindy.sh +++ b/Master/texmf-dist/scripts/ketcindy/ketcindy.sh @@ -2,13 +2,14 @@ # # KETCindy starter script # -# (C) 2017 Norbert Preining +# (C) 2017-2018 Norbert Preining # Licensed under the same license terms as ketpic itself, that is GPLv3+ # BinaryName=Cinderella2 TemplateFile=template1basic.cdy systype=`uname` +workdir="$HOME/ketcindy" if [ "$1" = "-c" ] then @@ -52,11 +53,13 @@ case $systype in esac plugin="$plugindir/KetCindyPlugin.jar" +dirheadplugin="$plugindir/dirhead.txt" # find Jar KetCdyJar=`kpsewhich -format=texmfscripts KetCindyPlugin.jar` # search for template.cdy TempCdy=`kpsewhich -format=texmfscripts $TemplateFile` +DirHead=`kpsewhich -format=texmfscripts dirhead.txt` if [ -z "$TempCdy" -o -z "$KetCdyJar" ] then @@ -65,10 +68,11 @@ then fi -if [ ! -r "$plugin" ] ; then +if [ ! -r "$plugin" -o ! -r "$dirheadplugin" ] ; then echo "Cinderella is *NOT* set up for KETCindy!" echo "You need to copy" echo " $KetCdyJar" + echo " $DirHead" echo "into" echo " $plugindir" echo "" @@ -94,7 +98,8 @@ then fi -mkdir -p ~/ketcindy +mkdir -p "$workdir" +cp "$TempCdy" "$workdir" -exec "$cinderella" "$TempCdy" +exec "$cinderella" "$workdir/$TemplateFile" diff --git a/Master/texmf-dist/scripts/ketcindy/ketjava/KetCindyPlugin.jar b/Master/texmf-dist/scripts/ketcindy/ketjava/KetCindyPlugin.jar Binary files differindex 2ae7ceda3f5..3c150e58ddb 100644 --- a/Master/texmf-dist/scripts/ketcindy/ketjava/KetCindyPlugin.jar +++ b/Master/texmf-dist/scripts/ketcindy/ketjava/KetCindyPlugin.jar diff --git a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylib3dhelpE.txt b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylib3dhelpE.txt index 27b40955e62..27b40955e62 100644..100755 --- a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylib3dhelpE.txt +++ b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylib3dhelpE.txt diff --git a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylib3dhelpJ.txt b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylib3dhelpJ.txt index bd29d25ff24..2d33176d4e7 100644..100755 --- a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylib3dhelpJ.txt +++ b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylib3dhelpJ.txt @@ -36,7 +36,6 @@ //help:Concatobj*(いくつかのobjデータを結合); //help:Crvsfparadata*(曲線の曲面による陰線処理); //help:Intersectcrvsf*(曲線と曲面の交点を求める); -//help:Intersectcrvsf*(曲線と曲面の交点を求める); //help:Sfbdparaparadata*(空間曲面の陰線処理); //help:Wireparadata*(曲面のワイヤフレームを陰線処理); //help:Dist3d*(空間の2点の距離); diff --git a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylib3dlogr.txt b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylib3dlogr.txt index 55b2fc71c23..7dcdd198e91 100644 --- a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylib3dlogr.txt +++ b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylib3dlogr.txt @@ -1,3 +1,44 @@ +// 20180614 +// Setangle changed (for angle list) +// 20180613 +// Getangle changed ("Disp=y" options added ) +// 20180608 +// Xyzaxparaname changed ( former names deleted ) +// Projpara changed (default: Msg=no ) +// Start3d changed ( Setfiles(Namecdy) added ) +// 20180607 +// Getangle debugged (output) +// 20180606 +// Start3d changed (ADDPACK ) +// 20180603 +// Projpara,... changed (KCOLOR) +// 20180602 +// divoptions ( 8,9 ->length(tmp)-1,length(tmp)) +// Projara,... changed (color supported ) +// Rotatedata3d,Translatedatad3 changed ( Level of RSform to 1) +// Changestyle3d changed ( for case where name not found) +// 20180601 +// Start3d changed (CutFunList, EraseList added) +// 20180531 +// Start3d changed (CommandListC added) +// ExeccmdC added +// SfbdparadataC,CrvsfparadataC,... changed ( for "c" option) +// 20180522 +// Sfbdparadata debugged ( "Proj" ) +// 20180517 +// Isangle(isAngle),Getangle added +// kcC changed ( "resultC" => "end") +// 20180510 +// Wireparadata,Sfcutparadata debugged +// 20180509 +// Sfbdparadata,... changed ( name2,name2h removed) +// Crvsfparadata renamed to Crv3sfparadata +// Crvs3fparadata, changed ( Proj from GLIST removed) +// 20180508 +// Sfbdparadata,... changed ( to Projpara(name3) ) +// 20180426 +// Sfbdparadata,... changed (.dat => .Rdata ) +// WriteCdata,ReadCdata => WritedataC,ReaddataC // 2018.03.27 // Start3d changed (for C) // 2018.02.27 diff --git a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylib3dr.cs b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylib3dr.cs index ce7a65f1074..ffb4798b846 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(20180327) loaded"); +println("ketcindylib3d(20180614) loaded"); //help:start(); @@ -85,9 +85,13 @@ Start3d(ptexception):=( //help:Start3d(execptionptlist); regional(xmn,xMx,ymn,yMx,pt,pt3,pt2, xPos,yTh,yPh,Eps,tmp,tmp1,tmp2,tmp3,tmp4); + Setfiles(Namecdy); //180608 ConstantListC=[[50,50],[5000,1500,500,200],[0.00001,0.01,0.1]]; FuncListC=[]; - CommandListC=[]; + CommandListC=[]; //180531 + CutFunList=[];//180601 + EraseList=[];//180601 + ADDPACK=[]; //180606 GCLIST=[]; GLIST=[]; FUNLIST=[]; @@ -206,6 +210,7 @@ Start3d(ptexception):=( Ptseg3data(ptexception); //16.08.23 ); +Setangle(angL):=Setangle(ang_1,ang_2);//180614 Setangle(theta,phi):=( //16.12.24 //help:Setangle(60,30); regional(xmn,xMx,ymn,yMx,pt,pt3,pt2, @@ -278,6 +283,28 @@ Setangle(theta,phi):=( //16.12.24 Ptseg3data(ptexception); ); +Getangle():=getangle(["Disp=y"]); //180613from +Getangle(option):=( + regional(tmp,tmp1,dispflg,eqL); + tmp=divoptions(option); + dispflg="N"; + eqL=tmp_7; + forall(eqL, + if(Toupper(#_1)=="DISP", + dispflg=Toupper(#_1); + dispflg=substring(dispflg,0,1); + ); + ); + tmp=[THETA*180/pi, PHI*180/pi]; + if(dispflg=="Y", + println(textformat(tmp,6)); + ); + tmp; //180607 +); //180613to + +isAngle():=Isangle(); //180517 +Isangle():=isselected(TH)%isselected(FI); //180517 + Changestyle3d(nameL,style):=( //help:Changestyle3d(["geoseg3d","ax3d"],["notex"]); regional(nmL,name,tmp,tmp1,tmp2); @@ -285,15 +312,17 @@ Changestyle3d(nameL,style):=( tmp1=[]; forall(nmL,name, tmp=parse(name); - if(isstring(tmp_1), - tmp1=concat(tmp1,tmp); - , - tmp1=append(tmp1,name); + if(islist(tmp), + if(isstring(tmp_1), + tmp1=concat(tmp1,tmp); + , + tmp1=append(tmp1,name); + ); + tmp=apply(tmp1,replace(#,"3d","2d")); + Changestyle(tmp,style); + tmp=apply(tmp,"sub"+#); // 15.05.24 + Changestyle(tmp,style); ); - tmp=apply(tmp1,replace(#,"3d","2d")); - Changestyle(tmp,style); - tmp=apply(tmp,"sub"+#); // 15.05.24 - Changestyle(tmp,style); ); ); @@ -421,16 +450,30 @@ ProjCurve(crv):=( ); Projpara(ptdata):=Projpara(ptdata,[]); -Projpara(ptdata,options):=( - regional(name2,name3,Ltype,Noflg,opcindy,dtL,ptL,tmp,Out); +Projpara(ptdata,optionsorg):=( +//help:Projpara("sf3d1"); +//help:Projpara(options=["Msg=no"]); + regional(options,name2,name3,Ltype,Noflg,eqL,opcindy, + dtL,ptL,tmp,tmp1,Out,color,msgflg); + options=optionsorg; tmp=Divoptions(options); Ltype=tmp_1; Noflg=tmp_2; + eqL=tmp_5; + color=tmp_(length(tmp)-2); opcindy=tmp_(length(tmp)); - if(islist(ptdata),dtL=ptdata,dtL=[ptdata]); + msgflg=0; //180602from + forall(eqL, + tmp=Strsplit(#,"="); + if(Toupper(tmp_1)=="MSG", + tmp=substring(tmp_2,0,1); + if(Toupper(tmp)=="Y", msgflg=1); + options=remove(options,[#]); + ); + );//180602to Out=[]; + if(islist(ptdata),dtL=ptdata,dtL=[ptdata]); forall(dtL,name3, -// name3=#; if(indexof(name3,"3d")>0, //17.05.24 name2=replace(name3,"3d","2d"); , @@ -443,7 +486,9 @@ Projpara(ptdata,options):=( ); Out=append(Out,ptL); if(Noflg<3, - println("generate projparadata "+name2); + if(msgflg==1,//180602from + println("generate projparadata "+name2); + );//180602to tmp=name2+"="+textformat(ptL,5); parse(tmp); tmp=name2+"=Projpara("+name3+")"; @@ -451,15 +496,16 @@ Projpara(ptdata,options):=( ); if(Noflg<2, if(isstring(Ltype), + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Ltype=GetLinestyle(text(Noflg)+Ltype,name2); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); , if(Noflg==1,Ltype=0); ); - GCLIST=append(GCLIST,[name2,Ltype,opcindy]); + GCLIST=append(GCLIST,[name2,Ltype,opcindy]); ); ); if(length(Out)==1,Out=Out_1); -// Out=Flattenlist(Out); if(length(Out)==1,Out=Out_1); // 15.02.24 tmp=[]; forall(Out, @@ -562,7 +608,7 @@ Spaceline(nm,ptlistorg,optionorg):=( //help:Spaceline("1",[[2,5,1],[4,2,3]]); //help:Spaceline([A,B]); regional(name2,name3,options,Out,tmp,tmp1,tmp2, - opstr,opcindy,Ltype,Noflg,eqL,ptlist, Msg); + opstr,opcindy,Ltype,Noflg,eqL,ptlist, Msg,color); ptlist=apply(ptlistorg,if(ispoint(#),parse(text(#)+"3d"),#)); // 16.02.10 if(substring(nm,0,2)=="bz", name2=replace(nm,"bz","bz2d"); @@ -582,6 +628,7 @@ Spaceline(nm,ptlistorg,optionorg):=( Ltype=tmp_1; Noflg=tmp_2; eqL=tmp_5; + color=tmp_(length(tmp)-2); opcindy=tmp_(length(tmp)); Msg=1; forall(eqL, @@ -620,7 +667,9 @@ Spaceline(nm,ptlistorg,optionorg):=( ); if(Noflg<2, if(isstring(Ltype), - Ltype=GetLinestyle(text(Noflg)+Ltype,name2); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); + Ltype=GetLinestyle(text(Noflg)+Ltype,name2); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); , if(Noflg==1,Ltype=0); ); @@ -636,7 +685,7 @@ Spacecurve(nm,funstr,variable):=Spacecurve(nm,funstr,variable,[]); Spacecurve(nm,funstr,variable,optionorg):=( //help:Spacecurve("1","[cos(t),sin(t),0.5*t]","t=[0,4*pi]",["Num=200"]); regional(name2,name3,options,Out,tmp,tmp1,tmp2,vname,tmpfn,str,Rng,Num,Msg, - Ec,Exfun,Dc,opstr,opcindy,Fntmp,Vatmp,Ltype,Noflg,eqL,t1,t2,dt,tt,pa,ke); + Ec,Exfun,Dc,opstr,opcindy,Fntmp,Vatmp,Ltype,Noflg,eqL,t1,t2,dt,tt,pa,ke,color); if(substring(nm,0,2)=="bz", name2=replace(nm,"bz","bz2d"); name3=replace(nm,"bz","bz3d"); @@ -654,6 +703,7 @@ Spacecurve(nm,funstr,variable,optionorg):=( Ltype=tmp_1; Noflg=tmp_2; eqL=tmp_5; + color=tmp_(length(tmp)-2); opstr=tmp_(length(tmp)-1); opcindy=tmp_(length(tmp)); Msg=1; @@ -778,7 +828,9 @@ Spacecurve(nm,funstr,variable,optionorg):=( ); if(Noflg<2, if(isstring(Ltype), + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Ltype=GetLinestyle(text(Noflg)+Ltype,name2); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); , if(Noflg==1,Ltype=0); ); @@ -826,7 +878,7 @@ Partcrv3d(nm,pA,pB,PkLstr,options):=( dt1=partcrv("",p1,p2,tmp,["nodata"]); dts=partcrv("",q1,q2,"sub"+tmp,["nodata"]); dt=apply(1..length(dt1), - Xyzcoord(dt1_#_1,dt1_#_2,dts_#_2)); + Xyzcoord(dt1_#_1,dt1_#_2,dts_#_2)); Spaceline("-part3d"+nm,dt,options); ); @@ -834,7 +886,7 @@ Joincrvs3d(nm,plotstrL):=Joincrvs3d(nm,plotstrL,[]);//16.10.06 Joincrvs3d(nm,plotstrL,options):=( //help:Joincrvs3d("1",["bz3da1","bz3da1"]); regional(PtL,Eps,QdL,Flg,Ni,Qd,pP,pS,pQ,pR,rMN, - opcindy,tmp,tmp1,tmp2,str,name2,name3,Ltype,Noflg); + opcindy,tmp,tmp1,tmp2,str,name2,name3,Ltype,Noflg,color); name2="join2d"+nm; name3="join3d"+nm; QdL=[]; @@ -850,6 +902,7 @@ Joincrvs3d(nm,plotstrL,options):=( tmp=Divoptions(options); Ltype=tmp_1; Noflg=tmp_2; + color=tmp_(length(tmp)-2); opcindy=tmp_(length(tmp)); tmp1=tmp_6; if(length(tmp1)>0,Eps=tmp1_1); @@ -905,7 +958,9 @@ Joincrvs3d(nm,plotstrL,options):=( ); if(Noflg<2, if(isstring(Ltype), + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Ltype=GetLinestyle(text(Noflg)+Ltype,name2); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); , if(Noflg==1,Ltype=0); ); @@ -926,7 +981,7 @@ Xyzax3data(nm,Xrange,Yrange,Zrange,options):=( //help:Xyzax3data("","x=[-5,5]","y=[-5,5]","z=[-5,5]"); //help:Xyzax3data(Options2=["a1","Osw"]); regional(name2,name3,Out,tmp,tmp1,tmp2,eqL,reL,strL, - opstr,opcindy,Ltype,Noflg,Axname,Arrow,Origin); + opstr,opcindy,Ltype,Noflg,Axname,Arrow,Origin,color); name2="ax2d"+nm; name3="ax3d"+nm; tmp=Divoptions(options); @@ -935,6 +990,7 @@ Xyzax3data(nm,Xrange,Yrange,Zrange,options):=( eqL=tmp_5; reL=tmp_6; strL=tmp_7; + color=tmp_(length(tmp)-2); opcindy=tmp_(length(tmp)); Axname=1; Arrow=0; // 16.08.14 @@ -994,7 +1050,9 @@ Xyzax3data(nm,Xrange,Yrange,Zrange,options):=( ); if(Noflg<2, if(isstring(Ltype), + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Ltype=GetLinestyle(text(Noflg)+Ltype,name2); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); , if(Noflg==1,Ltype=0); ); @@ -1022,6 +1080,7 @@ Xyzax3data(nm,Xrange,Yrange,Zrange,options):=( Xyzaxparaname(Xrange,Yrange,Zrange):= Xyzaxparaname(Xrange,Yrange,Zrange,[]); Xyzaxparaname(Xrange,Yrange,Zrange,options):=( +//help:Xyzaxparaname("x=[-5,5]","y=[-5,5]","z=[-5,5]"); regional(tmp,tmp1,tmp2,Eps,Dr,Noflg,Xname,Yname,Zname, px,qx,py,qy,pz,qz,ph,qh,rr,ch); Eps=10.0^(-6); @@ -1030,18 +1089,21 @@ Xyzaxparaname(Xrange,Yrange,Zrange,options):=( forall(options, if(isreal(#),Dr=Dr*#); ); - tmp=indexof(Xrange,"="); - Xname=substring(Xrange,0,tmp-1); - tmp=parse(substring(Xrange,tmp,length(Xrange))); + tmp1=Strsplit(Xrange,"="); + Xname=tmp1_1; + tmp=parse(tmp1_2); px=[tmp_1,0,0]; qx=[tmp_2,0,0]; - tmp=indexof(Yrange,"="); - Yname=substring(Yrange,0,tmp-1); - tmp=parse(substring(Yrange,tmp,length(Yrange))); + tmp1=Strsplit(Yrange,"="); + Yname=tmp1_1; + tmp=parse(tmp1_2); py=[0,tmp_1,0]; qy=[0,tmp_2,0]; - tmp=indexof(Zrange,"="); - Zname=substring(Zrange,0,tmp-1); - tmp=parse(substring(Zrange,tmp,length(Zrange))); + tmp1=Strsplit(Zrange,"="); + Zname=tmp1_1; + tmp=parse(tmp1_2); pz=[0,0,tmp_1]; qz=[0,0,tmp_2]; + COM2ndlist=select(COM2ndlist,indexof(#,Dqq("$"+Xname+"$"))==0);//180608(3lines) + COM2ndlist=select(COM2ndlist,indexof(#,Dqq("$"+Yname+"$"))==0); + COM2ndlist=select(COM2ndlist,indexof(#,Dqq("$"+Zname+"$"))==0); ph=Parapt(px); qh=Parapt(qx); rr=|ph-qh|; if(rr>Eps, ch=qh+Dr/rr*(qh-ph); @@ -1084,7 +1146,7 @@ Embed(nm,Pd2str,funstr,varstr):= Embed(nm,Pd2str,funstr,varstr,options):=( //help:Embed("1",["gr1"],"A3d+x*(B3d-A3d)+y*(C3d-A3d)","[x,y]"); regional(name2,name3,Pd2L,Pd2,tmp,tmp1,xstr,ystr, - Ltype,Noflg,opstr,opcindy,Out); + Ltype,Noflg,opstr,opcindy,Out,color); name2="em2d"+nm; name3="em3d"+nm; if(!islist(Pd2str),Pd2L=[Pd2str],Pd2L=Pd2str); // 15.03.06 @@ -1111,6 +1173,7 @@ Embed(nm,Pd2str,funstr,varstr,options):=( tmp=Divoptions(options); Ltype=tmp_1; Noflg=tmp_2; + color=tmp_(length(tmp)-2); opcindy=tmp_(length(tmp)); Out=[]; forall(Pd2L,Pd2, @@ -1148,7 +1211,9 @@ Embed(nm,Pd2str,funstr,varstr,options):=( ); if(Noflg<2, if(isstring(Ltype), + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Ltype=GetLinestyle(text(Noflg)+Ltype,name2); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); , if(Noflg==1,Ltype=0); ); @@ -1259,13 +1324,14 @@ Rotatedata3d(nm,P3data,w1,w2,options):= Rotate3data(nm,P3data,w1,w2):=Rotate3data(nm,P3data,w1,w2,[]); Rotate3data(nm,P3data,w1,w2,options):=( regional(name3,name2,center,pdata,Pd3,Pd,Out,tmp,tmp1, - Ltype,Noflg,opcindy,opstr); + Ltype,Noflg,opcindy,opstr,color); name3="rot3d"+nm; name2="rot2d"+nm; center=[0,0,0]; tmp=Divoptions(options); Ltype=tmp_1; Noflg=tmp_2; + color=tmp_(length(tmp)-2); opstr=tmp_(length(tmp)-1); opcindy=tmp_(length(tmp)); tmp1=tmp_6; @@ -1294,7 +1360,7 @@ Rotate3data(nm,P3data,w1,w2,options):=( tmp=name2+"="+textformat(tmp1,5); parse(tmp); tmp=textformat(P3data,5); // 17.12.23 - tmp=RSform(tmp); // 17.12.23 + tmp=RSform(tmp,1); //180602 // tmp=replace(tmp,"[","list("); // tmp=replace(tmp,"]",")"); tmp=name3+"=Rotate3data("+tmp+"," @@ -1305,7 +1371,9 @@ Rotate3data(nm,P3data,w1,w2,options):=( ); if(Noflg<2, if(isstring(Ltype), + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Ltype=GetLinestyle(text(Noflg)+Ltype,name2); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); , if(Noflg==1,Ltype=0); ); @@ -1353,12 +1421,13 @@ Translatedata3d(nm,P3data,w1,options):= Translate3data(nm,P3data,w1):=Translate3data(nm,P3data,w1,[]); Translate3data(nm,P3data,w1,options):=( regional(name3,name2,pdata,Pd3,Pd,Out,tmp,tmp1, - Ltype,Noflg,opcindy); + Ltype,Noflg,opcindy,color); name3="tra3d"+nm; name2="tra2d"+nm; tmp=Divoptions(options); Ltype=tmp_1; Noflg=tmp_2; + color=tmp_(length(tmp)-2); opcindy=tmp_(length(tmp)); if(islist(P3data) & isstring(P3data_1),Pd3=P3data,Pd3=[P3data]); Out=[]; @@ -1382,7 +1451,7 @@ Translate3data(nm,P3data,w1,options):=( tmp=name2+"="+textformat(tmp1,5); parse(tmp); tmp=textformat(P3data,5); // 17.12.23 - tmp=RSform(tmp); // 17.12.23 + tmp=RSform(tmp,1); // 180602 // tmp=text(P3data); // tmp=replace(tmp,"[","list("); // tmp=replace(tmp,"]",")"); @@ -1393,7 +1462,9 @@ Translate3data(nm,P3data,w1,options):=( ); if(Noflg<2, if(isstring(Ltype), + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Ltype=GetLinestyle(text(Noflg)+Ltype,name2); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); , if(Noflg==1,Ltype=0); ); @@ -2001,7 +2072,7 @@ Bezier3(nm,Ag1,Ag2):=( ); Bezier3(nm,ptlistorg,ctrlistorg,options):=( //17.10.08 greatly changed regional(name,name3,name2,tmp,tmp1,tmp2, - Ltype,Noflg,opstr,eqL,Num,ii,knt,ctr,out); + Ltype,Noflg,opstr,eqL,Num,ii,knt,ctr,out,color); name="bz"+nm; name3="bz3d"+nm; name2="bz2d"+nm; @@ -2009,6 +2080,7 @@ Bezier3(nm,ptlistorg,ctrlistorg,options):=( //17.10.08 greatly changed Ltype=tmp_1; Noflg=tmp_2; eqL=tmp_5; + color=tmp_(length(tmp)-2); opcindy=tmp_(length(tmp)); Num=20; forall(eqL, @@ -2062,7 +2134,9 @@ Bezier3(nm,ptlistorg,ctrlistorg,options):=( //17.10.08 greatly changed ); if(Noflg<2, if(isstring(Ltype), + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Ltype=GetLinestyle(text(Noflg)+Ltype,name2); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); , if(Noflg==1,Ltype=0); ); @@ -2550,7 +2624,7 @@ Phparadata(nm,nmvf,Arg1):=( Phparadata(nm,nmvf,vfL,options):=( //help:Phparadata("1","1",["do"]); regional(name2,name3,nameh2,nameh3,Ltype,Noflg,eqL,Hidden, - opstr,opcindy,Outflg,Inflg,pdata1,tmp,tmp1,tmp2); + opstr,opcindy,Outflg,Inflg,pdata1,tmp,tmp1,tmp2,color); name2="php2d"+nm; name3="php3d"+nm; nameh2="phh2d"+nm; @@ -2562,6 +2636,7 @@ Phparadata(nm,nmvf,vfL,options):=( Outflg=tmp_4; if(Inflg==0 & Outflg==0, Inflg=1;Outflg=1); // 15.05.15 eqL=tmp_5; + color=tmp_(length(tmp)-2); opstr=tmp_(length(tmp)-1); opcindy=tmp_(length(tmp)); Hidden=""; @@ -2606,7 +2681,9 @@ Phparadata(nm,nmvf,vfL,options):=( ); if(Noflg<2, if(isstring(Ltype), + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Ltype=GetLinestyle(text(Noflg)+Ltype,name2); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); , if(Noflg==1,Ltype=0); ); @@ -2950,7 +3027,7 @@ Nohiddenbyfaces(nm,segstr,facestr,optionorg,optionsh):=( Faceremovaldata(nm,vfdata,crvdata):=Faceremovaldata(nm,vfdata,crvdata,[]); Faceremovaldata(nm,vfdata,crvdata,options):=( regional(name2,name3,nameh2,nameh3,Ltype,Noflg,eqL,Hidden, - opstr,opcindy,Outflg,Inflg,tmp,tmp1,tmp2); + opstr,opcindy,Outflg,Inflg,tmp,tmp1,tmp2,color); name2="frc2d"+nm; name3="frc3d"+nm; nameh2="frch2d"+nm; @@ -2962,6 +3039,7 @@ Faceremovaldata(nm,vfdata,crvdata,options):=( Outflg=tmp_4; if(Inflg==0 & Outflg==0, Inflg=1;Outflg=1); // 15.05.15 eqL=tmp_5; + color=tmp_(length(tmp)-2); opstr=tmp_(length(tmp)-1); opcindy=tmp_(length(tmp)); Hidden=""; @@ -2999,7 +3077,9 @@ Faceremovaldata(nm,vfdata,crvdata,options):=( ); if(Noflg<2, if(isstring(Ltype), + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Ltype=GetLinestyle(text(Noflg)+Ltype,name2); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); , if(Noflg==1,Ltype=0); ); @@ -3223,12 +3303,12 @@ Sfbdparadata(nm,fd,options):= Sfbdparadata(nm,fd,options,["nodisp"]); Sfbdparadata(nm,fdorg,optionorg,optionsh):=( //help:Sfbdparadata("1",Fd); -//help:Sfbdparadata(options2=["Wait=60",division(c(50,50)),Eps1(c(0.01,1)), Eps2(0.05)]); - regional(fd,options,name2,name3,name2h,name3h,waiting, +//help:Sfbdparadata(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); - name2="sfbd2d"+nm; + tmp=ConvertFdtoC(fdorg);//180430(2lines) + FuncListC=append(FuncListC,tmp); name3="sfbd3d"+nm; - name2h="sfbdh2d"+nm; name3h="sfbdh3d"+nm; fname=Fhead+"sfbd"+nm+".txt"; tmp=apply(fdorg,if(isstring(#),"'"+#+"'",#)); @@ -3262,32 +3342,31 @@ Sfbdparadata(nm,fdorg,optionorg,optionsh):=( options=remove(options,[#]); ); ); + cmdL=[]; //180509from + tmp=Select(GLIST,indexof(#,"Proj")==0); + cmdL=MkprecommandR(tmp);//180509to tmp=["fd"+nm]; if(length(reL)>0, reL=textformat(reL,4); reL=substring(reL,1,length(reL)-1); - reL=Rsform(reL); + reL=RSform(reL); tmp=append(tmp,reL); ); - tmp1=[Dqq(fname),Dqq(name3),name3,Dqq(name2),name2]; - tmp1=concat(tmp1,[Dqq(name3h),name3h,Dqq(name2h),name2h]); -// tmp1=concat(tmp1,[Dqq("CUSPPT"),"CUSPPT"]); -// tmp1=concat(tmp1,[Dqq("OTHERPARTITION"),"OTHERPARTITION"]); - tmp2=replace(fname,".txt",".dat"); //18.02.18 - cmdL=[ + tmp1=[Dqq(fname),Dqq(name3),name3,Dqq(name3h),name3h];//180509 + tmp2=replace(fname,".txt",".Rdata"); //18.02.18 + cmdL=concat(cmdL,[ "print",[Dqq("fd"+nm)], //18.02.22 "fd"+nm+"="+fd,[], name3+"=Sfbdparadata",tmp, - name2+"=Projpara",[name3], name3h+"=HIDDENDATA",[], - name2h+"=Projpara",[name3h], "WriteOutData",tmp1, "save",["CUSPPT","OTHERPARTITION","file='"+tmp2+"'"] - ]; + ]); tmp=replace(fname,".txt","end.txt"); options=concat(options,["Out=no","Wait="+text(waiting),"Res="+tmp]); if(wflg==1,options=append(options,"m")); if(wflg==-1,options=append(options,"r")); + options=append(options,"Pre=!G"); //180509 if(ErrFlag==0, CalcbyR("sfbd"+nm,cmdL,options); ); @@ -3295,10 +3374,11 @@ Sfbdparadata(nm,fdorg,optionorg,optionsh):=( err("Sfbdparadata not completed"); , ReadOutData(fname); - if(islist(parse(name2)), - Extractdata(name2,options); + if(islist(parse(name3)), //180508(2lines) + Extractdata(name3,["nodisp"]); + Projpara(name3,options); if(length(optionsh)>0,tmp=optionsh,tmp=["nodisp"]); - Extractdata(name2h,tmp); + Projpara(name3h,tmp); //180508 , ErrFlag=1; ); @@ -3317,25 +3397,25 @@ Addpoints(ptlist):=( if(length(ptlist)==0, ADDPOINT="list()"; , - ADDPOINT=Rsform(textformat(ptlist,6),2); + ADDPOINT=RSform(textformat(ptlist,6),2); ); ADDPOINT; ); -Wireparadata(nm,sf,wr1,wr2,fd):= - Wireparadata(nm,sf,fd,wr1,wr2,[],["nodisp"]); -Wireparadata(nm,sf,fd,wr1,wr2,options):= - Wireparadata(nm,sf,fd,wr1,wr2,options,["nodisp"]); -Wireparadata(nm,sfstr,fdorg,wr1,wr2,optionorg,optionsh):=( -//help:Wireparadata("1","sfbd3d1",fd,5,5); -//help:Wireparadata(options2=[division(c(50,50)),Eps1(0.01), Eps2(0.05)]); - regional(fd,options,name2,name3,name2h,name3h,outreg, - eqL,reL,strL,fname,rfname,waiting,tmp,tmp1,tmp2,flg,wflg); - name2="wire2d"+nm; - name3="wiref3d"+nm; - name2h="wireh2d"+nm; - name3h="wireh3d"+nm; - fname=Fhead+"wire"+nm+".txt"; +Crvsfparadata(nm,crv,sf,fd):= + Crvsfparadata(nm,crv,sf,fd,[],["nodisp"]); +Crvsfparadata(nm,crv,sf,fd,options):= + Crvsfparadata(nm,crv,sf,fd,options,["nodisp"]); +Crvsfparadata(nm,crvstr,sfstr,fdorg,optionorg,optionsh):=( +//help:Crvsfparadata("1","ax3d","sfbd3d1",fd); +//help:Crvsfparadata(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"); + Changestyle(tmp,["nodisp"]); + name3="crvsf3d"+nm; + name3h="crvsfh3d"+nm; + fname=Fhead+"crvsf"+nm+".txt"; rfname=Fhead+sfstr+".txt"; rfname=replace(rfname,"3d",""); tmp=apply(fdorg,if(isstring(#),"'"+#+"'",#)); @@ -3346,7 +3426,7 @@ Wireparadata(nm,sfstr,fdorg,wr1,wr2,optionorg,optionsh):=( eqL=tmp_5; reL=tmp_6; strL=tmp_7; - waiting=600; + waiting=120; forall(eqL, tmp=indexof(#,"="); tmp1=Toupper(substring(#,0,1)); @@ -3369,74 +3449,84 @@ Wireparadata(nm,sfstr,fdorg,wr1,wr2,optionorg,optionsh):=( options=remove(options,[#]); ); ); - tmp1=textformat(wr1,6); - tmp1=Rsform(tmp1,1); - tmp2=textformat(wr2,6); - tmp2=Rsform(tmp2,1); - tmp=[sfstr,"fd"+nm,tmp1,tmp2]; reL=RSform(text(reL),2); reL=substring(reL,5,length(reL)-1); + cmdL=[]; //180509from + tmp=Select(GLIST,indexof(#,"Proj")==0); + cmdL=MkprecommandR(tmp);//180509to + tmp2=replace(rfname,".txt",".Rdata"); + cmdL=concat(cmdL,[ + "print",[Dqq("crv"+nm)], //18.02.22 + "fd"+nm+"="+fd,[], + "ReadOutData",[Dqq(rfname)], + "load",[Dqq(tmp2)], + "Addpoints",[Addpoints()] + ]); + tmp3=select(GLIST,indexof(#,crvstr+"=")>0); //18.02.22from + if(length(tmp3)==0, + tmp3=Fhead+crvstr+".txt"; + tmp3=replace(tmp3,"3d",""); + cmdL=concat(cmdL,[ + "ReadOutData",[Dqq(tmp3)] + ]); + ); //18.02.22to + tmp=[crvstr,sfstr,"fd"+nm]; if(length(reL)>0, reL=textformat(reL,4); reL=substring(reL,1,length(reL)-1); reL=Rsform(reL); tmp=append(tmp,reL); ); - tmp1=[Dqq(fname),Dqq(name3),name3,Dqq(name2),name2]; - tmp1=concat(tmp1,[Dqq(name3h),name3h,Dqq(name2h),name2h]); - tmp2=replace(rfname,".txt",".dat"); - cmdL=[ - "print",[Dqq("wire"+nm)], //18.02.22 - "fd"+nm+"="+fd,[], - "ReadOutData",[Dqq(rfname)], - "load",[Dqq(tmp2)], - "Addpoints",[Addpoints()], - name3+"=Wireparadata",tmp, - name2+"=Projpara",[name3], - name3h+"=WIREHIDDENDATA",[], - name2h+"=Projpara",[name3h], + tmp1=[DqDq(fname),DqDq(name3),name3,DqDq(name3h),name3h]; + cmdL=concat(cmdL,[ + name3+"=Crvsfparadata",tmp, + name3h+"=CRVSFHIDDENDATA",[], "WriteOutData",tmp1 - ]; + ]); tmp=replace(fname,".txt","end.txt"); options=concat(options,["Out=no","Wait="+text(waiting),"Res="+tmp]); - if(wflg==1,options=concat(options,["m"])); - if(wflg==-1,options=concat(options,["r"])); + if(wflg==1,options=append(options,"m")); + if(wflg==-1,options=append(options,"r")); + options=append(options,"Pre=!G");//180509 if(ErrFlag==0, - CalcbyR("wire"+nm,cmdL,options); + CalcbyR("crvsf"+nm,cmdL,options); ); if(ErrFlag==1, - err("Wireparadata not completed"); + err("Crvsfparadata not completed"); , ReadOutData(fname); - if(islist(parse(name2)), - Extractdata(name2,options); + if(islist(parse(name3)), //180507(2lines) + Extractdata(name3,["nodisp"]); + Projpara(name3,options); if(length(optionsh)>0,tmp=optionsh,tmp=["nodisp"]); - Extractdata(name2h,tmp); + Projpara(name3h,tmp);//180507 , ErrFlag=1; ); ); ); -Crvsfparadata(nm,crv,sf,fd):= - Crvsfparadata(nm,crv,sf,fd,[],["nodisp"]); -Crvsfparadata(nm,crv,sf,fd,options):= - Crvsfparadata(nm,crv,sf,fd,options,["nodisp"]); -Crvsfparadata(nm,crvstr,sfstr,fdorg,optionorg,optionsh):=( -//help:Crvsfparadata("1","ax3d","sfbd3d1",fd); -//help:Crvsfparadata(options2=[division(c(50,50)),Eps1(0.01), Eps2(0.05)]); - regional(gd,out,fd,options,name2,name3,name2h,name3h, +Crv3onsfparadata(nm,crv3d,sf,fd):= + Crvs3onfparadata(nm,crv3d,sf,fd,[],["nodisp"]); +Crv3onsfparadata(nm,crv3d,sf,fd,options):= + Crv3onsfparadata(nm,crv3d,sf,fd,options,["nodisp"]); +Crv3onsfparadata(nm,crv3dstr,sfstr,fdorg,optionorg,optionsh):=( +//help:Crv3onsfparadata("1","sc1","sfbd3d1",fd); +//help:Crv3onsfparadata(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"); + tmp1=replace(crv3dstr,"3d","2d"); + tmp=apply(GCLIST,#_1); + if(contains(tmp,tmp1), + Changestyle3d(tmp1,["nodisp"]);//180428 + ); Changestyle(tmp,["nodisp"]); - name2="crvsf2d"+nm; - name3="crvsf3d"+nm; - name2h="crvsfh2d"+nm; - name3h="crvsfh3d"+nm; - fname=Fhead+"crvsf"+nm+".txt"; + name3="crv3onsf3d"+nm; + name3h="crv3onsfh3d"+nm; + fname=Fhead+"crv3onsf"+nm+".txt"; rfname=Fhead+sfstr+".txt"; rfname=replace(rfname,"3d",""); - tmp=apply(fdorg,if(isstring(#),"'"+#+"'",#)); + tmp=apply(fdorg,if(isstring(#),Dqq(#),#)); tmp=text(tmp); fd=RSform(tmp,2); options=optionorg; @@ -3469,73 +3559,68 @@ Crvsfparadata(nm,crvstr,sfstr,fdorg,optionorg,optionsh):=( ); reL=RSform(text(reL),2); reL=substring(reL,5,length(reL)-1); - tmp=[crvstr,sfstr,"fd"+nm]; + cmdL=[]; //180509from + tmp=Select(GLIST,indexof(#,"Proj")==0); + cmdL=MkprecommandR(tmp);//180509to + tmp=["crv",sfstr,"fd"+nm]; if(length(reL)>0, reL=textformat(reL,4); reL=substring(reL,1,length(reL)-1); reL=Rsform(reL); tmp=append(tmp,reL); ); - tmp1=[DqDq(fname),DqDq(name3),name3,DqDq(name2),name2]; - tmp1=concat(tmp1,[DqDq(name3h),name3h,DqDq(name2h),name2h]); - tmp2=replace(rfname,".txt",".dat"); - cmdL=[ - "print",[Dqq("crv"+nm)], //18.02.22 + tmp1=[Dqq(fname),Dqq(name3),name3,Dqq(name3h),name3h]; + tmp2=replace(rfname,".txt",".Rdata"); + cmdL=concat(cmdL,[ + "print",[Dqq("crv3onsf"+nm)], //180222 "fd"+nm+"="+fd,[], "ReadOutData",[Dqq(rfname)], - "load",[Dqq(tmp2)], - "Addpoints",[Addpoints()] - ]; - tmp3=select(GLIST,indexof(#,crvstr+"=")>0); //18.02.22from - if(length(tmp3)==0, - tmp3=Fhead+crvstr+".txt"; - tmp3=replace(tmp3,"3d",""); - cmdL=concat(cmdL,[ - "ReadOutData",[Dqq(tmp3)] - ]); - ); //18.02.22until - cmdL=concat(cmdL,[ - name3+"=Crvsfparadata",tmp, - name2+"=Projpara",[name3], - name3h+"=CRVSFHIDDENDATA",[], - name2h+"=Projpara",[name3h], + "load",[Dqq(tmp2)] + ]); + cmdL=concat(cmdL,[ + "Addpoints",[Addpoints()], + "crv="+crv3dstr,[], + name3+"=Crv3onsfparadata",tmp, + name3h+"=HIDDENDATA",[], "WriteOutData",tmp1 ]); tmp=replace(fname,".txt","end.txt"); options=concat(options,["Out=no","Wait="+text(waiting),"Res="+tmp]); if(wflg==1,options=append(options,"m")); if(wflg==-1,options=append(options,"r")); + options=append(options,"Pre=!G"); //180508 if(ErrFlag==0, - CalcbyR("crvsf"+nm,cmdL,options); + CalcbyR("crv3onsf"+nm,cmdL,options); ); if(ErrFlag==1, - err("Crvsfparadata not completed"); + err("Crv3onsfparadata not completed"); , ReadOutData(fname); - if(islist(parse(name2)), - Extractdata(name2,options); + if(islist(parse(name3)), + Extractdata(name3,["nodisp"]); + Projpara(name3,options); //180507 if(length(optionsh)>0,tmp=optionsh,tmp=["nodisp"]); - Extractdata(name2h,tmp); + Extractdata(name3h,["nodisp"]); + Projpara(name3h,tmp); , ErrFlag=1; ); ); ); -Crvonsfparadata(nm,crv2d,sf,fd):= - Crvsonfparadata(nm,crv2d,sf,fd,[],["nodisp"]); -Crvonsfparadata(nm,crv2d,sf,fd,options):= - Crvonsfparadata(nm,crv2d,sf,fd,options,["nodisp"]); -Crvonsfparadata(nm,crv2dstr,sfstr,fdorg,optionorg,optionsh):=( -//help:Crvonsfparadata("1",["[1,t]","t=[0,2*pi]","Num=50"],"sfbd3d1",fd); -//help:Crvonsfparadata(options2=[division(c(50,50)),Eps1(0.01), Eps2(0.05)]); - regional(gd,out,fd,options,name2,name3,name2h,name3h, +Crv2onsfparadata(nm,crv2d,sf,fd):= + Crvs2onfparadata(nm,crv2d,sf,fd,[],["nodisp"]); +Crv2onsfparadata(nm,crv2d,sf,fd,options):= + Crv2onsfparadata(nm,crv2d,sf,fd,options,["nodisp"]); +Crv2onsfparadata(nm,crv2dstr,sfstr,fdorg,optionorg,optionsh):=( +//help:Crv2onsfparadata("1","pa1","sfbd3d1",fd); +//help:Crv2onsfparadata(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); - name2="crvonsf2d"+nm; - name3="crvonsf3d"+nm; - name2h="crvonsfh2d"+nm; - name3h="crvonsfh3d"+nm; - fname=Fhead+"crvonsf"+nm+".txt"; + Changestyle(crv2dstr,["nodisp"]); + name3="crv2onsf3d"+nm; + name3h="crv2onsfh3d"+nm; + fname=Fhead+"crv2onsf"+nm+".txt"; rfname=Fhead+sfstr+".txt"; rfname=replace(rfname,"3d",""); tmp=apply(fdorg,if(isstring(#),Dqq(#),#)); @@ -3578,6 +3663,9 @@ Crvonsfparadata(nm,crv2dstr,sfstr,fdorg,optionorg,optionsh):=( ); reL=RSform(text(reL),2); reL=substring(reL,5,length(reL)-1); + cmdL=[]; //180509from + tmp=Select(GLIST,indexof(#,"Proj")==0); + cmdL=MkprecommandR(tmp);//180509to tmp=["crv",sfstr,"fd"+nm]; if(length(reL)>0, reL=textformat(reL,4); @@ -3585,37 +3673,141 @@ Crvonsfparadata(nm,crv2dstr,sfstr,fdorg,optionorg,optionsh):=( reL=Rsform(reL); tmp=append(tmp,reL); ); - tmp1=[Dqq(fname),Dqq(name3),name3,Dqq(name2),name2]; - tmp1=concat(tmp1,[Dqq(name3h),name3h,Dqq(name2h),name2h]); - tmp2=replace(rfname,".txt",".dat"); - cmdL=[ - "print",[Dqq("crvonsf"+nm)], //18.02.22 + tmp1=[Dqq(fname),Dqq(name3),name3,Dqq(name3h),name3h]; + tmp2=replace(rfname,".txt",".Rdata"); + cmdL=concat(cmdL,[ + "print",[Dqq("crv2onsf"+nm)], //18.02.22 "fd"+nm+"="+fd,[], "ReadOutData",[Dqq(rfname)], - "load",[Dqq(tmp2)], + "load",[Dqq(tmp2)] + ]); + cmdL=concat(cmdL,[ "Addpoints",[Addpoints()], - "crv="+crv,[], - name3+"=Crvonsfparadata",tmp, - name2+"=Projpara",[name3], + "crv="+crv2dstr,[], + name3+"=Crv2onsfparadata",tmp, name3h+"=HIDDENDATA",[], - name2h+"=Projpara",[name3h], "WriteOutData",tmp1 - ]; + ]); tmp=replace(fname,".txt","end.txt"); options=concat(options,["Out=no","Wait="+text(waiting),"Res="+tmp]); if(wflg==1,options=append(options,"m")); if(wflg==-1,options=append(options,"r")); + options=append(options,"Pre=!G"); //180508 + if(ErrFlag==0, + CalcbyR("crv2onsf"+nm,cmdL,options); + ); + if(ErrFlag==1, + err("Crv2onsfparadata not completed"); + , + ReadOutData(fname); + if(islist(parse(name3)), + Extractdata(name3,["nodisp"]); + Projpara(name3,options); //180507 + if(length(optionsh)>0,tmp=optionsh,tmp=["nodisp"]); + Projpara(name3h,tmp); + , + ErrFlag=1; + ); + ); +); + +Wireparadata(nm,sf,wr1,wr2,fd):= + Wireparadata(nm,sf,fd,wr1,wr2,[],["nodisp"]); +Wireparadata(nm,sf,fd,wr1,wr2,options):= + Wireparadata(nm,sf,fd,wr1,wr2,options,["nodisp"]); +Wireparadata(nm,sfstr,fdorg,wr1,wr2,optionorg,optionsh):=( +//help:Wireparadata("1","sfbd3d1",fd,5,5); +//help:Wireparadata(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; + name3h="wireh3d"+nm; + fname=Fhead+"wire"+nm+".txt"; + rfname=Fhead+sfstr+".txt"; + rfname=replace(rfname,"3d",""); + tmp=apply(fdorg,if(isstring(#),"'"+#+"'",#)); + tmp=text(tmp); + fd=RSform(tmp,2); + options=optionorg; + tmp=Divoptions(options); + eqL=tmp_5; + reL=tmp_6; + strL=tmp_7; + waiting=600; + forall(eqL, + tmp=indexof(#,"="); + tmp1=Toupper(substring(#,0,1)); + tmp2=substring(#,tmp,length(#)); + if(tmp1=="W", + waiting=parse(tmp2); + options=remove(options,[#]); + ); + ); + options=remove(options,reL); + wflg=0; + forall(strL, + tmp=Toupper(substring(#,0,1)); + if(tmp=="M", + wflg=1; + options=remove(options,[#]); + ); + if(tmp=="R", + wflg=-1; + options=remove(options,[#]); + ); + ); + tmp1=textformat(wr1,6); + tmp1=Rsform(tmp1,1); + tmp2=textformat(wr2,6); + tmp2=Rsform(tmp2,1); + tmp=[sfstr,"fd"+nm,tmp1,tmp2]; + reL=RSform(text(reL),2); + reL=substring(reL,5,length(reL)-1); + cmdL=[]; //180509from + tmp=Select(GLIST,indexof(#,"Proj")==0); + cmdL=MkprecommandR(tmp);//180509to + tmp1=textformat(wr1,6); + tmp1=Rsform(tmp1,1); + tmp2=textformat(wr2,6); + tmp2=Rsform(tmp2,1); + tmp=[sfstr,"fd"+nm,tmp1,tmp2]; + reL=RSform(text(reL),2); + reL=substring(reL,5,length(reL)-1); + if(length(reL)>0, + reL=textformat(reL,4); + reL=substring(reL,1,length(reL)-1); + reL=Rsform(reL); + tmp=append(tmp,reL); + ); + tmp1=[Dqq(fname),Dqq(name3),name3,Dqq(name3h),name3h]; + tmp2=replace(rfname,".txt",".Rdata"); + cmdL=concat(cmdL,[ + "print",[Dqq("wire"+nm)], //18.02.22 + "fd"+nm+"="+fd,[], + "ReadOutData",[Dqq(rfname)], + "load",[Dqq(tmp2)], + "Addpoints",[Addpoints()], + name3+"=Wireparadata",tmp, + name3h+"=WIREHIDDENDATA",[], + "WriteOutData",tmp1 + ]); + tmp=replace(fname,".txt","end.txt"); + options=concat(options,["Out=no","Wait="+text(waiting),"Res="+tmp]); + if(wflg==1,options=concat(options,["m"])); + if(wflg==-1,options=concat(options,["r"])); + options=append(options,"Pre=!G"); //180508 if(ErrFlag==0, - CalcbyR("crvonsf"+nm,cmdL,options); + CalcbyR("wire"+nm,cmdL,options); ); if(ErrFlag==1, - err("Crvonsfparadata not completed"); + err("Wireparadata not completed"); , ReadOutData(fname); - if(islist(parse(name2)), - Extractdata(name2,options); + if(islist(parse(name3)), + Extractdata(name3,["nodisp"]); + Projpara(name3,options); if(length(optionsh)>0,tmp=optionsh,tmp=["nodisp"]); - Extractdata(name2h,tmp); + Projpara(name3h,tmp); , ErrFlag=1; ); @@ -3716,16 +3908,20 @@ Sfcutparadata(nm,eqstr,sf,fd):= Sfcutparadata(nm,eqstr,sf,fd,[]); Sfcutparadata(nm,eqstr,sf,fd,options):= Sfcutparadata(nm,eqstr,sf,fd,options,["nodisp"]); -Sfcutparadata(nm,eqstr,sf,fdorg,optionorg,optionsh):=( -//help:Sfcutparadata("1","x+y+z=1","sfbd3d1",fd,"x+y+z=1"); -//help:Sfcutparadata(options2=[division(c(50,50)),Eps1(0.01), Eps2(0.05)]); - regional(gd,out,fd,options,name2,name3,name2h,name3h, +Sfcutparadata(nm,eqstrorg,sf,fdorg,optionorg,optionsh):=( +//help:Sfcutparadata("1","x+y+z=1","sfbd3d1",fd); +//help:Sfcutparadata(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,"="); + if(length(tmp)==1, + eqstr=tmp_1; + , + eqstr=tmp_1+"-("+tmp_2+")"; + ); tmp=replace(sfcut,"3d","2d"); Changestyle(tmp,["nodisp"]); - name2="sfcut2d"+nm; name3="sfcut3d"+nm; - name2h="sfcuth2d"+nm; name3h="sfcuth3d"+nm; fname=Fhead+"sfcut"+nm+".txt"; rfname=Fhead+sf+".txt"; @@ -3763,6 +3959,9 @@ Sfcutparadata(nm,eqstr,sf,fdorg,optionorg,optionsh):=( ); reL=RSform(text(reL),2); reL=substring(reL,5,length(reL)-1); + cmdL=[]; //180509from + tmp=Select(GLIST,indexof(#,"Proj")==0); + cmdL=MkprecommandR(tmp);//180509to tmp=[Dqq(eqstr),sf,"fd"+nm]; if(length(reL)>0, reL=textformat(reL,4); @@ -3770,24 +3969,22 @@ Sfcutparadata(nm,eqstr,sf,fdorg,optionorg,optionsh):=( reL=Rsform(reL); tmp=append(tmp,reL); ); - tmp1=[DqDq(fname),DqDq(name3),name3,DqDq(name2),name2]; - tmp1=concat(tmp1,[DqDq(name3h),name3h,DqDq(name2h),name2h]); - tmp2=replace(rfname,".txt",".dat"); - cmdL=[ + tmp1=[DqDq(fname),DqDq(name3),name3,DqDq(name3h),name3h]; + tmp2=replace(rfname,".txt",".Rdata"); + cmdL=concat(cmdL,[ "print",[Dqq("sfcut"+nm)], //18.02.22 "fd"+nm+"="+fd,[], "ReadOutData",[Dqq(rfname)], "load",[Dqq(tmp2)], name3+"=Sfcutparadata",tmp, - name2+"=Projpara",[name3], name3h+"=CRVONSFHIDDENDATA",[], - name2h+"=Projpara",[name3h], "WriteOutData",tmp1 - ]; + ]); tmp=replace(fname,".txt","end.txt"); options=concat(options,["Out=no","Wait="+text(waiting),"Res="+tmp]); if(wflg==1,options=append(options,"m")); if(wflg==-1,options=append(options,"r")); + options=append(options,"Pre=!G"); //180508 if(ErrFlag==0, CalcbyR("sfcut"+nm,cmdL,options); ); @@ -3795,10 +3992,11 @@ Sfcutparadata(nm,eqstr,sf,fdorg,optionorg,optionsh):=( err("Sfcutparadata not completed"); , ReadOutData(fname); - if(islist(parse(name2)), - Extractdata(name2,options); + if(islist(parse(name3)), + Extractdata(name3,["nodisp"]); + Projpara(name3,options); if(length(optionsh)>0,tmp=optionsh,tmp=["nodisp"]); - Extractdata(name2h,tmp); + Projpara(name3h,tmp); , ErrFlag=1; ); @@ -3826,7 +4024,7 @@ Skeletondatacindy(nm,pltdata1org,pltdata2org,options):=( //help:Skeletonparadata("1"); //help:Skeletonparadata("1",[pdata1,pdata2],[pdata3]); //help:Skeletondata(options2=[1(width)]); - regional(Eps,Eps2,name2,name3,Ltype,Noflg,reL,opcindy, + regional(Eps,Eps2,name2,name3,Ltype,Noflg,reL,opcindy,color, Data,Out,ObjL,Plt3L,Rr,pltdata1,pltdata2,Plt2L,ObjL,ii,Data, Obj3,jj,Gd,PtD,size,tmp,tmp1,tmp2); name2="sk2d"+nm; @@ -3845,7 +4043,8 @@ Skeletondatacindy(nm,pltdata1org,pltdata2org,options):=( Ltype=tmp_1; Noflg=tmp_2; reL=tmp_6; //16.02.28 - opcindy=tmp_9; + color=tmp_(length(tmp)-2); + opcindy=tmp_(length(tmp)); Rr=0.15*1000/2.54/MilliIn; size=1; Eps2=0.05; @@ -3880,7 +4079,9 @@ Skeletondatacindy(nm,pltdata1org,pltdata2org,options):=( ); if(Noflg<2, if(isstring(Ltype), + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Ltype=GetLinestyle(text(Noflg)+Ltype,name2); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); , if(Noflg==1,Ltype=0); ); @@ -4020,7 +4221,7 @@ Skeletondatacindy(nm,pltdata1org,pltdata2org,options):=( //help:Skeletondatacindy(options2=[1(width)]); regional(Eps,Eps2,name2,name3,Ltype,Noflg,reL,opcindy, Out,ObjL,Plt3L,Rr,pltdata1,pltdata2,Plt2L,ObjL,ii,Data, - Obj3,jj,Gd,PtD,size,tmp,tmp1,tmp2); + Obj3,jj,Gd,PtD,size,tmp,tmp1,tmp2,color); name2="sk2d"+nm; name3="sk3d"+nm; pltdata1=[];// 16.01.31 @@ -4037,7 +4238,8 @@ Skeletondatacindy(nm,pltdata1org,pltdata2org,options):=( Ltype=tmp_1; Noflg=tmp_2; reL=tmp_6; //16.02.28 - opcindy=tmp_9; + color=tmp_(length(tmp)-2); + opcindy=tmp_(length(tmp)); Rr=0.075*1000/2.54/MilliIn; size=1; Eps2=0.05; @@ -4092,7 +4294,9 @@ Skeletondatacindy(nm,pltdata1org,pltdata2org,options):=( ); if(Noflg<2, if(isstring(Ltype), + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Ltype=GetLinestyle(text(Noflg)+Ltype,name2); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); , if(Noflg==1,Ltype=0); ); diff --git a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic1logr.txt b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic1logr.txt index d815618a97a..4f23caa52b0 100644 --- a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic1logr.txt +++ b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic1logr.txt @@ -1,3 +1,48 @@ +//20180613 +// Shade changed ( name, pointlist supported, Com2nd("before")) +// Shade debugged (color,opcindy) +// WritetoRS changed (for COM2ndlistb) +//20180612 +// Com2nd changed ("before" options added ) +//20180609 +// Ketinit changed (CommonMake added ) +//20180608 +// Ketinit changed (Namecdy defined ) +//20180606 +// Changework debugged ( case where "Sub=n" ) +//20180605 +// Changework changed ( "Sub=n" option supported ) +//20180603 +// Shade changed ( option density supported ) +// Addcolor removed +// Setcolor(color,option),Setcolorrgb removed +// Setcolor renewed +// Divoptions degugged (KCOLOR) +// Listplot,... changed (KCOLOR) +// Pointdata changed (color) +//20180602 +// Divoptions changed ( "Color=" supported ) +// Changestyle,.... changed ("Color=" supported) +// Changetyle changed (case in which name not found) +// Shade debugged ( color ) +// Rotatedata,... degugged ( for list of plotdata ) +//20180530 +// Anglemark changed (opstr,Brat=1.2) +// Pointdata degugged (for single point) +//20180527 +// Deqplot changed ( ' as default ) +//20180513 +// Setunitlen debugged ( string => UI ) +//20180506 +// Anglemark changed ( [A,B,angle] supported ) +//20180505 +// Strsplit added +//20180501 +// MeasureDepth debugged ( for blank list ) +//20180420 +// Ketinit changed ( Changesetting moved to ketoutset.txt ) +//20180413 +// Ketinit changed ( utf for windows removed ) //20180408 // Divoptions changed ( to remove null string ) // Changework changed (nkfwin) diff --git a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic1r.cs b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic1r.cs index f45ffee8d7a..024f9df129b 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.0(20180409)"); -println(ketjavaversion());//17.06.05 -println("ketcindylibbasic1(20180408) loaded"); +println("KeTCindy V.3.2.1(20180614)"); +println(ketjavaversion()); +println("ketcindylibbasic1(20180613) loaded"); //help:start(); @@ -48,7 +48,7 @@ Ketinit(sy,rangex,rangey):=( MEMORIInit=MEMORI; MEMORINow=MEMORI; MARKLEN=0.05; - MARKLENInit=MARKLEN: + MARKLENInit=MARKLEN; //180504 MARKLENNow= MARKLEN; GENTEN=[0,0];//18.01.15until KETPICLAYER=20; @@ -72,10 +72,12 @@ Ketinit(sy,rangex,rangey):=( COM0thlist=[]; COM1stlist=[]; COM2ndlist=[]; + COM2ndlistb=[]; //180612 ADDAXES="1"; LFmark=unicode("000a"); CRmark=unicode("000d");//16.12.13 Dq=unicode("0022"); + CommonMake=0;//180610 WaitUnit=10; CONTINUED=0; OutComList=[]; @@ -90,6 +92,7 @@ Ketinit(sy,rangex,rangey):=( Slidename=Fhead; //17.10.24 );//17.11.12 Dircdy=replace(Dircdy,"%E3%80%80"," ");//180405 + Namecdy=Cindyname();//180608 tmp1=Indexall(Dircdy,"%"); //180329from if(length(tmp1)>0, tmp1=append(tmp1,length(Dircdy)); @@ -106,9 +109,9 @@ Ketinit(sy,rangex,rangey):=( if(substring(Dircdy,0,1)==pathsep(), Dircdy=substring(Dircdy,1,length(Dircdy)); ); - Changesetting([gethome(), gethome()+"\Desktop","C:"]); //180405 +// Changesetting([gethome(), gethome()+"\Desktop","C:"]); //180405 , - Changesetting([gethome(),gethome()+"/Desktop"]); +// Changesetting([gethome(),gethome()+"/Desktop"]); ); Changework(Dircdy+pathsep()+"fig"); //180329to Fnametex=Fhead+".tex"; @@ -186,7 +189,7 @@ Changesetting(dirL):=( //180329 Cindyname():=Getcdyname(); Cdyname():=Getcdyname(); Getcdyname():=( //17.12.27 -//help:Cdyname(); +//help:Cindyname(); regional(out); out=text(curkernel()); out=replace(out,".cdy",""); @@ -436,6 +439,18 @@ Indexall(str,key):=( out; ); +Strsplit(str,key):=( //180505 + regional(start,out,tmp1,tmp2); + tmp1=Indexall(str,key); + out=[]; start=0; + forall(tmp1, + out=append(out,substring(str,start,#-1)); + start=#; + ); + out=append(out,substring(str,start,length(str))); + out; +); + Parlevel(str):=Bracket(str); // 16.05.22from Bracket(str):=Bracket(str,"()"); Bracket(str,br):=( @@ -559,9 +574,24 @@ Pardiagram(str,options):=( out; ); -Changework(dirorg):=( //16.10.21 +Changework(dirorg):=Changework(dirorg,["Sub=y"]); +Changework(dirorg,options):=( //16.10.21 //help:Changework(directory); - regional(dir,subdir,tmp); +//help:Changework(Dircdy+"fig"); +//help:Changework(options=["Sub=y"]); + regional(dir,subdir,tmp,,eqL,makesub); + tmp=Divoptions(options); + eqL=tmp_5; //180605from + makesub=1; + forall(eqL, + tmp=Strsplit(#,"="); + if(Toupper(tmp_1)=="SUB", + tmp=Toupper(tmp_2); + if(substring(tmp,0,1)=="N", + makesub=0; + ); + ); + ); //180605to dir=replace(dirorg,"/",pathsep());//17.11.20from dir=replace(dir,"\",pathsep()); dir=replace(dir,pathsep()+pathsep(),pathsep());//17.11.24 @@ -577,11 +607,14 @@ Changework(dirorg):=( //16.10.21 dir=substring(dir,0,tmp-1); ); //17.11.24until if(dir=="" % !isexists(dir,""), - println("Directory "+dir+" not exist, so set to "+Dirwork); + println("Directory "+dir+" not exist, so set to "+Dircdy);//180604(2lines) + Dirwork=Dircdy; ErrFlag=-1; , - if(length(subdir)>0, //17.11.24from - println(makedir(dir,subdir)); + if(length(subdir)>0, //180605 + if(makesub==1,//180606from + println(makedir(dir,subdir)); + );//180606 Dirwork=dir+pathsep()+subdir; , Dirwork=dir; @@ -593,37 +626,36 @@ Changework(dirorg):=( //16.10.21 closefile(SCEOUTPUT); println(setexec(Dirwork,"/kc.sh")); ); - , - if(isincludefull(Dirwork),//180408from - SCEOUTPUT = openfile("utf8.txt"); - println(SCEOUTPUT,"tmp="+Dqq(Dirwork)+";"); - closefile(SCEOUTPUT); - nkfwin("C:",Dirwork,"utf8.txt","sjis.txt");//180408to - ); ); ); ); Changestyle(nameL,style):=( //help:Changestyle(["sgAB"],["da"]); - regional(nmL,name,Ltype,Ltypeorg,Noflg,opcindy,tmp); + regional(nmL,name,Ltype,Ltypeorg,Noflg,color,opcindy,tmp); tmp=Divoptions(style); Ltypeorg=tmp_1; Noflg=tmp_2; + color=tmp_(length(tmp)-2); opcindy=tmp_(length(tmp)); if(islist(nameL),nmL=nameL,nmL=[nameL]); forall(nmL,name, - Ltype=Ltypeorg; - GCLIST=select(GCLIST,#_1!=name); - COM2ndlist=select(COM2ndlist, - (indexof(#,"("+name)==0)%(indexof(#,"Shade")>0)); // 15.05.23,16.12.13 - if(Noflg<2, - if(isstring(Ltype), - Ltype=GetLinestyle(text(Noflg)+Ltype,name); - , - if(Noflg==1,Ltype=0); + tmp=select(GCLIST,#_1==name); + if(length(tmp)>0, + Ltype=Ltypeorg; + GCLIST=select(GCLIST,#_1!=name); + COM2ndlist=select(COM2ndlist, + (indexof(#,"("+name)==0)%(indexof(#,"Shade")>0)); // 15.05.23,16.12.13 + if(Noflg<2, + if(isstring(Ltype), + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); + Ltype=GetLinestyle(text(Noflg)+Ltype,name); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); + , + if(Noflg==1,Ltype=0); + ); + GCLIST=append(GCLIST,[name,Ltype,opcindy]); ); - GCLIST=append(GCLIST,[name,Ltype,opcindy]); ); ); ); @@ -908,24 +940,26 @@ MeasureDepth(list):=( regional(tmp,tmp1,Depth,Flg); Flg=0; Depth=0; - if(ispoint(list), // 15.01.22 - Depth=0; - Flg=1; - , - tmp1=select(1..(length(list)),length(list_#)>0);//17.05.21from - tmp=list_(tmp1_1);//17.05.21until - ); - repeat(4, - if(Flg==0, - if(islist(tmp), - tmp=tmp_1; - Depth=Depth+1; - , - if(ispoint(tmp),Depth=Depth+1); - Flg=1; + if(length(list)>0, //180501 + if(ispoint(list), + Depth=0; + Flg=1; + , + tmp1=select(1..(length(list)),length(list_#)>0);//17.05.21from + tmp=list_(tmp1_1);//17.05.21until + ); + repeat(4, + if(Flg==0, + if(islist(tmp), + tmp=tmp_1; + Depth=Depth+1; + , + if(ispoint(tmp),Depth=Depth+1); + Flg=1; + ); ); ); - ); + );//180501 Depth; ); @@ -953,7 +987,7 @@ Flattenlist(pltlist):=( Divoptions(options):=( //help:Divoptions(options); - regional(Ltype,Noflg,Inflg,Outflg,eqL,realL,strL,opstr,opcindy,flg,tmp,tmp1); + regional(Ltype,Noflg,Inflg,Outflg,eqL,realL,strL,color,opstr,opcindy,flg,tmp,tmp1,tmp2); Ltype="dr"; // 2015.01.13 Noflg=0; Inflg=0; @@ -961,6 +995,7 @@ Divoptions(options):=( eqL=[]; realL=[]; strL=[]; + color=KCOLOR; //180603 opstr=""; opcindy=""; forall(options, @@ -974,7 +1009,31 @@ Divoptions(options):=( ); if(flg==0, if(indexof(#,"=")>0, - eqL=append(eqL,#); + tmp=Strsplit(#,"="); //180602from + tmp1=Toupper(tmp_1); + tmp2=tmp_2; + if(tmp1=="COLOR", + if(substring(tmp2,0,1)=="[", + tmp1=parse(tmp2); + color=tmp1; + if(length(tmp1)==4, + tmp1=colorCmyk2Rgb(tmp1); + ); + , + if(tmp2=="red",tmp1=[1,0,0];color=tmp1); + if(tmp2=="green",tmp1=[0,1,0];color=tmp1); + if(tmp2=="blue",tmp1=[0,0,1];color=tmp1); + if(tmp2=="black",tmp1=[0,0,0];color=tmp1); + if(tmp2=="white",tmp1=[1,1,1];color=tmp1); + if(tmp2=="cyan",tmp1=[0,1,1];color=tmp1); + if(tmp2=="magenta",tmp1=[1,0,1];color=tmp1); + if(tmp2=="yellow",tmp1=[1,1,0];color=tmp1); + ); + tmp="color->"+text(tmp1); + opcindy=opcindy+","+tmp; + , + eqL=append(eqL,#); + );//180602to flg=1; ); ); @@ -1032,9 +1091,9 @@ Divoptions(options):=( ); ); if(indexof(opcindy,"color->")==0,// 16.10.07from - opcindy=opcindy+",color->[0,0,0]"; + opcindy=opcindy+",color->"+text(KCOLOR); ); - [Ltype,Noflg,Inflg,Outflg,eqL,realL,strL,opstr,opcindy]; + [Ltype,Noflg,Inflg,Outflg,eqL,realL,strL,color,opstr,opcindy]; ); Dotprod(vec1,vec2):=( @@ -2229,11 +2288,17 @@ Com1st(String):=( // COM1stlist=append(COM1stlist,str); ); -Com2nd(String):=( -// help:Com2nd(""); - regional(str); - str=replace(String,LFmark,""); +Com2nd(String):=Com2nd(String,["a"]);//180612 +Com2nd(String,option):=( +// help:Com2nd(str,["before"]); + regional(str,tmp); + str=replace(String,LFmark,""); + tmp=substring(option_1,0,1);//180612from + if(Toupper(tmp)=="B", + COM2ndlistb=append(COM2ndlistb,str); + , COM2ndlist=append(COM2ndlist,str); + );//180612to ); Com2ndpre(String):=( @@ -2306,6 +2371,7 @@ Setunitlen():=( println(ULEN); ); Setunitlen(UI):=( +//help:Setunitlen("1.5cm"); regional(Dx,Dy,Sym,SL,OL,Is,VL,Ucode,ii,cha, str,Unit,Valu,flg,tmp); Dx=XMAX-XMIN; @@ -2315,7 +2381,7 @@ Setunitlen(UI):=( OL="+-*/"; if(length(UI)>0, ULEN=UI; - GLIST=append(GLIST,"Setunitlen("+Dq+string+Dq+")"); + GLIST=append(GLIST,"Setunitlen("+Dq+UI+Dq+")");//180513 ); Is=1; VL=""; @@ -2484,46 +2550,33 @@ Definecolor(name,data):=( Texcom(tmp); ); -Setcolor(Par):=( +Setcolor(parorg):=( //180603renew //help:Setcolor([1,0,0,1]); //help:Setcolor([1,1,0]); - if(islist(Par), - if(length(Par)==3, - Setcolorrgb(Par); // 2015.04.28 -// KCOLOR=Par; - ); - if(length(Par)==4, - Setcolor(Par,[]); - ); - , - Setcolor(Par,[]); - ); -); - -Setcolor(colorname,options):=( -//help:Setcolor("greenyellow",0.3); - regional(tmp); - if(isstring(colorname), - tmp="Setcolor("+Dq+colorname+Dq; - if(length(options)>0, - tmp=tmp+","+text(options_1); - ); - Com2nd(tmp+")"); - ); - if(islist(colorname), - tmp=text(colorname); - tmp=substring(tmp,1,length(tmp)-1); - Texcom("\color[cmyk]{"+tmp+"}"); //17.09.22 - ); -); - -Setcolorrgb(colorlist):=( -// help:Setcolorrgb([0.5,0.3,0.4]); - regional(tmp); - tmp=text(colorlist); - tmp=substring(tmp,1,length(tmp)-1); - tmp="Texcom("+Dq+"\\color[rgb]{"+tmp+"}"+Dq+")"; //17.10.07 - Com2nd(tmp); + regional(par,cstr,tmp,tmp1); + par=parorg; + if(isstring(par), + if(par=="black",par=[0,0,0]); + if(par=="white",par=[1,1,1]); + if(par=="red",par=[1,0,0]); + if(par=="green",par=[0,1,0]); + if(par=="blue",par=[0,0,1]); + if(par=="cyan",par=[0,1,1]); + if(par=="magenta",par=[1,0,1]); + if(par=="yellow",par=[1,1,0]); + ); + cstr=text(par); + cstr=substring(cstr,1,length(cstr)-1); + if(length(par)==3, + cstr="Texcom('\\color[rgb]{"+cstr+"}')"; + KCOLOR=par; + ); + if(length(par)==4, + cstr="Texcom('\\color[cmyk]{"+cstr+"}')"; + tmp=ColorCmyk2Rgb(par); + KCOLOR=tmp; + ); + Com2nd(cstr); ); ColorRgb2Cmyk(clr):=( @@ -2815,30 +2868,6 @@ Colorcode(src,dest,sL):=( dL; ); -Addcolor(cmdorg,list):=( -//help:Addcolor("Plotdata('1','x^2','x',[])",[1,1,0]); - regional(rgb,cmyk,cmd,tmp,tmp1,tmp2,tmp3,tmp4); - cmd=replace(cmdorg,"'",Dq); - if(length(list)==3, - rgb=list; - cmyk=Colorcode("rgb","cmyk",list); - , - cmyk=list; - rgb=Colorcode("cmyk","rgb",list); - ); - tmp1="color->"+text(rgb); - tmp2="Setcolor("+text(cmyk)+");"; - tmp3=substring(cmd,0,length(cmd)-2); - tmp=substring(tmp3,length(tmp3)-1,length(tmp3)); - if(tmp!="[", - tmp3=tmp3+","; - ); - tmp3=tmp3+Dq+tmp1+Dq+"])"; - parse(tmp2); - parse(tmp3); - Setcolor("black"); -); - Colorinfile(filename,clrf,clrt):=( regional(tmp,tmp1,tmp2,head,cstrL,chstrL,head,body); if(length(clrf_1)==3, @@ -2974,23 +3003,12 @@ Chunderscore(str):=( tmp1; ); -//AddGraph(pltdata):=AddGraph("-"+pltdata,pltdata,[]); AddGraph(nm,pltdata):=AddGraph(nm,pltdata,[]); -// if(isstring(Arg2), -// AddGraph(Arg1,Arg2,[]); -// , -// if(MeasureDepth(Arg2)>0, -// Addgraph(Arg1,Arg2,[]); -// , -// Addgraph("-"+Arg1,Arg1,Arg2); -// ); -// ); -//); AddGraph(nm,pltdata,options):=( //help:AddGraph("1","imp1"); // 16.04.04 //help:Addgraph("1",["[pt1]","gr1"],["nodisp"]); regional(name,Ltype,Noflg,opcindy,pdata,fname,flg, - tmp,tmp1,tmp2,tmp3); + tmp,tmp1,tmp2,tmp3,color); if(substring(nm,0,1)=="-", name=substring(nm,1,length(nm)); , @@ -2999,7 +3017,8 @@ AddGraph(nm,pltdata,options):=( tmp=Divoptions(options); Ltype=tmp_1; Noflg=tmp_2; - opcindy=tmp_9; + color=tmp_(length(tmp)-2); + opcindy=tmp_(length(tmp)); if(isstring(pltdata), pdata=parse(pltdata) , @@ -3072,7 +3091,9 @@ AddGraph(nm,pltdata,options):=( ); // 16.04.04 until if(Noflg<2, if(isstring(Ltype), + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Ltype=GetLinestyle(text(Noflg)+Ltype,name); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); , if(Noflg==1,Ltype=0); ); @@ -3084,7 +3105,7 @@ Joincrvs(nm,plotstrL):=Joincrvs(nm,plotstrL,[]); Joincrvs(nm,plotstrL,options):=( //help:Joincrvs("1",["sgAB","sgDCB"]); regional(plotlist,PtL,Eps,QdL,Flg,Ni,Qd,pP,pS,pQ,pR,rMN, - opcindy,tmp,tmp1,tmp2,str,name,Ltype,Noflg); + opcindy,tmp,tmp1,tmp2,str,name,Ltype,Noflg,color); name="join"+nm; plotlist=[]; forall(plotstrL,str, @@ -3100,6 +3121,7 @@ Joincrvs(nm,plotstrL,options):=( tmp=Divoptions(options); Ltype=tmp_1; Noflg=tmp_2; + color=tmp_(length(tmp)-2); opcindy=tmp_(length(tmp)); tmp1=tmp_6; if(length(tmp1)>0,Eps=tmp1_1); @@ -3162,7 +3184,9 @@ Joincrvs(nm,plotstrL,options):=( ); if(Noflg<2, if(isstring(Ltype), + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Ltype=GetLinestyle(text(Noflg)+Ltype,name); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); , if(Noflg==1,Ltype=0); ); @@ -3176,7 +3200,7 @@ Partcrv(nm,pA,pB,PkLstr,options):=( //help:Partcrv("1",A,B,"sgABC"); //help:Partcrv("1",1.3,2.5,"sgABC"); regional(PkL,Ans,Eps,Npt,Out1,Out2,tmp,tmp1,Flg,nS,nE,PPL,pP, - opcindy,Ta,Tb,name,Ltype,Noflg,DepthFlg); + opcindy,Ta,Tb,name,Ltype,Noflg,DepthFlg,color); name="part"+nm; if(isstring(PkLstr),PkL=parse(PkLstr),PkL=PkLstr); DepthFlg=0; @@ -3188,6 +3212,7 @@ Partcrv(nm,pA,pB,PkLstr,options):=( tmp=Divoptions(options); Ltype=tmp_1; Noflg=tmp_2; + color=tmp_(length(tmp)-2); opcindy=tmp_(length(tmp)); Eps=10^(-3); Flg=0; @@ -3246,7 +3271,9 @@ Partcrv(nm,pA,pB,PkLstr,options):=( ); if(Noflg<2, if(isstring(Ltype), + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Ltype=GetLinestyle(text(Noflg)+Ltype,name); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); , if(Noflg==1,Ltype=0); ); @@ -3271,17 +3298,18 @@ Pointdata(nm,listorg,options):=( //help:Pointdata("1",[2,4],["Size=5"]); //help:Pointdata("2",[[2,3],[4,1]]); regional(list,name,nameL,ptlist,opstr,opcindy, - eqL,size,thick,tmp,tmp1,tmp2,tmp3,Ltype,Noflg); + eqL,size,thick,tmp,tmp1,tmp2,tmp3,Ltype,Noflg,color); name="pt"+nm; nameL=name+"L"; println("generate pointdata "+name); tmp=Divoptions(options); Ltype=tmp_1; Noflg=tmp_2; + eqL=tmp_5; opcindy=tmp_(length(tmp)); opstr=tmp_(length(tmp)-1); + color=tmp_(length(tmp)-2); size=""; - eqL=tmp_5; if(length(eqL)>0, forall(eqL, tmp=substring(#,0,1); @@ -3292,6 +3320,7 @@ Pointdata(nm,listorg,options):=( ); ); if(isstring(listorg),list=parse(listorg),list=listorg); //17.10.23 + if(MeasureDepth(list)==0,list=[list]);//180530 tmp=MeasureDepth(list); if(tmp>0, // 2015.02.21 if(tmp==1,ptlist=list,ptlist=list_1); @@ -3337,7 +3366,9 @@ Pointdata(nm,listorg,options):=( if(length(size)>0,tmp1=parse(size),tmp1=1); tmp1=max(tmp1,1)/8; Setpen(tmp1); // 16.04.09 until + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Com2nd("Drwpt(list("+name+")"+opstr+")"); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); Setpen(thick); // 16.04.09 if(length(size)>0, Com2nd("Setpt("+textformat(TenSize/TenSizeInit,1)+")"); @@ -3352,7 +3383,7 @@ Listplot(nm,list,options):=( // help:Listplot(["A","B"]); //help:Listplot("1",[[2,1],[3,3]]); //help:Listplot(options2=["Msg=yes"]); - regional(name,tmp,tmp1,ptlist,Ltype,opcindy,Noflg,eqL,Msg); + regional(name,tmp,tmp1,ptlist,Ltype,opcindy,Noflg,eqL,Msg,color); if(substring(nm,0,1)=="-", // 16.01.27 from name=substring(nm,1,length(nm)); , @@ -3362,6 +3393,7 @@ Listplot(nm,list,options):=( Ltype=tmp_1; Noflg=tmp_2; eqL=tmp_5; + color=tmp_(length(tmp)-2); opcindy=tmp_(length(tmp)); Msg=1; // 15.09.17 forall(eqL, @@ -3386,7 +3418,9 @@ Listplot(nm,list,options):=( ); if(Noflg<2, if(isstring(Ltype), + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Ltype=GetLinestyle(text(Noflg)+Ltype,name); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); , if(Noflg==1,Ltype=0); ); @@ -3417,13 +3451,14 @@ Lineplot(nm,list,options):=( //help:Lineplot([A,B]); //help:Lineplot("1",[[2,1],[3,3]]); regional(name,Out,tmp,tmp1,opstr,opcindy,Mag,Semi, - Vec,pA,pB,Ltype,Noflg); + Vec,pA,pB,Ltype,Noflg,color); name="ln"+nm; Mag=100; Semi=""; tmp=Divoptions(options); Ltype=tmp_1; Noflg=tmp_2; + color=tmp_(length(tmp)-2); opcindy=tmp_(length(tmp)); opstr=tmp_(length(tmp)-1); tmp1=tmp_6; @@ -3450,7 +3485,9 @@ Lineplot(nm,list,options):=( ); if(Noflg<2, if(isstring(Ltype), + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Ltype=GetLinestyle(text(Noflg)+Ltype,name); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); , if(Noflg==1,Ltype=0); ); @@ -3483,7 +3520,7 @@ Plotdata(name1,func,variable,options):=( //help:Plotdata("3","Fout(x)","x",["out"]); regional(Fn,Va,tmp,tmp1,tmp2,eqL,name,Vname,x1,x2,dx, PdL,QdL,Num,Ec,Dc,Fun,Exfun,x,Ke,Eps,Pa, - Ltype,Noflg,Inflg,Outflg,opstr,opcindy); + Ltype,Noflg,Inflg,Outflg,opstr,opcindy,color); name="gr"+name1; tmp=Divoptions(options); Ltype=tmp_1; @@ -3491,6 +3528,7 @@ Plotdata(name1,func,variable,options):=( Inflg=tmp_3; Outflg=tmp_4; opstr=tmp_(length(tmp)-1); + color=tmp_(length(tmp)-2); opcindy=tmp_(length(tmp)); eqL=tmp_5; Num=50; @@ -3617,8 +3655,10 @@ Plotdata(name1,func,variable,options):=( ); if(Noflg<2, if(isstring(Ltype), + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Ltype=GetLinestyle(text(Noflg)+Ltype,name); - , + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); + , if(Noflg==1,Ltype=0); ); GCLIST=append(GCLIST,[name,Ltype,opcindy]); @@ -3627,7 +3667,9 @@ Plotdata(name1,func,variable,options):=( , if(Noflg<2, if(isstring(Ltype), + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Ltype=GetLinestyle(text(Noflg)+Ltype,name); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); , if(Noflg==1,Ltype=0); ); @@ -3643,7 +3685,7 @@ Paramplot(name1,funstr,variable,options):=( //help:Paramplot("1","[2*cos(t),sin(t)]","t=[0,2*pi]"); regional(name,Out,tmp,tmp1,tmp2,vname,func,str,Rng,Num, Ec,Exfun,Dc,eqL,Fntmp,Vatmp,t1,t2,dt,tt,pa,ke, - Ltype,Noflg,Inflg,Outflg,opstr,opcindy); + Ltype,Noflg,Inflg,Outflg,opstr,opcindy,color); name="gp"+name1; Eps=10^(-4); tmp=Divoptions(options); @@ -3651,6 +3693,7 @@ Paramplot(name1,funstr,variable,options):=( Noflg=tmp_2; Inflg=tmp_3; Outflg=tmp_4; + color=tmp_(length(tmp)-2); opstr=tmp_(length(tmp)-1); opcindy=tmp_(length(tmp)); eqL=tmp_5; @@ -3760,7 +3803,9 @@ Paramplot(name1,funstr,variable,options):=( ); if(Noflg<2, if(isstring(Ltype), + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Ltype=GetLinestyle(text(Noflg)+Ltype,name); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); , if(Noflg==1,Ltype=0); ); @@ -3770,7 +3815,9 @@ Paramplot(name1,funstr,variable,options):=( , if(Noflg<2, if(isstring(Ltype), + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Ltype=GetLinestyle(text(Noflg)+Ltype,name); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); , if(Noflg==1,Ltype=0); ); @@ -3850,7 +3897,7 @@ Implicitplot(name1,func,xrng,yrng,options):=( //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,opsr,opcindy,dx,dy,out,jj,ii,kk, + Eps,Ltype,Noflg,eqL,color,opsr,opcindy,dx,dy,out,jj,ii,kk, yval1,yval2,xval1,xval2,eval11,eva12,eval21,eval22,pL,vL,qL); name="imp"+name1; Eps=10^(-4); @@ -3858,6 +3905,7 @@ Implicitplot(name1,func,xrng,yrng,options):=( Ltype=tmp_1; Noflg=tmp_2; eqL=tmp_5; + color=tmp_(length(tmp)-2); opstr=tmp_(length(tmp)-1); opcindy=tmp_(length(tmp)); Mdv=50;Ndv=50; @@ -3961,7 +4009,9 @@ Implicitplot(name1,func,xrng,yrng,options):=( ); if(Noflg<2, if(isstring(Ltype), + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Ltype=GetLinestyle(text(Noflg)+Ltype,name); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); , if(Noflg==1,Ltype=0); ); @@ -3990,15 +4040,16 @@ Circledata(para1,para2):=( Circledata(name,cenrad,options); ); Circledata(nm,cenrad,options):=( - regional(name,Out,Ctr,Ptcir,ra,Num,Rg,opstr,opcindy, + regional(name,Out,Ctr,Ptcir,ra,Num,Rg,opstr,opcindy,color, tmp,tmp1,tmp1,Th,Ltype,Noflg,eqL,pA,pB,pC,d1,d2,Eps); name="cr"+nm; tmp=Divoptions(options); Ltype=tmp_1; Noflg=tmp_2; + eqL=tmp_5; + color=tmp_(length(tmp)-2); opstr=tmp_(length(tmp)-1); opcindy=tmp_(length(tmp)); - eqL=tmp_5; Num=50; Rg=[0,2*pi]; forall(eqL, @@ -4065,7 +4116,9 @@ Circledata(nm,cenrad,options):=( ); if(Noflg<2, if(isstring(Ltype), + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Ltype=GetLinestyle(text(Noflg)+Ltype,name); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); , if(Noflg==1,Ltype=0); ); @@ -4107,11 +4160,12 @@ Framedata(nm,list,options):=( //help:Framedata("1",[C,A]); //help:Framedata("1",[C,dx,dy]); regional(name,Out,tmp,tmp1,pB,x1,x2,y1,y2,dx,dy, - opcindy,Ltype,Noflg,cent,dx,dy); + opcindy,Ltype,Noflg,cent,dx,dy,color); name="fr"+nm; tmp=Divoptions(options); Ltype=tmp_1; Noflg=tmp_2; + color=tmp_(length(tmp)-2); opcindy=tmp_(length(tmp)); if(length(list)==2, // 15.05.12 pA=Lcrd(list_1); pB=Lcrd(list_2); @@ -4132,7 +4186,9 @@ Framedata(nm,list,options):=( ); if(Noflg<2, if(isstring(Ltype), + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Ltype=GetLinestyle(text(Noflg)+Ltype,name); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); , if(Noflg==1,Ltype=0); ); @@ -4142,11 +4198,12 @@ Framedata(nm,list,options):=( ); Framedata(nm,cent,dx,dy):=Framedata(nm,cent,dx,dy,[]); Framedata(nm,cent,dx,dy,options):=( - regional(name,Out,tmp,tmp1,x1,y1,x2,y2,Ltype,opcindy,Noflg); + regional(name,Out,tmp,tmp1,x1,y1,x2,y2,Ltype,opcindy,Noflg,color); name="fr"+nm; tmp=Divoptions(options); Ltype=tmp_1; Noflg=tmp_2; + color=tmp_(length(tmp)-2); opcindy=tmp_(length(tmp)); x1=cent.x-dx; x2=cent.x+dx; y1=cent.y-dy; y2=cent.y+dy; @@ -4160,7 +4217,9 @@ Framedata(nm,cent,dx,dy,options):=( ); if(Noflg<2, if(isstring(Ltype), + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Ltype=GetLinestyle(text(Noflg)+Ltype,name); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); , if(Noflg==1,Ltype=0); ); @@ -4183,11 +4242,12 @@ Ovaldata(nm,Pdata,options):=( //help:Ovaldata("1",[A,B]); //help:Ovaldata(optios=[size]); regional(name,Graph,Ctr,Dx,Dy,Rc,Out,Point,Graph, - opstr,opcindy,tmp,tmp1,tmp2,tmp3,Ltype,Noflg); + opstr,opcindy,tmp,tmp1,tmp2,tmp3,Ltype,Noflg,color); name="ov"+nm; tmp=Divoptions(options); Ltype=tmp_1; Noflg=tmp_2; + color=tmp_(length(tmp)-2); opcindy=tmp_(length(tmp)); opstr=tmp_(length(tmp)-1); Rc=0.2; @@ -4226,7 +4286,9 @@ Ovaldata(nm,Pdata,options):=( ); if(Noflg<2, if(isstring(Ltype), + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Ltype=GetLinestyle(text(Noflg)+Ltype,name); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); , if(Noflg==1,Ltype=0); ); @@ -4240,7 +4302,7 @@ Ovaldata(nm,Pdata,options):=( ); Segmark(nm,ptlist):=Segmark(nm,ptlist,[]); -Segmark(nm,ptlist,options):=Drawsegmark(nm,ptlist,options); +Segmark(nm,ptlist,options):=Drawsegmark(nm,ptlist,options,color); Drawsegmark(nm,ptlist):=Drawsegmark(nm,ptlist,[]); Drawsegmark(nm,ptlist,options):=( //help:Segmark("1",[A,B]); @@ -4255,6 +4317,7 @@ Drawsegmark(nm,ptlist,options):=( tp=1; tmp1=Divoptions(options); eqL=tmp1_5; + color=tmp_(length(tmp)-2); forall(eqL, tmp=indexof(#,"="); tmp1=substring(#,tmp,length(#)); @@ -4516,7 +4579,7 @@ Putintersect(nm,pdata1,pdata2,ptno):=( Arrowheaddata(point,direction):=Arrowheaddata(point,direction,[]); Arrowheaddata(point,direction,options):=( -//help:Arrowheaddata(A,B); +// help:Arrowheaddata(A,B); regional(list,Ookisa,Hiraki,Futosa,Houkou,Str,Flg,tmp,Ev,Nv,pA,pB, pP,rF,gG,Flg,Nj,Eps,tmp1,scx,scy); Eps=10^(-3); @@ -4609,7 +4672,8 @@ Arrowhead(point,Houkou,options):=( //help:Arrowhead(B,B-A,[1.5,30]); //help:Arrowhead(A,"gr1"); // global ArrowheadNumber - regional(name,Ltype,Noflg,reL,opstr,opcindy,ptstr,hostr,tmp,tmp1,list); + regional(name,Ltype,Noflg,reL,opstr,opcindy,color, + ptstr,hostr,tmp,tmp1,list); name="arh"+text(ArrowheadNumber); ArrowheadNumber=ArrowheadNumber+1; ptstr=textformat(point,5); @@ -4631,6 +4695,7 @@ Arrowhead(point,Houkou,options):=( Ltype=tmp_1; Noflg=tmp_2; reL=tmp_6; + color=tmp_(length(tmp)-2); opstr=tmp_(length(tmp)-1); opcindy=tmp_(length(tmp)); list=Arrowheaddata(point,Houkou,options); @@ -4643,7 +4708,9 @@ Arrowhead(point,Houkou,options):=( ); if(Noflg<2, if(isstring(Ltype), + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Ltype=GetLinestyle(text(1)+Ltype,name); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); , // if(Noflg==1,Ltype=0); Ltype=0; @@ -4691,7 +4758,7 @@ Arrowdata(Arg1,Arg2,options):=( //help:Arrowdata([A,B],[2,10]); //help:Arrowdata("1",[p1,p2]); regional(Retflg,nm,ptlist,name,opstr,opcindy,realL,strL,size, - flg,Ltype,Noflg,lineflg,tmp,tmp1,tmp2,pA,pB,segpos); + flg,Ltype,Noflg,lineflg,tmp,tmp1,tmp2,pA,pB,segpos,color); Retflg=0; Noflg=0; Ltype=0; @@ -4711,6 +4778,7 @@ Arrowdata(Arg1,Arg2,options):=( Noflg=tmp_2; realL=tmp_6; strL=tmp_7; + color=tmp_(length(tmp)-2); opstr=tmp_(length(tmp)-1); opcindy=tmp_(length(tmp)); size=1; // 15.06.11 @@ -4741,7 +4809,9 @@ Arrowdata(Arg1,Arg2,options):=( ); if(Noflg<2, if(isstring(Ltype), + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Ltype=GetLinestyle(text(Noflg)+Ltype,name); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); , if(Noflg==1,Ltype=0); ); @@ -4811,12 +4881,13 @@ Anglemark(Arg1,Arg2):=( // 2015.04.28 from nm=substring(tmp,1,length(tmp)-1); Anglemark(nm,plist,options); ); -); // until +); // to Anglemark(nm,plist,options):=( -//help:Anglemark([A,B,C],["E=\theta",2]); +//help([A,B,C],["E=\theta",2]); //help:Anglemark("1",[A,B,C],["E=1.2,\theta",2]); -//help:Anglemark(options=["E/L=(sep,)letter",size]); - regional(name,Out,pB,pA,pC,Ctr,ra,sab,sac,ratio,opstr,Bname,Bpos, +//help:Anglemark("1",[A,B,2*pi]); +//help:Anglemark(options=[size,"E/L=(sep,)letter"]); + regional(name,Out,pB,pA,pC,Ctr,ra,sab,sac,ratio,opstr,Bname,Bpos,color, Brat,tmp,tmp1,tmp2,Num,opcindy,Ltype,eqL,realL,Rg,Th,Noflg); name="ag"+nm; Bpos="md"+name; @@ -4824,16 +4895,18 @@ Anglemark(nm,plist,options):=( tmp=Divoptions(options); Ltype=tmp_1; Noflg=tmp_2; - opstr=tmp_(length(tmp)-1); +// opstr=tmp_(length(tmp)-1);//180530 + color=tmp_(length(tmp)-2); opcindy=tmp_(length(tmp)); eqL=tmp_5; realL=tmp_6; Bname=""; - Brat=1.5; + Brat=1.2; //180530 Num=20; + opstr=""; if(length(realL)>0, ra=realL_1*ra; - opstr=opstr+","+text(realL_1); + opstr=","+text(realL_1);//180530 ); forall(eqL, if(substring(#,0,1)=="L",Bname="Letter("); @@ -4846,11 +4919,16 @@ Anglemark(nm,plist,options):=( Brat=parse(substring(tmp,0,tmp1-1)); ); ); - pB=Lcrd(plist_1); pA=Lcrd(plist_2); pC=Lcrd(plist_3); - Ctr=Lcrd(pA); - sab=pB-pA; - sac=pC-pA; - Rg=[arctan2(sab)+0,arctan2(sac)+0]; + pB=Lcrd(plist_1); pA=Lcrd(plist_2); sab=pB-pA; + Ctr=pA; + if((length(plist_3)>1)%(ispoint(plist_3)), //180506from + pC=Lcrd(plist_3); + sac=pC-pA; + Rg=[arctan2(sab)+0,arctan2(sac)+0]; + , + sac=pB-pA; + Rg=[arctan2(sab)+0,arctan2(sab)+plist_3]; + ); //180506to if(Rg_2<Rg_1,Rg_2=Rg_2+2*pi); Out=[]; if(ra>min(|sab|,|sac|), // 16.12.29 @@ -4880,7 +4958,9 @@ Anglemark(nm,plist,options):=( ); if(Noflg<2, if(isstring(Ltype), + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Ltype=GetLinestyle(text(Noflg)+Ltype,name); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); , if(Noflg==1,Ltype=0); ); @@ -4910,11 +4990,12 @@ Paramark(nm,plist,options):=( //help:Paramark([A,B,C],["E=\theta"]); //help:Paramark("1",[p1,p2,p3],["E=\theta"]); regional(name,Out,pB,pA,pC,ra,sab,sac,ratio,opstr,Bname,Bpos, - Brat,tmp,tmp1,tmp2,Ltype,Noflg,eqL,realL,opcindy); + Brat,tmp,tmp1,tmp2,Ltype,Noflg,eqL,realL,opcindy,color); name="pm"+nm; tmp=Divoptions(options); Ltype=tmp_1; Noflg=tmp_2; + color=tmp_(length(tmp)-2); opstr=tmp_(length(tmp)-1); opcindy=tmp_(length(tmp)); eqL=tmp_5; @@ -4962,7 +5043,9 @@ Paramark(nm,plist,options):=( ); if(Noflg<2, if(isstring(Ltype), + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Ltype=GetLinestyle(text(Noflg)+Ltype,name); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); , if(Noflg==1,Ltype=0); ); @@ -5006,11 +5089,12 @@ Bowdata(nm,plist,options):=( //help:Bowdata([A,B],["Exprrot=t0n2r,a"]); regional(name,Out,pB,pA,pC,ra,tmp,tmp1,tmp2,Ltype,eqL,realL, Bname,Bpos,Th,Cut,Num,Hgt,opstr,opcindy,Ydata,pC, - Th1,Th2,Noflg,Bops,Bmov,Tmov,Nmov,rev); + Th1,Th2,Noflg,Bops,Bmov,Tmov,Nmov,rev,color); name="bw"+nm; tmp=Divoptions(options); Ltype=tmp_1; Noflg=tmp_2; + color=tmp_(length(tmp)-2); opstr=tmp_(length(tmp)-1); opcindy=tmp_(length(tmp)); eqL=tmp_5; @@ -5138,7 +5222,9 @@ Bowdata(nm,plist,options):=( ); if(Noflg<2, if(isstring(Ltype), + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Ltype=GetLinestyle(text(Noflg)+Ltype,name); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); , if(Noflg==1,Ltype=0); ); @@ -5242,16 +5328,17 @@ Deqplot(nm,deq,rng,Arg1,Arg2):=( Deqplot(nm,deq,rng,initt,initf,options); ); Deqplot(nm,deqorg,rngorg,initt,initf,options):=( //17.10.06 -//help:Deqplot("2","y`=y*(1-y)","x",0, 0.5,["Num=100"]); -//help:Deqplot("1","y``=-y","x",0, [1,0]); -//help:Deqplot("3","[x,y]`=[x*(1-y),0.3*y*(x-1)]","t=[0,20]",0,[1,0.5]); +//help:Deqplot("2","y'=y*(1-y)","x",0, 0.5,["Num=100"]); +//help:Deqplot("1","y''=-y","x",0, [1,0]); +//help:Deqplot("3","[x,y]'=[x*(1-y),0.3*y*(x-1)]","t=[0,20]",0,[1,0.5]); regional(deq,rng,Ltype,Noflg,eqL,opcindy,Num,name,nn,pdL,phase, - sel,tmp,tmp1,tmp2); + sel,tmp,tmp1,tmp2,color); name="de"+nm; tmp=Divoptions(options); Ltype=tmp_1; Noflg=tmp_2; eqL=tmp_5; + color=tmp_(length(tmp)-2); opcindy=tmp_(length(tmp)); Num=50; forall(eqL, @@ -5268,6 +5355,7 @@ Deqplot(nm,deqorg,rngorg,initt,initf,options):=( //17.10.06 rng=rng+"="+textformat([XMIN,XMAX],6); ); deq=deqorg; + deq=replace(deq,"'","`"); //180527 tmp=indexof(deq,"="); tmp1=substring(deq,0,tmp-1); if(indexof(tmp1,"[")==0, @@ -5338,7 +5426,9 @@ Deqplot(nm,deqorg,rngorg,initt,initf,options):=( //17.10.06 ); if(Noflg<2, if(isstring(Ltype), + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Ltype=GetLinestyle(text(Noflg)+Ltype,name); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); , if(Noflg==1,Ltype=0); ); @@ -5353,7 +5443,7 @@ Enclosing(nm,plist,options):=EnclosingS(nm,plist,options); EnclosingS(nm,plist):=EnclosingS(nm,plist,[]); EnclosingS(nm,plist,options):=( //help:Enclosing("1",["sc2","crAB","sc2","Invert(sc1)"],[pt,"dr"]); - regional(name,AnsL,Start,Eps,EEps,S,Flg,Fdata,Gdata,KL,pt,qt, + regional(name,AnsL,Start,Eps,EEps,S,Flg,Fdata,Gdata,KL,pt,qt,color t1,t2,t3,ii,nn,tmp,tmp1,tmp2,Ltype,Noflg,realL,eqL,opstr,opcindy); name="en"+nm; tmp=Divoptions(options); @@ -5361,6 +5451,7 @@ EnclosingS(nm,plist,options):=( Noflg=tmp_2; eqL=tmp_5; realL=tmp_6; + color=tmp_(length(tmp)-2); opstr=tmp_(length(tmp)-1); opcindy=tmp_(length(tmp)); Eps=10^(-5); // 16.12.05 @@ -5488,25 +5579,12 @@ EnclosingS(nm,plist,options):=( ); tmp=tmp+substring(tmp1,0,length(tmp1)-1)+")"+opstr+")"; GLIST=append(GLIST,tmp);//16.11.07until - // GLIST=append(GLIST,"Tmp=[]"); // 16.11.05from -// nn=floor(length(AnsL)/20); -// forall(1..nn,ii, -// tmp=AnsL_(((ii-1)*20+1)..(ii*20)); -// tmp=apply(tmp,LLcrd(#)); -// tmp="Tmp=[Tmp,"+textformat(tmp,5)+"]"; -// GLIST=append(GLIST,tmp); -// ); -// if(length(AnsL)>nn*20, -// tmp=AnsL_((nn*20+1)..(length(AnsL))); -// tmp=apply(tmp,LLcrd(#)); -// tmp="Tmp=[Tmp,"+textformat(tmp,5)+"]"; -// GLIST=append(GLIST,tmp); -// ); -// GLIST=append(GLIST,name+"=Listplot(Tmp)"); // 16.11.05until ); if(Noflg<2, if(isstring(Ltype), + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Ltype=GetLinestyle(text(Noflg)+Ltype,name); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); , if(Noflg==1,Ltype=0); ); @@ -5524,7 +5602,7 @@ Enclosing2(nm,plistorg,options):=( //help:Enclosing2(options=[Eps1(0.01),Eps2(0.1)]); regional(name,plist,AnsL,Start,Eps,Eps1,Eps2,flg,Fdata,Gdata,KL, t1,t2,tst,ss,ii,nn,nxtno,Ltype,Noflg,realL,eqL,opstr,opcindy, - tmp,tmp1,tmp2); + tmp,tmp1,tmp2,color); name="en"+nm; plist=plistorg; tmp=Divoptions(options); @@ -5532,6 +5610,7 @@ Enclosing2(nm,plistorg,options):=( Noflg=tmp_2; eqL=tmp_5; realL=tmp_6; + color=tmp_(length(tmp)-2); opstr=tmp_(length(tmp)-1); opcindy=tmp_(length(tmp)); Eps=10^(-5); // 16.12.05 @@ -5654,7 +5733,9 @@ Enclosing2(nm,plistorg,options):=( ); if(Noflg<2, if(isstring(Ltype), + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Ltype=GetLinestyle(text(Noflg)+Ltype,name); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); , if(Noflg==1,Ltype=0); ); @@ -5746,11 +5827,12 @@ Makehatch(iolistorg,pt,vec,bdylist):=( ); Hatchdatacindy(nm,iostr,bdylist):=Hatchdatacindy(nm,iostr,bdylist,[]); +Hatchdata(nm,iostr,bdylist,options):=Hatchdatacindy(nm,iostr,bdylist,options); Hatchdatacindy(nm,iostr,bdylistorg,options):=( -//help:Hatchdatacindy("1",["ii"],[["ln1","Invert(gr1)"],["gr2","n"]]); -//help:Hatchdatacindy(options=[angle,width]); +//help:Hatchdata("1",["ii"],[["ln1","Invert(gr1)"],["gr2","n"]]); +//help:Hatchdata(options=[angle,width]); regional(name,bdylist,bdynameL,bname,Ltype,Noflg,opstr,opcindy,reL,startP,angle, - interval,vec,nvec,flg,pt,kk,delta,sha,AnsL,tmp,tmp1,tmp2); + interval,vec,nvec,flg,pt,kk,delta,sha,AnsL,tmp,tmp1,tmp2,color); name="ha"+nm; bdylist=[]; bdynameL=[]; @@ -5797,6 +5879,7 @@ Hatchdatacindy(nm,iostr,bdylistorg,options):=( tmp=Divoptions(options); Ltype=tmp_1; Noflg=tmp_2; + color=tmp_(length(tmp)-2); opstr=tmp_(length(tmp)-1); opcindy=tmp_(length(tmp)); reL=tmp_6; @@ -5863,7 +5946,9 @@ Hatchdatacindy(nm,iostr,bdylistorg,options):=( ); if(Noflg<2, if(isstring(Ltype), + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Ltype=GetLinestyle(text(Noflg)+Ltype,name); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); , if(Noflg==1,Ltype=0); ); @@ -5877,34 +5962,65 @@ Hatchdatacindy(nm,iostr,bdylistorg,options):=( tmp2; ); -/////////// end of new Hatchdata(cindy) /////////// - -Shade(plist):=Shade(plist,[]); -Shade(plist,options):=( -//help:Shade(["gr2","sg1"],[0.5]); -//help:Shade(["gr2","sg1"],["red" /pict2e]); -//help:Shade(["gr2","sg1"],[[0,0,0,0.5] /pict2e]); -//help:Shade(["gr2","sg1"],[[1,0,0] /pict2e]); -//help:Shade([pointlist]); - regional(tmp,tmp1,tmp2,opstr,opcindy,Str,G2,flg); +Shade(plist):=Shade("",plist,[]); //180613from +Shade(Arg1,Arg2):=( + if(isstring(Arg1), + Shade(Arg1,Arg2,[]); + , + Shade("",Arg1,Arg2); + ); +); +Shade(nm,plistorg,options):=( //180613to +//help:Shade(["gr"],[0.5]); +//help:Shade(["gr"],["Color=red"]); +//help:Shade(["gr2","sg1"],["Color=[0,0,0,0.5]"]); +//help:Shade(["gr2","sg1"],["Color=[1,0,0]"]); +// help:Shade([[A,B,C,A]]); + regional(name,plist,jj,tmp,tmp1,tmp2,opstr,opcindy,reL,Str,G2,flg,color,ctr); + name="shade"+nm; + plist=plistorg; if(isstring(plist_1), // 16.01.24 println("output Shade of "+plist); , println("output Shade of lists"); ); tmp=Divoptions(options); + color=tmp_(length(tmp)-2); opstr=tmp_(length(tmp)-1); opcindy=tmp_(length(tmp)); - flg=0; - forall(plist, + reL=tmp_6; //180603from + if(length(reL)>0, + color=reL_1*color; + );//180603to + if(length(color)==4, //180602from + tmp=colorCmyk2rgb(color); + ); + flg=0; ctr=1; + forall(1..(length(plist)),jj, //180613from if(flg==0, - if(isstring(#),tmp=parse(#),tmp=#); // from 16.01.24 - if(!islist(tmp),flg=1); until + tmp1=plist_jj; + if(isstring(tmp1),tmp=parse(tmp1),tmp=tmp1); + if(!islist(tmp), + flg=1; + , + if(!isstring(tmp1), + tmp2=[]; + forall(tmp1,if(ispoint(#),tmp=#.xy,tmp=#); + tmp2=append(tmp2,tmp); + ); + tmp1=Dqq("-"+name+text(ctr)); + tmp2=textformat(tmp2,6)+",["+Dqq("nodisp")+"]"; + tmp=name+text(ctr)+"=Listplot("+tmp1+","+tmp2+")"; + parse(tmp); + plist_jj=name+text(ctr); + ctr=ctr+1; + ); + ); ); - ); + );//180613to if(flg==1, -// err("some data not defined yet"); + println(" some data not defined properly"); , G2=Joincrvs("1",plist,["nodata"]); G2=apply(G2,Pcrd(#)); @@ -5925,8 +6041,15 @@ Shade(plist,options):=( ); // until 16.01.24 ); Str=Str+substring(tmp1,0,length(tmp1)-1)+")"+opstr+")"; - Com2nd(Str); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")",["before"])); + Com2nd(Str,["before"]); + if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")",["before"])); ); +/////////// end of new Hatchdata(cindy) /////////// + + + + //help:end(); diff --git a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic2logr.txt b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic2logr.txt index 6510040a896..afbbbad15a7 100644 --- a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic2logr.txt +++ b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic2logr.txt @@ -1,3 +1,34 @@ +// 20180610 +// WritetoRS changed ( \\ => /) +// 20180608 +// Setslide changed ( old style of setting title resupported ) +// 20180604 +// Mkslides,Mkslidesummary debugged ( to make kc.sh executable ) +// Changework changed (set to Dircdy if dir not found ) +// 20180603 +// Rotatedata,... changed (KCOLOR) +// Letter,Letterrot,Exprrot changed (color) +// Scaledata changed ( case where x,y is the same ratio) +// 20180602 +// divoptions ( 8,9 ->length(tmp)-1,length(tmp)) +// Rotatedata,... changed (color supported ) +// Rotataedata,... debugged ( level RSform =>1 ) +// Settitle debugged ( color option batted ) +//20180529 +// Presentation debugged (for repeat=1) +//20180526 +// Repeatsameslide debugged (for minipage with thin) +// Presentation changed ( page jump button ) +//20180524 +// Presentation changed ( pageend, \slidepage, pagestyle{empty}) +//20180515 +// Setpara changed ( "m" as default) +//20180514 +// WritetoRS,Makebat changed ( to execsrc.r) +//20180513 +// WritetoRS,Makebat changed ( UTF-8) +//20180412 +// Mksummary changed ( calcbyR, quit ) //20180409 // WritetoRS,Makebat changed ( "shell" used ) //20180408 diff --git a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic2r.cs b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic2r.cs index ae40d147f9b..859b46f749f 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(20180409) loaded");
+println("ketcindybasic2(20180610) loaded");
//help:start();
@@ -103,14 +103,16 @@ Reflectpoint(point,symL):=( Rotatedata(nm,plist,Theta):=Rotatedata(nm,plist,Theta,[]);
Rotatedata(nm,plist,angle,options):=(
-//help:Rotatedata("1","crAB",pi/3,[[1,5],"dr,2"]);
+//help:Rotatedata("1",["crAB","pt1"],pi/3,[[1,5],"dr,2"]);
+//help:Rotatedata("1",[[A.xy],[B.xy]],pi/3,[[1,5],"dr,2"]);
regional(tmp,tmp1,tmp2,pdata,Theta,Pt,Cx,Cy,PdLL,PdL,
- opcindy,Nj,Njj,Kj,Mj,X1,Y1,X2,Y2,Ltype,Noflg,name);
+ opcindy,Nj,Njj,Kj,Mj,X1,Y1,X2,Y2,Ltype,Noflg,name,color);
name="rt"+nm;
Pt=[0,0];
tmp=Divoptions(options);
Ltype=tmp_1;
Noflg=tmp_2;
+ color=tmp_(length(tmp)-2);
opcindy=tmp_(length(tmp));
tmp1=tmp_6;
if(length(tmp1)>0,Pt=Lcrd(tmp1_1));
@@ -152,14 +154,16 @@ Rotatedata(nm,plist,angle,options):=( tmp=name+"="+textformat(tmp1,5);
parse(tmp);
tmp1=text(plist);
- tmp1=RSform(tmp1);// 17.12.23(2lines)
+ tmp1=RSform(tmp1,1);// 180602
tmp=name+"=Rotatedata("+tmp1+","
+textformat(angle,5)+","+RSform(textformat(Pt,5))+")"; //17.12.23
GLIST=append(GLIST,tmp);
);
if(Noflg<2,
if(isstring(Ltype),
+ if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")"));
Ltype=GetLinestyle(text(Noflg)+Ltype,name);
+ if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")"));
,
if(Noflg==1,Ltype=0);
);
@@ -170,13 +174,14 @@ Rotatedata(nm,plist,angle,options):=( Translatedata(nm,plist,mov):=Translatedata(nm,plist,mov,[]);
Translatedata(nm,plist,mov,options):=(
-//help:Translatedata("1",["gr1"],[1,2]);
+//help:Translatedata("1",["gr1","pt1"],[1,2]);
regional(tmp,tmp1,tmp2,pdata,Cx,Cy,PdL,Nj,Njj,Kj,
- opcindy,X2,Y2,Ltype,Noflg,name);
+ opcindy,X2,Y2,Ltype,Noflg,name,color,leveL);
name="tr"+nm;
tmp=Divoptions(options);
Ltype=tmp_1;
Noflg=tmp_2;
+ color=tmp_(length(tmp)-2);
opcindy=tmp_(length(tmp));
pdata=plist;
if(isstring(pdata),pdata=[pdata]);
@@ -212,14 +217,16 @@ Translatedata(nm,plist,mov,options):=( if(length(tmp1)==1,tmp1=tmp1_1);
tmp=name+"="+textformat(tmp1,5);
parse(tmp);
- tmp1=text(plist);
- tmp1=RSform(tmp1);// 17.12.23
+ tmp1=text(plist);
+ tmp1=RSform(tmp1,1);// 180602
tmp=name+"=Translatedata("+tmp1+","+RSform(textformat(mov,5))+")";
GLIST=append(GLIST,tmp);
);
if(Noflg<2,
if(isstring(Ltype),
+ if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")"));
Ltype=GetLinestyle(text(Noflg)+Ltype,name);
+ if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")"));
,
if(Noflg==1,Ltype=0);
);
@@ -230,14 +237,19 @@ Translatedata(nm,plist,mov,options):=( Scaledata(nm,plist,ratioV):=(
regional(tmp);
- tmp=Lcrd(ratioV);
+ tmp=ratioV; //180603from
+ if(!islist(tmp),tmp=[tmp,tmp]);
+ tmp=Lcrd(tmp);//180603to
Scaledata(nm,plist,tmp_1,tmp_2,[]);
);
Scaledata(nm,plist,Arg1,Arg2):=(
-//help:Scaledata("1","crAB",3,2,[[0,0]]);
+//help:Scaledata("1",["crAB","pt1"],3,2,[[0,0]]);
+//help:Scaledata("1",["crAB","pt1"],2,[[0,0]]);
regional(tmp,options);
if(islist(Arg2),
- tmp=Lcrd(Arg1);
+ tmp=Arg1;//180603(2lines)
+ if(!islist(tmp),tmp=[tmp,tmp]);
+ tmp=Lcrd(tmp);
options=Arg2;
Scaledata(nm,plist,tmp_1,tmp_2,options);
,
@@ -246,12 +258,13 @@ Scaledata(nm,plist,Arg1,Arg2):=( );
Scaledata(nm,plist,rx,ry,options):=(
regional(tmp,tmp1,tmp2,pdata,Theta,Pt,Cx,Cy,PdL,
- opcindy,Nj,Njj,Kj,X2,Y2,Ltype,Noflg,name);
+ opcindy,Nj,Njj,Kj,X2,Y2,Ltype,Noflg,name,color);
name="sc"+nm;
Pt=[0,0];
tmp=Divoptions(options);
Ltype=tmp_1;
Noflg=tmp_2;
+ color=tmp_(length(tmp)-2);
opcindy=tmp_(length(tmp));
tmp1=tmp_6;
if(length(tmp1)>0,
@@ -291,14 +304,16 @@ Scaledata(nm,plist,rx,ry,options):=( tmp=name+"="+textformat(tmp1,5);
parse(tmp);
tmp1=text(plist);
- tmp1=RSform(tmp1); // 17.12.23
+ tmp1=RSform(tmp1,1); // 180602
tmp=name+"=Scaledata("+tmp1+","
+textformat(rx,5)+","+textformat(ry,5)+","+RSform(textformat(Pt,5))+")";
GLIST=append(GLIST,tmp);
);
if(Noflg<2,
if(isstring(Ltype),
+ if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")"));
Ltype=GetLinestyle(text(Noflg)+Ltype,name);
+ if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")"));
,
if(Noflg==1,Ltype=0);
);
@@ -309,14 +324,15 @@ Scaledata(nm,plist,rx,ry,options):=( Reflectdata(nm,plist,symL):=Reflectdata(nm,plist,symL,[]);
Reflectdata(nm,plist,symL,options):=(
-//help:Reflectdata("1","crAB",[C]);
+//help:Reflectdata("1",["crAB"],[C]);
regional(tmp,tmp1,tmp2,pdata,Us,Vs,Pt1,Pt2,Cx,Cy,PdL,
- opcindy,Nj,Njj,Kj,X1,Y1,X2,Y2,Ltype,Noflg,name);
+ opcindy,Nj,Njj,Kj,X1,Y1,X2,Y2,Ltype,Noflg,name,color);
name="re"+nm;
Pt=[0,0];
tmp=Divoptions(options);
Ltype=tmp_1;
Noflg=tmp_2;
+ color=tmp_(length(tmp)-2);
opcindy=tmp_(length(tmp));
pdata=plist;
if(isstring(pdata),pdata=[pdata]);
@@ -368,13 +384,15 @@ Reflectdata(nm,plist,symL,options):=( tmp=name+"="+textformat(tmp1,5);
parse(tmp);
tmp1=text(plist);
- tmp1=RSform(tmp1);// 17.12.23
+ tmp1=RSform(tmp1,1);// 180602
tmp=name+"=Reflectdata("+tmp1+","+RSform(textformat(symL,5))+")";//17.12.23
GLIST=append(GLIST,tmp);
);
if(Noflg<2,
if(isstring(Ltype),
+ if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")"));
Ltype=GetLinestyle(text(Noflg)+Ltype,name);
+ if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")"));
,
if(Noflg==1,Ltype=0);
);
@@ -538,6 +556,7 @@ Expr(Pt,Dr,St):=Expr([Pt,Dr,St]); Expr(list):=Expr(list,[]);
Expr(listorg,options):=( //16.10.09
//help:Expr([A,"e","f(x)=x^2"]);
+//help:Expr([A,"e","f(x)=x^2"],["size->24"]);
regional(list,str,tmp,tmp1,tmp2);
list=listorg;
forall(1..round(length(list)/3),
@@ -552,15 +571,16 @@ Expr(listorg,options):=( //16.10.09 Letter(Pt,Dr,St):=Letter([Pt,Dr,St]);
Letter(list):=Letter(list,[]);
Letter(list,options):=(
-//help:Letter([C,"c","Graph of f(x)"]);
+//help:Letter([C,"c","Graph of $f(x)$"]);
+//help:Letter([C,"c","xy"],["size->30"]);
regional(Nj,Pos,Dir,Str,Off,Dmv,Xmv,Ymv,Noflg,opcindy,
- opL,aln,sz,clr,bld,ita,tmp,tmp1,tmp2);
+ opL,aln,sz,clr,bld,ita,tmp,tmp1,tmp2,color);
tmp=Divoptions(options);
Noflg=tmp_2;
+ color=tmp_(length(tmp)-2);
opL=select(options,indexof(#,"->")>0); //16.10.09from
tmp=select(opL,indexof(#,"color"));
size=12;
- clr=[0,0,0];
bld=false;
ita=false;
aln="left";
@@ -596,7 +616,9 @@ Letter(list,options):=( Str=replace(Str,"`","'");//180303
tmp=Dq+","+Dq+Str+Dq+")";
if(Noflg==0,
+ if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")"));
Com2nd("Letter("+Lcrd(Pos)+","+Dq+Dir+tmp);//16.10.10
+ if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")"));
);
if(Noflg<2,
Xmv=0;//16.10.13
@@ -625,18 +647,25 @@ Letter(list,options):=( );
Str=list_(Nj+2); //17.10.17
drawtext(Pcrd(Pos),Str,offset->[Off+Xmv,Off+Ymv],
- size->sz,color->clr,align->aln,bold->bld,italics->ita);//16.10.09
+ size->sz,color->color,align->aln,bold->bld,italics->ita);//16.10.09
);
Nj=Nj+3;
);
);
-Letterrot(pt,dir,str):=Letterrot(pt,dir,0,0,str);
-Letterrot(pt,dir,movstr,str):=(
+Letterrot(pt,dir,str):=Letterrot(pt,dir,0,0,str,[]);
+Letterrot(pt,dir,Arg1,Arg2):=(
+ if(islist(Arg2),
+ Letterrot(pt,dir,"t0n0",Arg1,Arg2);
+ ,
+ Letterrot(pt,dir,Arg1,Arg2,[]);
+ );
+);
+Letterrot(pt,dir,movstr,str,options):=(
//help:Letterrot(C,B-A,"AB"):
//help:Letterrot(C,B-A,0,5,"AB"):
//help:Letterrot(C,B-A,"t0n5","AB"):
- regional(tmov,nmov,tmp,tmp1,tmp2);
+ regional(tmov,nmov,tmp,tmp1,tmp2,color);
tmp1=indexof(movstr,"t");
tmp2=indexof(movstr,"n");
if(tmp1>0,
@@ -650,21 +679,32 @@ Letterrot(pt,dir,movstr,str):=( ,
nmov=0;
);
- Letterrot(pt,dir,tmov,nmov,str);
+ Letterrot(pt,dir,tmov,nmov,str,options);
);
-Letterrot(pt,dir,tmov,nmov,str):=(
- regional(tmp);
- Letter([pt,"c",str],["notex"]);
+Letterrot(pt,dir,tmov,nmov,str,options):=(
+ regional(tmp,color);
+ tmp=Divoptions(options);
+ color=tmp_(length(tmp)-2);
+ Letter([pt,"c",str],append(options,"notex"));
tmp=replace(str,"\","\\"); //17.10.18
+ if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")"));
Com2nd("Letterrot("+pt+","+dir+","+tmov+","+nmov+",'"+tmp+"')");
+ if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")"));
);
-Exprrot(pt,dir,str):=Exprrot(pt,dir,0,0,str);
-Exprrot(pt,dir,movstr,str):=(
+Exprrot(pt,dir,str):=Exprrot(pt,dir,0,0,str,[]);
+Exprrot(pt,dir,Arg1,Arg2):=(
+ if(islist(Arg2),
+ Exprrot(pt,dir,"t0n0",Arg1,Arg2);
+ ,
+ Exprrot(pt,dir,Arg1,Arg2,[]);
+ );
+);
+Exprrot(pt,dir,movstr,str,options):=(
//help:Exprrot(C,B-A,"d"):
//help:Exprrot(C,B-A,0,5,"d"):
//help:Exprrot(C,B-A,"t0n5","d"):
- regional(tmov,nmov,tmp,tmp1,tmp2);
+ regional(tmov,nmov,tmp,tmp1,tmp2,color);
tmp1=indexof(movstr,"t");
tmp2=indexof(movstr,"n");
if(tmp1>0,
@@ -678,13 +718,17 @@ Exprrot(pt,dir,movstr,str):=( ,
nmov=0;
);
- Exprrot(pt,dir,tmov,nmov,str);
+ Exprrot(pt,dir,tmov,nmov,str,options);
);
-Exprrot(pt,dir,tmov,nmov,str):=(
- regional(tmp);
- Expr([pt,"c",str],["notex"]);
+Exprrot(pt,dir,tmov,nmov,str,options):=(
+ regional(tmp,color);
+ tmp=Divoptions(options);
+ color=tmp_(length(tmp)-2);
+ Expr([pt,"c",str],append(options,"notex"));
tmp=replace(str,"\","\\"); //17.10.18
+ if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")"));
Com2nd("Exprrot("+pt+","+dir+","+tmov+","+nmov+",'"+tmp+"')");
+ if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")"));
);
Putslider(ptstr,p1,p2):=Slider(ptstr,p1,p2);
@@ -765,11 +809,12 @@ BezierCurve(nm,ptlistorg,ctrlistorg,options):=( //help:Bezier("1",[A,D],[B,C]);
//help:Bezier(options=["Num=10"]);
regional(name,Ltype,Noflg,opstr,opcindy,Num,
- ptlist,ctrlist,tmp,tmp1,tmp2,ii,st,out,list);
+ ptlist,ctrlist,tmp,tmp1,tmp2,ii,st,out,list,color);
name="bz"+nm;
tmp=Divoptions(options);
Ltype=tmp_1;
Noflg=tmp_2;
+ color=tmp_(length(tmp)-2);
opstr=tmp_(length(tmp)-1);
opcindy=tmp_(length(tmp));
Num=10;
@@ -822,7 +867,9 @@ BezierCurve(nm,ptlistorg,ctrlistorg,options):=( );
if(Noflg<2,
if(isstring(Ltype),
+ if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")"));
Ltype=GetLinestyle(text(Noflg)+Ltype,name);
+ if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")"));
,
if(Noflg==1,Ltype=0);
);
@@ -1731,7 +1778,6 @@ Tabledatalight(nm,xLst,yLst,rmvL,optionorg):=( Tabledata(nm,n,m,xsize,ysize,rmvL):=
Tabledata(nm,n,m,xsize,ysize,rmvL,[]);
Tabledata(nm,n,m,xsize,ysize,rmvL,options):=(
-//help:Tabledata("",xLst,yLst,rmvL,[2,"Rng=y"]);
regional(Tb,name,tmp,xLst,yLst);
name="tb"+nm;
xLst=apply(1..n,xsize/n);
@@ -2578,6 +2624,7 @@ WritetoRS(Arg):=( );
WritetoRS(filename,shchoice):=(
regional(Plist,Pos,GrL,str,tmp,tmp1,tmp2,cmd);
+ //help:WritetoRS(2);
println("Write to R "+filename);
Plist=[];
Pnamelist=[];
@@ -2592,7 +2639,7 @@ WritetoRS(filename,shchoice):=( SCEOUTPUT = openfile(filename);
tmp=Datetime();
println(SCEOUTPUT,"# date time="+tmp_1+" "+tmp_2);
- if(isstring(CindyPathName), // 16.12.25from
+ if(isstring(CindyName), // 16.12.25from
if(length(CindyPathName)>0,
println(SCEOUTPUT,
"# path file="+CindyPathName+" "+CindyFileName+".cdy");
@@ -2602,6 +2649,9 @@ WritetoRS(filename,shchoice):=( ,
println(SCEOUTPUT,"");
);
+ if(iswindows(),
+ println(SCEOUTPUT,"options(encoding='UTF-8')"); //180513
+ );
tmp1=replace(Dirwork,"\","/");
if((iswindows())&(indexof(tmp1,"Users")>0),
tmp=Indexall(tmp1,"/");
@@ -2613,6 +2663,7 @@ WritetoRS(filename,shchoice):=( println(SCEOUTPUT,"Hpath=Hpath[length(Hpath)]");
println(SCEOUTPUT,"Rest="+Dqq(tmp2));
println(SCEOUTPUT,"Path=paste(Drv,Hpath,Rest,sep='')");
+ println(SCEOUTPUT,"Path=gsub('\\','/',Path,fixed=TRUE)"); //180610
println(SCEOUTPUT,"setwd(Path)");
,
println(SCEOUTPUT,"setwd('"+tmp1+"')");
@@ -2705,6 +2756,13 @@ WritetoRS(filename,shchoice):=( tmp=tmp+",'Cdy="+Cindyname()+".cdy"; //180404
tmp=replace(tmp,"\","\\");
println(SCEOUTPUT,tmp+"')");
+ forall(COM2ndlistb, //180613from
+ if(indexof(#,"Texcom")==0,
+ println(SCEOUTPUT,RSform(#));
+ ,
+ println(SCEOUTPUT,#);
+ );
+ );//180613to
forall(COM2ndlist,
if(indexof(#,"Texcom")==0, //17.09.22
println(SCEOUTPUT,RSform(#));
@@ -2726,7 +2784,25 @@ WritetoRS(filename,shchoice):=( println(SCEOUTPUT,"#quit()");
);
closefile(SCEOUTPUT);
-); //17.09.17to
+ if(iswindows(), //180513from
+ SCEOUTPUT = openfile("execsrc.r");//180514
+ tmp1=replace(Dirwork,"\","/");
+ if(indexof(tmp1,"Users")>0,
+ tmp=Indexall(tmp1,"/");
+ tmp2=substring(tmp1,tmp_3-1,length(tmp1));
+ tmp1=substring(tmp1,0,tmp_3-1);
+ println(SCEOUTPUT,"Drv=shell('echo %HOMEDRIVE%',intern=TRUE)");
+ println(SCEOUTPUT,"Drv=Drv[length(Drv)]");
+ println(SCEOUTPUT,"Hpath=shell('echo %HOMEPATH%',intern=TRUE)");
+ println(SCEOUTPUT,"Hpath=Hpath[length(Hpath)]");
+ println(SCEOUTPUT,"Rest="+Dqq(tmp2));
+ println(SCEOUTPUT,"Path=paste(Drv,Hpath,Rest,sep='')");
+ println(SCEOUTPUT,"setwd(Path)");
+ println(SCEOUTPUT,"source('"+filename+"',encoding='UTF-8')");
+ );
+ closefile(SCEOUTPUT);
+ ); //180513to
+);
Extractdata(name):=Extractdata(1,name,[]);
Extractdata(Arg1,Arg2):=(
@@ -2739,10 +2815,11 @@ Extractdata(Arg1,Arg2):=( Extractdata(number,name,options):=(
//help:ExtractData("ha1");
//help:ExtractData(1,"ha1");
- regional(dlist,tmp,tmp1,tmp2,tmp3,File,Ltype,Noflg,opstr,opcindy);
+ regional(dlist,tmp,tmp1,tmp2,tmp3,File,Ltype,Noflg,opstr,opcindy,color);
tmp=Divoptions(options);
Ltype=tmp_1;
Noflg=tmp_2;
+ color=tmp_(length(tmp)-2);
opstr=tmp_(length(tmp)-1);
opcindy=tmp_(length(tmp));
tmp1=[];
@@ -2770,7 +2847,9 @@ Extractdata(number,name,options):=( );
if(Noflg<2,
if(isstring(Ltype),
+ if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")"));
Ltype=GetLinestyle(text(Noflg)+Ltype,name);
+ if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")"));
,
if(Noflg==1,Ltype=0);
);
@@ -3168,7 +3247,7 @@ Makebat(texmainfile,flow):=( path="";
);
if(indexof(flow,"r")>0,
- tmp=Dq+PathR+"\R"+Dq+" --vanilla --slave < "+Fhead+".r";
+ tmp=Dq+PathR+"\R"+Dq+" --vanilla --slave < execsrc.r";//180514
// 17.09.14
println(SCEOUTPUT,tmp);
);
@@ -3235,7 +3314,7 @@ Addpackage(packorg):=( packL_#="{"+tmp+"}";
);
);
- ADDPACK=concat(ADDPACK,packL); //17.06.25until
+ ADDPACK=concat(ADDPACK,packL); //17.06.25to
);
Viewtex():=(
@@ -3847,7 +3926,7 @@ Setslidehyper(Arg):=( );
Setslidehyper(driverorg,options):=(
//help:Setslidehyper();
-//help:Setslidehyper("dvipdfmx",["cl=true,lc=blue,fc=blue","Pos=[125,70]","Size=1"]);
+//help:Setslidehyper("dvipdfmx",["cl=true,lc=blue,fc=blue","Pos=[125,73]","Size=1"]);
regional(driver,eqL,reL,stL,,str,tmp,tmp1,tmp2);
driver=driverorg;
if(length(driver)==0,
@@ -3879,41 +3958,52 @@ Setslidehyper(driverorg,options):=( ADDPACK=select(ADDPACK,indexof(#,"hyperref")==0);
Addpackage(tmp1+"{hyperref}");
LinkPosH=125;
- LinkPosV=70;
+ LinkPosV=73;//180524
LinkSize=1;
- if(length(reL)>0,
- LinkPosH=reL_1;
- if(length(reL)>1,LinkPosV=reL_2);
- if(length(reL)>2,LinkSize=max(reL_3,0.1));
- );
+// if(length(reL)>0,
+// LinkPosH=reL_1;
+// if(length(reL)>1,LinkPosV=reL_2);
+// if(length(reL)>2,LinkSize=max(reL_3,0.1));
+// );
forall(eqL,
- tmp=indexof(#,"=");
- tmp1=Toupper(substring(#,0,1));
- tmp2=substring(#,tmp,length(#));
- tmp2=parse(tmp2);
- if(tmp1=="P",
- LinkPosH=tmp2_1;
- LinkPosV=tmp2_2;
- );
- if(tmp1=="S",
- LinkSize=max(tmp2,0.1);
- );
+ tmp=Indexall(#,"=");//180524from
+ if(length(tmp)==1,
+ tmp1=Toupper(substring(#,0,1));
+ tmp2=substring(#,tmp_1,length(#));
+ tmp2=parse(tmp2);
+ if(tmp1=="P",
+ LinkPosH=tmp2_1;
+ LinkPosV=tmp2_2;
+ );
+ if(tmp1=="S",
+ LinkSize=max(tmp2,0.1);
+ );
+ );//180524to
);
-); //17.12.16until
+); //17.12.16to
-Settitle(cmdL):=Settitle(cmdL,[]); // 180330changed
-Settitle(cmdL,options):=(
+Settitle(cmdL):=Settitle("",cmdL,[]); // 180608from
+Settitle(Arg1,Arg2):=(
+ if(isstring(Arg1),
+ Settitle(Arg1,Arg2,[]);
+ ,
+ Settitle("",Arg1,Arg2);
+ );
+); // 180608to
+Settitle(titleold,cmdL,options):=(
//help:Settitle(cmdL);
//help:Settitle(name,cmdL);
//help:Settitle(options=["Title=slide0","Layery=0","Color=blue"]);
regional(tmp,tmp1,tmp2,eqL,layery,color,size,font);
TitleName="slide0"; //180330
+ if(length(titleold)>0,TitleName=titleold);//180608
layery="0";
color="blue";
size="\Large";
font="\bf";
- tmp=Divoptions(options);
- eqL=tmp_5;
+// tmp=Divoptions(options);
+// eqL=tmp_5;
+ eqL=options; //180602
forall(eqL,
tmp1=Toupper(substring(#,0,1));
tmp=indexof(#,"=");
@@ -4039,7 +4129,7 @@ Maketitle(name):=( Repeatsameslide(repeatflg,sestr,addedL):=(
regional(seL,flg1,ss,nn,nrep,tmp,tmp1,tmp2,tmp3,str,j,k);
- // global RepeatList, SCEOUTPUT
+ // global RepeatList, SCEOUTPUT, NonThinFlg
nrep=length(RepeatList);
flg1=0;
forall(addedL,ss,
@@ -4081,6 +4171,7 @@ Repeatsameslide(repeatflg,sestr,addedL):=( if(flg1==1,seL=append(seL,1));
seL=remove(1..nrep,seL);
str=ss; // 17.05.28from
+ if(substring(str,0,16)=="\begin{minipage}",MiniFlg=1);//180526
repeat(10,
tmp1=Indexall(str,"{\color");
if(length(tmp1)>0,
@@ -4090,28 +4181,50 @@ Repeatsameslide(repeatflg,sestr,addedL):=( str=replace(str,tmp+" ","");
str=replace(str,tmp,"");
);
- );//17.05.28until
+ );//17.05.28to
if(contains(seL,1),
if(substring(str,0,1)!="%",
if(NonThinFlg==0,
if(!contains(["\begi","\end{"],substring(str,0,5)),//17.01.15
- println(SCEOUTPUT,"{\color[cmyk]{\thin,\thin,\thin,\thin}");//17.08.23
- println(SCEOUTPUT,str);
- println(SCEOUTPUT,"}%");
+ if(MiniFlg==0, //180526from
+ println(SCEOUTPUT,"{\color[cmyk]{\thin,\thin,\thin,\thin}");//17.08.23
+ println(SCEOUTPUT,str);
+ println(SCEOUTPUT,"}%");
+ ,
+ println(SCEOUTPUT,str);
+ if(indexof(str,"\end{minipage}")>0, //180526from
+ println(SCEOUTPUT,"}%");
+ );
+ ); //180526to
,
println(SCEOUTPUT,str);
+ if(indexof(str,"\end{minipage}")>0, //180526from
+ println(SCEOUTPUT,"}%");
+ MiniFlg=0;
+ );
);
);
if(NonThinFlg==1,
if(!contains(["\begi","\end{"],substring(str,0,5)),//17.01.15
println(SCEOUTPUT,"{\color[cmyk]{\thin,\thin,\thin,\thin}");//17.08.23
+ println(SCEOUTPUT,str);
+ ,
+ println(SCEOUTPUT,str);
+ if(indexof(str,"\end{minipage}")>0, //180526from
+ println(SCEOUTPUT,"}%");
+ MiniFlg=0;
+ );
);
- println(SCEOUTPUT,str);
);
if(NonThinFlg==2,
println(SCEOUTPUT,str);
if(!contains(["\begi","\end{"],substring(str,0,5)),//17.01.15
println(SCEOUTPUT,"}%");
+ , //180526from
+ if(indexof(str,"\end{minipage}")>0,
+ println(SCEOUTPUT,"}%");
+ MiniFlg=0;
+ ); //180526from
);
);
seL=remove(seL,[1]);
@@ -4119,24 +4232,56 @@ Repeatsameslide(repeatflg,sestr,addedL):=( );
if(substring(ss,0,1)!="%", //16.01.04
forall(1..(length(seL)),nn,
+ if(substring(str,0,16)=="\begin{minipage}",MiniFlg=1);//180526
tmp=seL_nn;
if(NonThinFlg==0,
- tmp1="{\color[cmyk]{\thin,\thin,\thin,\thin}";//17.08.23
- tmp1=[tmp1,str,"}%"];
+ if(!contains(["\begi","\end{"],substring(str,0,5)),//180526from
+ if(MiniFlg==0,
+ tmp1="{\color[cmyk]{\thin,\thin,\thin,\thin}";//17.08.23
+ tmp1=[tmp1,str,"}%"];
+ ,
+ tmp1=[str];
+ if(indexof(str,"\end{minipage}")>0, //180526from
+ tmp1=append(tmp1,"}%");
+ );
+ );
+ ,
+ tmp1=[str];
+ if(indexof(str,"\end{minipage}")>0,
+ tmp1=append(tmp1,"}%");
+ MiniFlg=0;
+ );
+ );
);
if(NonThinFlg==1,
- tmp1="{\color[cmyk]{\thin,\thin,\thin,\thin}";//17.08.23
- tmp1=[tmp1,str];//17.01.08until
+ if(!contains(["\begi","\end{"],substring(str,0,5)),//17.01.15
+ tmp1="{\color[cmyk]{\thin,\thin,\thin,\thin}";//17.08.23
+ tmp1=[tmp1,str];
+ ,
+ tmp1=[str];
+ if(indexof(str,"\end{minipage}")>0,
+ tmp1=append(tmp1,"}%");
+ MiniFlg=0;
+ );
+ );
);
if(NonThinFlg==2,
- tmp1=[str,"}%"];
+ tmp1=[str];
+ if(!contains(["\begi","\end{"],substring(str,0,5)),
+ tmp1=append(tmp1,"}%");
+ ,
+ if(indexof(str,"\end{minipage}")>0,
+ tmp1=append(tmp1,"}%");
+ MiniFlg=0;
+ );
+ );
);
RepeatList_tmp=concat( RepeatList_tmp,tmp1);
);
);
- );//16.01.05until
+ );//16.01.05to
);
- );//16.12.05until
+ );//16.12.05to
);
Presentation(texfile):=Presentation(texfile,texfile);
@@ -4146,6 +4291,7 @@ Presentation(texfile,txtfile):=( tmp2,tmp3,tmp4,tmp5,newoption,top,repeatflg,nrep,nrepprev,,repstr,
sestr,npara,paradt,parafiles,hyperflg,paractr,
letterc,boxc,shadowc,mboxc,sep);
+ MiniFlg=0;//180526
slidecmd=["\ketcletter","\ketcbox","\ketdbox","\ketcframe",
"\ketcshadow","\ketdshadow","\slidetitlex","\slidetitlesize",
"\mketcletter","\mketcbox","\mketdbox","\mketcframe",
@@ -4259,15 +4405,9 @@ Presentation(texfile,txtfile):=( ,
println(SCEOUTPUT,"\usepackage[dvipdfmx]{graphicx}");
);
-// println(SCEOUTPUT,"\usepackage[usenames]{color}");
-// println(SCEOUTPUT,"\usepackage{color}");//17.06.14
println(SCEOUTPUT,"\usepackage{xcolor}");//17.07.31
letterc=[0.98,0.13,0,0.43]; boxc=[0,0.32,0.52,0];
shadowc=[0,0,0,0.5]; mboxc="yellow";
-// if(!islist(SlideColorList), //17.03.02from
-// SlideColorList=[letterc,boxc,boxc,boxc,shadowc,shadowc,6,1.3,
-// letterc,mboxc,mboxc,mboxc,62,2,letterc];
-// , //17.03.02until
tmp4="abcdefghijklmno";
forall(1..15,
tmp=SlideColorList_#;
@@ -4283,16 +4423,18 @@ Presentation(texfile,txtfile):=( SlideColorList_#="slidecolor"+tmp4_#;
);
);
-// ); //17.03.02
println(SCEOUTPUT,"\def\setthin#1{\def\thin{#1}}");//17.08.23
println(SCEOUTPUT,"\setthin{"+text(ThinDense)+"}");//17.08.23
+ println(SCEOUTPUT,"\newcommand{\slidepage}[1][s]{%");//180524from
+ println(SCEOUTPUT,"\setcounter{ketpicctra}{18}%");
+ println(SCEOUTPUT,"\if#1m \setcounter{ketpicctra}{1}\fi");
+ println(SCEOUTPUT,"\hypersetup{linkcolor=black}%");
+ println(SCEOUTPUT,"\begin{layer}{118}{0}");
+ println(SCEOUTPUT,"\putnotee{122}{-\theketpicctra.05}{\small\thepage/\pageref{pageend}}");
+ println(SCEOUTPUT,"\end{layer}\hypersetup{linkcolor=blue}}");//189524to
forall(ADDPACK,// 16.06.09from
-// if(indexof(#,"[")==0, // 16.09.05from
-// println(SCEOUTPUT,"\usepackage{"+#+"}");
-// ,
- println(SCEOUTPUT,"\usepackage"+#); //17.07.10
-// );
- );// 16.06.09until
+ println(SCEOUTPUT,"\usepackage"+#);
+ );// 16.06.09to
tmp=select(ADDPACK,indexof(#,"{hyperref}")>0);//16.12.31from
if(length(tmp)>0,
hyperflg=1;
@@ -4309,8 +4451,9 @@ Presentation(texfile,txtfile):=( forall(tmp, // 15.07.21
if(substring(#,0,1)=="\", println(SCEOUTPUT,#));
);
- if(!isstring(PageStyle),PageStyle="headings");//17.04.09
- println(SCEOUTPUT,"\pagestyle{"+PageStyle+"}");//17.04.09
+// if(!isstring(PageStyle),PageStyle="headings");//180524from
+// println(SCEOUTPUT,"\pagestyle{"+PageStyle+"}");
+ println(SCEOUTPUT,"\pagestyle{empty}");//180524to
println(SCEOUTPUT,"");
println(SCEOUTPUT,"\begin{document}");
println(SCEOUTPUT,"");
@@ -4351,7 +4494,7 @@ Presentation(texfile,txtfile):=( println(SCEOUTPUT,"");
println(SCEOUTPUT,"\color{"+SlideColorList_(15)+"}");
println(SCEOUTPUT,BodyStyle);//17.01.07
- println(SCEOUTPUT,"\thispagestyle{empty}");//17.01.29
+// println(SCEOUTPUT,"\thispagestyle{empty}");//180524
println(SCEOUTPUT,"\addtocounter{page}{-1}");//17.01.29
println(SCEOUTPUT,"");
verbflg=0; //16.06.28
@@ -4374,7 +4517,9 @@ Presentation(texfile,txtfile):=( tmp=indexof(sld,"]::");
if(tmp>0,
if(substring(sld,1,2)!="%",//17.05.31
- if(substring(sld,1,5)=="thin", ThinFlg=1); // 17.05.28
+ if(substring(sld,1,5)=="thin",
+ ThinFlg=1;
+ );
sestr=substring(sld,1,tmp);
sld=substring(sld,tmp+2,length(sld));
tmp=indexof(sestr,"[");
@@ -4396,7 +4541,8 @@ Presentation(texfile,txtfile):=( if(length(wall)>0,
tmp=["","\input{fig/"+wall+".tex}"];
);
- tmp=concat(tmp,["","\sameslide"+NewSlideOption,"","\vspace*{18mm}",""]);
+ tmp=concat(tmp,
+ ["","\sameslide"+NewSlideOption,"","\vspace*{18mm}",""]);//180524
RepeatList=apply(1..nrep,if(#==1,[],tmp));
);
if(sestr=="",flg=1);
@@ -4441,7 +4587,8 @@ Presentation(texfile,txtfile):=( if(length(wall)>0,
tmp=["","\input{fig/"+wall+".tex}"];
);
- tmp=concat(tmp,["","\sameslide"+NewSlideOption,"","\vspace*{18mm}",""]);
+ tmp=concat(tmp,
+ ["","\sameslide"+NewSlideOption,"","\vspace*{18mm}",""]);//180524
RepeatList=apply(1..nrep,if(#==1,[],tmp));
);
);
@@ -4449,7 +4596,7 @@ Presentation(texfile,txtfile):=( tmp4=[]; //16.12.31from
if(hyperflg>0,
tmp4=["\hypertarget{para"+text(paractr)+"pg"+text(#)+"}{}"];
- );//16.12.31until
+ );//16.12.31to
if(npara>0, //17.01.03
tmp4=concat(tmp4,["","\begin{layer}{120}"+paradt_2]);
if(#<=npara, //16.12.28from
@@ -4474,43 +4621,47 @@ Presentation(texfile,txtfile):=( tmp="{"+text(LinkPosV)+"}{\hyperlink{para"; // 17.01.12from
tmp1=tmp+text(paractr)+"pg";
tmp2=tmp+text(paractr-1)+"pg"+text(nrepprev);
- if(#>1,tmp=tmp1+text(1),tmp=tmp2);
+ tmp=tmp2; //180526from
tmp3=[text(LinkPosH-29*LinkSize)+"}"+tmp+"}{\fbox{\Ctab{"
+text(2.5*LinkSize)+"mm}{\scalebox{"+text(LinkSize)
- +"}{\scriptsize $\mathstrut|\!\lhd$}}}}}"];
- if(#>1,tmp=tmp1+text(max(#-3,1)),tmp=tmp2);
- tmp3=append(tmp3,
- text(LinkPosH-24*LinkSize)+"}"+tmp+"}{\fbox{\Ctab{"
- +text(2.5*LinkSize)+"mm}{\scalebox{"+text(LinkSize)
- +"}{\scriptsize $\mathstrut\!\! \lhd\!\!\lhd\!$}}}}}");
- if(#>1,tmp=tmp1+text(#-1),tmp=tmp2);
- tmp3=append(tmp3,
- text(LinkPosH-17*LinkSize)+"}"+tmp+"}{\fbox{\Ctab{"
- +text(4.5*LinkSize)+"mm}{\scalebox{"+text(LinkSize)
- +"}{\scriptsize $\mathstrut\!\!\lhd\!\!$}}}}}");
- tmp="{"+text(LinkPosV)+"}{\hyperlink{para";
- tmp2=tmp+text(paractr+1)+"pg"+text(1);
- if(#<nrep,tmp=tmp1+text(#+1),tmp=tmp2);
- tmp3=append(tmp3,
- text(LinkPosH-10*LinkSize)+"}"+tmp+"}{\fbox{\Ctab{"
- +text(4.5*LinkSize)+"mm}{\scalebox{"+text(LinkSize)
- +"}{\scriptsize $\mathstrut\!\rhd\!$}}}}}");
- if(#<nrep,tmp=tmp1+text(min(#+3,nrep)),tmp=tmp2);
- tmp3=append(tmp3,
- text(LinkPosH-5*LinkSize)+"}"+tmp+"}{\fbox{\Ctab{"
+ +"}{\scriptsize $\mathstrut||\!\lhd$}}}}}"];
+ if(nrep>1,//180526
+ tmp="{"+text(LinkPosV)+"}{\hyperlink{para"; // 17.01.12from
+ tmp1=tmp+text(paractr)+"pg";
+ tmp2=tmp+text(paractr-1)+"pg"+text(nrepprev);
+ tmp=tmp1+text(1);
+ tmp3=append(tmp3,
+ text(LinkPosH-24*LinkSize)+"}"+tmp+"}{\fbox{\Ctab{"
+ +text(2.5*LinkSize)+"mm}{\scalebox{"+text(LinkSize)
+ +"}{\scriptsize $\mathstrut|\!\lhd$}}}}}"); //180526to
+ if(#>1,tmp=tmp1+text(#-1),tmp=tmp2);
+ tmp3=append(tmp3,
+ text(LinkPosH-17*LinkSize)+"}"+tmp+"}{\fbox{\Ctab{"
+ +text(4.5*LinkSize)+"mm}{\scalebox{"+text(LinkSize)
+ +"}{\scriptsize $\mathstrut\!\!\lhd\!\!$}}}}}");
+ if(#<nrep,tmp=tmp1+text(#+1),tmp=tmp1+text(nrep));
+ tmp3=append(tmp3,
+ text(LinkPosH-10*LinkSize)+"}"+tmp+"}{\fbox{\Ctab{"
+ +text(4.5*LinkSize)+"mm}{\scalebox{"+text(LinkSize)
+ +"}{\scriptsize $\mathstrut\!\rhd\!$}}}}}");
+ tmp=tmp1+text(nrep); //180526from
+ tmp3=append(tmp3,
+ text(LinkPosH-5*LinkSize)+"}"+tmp+"}{\fbox{\Ctab{" // 17.01.19
+text(2.5*LinkSize)+"mm}{\scalebox{"+text(LinkSize)
- +"}{\scriptsize $\mathstrut\!\!\rhd\!\!\rhd\!$}}}}}");
- if(#<nrep,tmp=tmp1+text(nrep),tmp=tmp2);
+ +"}{\scriptsize $\mathstrut \!\rhd\!\!|$}}}}}");
+ );
+ tmp="{"+text(LinkPosV)+"}{\hyperlink{para"; //180529(2lines)
+ tmp=tmp+text(paractr+1)+"pg"+text(1);
tmp3=append(tmp3,
text(LinkPosH)+"}"+tmp+"}{\fbox{\Ctab{" // 17.01.19
+text(2.5*LinkSize)+"mm}{\scalebox{"+text(LinkSize)
- +"}{\scriptsize $\mathstrut \!\rhd\!\!|$}}}}}");
- tmp3=apply(tmp3,tmp,"\putnotew{"+tmp);
- tmp4=concat(tmp4,tmp3);// 17.01.12untilr
- tmp="\putnotew{"+text(LinkPosH)+"}{"+text(LinkPosV+6)+"}";//17.10.21from
- tmp=tmp+"{\scriptsize\color{black} "+text(#)+"/"+text(nrep)+"}";
- tmp4=append(tmp4,tmp);//17.10.21until
+ +"}{\scriptsize $\mathstrut \!\rhd\!\!||$}}}}}"); //180526to
);
+ tmp3=apply(tmp3,tmp,"\putnotew{"+tmp);
+ tmp4=concat(tmp4,tmp3);// 17.01.12to
+ tmp="\putnotee{"+text(LinkPosH+1)+"}{"+text(LinkPosV)+"}";//180524
+ tmp=tmp+"{\scriptsize\color{blue} "+text(#)+"/"+text(nrep)+"}"; //180524(blue)
+ tmp4=append(tmp4,tmp);
tmp4=concat(tmp4,["\end{layer}",""]);//16.12.31until
Repeatsameslide(repeatflg,text([#]),tmp4);
);
@@ -4519,7 +4670,7 @@ Presentation(texfile,txtfile):=( if(substring(sld,0,2)=="%%", //17.06.23from
println(SCEOUTPUT,sld);
flg=1;
- ); //17.06.23until
+ ); //17.06.23to
if(flg==0,
if(indexof(sld,"\begin{verbatim}")==1, // 16.06.28from
Repeatsameslide(repeatflg,sestr,[slideL_ns]);
@@ -4573,6 +4724,7 @@ Presentation(texfile,txtfile):=( );
println(SCEOUTPUT,"\mainslide{"+tmp2+"}");
println(SCEOUTPUT,"");
+ println(SCEOUTPUT,"");
tmp2="";
flg=1;
);
@@ -4605,7 +4757,7 @@ Presentation(texfile,txtfile):=( tmp4=tmp5;
);
tmp=tmp+"{"+tmp2+"}";
- Repeatsameslide(repeatflg,sestr,[tmp,"","\vspace*{18mm}",""]);
+ Repeatsameslide(repeatflg,sestr,[tmp,"","\vspace*{18mm}",""]);//180524
tmp2="";
flg=1;
);
@@ -4635,7 +4787,7 @@ Presentation(texfile,txtfile):=( // tmp3=tmp4;
// );
println(SCEOUTPUT,tmp);
- println(SCEOUTPUT,"");
+ println(SCEOUTPUT,""); //180524
println(SCEOUTPUT,"\vspace*{18mm}");
println(SCEOUTPUT,"");
tmp4=tmp3;
@@ -4707,9 +4859,9 @@ Presentation(texfile,txtfile):=( tmp3="";
flg=1;
);
- if(flg==0&tmp1=="end",
+ if(flg==0&tmp1=="end"&(length(flgL)>0), //180526
tmp=flgL_(length(flgL));
- if(tmp=="i",
+ if(tmp=="i",
Repeatsameslide(repeatflg,sestr,["\end{itemize}"]);
);
if(tmp=="e",
@@ -4771,8 +4923,9 @@ Presentation(texfile,txtfile):=( );
);
);
- println(SCEOUTPUT,"");
+// println(SCEOUTPUT,"");
);
+ println(SCEOUTPUT,"\label{pageend}\mbox{}"); //180529
println(SCEOUTPUT,"");
println(SCEOUTPUT,"\end{document}");
closefile(SCEOUTPUT);
@@ -4789,8 +4942,12 @@ Mkslides():=( Dirwork=replace(Dirwork,"/",pathsep());
parent=replace(Dirwork+Batparent,"/",pathsep());// 16.05.29
);
- Dirwork=replace(Dirwork,pathsep()+"fig","");
+ tmp=replace(Dirwork,pathsep()+"fig","");//180604(2lines)
+ Changework(tmp);
Setdirectory(Dirwork);
+ if(!iswindows(), //180604from
+ println(setexec(Dirwork,Shellparent));
+ ); //180604to
if(length(Texmain)>0, // 15.08.14 from
Texparent=Texmain;
);
@@ -4802,7 +4959,7 @@ Mkslides():=( drawtext(mouse().xy,Texparent+".txt not exist in "+Dirwork,
size->24,color->[1,0,0]);
, // 17.04.12until
- Presentation(Texparent); // 15.08.14 until
+ Presentation(Texparent); // 15.08.14to
if(iswindows(),
tmp2=Batparent;
parent=replace(Dirwork+Batparent,sep+"fig","");// 16.05.29
@@ -4855,21 +5012,24 @@ Mkslidesummary(inputfile,outputfile,options):=( dirworkorg=Dirwork;//17.04.10from
dirtop=replace(Dirwork,pathsep()+"fig","");
Changework(dirtop);//17.04.10uptp
+ if(ismacosx(), //180604from
+ println(setexec(Dirwork,Shellparent));
+ ); //180604to
fin=inputfile;
if(indexof(fin,".")==0,fin=fin+".tex");
fout=outputfile;
if(indexof(fout,".")==0,fout=fout+".tex");
cmdL=[
- "Dt=readLines('"+fin+"')",[],
- "num=grep('\\hypertarget',Dt,fixed=TRUE)",[],
+ "Dt=readLines('"+fin+"',encoding='UTF-8')",[],
+ "num=grep('hypertarget',Dt,fixed=TRUE)",[], //180412
"Dt=Dt[setdiff(1:length(Dt),num)]",[],
"Smain=c();Snew=c();Ssame=c()",[],
"for(J in 1:length(Dt)){",[],
- " Tmp=length(grep('\\mainslide{',Dt[J],fixed=TRUE))",[],
+ " Tmp=length(grep('mainslide{',Dt[J],fixed=TRUE))",[], //180412
" if(Tmp>0){Smain=c(Smain,1)}else{Smain=c(Smain,0)}",[],
- " Tmp=length(grep('\\newslide{',Dt[J],fixed=TRUE))",[],
+ " Tmp=length(grep('newslide{',Dt[J],fixed=TRUE))",[], //180412
" if(Tmp>0){Snew=c(Snew,1)}else{Snew=c(Snew,0)}",[],
- " Tmp=length(grep('\\sameslide',Dt[J],fixed=TRUE))",[],
+ " Tmp=length(grep('sameslide',Dt[J],fixed=TRUE))",[], //180412
" if(Tmp>0){Ssame=c(Ssame,1)}else{Ssame=c(Ssame,0)}",[],
"}",[],
"Nnew=c();Nsame=c()",[],
@@ -4885,11 +5045,9 @@ Mkslidesummary(inputfile,outputfile,options):=( "}",[],
"Tmp=max(c(Nsame[-1],Nnew[-1]))+1",[],
"Out=c(Out,Dt[Tmp:length(Dt)])",[],
- "writeLines(Out,'"+fout+"',sep='\n')",[],
- "cat('////',file='resultR.txt',sep='')",[],
- "quit()",[]
+ "writeLines(Out,'"+fout+"',sep='\n')",[] //180412(2lines removed)
];
- CalcbyR("out",cmdL,append(options,"Cat=n"));
+ CalcbyR("",cmdL,append(options,"Cat=n"));//180412
wait(1000);
Changework(dirtop);//17.04.10
tmp=replace(fout,".tex","");
diff --git a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibhelpE.txt b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibhelpE.txt index 0c89e3e75ed..0c89e3e75ed 100644..100755 --- a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibhelpE.txt +++ b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibhelpE.txt diff --git a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibhelpJ.txt b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibhelpJ.txt index 93e5e323add..93e5e323add 100644..100755 --- a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibhelpJ.txt +++ b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibhelpJ.txt diff --git a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibmvhelpE.txt b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibmvhelpE.txt index 9a7edb2e99f..9a7edb2e99f 100644..100755 --- a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibmvhelpE.txt +++ b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibmvhelpE.txt diff --git a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibmvhelpJ.txt b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibmvhelpJ.txt index 354d6596a77..354d6596a77 100644..100755 --- a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibmvhelpJ.txt +++ b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibmvhelpJ.txt diff --git a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibmvlogr.txt b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibmvlogr.txt index 70b42e5ad65..e79262aa42c 100644 --- a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibmvlogr.txt +++ b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibmvlogr.txt @@ -1,3 +1,22 @@ +// 20180614 +// Setpara changed (ReadOutData&Projpara removed fromGLISTbkup) +// Setpara changed (the above also removed from COM2ndlist) +// 20180611 +// Parafolder changed (path removed, Dirworkbkup&Dirworksubbkup used) +// 20180610 +// Parafolder debugged (files not removed, waiting time for R) +// Parafolder changed ( pause option adde ) +// 20180609 +// Parafolder changed (CommonMake) +// Mkflipanime,Animationfile changed ( length(ParaSL) ) +// 20180608 +// Parafolder changed (to "all.r", to delete file) +// 20180607 +// Parafolder debugged ( FnameR,.. => Setfiles) +// 20180606 +// Setpara,Parafolder renewed +// 20180602 +// divoptions ( 8,9 ->length(tmp)-1,length(tmp)) //2017.12.09 // Parafolder debugged (Viewtex ->WritetoRS) // Mkanimation debugged ( \ -> / for windows ) diff --git a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibmvr.cs b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibmvr.cs index e9978e7b653..a538afd1330 100644..100755 --- a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibmvr.cs +++ b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibmvr.cs @@ -14,12 +14,12 @@ // along with this program. If not, see <http://www.gnu.org/licenses/> // -println("ketcindymv(20171124) loaded"); +println("ketcindymv(20180614) loaded"); //help:start(); -Setpara(path,fstr,sL):=Setpara(path,fstr,sL,[],[]); // 16.12.27added -Setpara(pathorg,fstr,sL,options):= //17.11.25(3lines) +Setpara(path,fstr,sL):=Setpara(path,fstr,sL,[],[]); +Setpara(pathorg,fstr,sL,options):= Setpara(pathorg,fstr,sL,options,[]); Setpara(pathorg,fstr,sL,options,optionsanim):=( //help:Setpara("folder name","funstr","range",options,optionsanim); @@ -29,13 +29,31 @@ Setpara(pathorg,fstr,sL,options,optionsanim):=( //help:Setpara(options2anim2=["OpA=[loop,controls,buttonsize=3mm]"]); //help:Setpara(options2anim3=["OpA=+step"]); //help:Setpara(options2anim4=["Mag=1600","Title=folder"]); - regional(path);//17.04.10 + regional(path,tmp,tmp1,tmp2,tmp3,eqL,ndiv,gtmp,ctmp,nn,flg); if(length(pathorg)==0, path=Slidename,path=pathorg);//17.04.10 ParaPath=path; ParaFstr=fstr; ParaSL=sL; + if(isstring(sL), + ndiv=25; + tmp=Divoptions(options); + eqL=tmp_5; + forall(eqL, + tmp=Strsplit(#,"="); + tmp1=Toupper(tmp_1); + if(substring(tmp1,0,1)=="D", + ndiv=parse(tmp_2); + ); + ); + tmp=Strsplit(sL,"="); + tmp1=parse(tmp_2); + ParaSL=apply(0..ndiv,tmp1_1+#*(tmp1_2-tmp1_1)/ndiv); + ); ParaOp=options; - ParaOpAnim=optionsanim; //17.11.25 + if((!contains(Paraop,"r"))&(!contains(ParaOp,"m")), + ParaOp=append(ParaOp,"m");//180604 + ); + ParaOpAnim=optionsanim; GLISTback=GLIST; GCLISTback=GCLIST; GOUTLISTback=GOUTLIST; @@ -46,167 +64,207 @@ Setpara(pathorg,fstr,sL,options,optionsanim):=( COM0thlistback=COM0thlist; COM1stlistback=COM1stlist; COM2ndlistback=COM2ndlist; + Dirworkbkup=Dirwork; //0611from + Dirworksubbkup=Dirwork+pathsep()+ParaPath; + Changework(Dirworksubbkup); + Changework(Dirworkbkup); + Fheadbkup=Fhead; //0611to + gtmp=GLISTback; + tmp1=select(1..(length(gtmp)),indexof(gtmp_#,"ReadOutData")>0); //180614from + tmp2=[];tmp3=[]; + forall(tmp1,nn, + tmp2=append(tmp2,nn); + flg=0; + tmp=min([nn+40,length(gtmp)]); + forall((nn+1)..tmp, + if(flg==0, + if(indexof(gtmp_#,"Projpara")>0, + tmp2=append(tmp2,#); + tmp=indexof(gtmp_#,"="); + tmp=substring(gtmp_#,0,tmp-1); + tmp3=append(tmp3,tmp); + , + flg=1; + ); + ); + ); + ); + tmp1=remove(1..(length(gtmp)),tmp2); + GLISTback=apply(tmp1,GLIST_#); //180614to + ctmp=COM2ndlistback; //180614 + forall(tmp3,tmp2, + tmp=select(ctmp,indexof(#,tmp2)>0); + ctmp=remove(ctmp,tmp); + ); + COM2ndlistback=ctmp; ); -Parafolder():=Parafolder(ParaPath,ParaFstr,ParaSL,ParaOp); -Parafolder(path,fstr,sL):=Parafolder(path,fstr,sL,[]); -Parafolder(path,fstr,sLorg,optionorg):=( +Parafolder():=Parafolder(ParaFstr,ParaSL,ParaOp); +Parafolder(fstr,sL):=Parafolder(fstr,sL,[]); +Parafolder(fstr,sL,optionorg):=( //help:Parafolder(foldername,1..4); //help:Parafolder(foldername,"s=[0,1]"); //help:Parafolder("mf(s)",foldername,"s=[0,1]"); -//help:Parafolder(options=["m/r","Div=25","Wait=20"]); +//help:Parafolder(options=["m/r","Div=25","Wait=20"]); +//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,sL,tmp,tmp1,tmp2,strL,eqL,waiting, - mkr,mktex,ndiv,options,sfL); - if(!isstring(ParaPath), - println("Setpara not executed"); - , - sL=sLorg;//16.12.24from - if(!isstring(sL), - tmp=indexof(fstr,"("); - tmp1=substring(fstr,tmp,length(fstr)); - tmp=indexof(tmp1,")"); - tmp1=substring(tmp1,0,tmp-1); - , - tmp=indexof(sL,"=");//16.12.21from - if(length(tmp)>0, - tmp1=substring(sL,0,tmp-1); - ); + regional(nn,tmp,tmp1,tmp2,strL,eqL,waiting,outflg,pause, + mkr,mktex,options,sfL,dirbkup,fbkup,pfile,ctr,flg,varL); + Changework(Dirworkbkup); + Setfiles(Fheadbkup); + tmp=indexof(fstr,"("); + tmp1=substring(fstr,tmp,length(fstr)); + tmp=indexof(tmp1,")"); + tmp1=substring(tmp1,0,tmp-1); + parse("Movieframe("+tmp1+"):="+fstr); + options=optionorg; + tmp=Divoptions(options); + eqL=tmp_5; + strL=tmp_7; + if(length(strL)==0,options=append(options,"m")); + mkr="A"; + mktex="A"; + waiting=20; + outflg=0; + pause=10; + forall(eqL, + tmp=Strsplit(#,"="); + tmp1=Toupper(substring(tmp_1,0,1)); + if(tmp1=="W", + waiting=parse(tmp_2); + options=remove(options,[#]); ); - parse("Movieframe("+tmp1+"):="+fstr); - options=optionorg; - tmp=Divoptions(options); - eqL=tmp_5; - strL=tmp_7; - if(length(strL)==0,options=append(options,"m"));//16.12.18 - mkr="A"; - mktex="A"; - ndiv=25; - waiting=20; - forall(eqL, - tmp=Indexof(#,"="); - tmp1=Toupper(substring(#,0,1)); - tmp2=substring(#,tmp,length(#)); - if(tmp1=="D", - ndiv=parse(tmp2); - options=remove(options,[#]); - ); - if(tmp1=="W", - waiting=parse(tmp2); - options=remove(options,[#]); - ); + if((tmp1=="O")%(tmp1=="R"), //180606from + tmp=Toupper(substring(tmp_2,0,1)); + if(tmp=="Y", outflg=1); + options=remove(options,[#]); ); - forall(strL, - tmp1=Toupper(substring(#,0,1)); - if(tmp1=="M", - mkr="Y"; mktex="Y"; - ); + if(tmp1=="P", //180610from + pause=parse(tmp_2); + options=remove(options,[#]); + ); // //180610to + ); + forall(strL, + tmp1=Toupper(substring(#,0,1)); + if(tmp1=="M", + mkr="Y"; mktex="Y"; ); - sL=sLorg; - if(isstring(sL), - tmp=indexof(sL,"="); - tmp1=parse(substring(sL,tmp,length(sL))); - sL=apply(0..ndiv,tmp1_1+#*(tmp1_2-tmp1_1)/ndiv); + ); + Changework(Dirworksubbkup); + SCEOUTPUT = openfile("all.r"); + println(SCEOUTPUT,""); + closefile(SCEOUTPUT);//180608to + if(outflg==1, //180606from + CommonMake=1;//180609 + ctr=1; + forall(sL, + tmp="000000"+text(ctr); + pfile="p"+substring(tmp,length(tmp)-3,length(tmp)); + Setfiles(pfile); + Changework(Dirworksubbkup); + Movieframe(#); + Changework(Dirworksubbkup);//180608 + ctr=ctr+1; ); - if(!isexists(Dirwork,path), - if(ErrFlag!=-1, - makedir(Dirwork,path) - , - println(" ==> Changework may not work properly"); - sL=[]; - ); + CommonMake=-1;//180609 + Setfiles(fbkup); + ); //180606to + wait(pause); //180610 +// Changework(Dirworkbkup); + sfL=[]; + ctr=1; + forall(1..(length(sL)),nn, + Changework(Dirworkbkup);//180611(2lines) + Setfiles(Fheadbkup); + GLIST=GLISTback; + GCLIST=GCLISTback; + GOUTLIST=GOUTLISTback; + POUTLIST=POUTLISTback; + VLIST=VLISTback; + FUNLIST=FUNLISTback; + LETTERlist=LETTERlistback; + COM0thlist=COM0thlistback; + COM1stlist=COM1stlistback; + COM2ndlist=COM2ndlistback; + tmp="000000"+text(nn); + pfile="p"+substring(tmp,length(tmp)-3,length(tmp)); + Setfiles(pfile); + Changework(Dirworksubbkup); + sfL=append(sfL,FnameR); + if(outflg==1, + Changework(Dirworksubbkup);//180606 + Setfiles(pfile); //180610(2lines) + wait(pause); + Movieframe(sL_nn); + Changework(Dirworksubbkup);//180606 + ctr=ctr+1; , - tmp=fileslist(Dirwork+pathsep()+path); //17.12.09(3lines); - tmp=length(tmp); - if((mkr=="Y") & (tmp>0), - tmp1=replace(Dirwork,"\","/");//17.10.13 - cmdL=[ - "setwd",[Dq+tmp1+"/"+path+Dq], - "fL=as.matrix(list.files())",[], - "apply",["fL",2,"file.remove"], - "setwd",[Dq+tmp1+Dq], - ]; - CalcbyR("rvf",cmdL,["Cat=n","m"]); - tmp=Dirwork+pathsep()+path; - repeat(1..30, - if(length(fileslist(tmp))>0,wait(10)); - ); - );//17.02.20until - ); - sfL=[]; - forall(1..(length(sL)),nn, - GLIST=GLISTback; - GCLIST=GCLISTback; - GOUTLIST=GOUTLISTback; - POUTLIST=POUTLISTback; - VLIST=VLISTback; - FUNLIST=FUNLISTback; - LETTERlist=LETTERlistback; - COM0thlist=COM0thlistback; - COM1stlist=COM1stlistback; - COM2ndlist=COM2ndlistback; - tmp1=Sprintf(nn/1000,3); - tmp=indexof(tmp1,"."); - tmp1=substring(tmp1,tmp,length(tmp1)); - FnameR=path+"/p"+tmp1+".r"; - sfL=append(sfL,FnameR); - Fnametex=replace(FnameR,".r",".tex"); - Movieframe(sL_nn); //17.10.13 - if(!isexists(Dirwork,FnameR) % mkr=="Y", - if(ErrFlag!=-1, - WritetoRS(2); //17.12.09 - ); + Movieframe(sL_nn); + ); + CommonMake=0;//180609 + Setfiles(pfile); //180608 + if(!isexists(Dirworksubbkup,FnameR) % mkr=="Y", + if(ErrFlag!=-1, + WritetoRS(2); ); - ); - tmp1=replace(Dirwork,"\","/"); //17.10.13 - cmdL=[ - "setwd",[Dq+tmp1+"/"+path+Dq], - "Mkallfile=function(fname){",[], - " Ctr<<- Ctr+1",[], - " tmp=readLines(fname)",[], - " first=1",[], - " if(Ctr>1){",[], - " first=7",[], - " cat('Ketinit()\n',file='all.r',append=TRUE)",[], + ); + ); + wait(pause); //180610 + Setfiles(fkbkup); + Changework(Dirworksubbkup); + GLIST=select(GLIST,indexof(#,"Projpara")==0); + tmp1=replace(Dirworksubbkup,"\\","/"); //180611 + tmp1=replace(tmp1,"\","/"); + cmdL=[ + "setwd("+Dqq(tmp1)+")",[], + "size="+text(length(sL)),[], + "cat('',file='all.r',sep='',append=FALSE)",[], //180614 + "for(n in Looprange(1,size)){",[], + " tmp=as.character(n)",[], + " tmp=paste('0000',tmp,sep='')",[], + " tmp=substring(tmp,nchar(tmp)-2,nchar(tmp))",[], + " fname=paste('p',tmp,'.r',sep='')",[], + " lines=readLines(fname)",[], + " if(n>1){",[], //180614from + " for(j in 1:length(lines)){",[], + " tmp=grep('source',lines[j],fixed=TRUE)",[], + " if(length(tmp)>0){",[], + " lines[j]=paste('#',lines[j],sep='')",[], + " lines[j+2]=paste('#',lines[j+2],sep='')",[], + " break",[], + " }",[], + " }",[], " }",[], - " for(J in first:(length(tmp)-1)){",[], - " cat(paste(tmp[J],'\n',sep=''),file='all.r',append=TRUE)",[], + " lines=lines[1:(length(lines)-1)]",[], //180614to + " tmp=paste('print(',as.character(n),')',sep='')",[], + " lines=c(tmp,lines)",[], + " for(j in Looprange(1,length(lines))){",[], + " cat(lines[j],file='all.r',sep='\n',append=TRUE)",[], " }",[], - " cat('print(',Ctr,')\n',file='all.r',append=TRUE)",[], - " Tmp=proc.time()-Tm",[], - " cat('print(',Tmp[3],')\n',file='all.r',append=TRUE)",[], - "}",[], - "if(file.exists('all.r')){file.remove('all.r')}",[], //17.10.24 - "fL=list.files()",[], - "Ctr=0",[], - "Tm<-invisible(proc.time())",[], - "for(fname in fL){",[], - " if(length(grep('.r',fname))>0){Mkallfile(fname)}",[], // 17.11.24 "}",[], - "source('all.r')",[], - "setwd",[Dq+tmp1+Dq] - ]; - if(ErrFlag!=-1, - if(!isexists(Dirwork,Fnametex) % mktex=="Y", - CalcbyR("all",cmdL,["Cat=n","m","Wait="+text(waiting)]); - , - println("Parafolder "+path+" finished");//16.12.20 - ); - if(length(after)>0, // 16.12.27 - parse(after); - ); - FnameR=Fhead+".r"; - Fnametex=Fhead+".tex"; + "source('all.r')",[] + ]; + if(ErrFlag!=-1, + waiting=min([waiting,8])*length(ParaSL); //180610 + if(!isexists(Dirworksubbkup,Fnametex) % mktex=="Y", + CalcbyR("",cmdL,["Cat=n","m","Wait="+text(waiting)]); + , + println("Parafolder finished"); + ); + if(length(after)>0, + parse(after); ); ); + Changework(Dirworkbkup); + Setfiles(Fheadbkup); ); Animatefile():=Animatefile(Dirwork,ParaPath); Animatefile(path,folder):=( //help:Animatefile(); //help:Animatefile(Dirwork,ParaPath); - regional(FRate, Scale, OpA, pa,fname,eqL,tmp,tmp1,tmp2); + regional(FRate, Scale, OpA, pa,fname,eqL,tmp,tmp1,tmp2,texfiles); tmp=divoptions(ParaOpAnim); //17.11.24 eqL=tmp_5; FRate="10"; @@ -244,11 +302,19 @@ Animatefile(path,folder):=( tmp1=fileslist(tmp); tmp1=tokenize(tmp1,","); tmp1=select(tmp1,indexof(#,".tex")>0); + texfiles=[];//180609from + forall(tmp1, + tmp=indexof(#,"."); + tmp=parse(substring(#,1,tmp-1)); + if(tmp<=length(ParaSL), + texfiles=append(texfiles,#); + ); + );//180609to SCEOUTPUT= openfile(fname); println(SCEOUTPUT,"\def\parapath{"+pa+"}%"); //17.06.22 println(SCEOUTPUT,"\def\figsize{"+Scale+"}%"); //17.12.07 println(SCEOUTPUT,"\begin{animateinline}"+OpA+"{"+FRate+"}%"); - forall(1..(length(tmp1)), + forall(1..(length(texfiles)), //180609 if(Scale==1, // 17.08.30from tmp="\input{\parapath/"; tmp=tmp+folder+"/"+tmp1_#+"}%"; @@ -511,7 +577,15 @@ Mkflipanime(path,folder):=( println(SCEOUTPUT,""); tmp=fileslist(Dirwork+pathsep()+folder); tmp=tokenize(tmp,","); - texfiles=select(tmp,indexof(#,".tex")>0); + tmp1=select(tmp,indexof(#,".tex")>0); //180609from + texfiles=[]; + forall(tmp1, + tmp=indexof(#,"."); + tmp=parse(substring(#,1,tmp-1)); + if(tmp<=length(ParaSL), + texfiles=append(texfiles,#); + ); + );//180609to forall(texfiles, println(SCEOUTPUT,"\vspace*{25mm}"); println(SCEOUTPUT,""); diff --git a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindyliboutlogr.txt b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindyliboutlogr.txt index 94752a33760..77e7c8c8656 100644 --- a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindyliboutlogr.txt +++ b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindyliboutlogr.txt @@ -1,3 +1,78 @@ +// 20180612 +// Hatchdata renamed to HatchdataR +// kcC changed ( "gcc -lm" ) +// 20180611 +// StartsurfC changed ( "reset" of GLIST ) +// 20180610 +// StartsurfC debugged ( sizeL ) +// 20180609 +// StartsurfC changed ( multi type of setting constant) +// ExeccmdC changed (CommonMake) +// 20180608 +// StartsurfC changed ( FuncListC reset) +// ExeccmdC changed ( Fhead printed) +// ExeccmdC, Crvsfparadata,... changed (Projpara with "Msg=n" ) +// CalcbyR changed (Wait=30) +// 20180607 +// CrvsfparadataC,WireparadataC debugged ( "sprintf..." of CommandListC); +// SfbdparadataC changed (name: funnm =>nm ) +// 20180606 +// StartsurfC added +// SfbdparadataC changed (FuncListC) +// Setpara, Parafolder renewed +// 20180605 +// ExeccmdC changed ("Path=" option supported ) +// 20180602 +// divoptions ( 8,9 ->length(tmp)-1,length(tmp)) +// ExeccmdC changed ( optionsh (default="do"), varL ) +// Crv2onsfparadata,Crv3onsfparadata debugged +// 20180601 +// SfbdparadataC,... changed ( fbdy => sfbd) +// Ctopsurf changed (data[DsizeL][3],sfbd[DsizeL][3] added ) +// Ctosurf changed (CutFunList) +// SfbdparadataC changed ( "w" or "a" set according to CommandListC) +// Wireparadata,Sfcutdata changed (cmdflg) +// ExeccmdC changed ( EraseList ); +// 20180531 +// SfbdparadataC changed ( outputend added, readoutdata3 changed) +// 20180530 +// Ctopsurf changed ( stdlib.h, string.h) +// CrvsfparadataC,Crvonsfparadata,... changed (readoutdata3 used for fbdy) +// 20180523 +// Cheadsurf,Ctopsurf debugged (case => break added ) +// Cheadsurf debugged ( Dirname "\" => "/") +// CalcbyC debugged ( "////" ) +// 20180521 +// IntersectcrvsfC added +// 20180517 +// Cform debugged ( "=", tmp=0) +// SfbdparadataC,... changed ( "" removed from optionh ) +// CalcbyC changed ( "result" => "end" ) +// 20180516 +// Ctopsurf debugged ( : => ;) +// 20180510 +// CalcbyR changed ( for the last command ) +// Crv2sfparadataC added +// 20180508 +// MkprecommandR changed (PVOFG) +// CalcbyR changed (option Pre) +// 20180505 +// Ctopsurf changed ( for mult cutfun) +// 20180504 +// Ketinit debuggde (MARKLEN : ) +// 20180502 +// CostC removed +// SetconstantC added +// 20180428 +// CrvsfparadataC changed (Changestyle => "nodisp") +// Ctopsurf changed (data[DsizeLL][3] removed ) +// 20180426 +// CrvsfparadataC largely changed +// WritedataC changed ( \n removed at the last line ) +// 2018.04.12 +// CalcbyR changed ( for blank name ) +// 2018.04.11 +// Mkketcindyjs debugged // 2018.03.27 // functions of C changed // CalcbyC added diff --git a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindyliboutr.cs b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindyliboutr.cs index 1bb3e3439c6..ef6f151f6b3 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("ketcindyout(20180327) loaded"); +println("ketcindylibout(20180612 loaded"); //help:start(); @@ -646,6 +646,90 @@ Dataframe(nmL,dL,options):=( out=replace(out,"]",")"); ); +MkprecommandR():=MkprecommandR(6,"PVOFG"); //180508(9lines) +MkprecommandR(Arg):=( + regional(out,tmp1); + if(isstring(Arg), + MkprecommandR(6,Arg); + , + if(islist(Arg), + out=[]; + forall(Arg, + tmp1=Rform(#); + out=concat(out,[tmp1,[]]); + ); + out; + , + MkprecommandR(Arg,"PVOFG"); + ); + ); +); +MkprecommandR(prec,chstr):=( + regional(cmdL,Plist,tmp,tmp1,tmp2); + cmdL=[]; + if(indexof(chstr,"P")>0, + Plist=[]; + forall(remove(allpoints(),[SW,NE]), + tmp=textformat(re(Lcrd(#)),prec); + tmp=RSform(tmp); + tmp1=#.name; + tmp1=tmp1+"="+tmp+";Assignadd('"+tmp1+"',"+tmp1+")"; + Plist=append(Plist,tmp1); + ); + forall(1..(length(Plist)), + cmdL=concat(cmdL,[Plist_#,[]]); + ); + ); + if(indexof(chstr,"V")>0, + tmp2=sort(apply(VLIST,#_1)); // 16.02.03 from + tmp=apply(allpoints(),text(#));//18.02.11 + tmp2=remove(tmp2,tmp); + tmp1=[]; + forall(tmp2,tmp, + tmp1=concat(tmp1,select(VLIST,#_1==tmp)); + ); + VLIST=tmp1;// 17.09.24from + forall(VLIST, + tmp=#_1; + tmp1=#_2; + if(!isstring(tmp1), + if(islist(tmp1), + tmp2="["; + forall(tmp1, + tmp2=tmp2+textformat(#,prec)+","; + ); + tmp1=substring(tmp2,0,length(tmp2)-1)+"]"; + , + tmp1=format(tmp1,prec); + ); + ); + tmp1=RSform(tmp1); + tmp1=tmp+"="+tmp1+";"; + tmp1=tmp1+"Assignadd('"+tmp+"',"+tmp+")"; + cmdL=concat(cmdL,[tmp1,[]]);//17.09.24until + ); + ); + if(indexof(chstr,"O")>0, + forall(OutFileList, + cmdL=concat(cmdL,["tmp=ReadOutData",[Dq+#+Dq]]); + ); + ); + if(indexof(chstr,"F")>0, + forall(FUNLIST, + cmdL=concat(cmdL,[#,[]]); + ); + ); + if(indexof(chstr,"G")>0, + forall(GLIST, + if(indexof(#,"ReadOutData")==0, //18.02.12 + tmp1=Rform(#); + cmdL=concat(cmdL,[tmp1,[]]); + ); + ); + ); + cmdL; +); + CalcbyR(name,cmd):=CalcbyR(name,PathR,cmd,[]); CalcbyR(name,Arg1,Arg2):=( if(isstring(Arg1), @@ -656,9 +740,10 @@ CalcbyR(name,Arg1,Arg2):=( ); CalcbyR(name,path,cmd,optionorg):=( //help:CalcbyR(name,cmd); -//help:CalcbyR(options=["m/r","Wait=2","Out=yes","Pre=yes","Res=" ]); +//help:CalcbyR(options=["m/r","Wait=2","Out=yes","Pre=PVOFG","Res=" ]); +//help:CalcbyR(options2=["Pre=!G" ]); regional(options,tmp,tmp1,tmp2,tmp3,realL,strL,eqL, - cat,dig,preflg,flg,wflg,file,nc,arg,cmdR,cmdlist,wfile,waiting); + cat,dig,prestr,flg,wflg,file,nc,arg,cmdR,cmdlist,wfile,waiting); options=optionorg; tmp=divoptions(options); eqL=tmp_5; @@ -667,12 +752,12 @@ CalcbyR(name,path,cmd,optionorg):=( dig=5; cat="Y"; wfile=""; - preflg=1; - waiting=5; + prestr="PVOFG"; //180508 + waiting=30; //180608 forall(eqL, - tmp=indexof(#,"="); - tmp1=Toupper(substring(#,0,1)); - tmp2=substring(#,tmp,length(#)); + tmp=Strsplit(#,"="); + tmp1=Toupper(substring(tmp_1,0,1)); + tmp2=tmp_2; if((tmp1=="C")%(tmp1=="O"), cat=Toupper(substring(tmp2,0,1)); options=remove(options,[#]); @@ -681,10 +766,16 @@ CalcbyR(name,path,cmd,optionorg):=( waiting=parse(tmp2); options=remove(options,[#]); ); - if(tmp1=="P", //18.01.27 - tmp2=substring(Toupper(tmp2),0,1); - if(tmp2=="Y",preflg=1); - if(tmp2=="N",preflg=0); + if(tmp1=="P", //180508from + tmp2=Toupper(tmp2); + if(substring(tmp2,0,1)!="!", + prestr=tmp2; + , + tmp2=substring(tmp2,1,length(tmp2)); + forall(1..(length(tmp2)), + prestr=replace(prestr,substring(tmp2,#-1,#),""); + ); + );//180508to options=remove(options,[#]); ); if(tmp1=="D", @@ -704,7 +795,7 @@ CalcbyR(name,path,cmd,optionorg):=( if(cat=="Y", wfile=Fhead+name+".txt"; , - wfile="result.txt"; + wfile="resultR.txt"; ); ); wflg=0; @@ -725,12 +816,14 @@ CalcbyR(name,path,cmd,optionorg):=( if(length(tmp)==0,wflg=1); ); ); - file=Fhead+name; + if(length(name)>0,//180412from + file=Fhead+name; + , + file=Cindyname(); + );//180412to cmdR=[]; - if(preflg==1, //18.01.27from - cmdR=MkprecommandR(); - ); - cmdR=concat(cmdR,cmd); //18.01.27until + cmdR=MkprecommandR(6,prestr); + cmdR=concat(cmdR,cmd); //18.01.27to cmdlist=[]; if(dig>5, //16.10.28from cmdlist=append(cmdlist,"options(digits="+text(dig+2)+");"); @@ -738,9 +831,9 @@ CalcbyR(name,path,cmd,optionorg):=( forall(1..floor(length(cmdR)/2),nc, //17.05.18 tmp1=cmdR_(2*nc-1); tmp1=replace(tmp1,LFmark,""); // 16.06.12 - if(nc==length(cmdR)/2, //16.10.23from +// if(nc==length(cmdR)/2, //16.10.23from // if(indexof(tmp1,"=")==0,tmp1="="+tmp1);//16.12.20 - ); //16.10.23uptp +// ); //16.10.23uptp if(substring(tmp1,0,1)=="=", tmp1=name+tmp1; ); @@ -769,17 +862,23 @@ CalcbyR(name,path,cmd,optionorg):=( ); tmp1=cmdlist_(length(cmdlist)); if(indexof(tmp1,"=")==0, - tmp1=tokenize(tmp1,"::"); - if(length(tmp1)==1, - tmp2=name+"="+tmp1_1; - , - tmp2=name+"=list("; - forall(tmp1, - tmp2=tmp2+#+","; + if(length(name)>0, //180412 + tmp1=tokenize(tmp1,"::"); + if(length(tmp1)==1, + if(indexof(tmp1_1,"(")==0, //180510from + tmp2=name+"="+tmp1_1; + , + tmp2=tmp1_1; + ); //180510to + , + tmp2=name+"=list("; + forall(tmp1, + tmp2=tmp2+#+","; + ); + tmp2=substring(tmp2,0,length(tmp2)-1)+")"; //180510(moved) ); - tmp2=substring(tmp2,0,length(tmp2)-1)+")"; + cmdlist_(length(cmdlist))=tmp2; ); - cmdlist_(length(cmdlist))=tmp2; ); if(CONTINUED==1, ComOutList=concat(ComOutList,cmdlist); @@ -1197,10 +1296,10 @@ Writecsv(nmL,dataorg,file,optionorg):=( closefile(SCEOUTPUT); ); -Hatchdata(nm,iostr,pltlist):=Hatchdata(nm,iostr,pltlist,[]); -Hatchdata(nm,iostr,pltlist,optionorg):=( //17.09.18 -//help:Hatchdata("1","ii",[["gr1"],["gr2","n"]]); -//help:Hatchdata(options=["Wait=5"]); +HatchdataR(nm,iostr,pltlist):=HatchdataR(nm,iostr,pltlist,[]); +HatchdataR(nm,iostr,pltlist,optionorg):=( //17.09.18 +//help:HatchdataR("1","ii",[["gr1"],["gr2","n"]]); +//help:HatchdataR(options=["Wait=5"]); regional(options,name,eqL,reL,strL, plt,fname,options,tmp,tmp1,tmp2,tmp3,flg,wflg,waiting); name="ha"+nm; @@ -1896,66 +1995,6 @@ Rulerscale(pt,hscale,vscale,tick):=( ); ); -MkprecommandR():=MkprecommandR(6); -MkprecommandR(prec):=( - regional(cmdL,Plist,tmp,tmp1,tmp2); - Plist=[]; - Pnamelist=[]; - Pvaluelist=[]; - forall(remove(allpoints(),[SW,NE]), - tmp=textformat(re(Lcrd(#)),prec); - tmp=RSform(tmp); - tmp1=#.name; - tmp1=tmp1+"="+tmp+";Assignadd('"+tmp1+"',"+tmp1+")"; - Plist=append(Plist,tmp1); - ); - cmdL=[]; - forall(1..(length(Plist)), - cmdL=concat(cmdL,[Plist_#,[]]); - ); - tmp2=sort(apply(VLIST,#_1)); // 16.02.03 from - tmp=apply(allpoints(),text(#));//18.02.11 - tmp2=remove(tmp2,tmp); - tmp1=[]; - forall(tmp2,tmp, - tmp1=concat(tmp1,select(VLIST,#_1==tmp)); - ); - VLIST=tmp1;// 17.09.24from - forall(VLIST, - tmp=#_1; - tmp1=#_2; - if(!isstring(tmp1), - if(islist(tmp1), - tmp2="["; - forall(tmp1, - tmp2=tmp2+textformat(#,6)+","; - ); - tmp1=substring(tmp2,0,length(tmp2)-1)+"]"; - , - tmp1=format(tmp1,6); - ); - ); - tmp1=RSform(tmp1); - tmp1=tmp+"="+tmp1+";"; - tmp1=tmp1+"Assignadd('"+tmp+"',"+tmp+")"; - cmdL=concat(cmdL,[tmp1,[]]);//17.09.24until - ); - forall(OutFileList, - cmdL=concat(cmdL,["tmp=ReadOutData",[Dq+#+Dq]]); - ); - forall(FUNLIST, - cmdL=concat(cmdL,[#,[]]); - ); - forall(GLIST, - if(indexof(#,"ReadOutData")==0, //18.02.12 - tmp1=Rform(#); - cmdL=concat(cmdL,[tmp1,[]]); - ); - ); - cmdL; -); - - MkprecommandS():=MkprecommandS(6); MkprecommandS(prec):=( regional(cmdL,Plist,Pnamelist,Pvaluelist,tmp,tmp1,tmp2); @@ -2029,8 +2068,8 @@ MkprecommandS(prec):=( PlotdataS(name1,func,var):=PlotdataS(name1,func,var,[]); PlotdataS(nm,fun,variable,optionorg):=( -//help:PlotdataS("1","besselj(1,x)","x"); -//help:PlotdataS(options=["m/r","Num=50","Wait=5","Mx=no"]); +// help:PlotdataS("1","besselj(1,x)","x"); +// help:PlotdataS(options=["m/r","Num=50","Wait=5","Mx=no"]); regional(options,name,varstr,Num,waiting,mxcheck,outreg, eqL,strL,fname,tmp,tmp1,tmp2,tmp3,cmdL,flg,wflg); name="grsc"+nm; @@ -4542,8 +4581,17 @@ Mkketcindyjs(Arg):=( ); Mkketcindyjs(libname,options):=( //17.11.18 //help:Mkketcindyjs(); -//help:Mkketcindyjs(options="Tex=y","Net=y"]); - regional(texflg,netflg,tmp,tmp1,tmp2); +//help:Mkketcindyjs(options=["Tex=y","Net=y"]); + regional(texflg,netflg,tmp,tmp1,tmp2,dirfile,dirwork,dirketjs); + dirwork=replace(Dirwork,"\","/"); + tmp=replace(Dircdy,"\","/"); + if(substring(tmp,length(tmp)-1,length(tmp))=="/",//180411from + dirfile=substring(tmp,0,length(tmp)-1); + , + dirfile=tmp; + );//180411to + tmp=replace(Dirlib,"\","/"); + dirketjs=replace(tmp,"ketlib","ketcindyjs");//180411to texflg="Y"; netflg="Y"; forall(options, @@ -4557,15 +4605,15 @@ Mkketcindyjs(libname,options):=( //17.11.18 netflg=Toupper(substring(tmp1,tmp,tmp+1)); ); ); - if(isexists(Dirwork,Fhead+".html"), + if(isexists(dirfile,Fhead+".html"),//180411to SCEOUTPUT = openfile(Fhead+".r"); println(SCEOUTPUT,"Looprange<- function(a,b){"); println(SCEOUTPUT," if (a<=b) return(a:b)"); println(SCEOUTPUT," return(c())"); println(SCEOUTPUT,"}"); - println(SCEOUTPUT,"setwd('"+Dirfile+"/CindyJS')"); + println(SCEOUTPUT,"setwd('"+dirketjs+"')"); println(SCEOUTPUT,"Dtket=readLines('"+libname+".txt')"); - println(SCEOUTPUT,"setwd('"+Dirwork+"')"); + println(SCEOUTPUT,"setwd('"+dirfile+"')");//180411 println(SCEOUTPUT,"Dtjs=readLines('"+Fhead+".html')"); println(SCEOUTPUT,"Qt=rawToChar(as.raw(34))"); println(SCEOUTPUT, @@ -4579,7 +4627,7 @@ Mkketcindyjs(libname,options):=( //17.11.18 println(SCEOUTPUT, " if(length(grep('link rel=',Tmp,fixed=TRUE))>0){"); println(SCEOUTPUT, - " Tmp1='file:///"+Dirfile+"/CindyJS/CindyJS.css'"); + " Tmp1='file:///"+dirketjs+"/CindyJS.css'");//180411 println(SCEOUTPUT, " Tmp=paste(' <link rel=',Qt,'stylesheet',Qt,' href=',Qt,Tmp1,Qt,'>',sep='')"); println(SCEOUTPUT, @@ -4591,7 +4639,7 @@ Mkketcindyjs(libname,options):=( //17.11.18 println(SCEOUTPUT, " if(Tmp1>0){"); println(SCEOUTPUT, - " Tmp1='file:///"+Dirfile+"/CindyJS/Cindy.js'"); + " Tmp1='file:///"+dirketjs+"/Cindy.js'");//180411 println(SCEOUTPUT, " Tmp=paste(' <script type=',Qt,'text/javascript',Qt,' src=',Qt,Tmp1,Qt,'>',sep='')"); println(SCEOUTPUT, @@ -4633,7 +4681,7 @@ Mkketcindyjs(libname,options):=( //17.11.18 " if(length(grep(paste(Qt,'Parent',sep=''),Dtjs[I],fixed=TRUE))>0){next}"); println(SCEOUTPUT, " if(length(grep(paste(Qt,'KeTJS',sep=''),Dtjs[I],fixed=TRUE))>0){next}"); - println(SCEOUTPUT, + println(SCEOUTPUT, " }"); println(SCEOUTPUT," Dt=c(Dt,Dtjs[I])"); if(texflg=="Y", @@ -4645,12 +4693,14 @@ Mkketcindyjs(libname,options):=( //17.11.18 " }"); ); println(SCEOUTPUT,"}"); + println(SCEOUTPUT,"setwd('"+dirfile+"')");//180411 println(SCEOUTPUT,"writeLines(Dt,'"+Fhead+"ketcindy.html',sep='\n')"); println(SCEOUTPUT,"quit()"); closefile(SCEOUTPUT); kcR(PathR,Fhead+".r",["m"]); + println(Fhead+"ketcindy.html generated successfully"); , - drawtext(mouse().xy-[0,1],"First export to CindyJS",size->24,color->[1,0,0]); + drawtext(mouse().xy-[0,1],"use 'write to CindyJS' before that",size->24,color->[1,0,0]); wait(3000); ); ); @@ -4658,10 +4708,10 @@ Mkketcindyjs(libname,options):=( //17.11.18 ///////////////// C function ////////////////// Cform(strorg):=( -//help:Cform(str) +//help:Cform(str); regional(str,ter,out,hat,ns,ne,nn,jj,flg, lv,str1,str2,tmp,tmp1,tmp2); - ter=["+","-","*","/","(",")"]; + ter=["+","-","*","/","(",")","="]; //180517 str=replace(strorg,"pi","M_PI"); hat=Indexall(str,"^"); out=""; @@ -4677,6 +4727,7 @@ Cform(strorg):=( out=out+substring(str,ns,ns+tmp-1); str1=substring(str,ns+tmp,nn-2); , + tmp=0;//180517 flg=0; tmp2=reverse(ns..(nn-1)); forall(tmp2,jj, @@ -4769,31 +4820,46 @@ ConvertFdtoC(Fd,name):=( FdC=concat(FdC,[tmp1_6]); ); -ConstC(setlist):=( //180323 - regional(divL,sizeL,epsL); - //Mdv=50; Ndv=50; - //DsizeLL=5000; DsizeL=1500; DsizeM=500; DsizeS=200; - //Eps=0.00001; Eps1=0.01; Eps2=0.1; - forall(setlist, - if((#_1>1)&(#_1<=200), - divL=#; - if(length(divL)==0,divL=[50]); - if(length(divL)==1,divL=append(divL,divL_1)); +StartsurfC():=StartsurfC("",[50,50],[1500,500,200],[0.01,0.1]);//180611renewed +StartsurfC(Arg):=( + regional(tmp); + if(isstring(Arg), + StartsurfC(Toupper(Arg),[50,50],[1500,500,200],[0.01,0.1]); + , + tmp=max(Arg); + if(tmp>=500, + StartsurfC("",[50,50],Arg,[0.01,0.1]); , - if(#_1>=100, - sizeL=#; - if(length(sizeL)==0,sizeL=[5000]); - if(length(sizeL)==1,sizeL=append(sizeL,1500)); - if(length(sizeL)==2,sizeL=append(sizeL,500)); - if(length(sizeL)==3,sizeL=append(sizeL,200)); + if(tmp>1, + StartsurfC("",Arg,[1500,500,200],[0.01,0.1]); , - epsL=#; - if(length(epsL)==0,epsL=[0.01]); - if(length(epsL)==1,epsL=append(epsL,0.1)); - epsL=prepend(0.00001,epsL); + StartsurfC("",[50,50],[1500,500,200],Arg); ); ); ); +); +StartsurfC(restr,Nplist,Dsizelist,Epslist):=(//180501 +//help:StartsurfC(); +//help:StartsurfC("reset"); +//help::StartsurfC([0.01,0.1]); +//help:StartsurfC([50,50],[1500,500,200],[0.01,0.1]); +//help:StartsurfC([50],[1500,500],[0.01,0.1]); + regional(divL,sizeL,epsL); + CommandListC=[];//180608(2lines) + FuncListC=[]; + if(substring(restr,0,1)=="R", //180611(3lines) + GLIST=[]; + ); + divL=Nplist; sizeL=Dsizelist; epsL=Epslist; + if(length(divL)==0,divL=[50]); + if(length(divL)==1,divL=append(divL,divL_1)); + if(length(sizeL)==0,sizeL=[1500]); //180610from + if(length(sizeL)==1,sizeL=append(sizeL,500)); + if(length(sizeL)==2,sizeL=append(sizeL,200)); + sizeL=prepend(5000,sizeL); //180610to + if(length(epsL)==0,epsL=[0.01]); + if(length(epsL)==1,epsL=append(epsL,0.1)); + epsL=prepend(0.00001,epsL); ConstantListC=[divL,sizeL,epsL]; ); @@ -4978,7 +5044,7 @@ Cmain(fname,cmdLorg):=( tmp3=concat(tmp3,[ "double "+tmp2_1+"[DsizeL][3];",[], //17.06.09(6lines) "sfbdparadata",[tmp2_1], - "output3h",[var, varh,file,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] @@ -5004,7 +5070,7 @@ Cmain(fname,cmdLorg):=( "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",[var, varh, file,tmp2_1] + "output3h",["w",var, varh, file,tmp2_1] ]); cmd=concat(cmd,tmp3); if(#<length(nL), @@ -5028,7 +5094,7 @@ Cmain(fname,cmdLorg):=( " crv3onsfparadata",[tmp2_1,tmp2_2,1,"Crvdata"], tmp2_1+"[0][0]=0;",[], "appendd3",[0,1,"length3(Crvdata)","Crvdata",tmp2_1], - "output3h",[var,varh, file ,tmp2_1] + "output3h",["w",var,varh, file ,tmp2_1] ]); cmd=concat(cmd,tmp3); if(#<length(nL), @@ -5058,7 +5124,7 @@ Cmain(fname,cmdLorg):=( "crv3onsfparadata",["out",tmp2_2,"Crvdata"], tmp2_1+"[0][0]=0;",[], "appendd3",[0,1,"length3(Crvdata)","Crvdata",tmp2_1], - "output3h",[var, varh, file, tmp2_1] + "output3h",["w",var, varh, file, tmp2_1] ]); cmd=concat(cmd,tmp3); if(#<length(nL), @@ -5114,7 +5180,7 @@ Cmain(fname,cmdLorg):=( "wireparadata",["Surf", "udv","vdv", num, "Wiredata"], tmp2_1+"[0][0]=0;",[], "appendd3",[0,1,"length3(Wiredata)","Wiredata",tmp2_1], - "output3h",[var, varh, file, tmp2_1] + "output3h",["w",var, varh, file, tmp2_1] ]); cmd=concat(cmd,tmp3); if(#<length(nL), @@ -5169,7 +5235,7 @@ Cmain(fname,cmdLorg):=( if(length(tmp2)<=3,tmp=1,tmp=tmp2_4); tmp3=concat(tmp3,[ "skeletondata3",["data", tmp, "Eps1","Eps2","sk"],//17.06.13 - "output3",[var, file, 2, "sk"] + "output3",["w",var, file, 2, "sk"] ]); cmd=concat(cmd,tmp3); if(nn<length(nL), @@ -5304,7 +5370,7 @@ Cmain(fname,cmdLorg):=( kcC():=kcC(FheadC); kcC(cname):=( regional(tmp, tmp1,flg,rfile); - rfile="resultC"+cname+".txt"; + rfile=cname+"end.txt"; //180517 if(iswindows(), SCEOUTPUT = openfile("kc.bat"); println(SCEOUTPUT,"set path="+Dirwork); @@ -5315,6 +5381,7 @@ kcC(cname):=( tmp=PathC+" %path%\"+cname+".c"; tmp=tmp+" -o %path%\main.exe"; println(SCEOUTPUT,tmp); + println(SCEOUTPUT,"cd "+Dq+Dirwork+Dq); println(SCEOUTPUT,"%path%\main.exe"); println(SCEOUTPUT,"echo //// > %path%\"+rfile); println(SCEOUTPUT,"exit"); @@ -5325,7 +5392,7 @@ kcC(cname):=( SCEOUTPUT = openfile("kc.sh"); println(SCEOUTPUT,"#!/bin/sh"); println(SCEOUTPUT,"cd "+Dq+Dirwork+Dq); - tmp=PathC+" "+cname+".c -o main.out"; + tmp=PathC+" -lm "+cname+".c -o main.out"; //180612 println(SCEOUTPUT,tmp); println(SCEOUTPUT,"./main.out"); println(SCEOUTPUT,"echo //// >"+rfile); @@ -5354,8 +5421,8 @@ kcC(cname):=( ); ); -ReadCdataold(var, fname):=ReadCdata(var, fname,[]); -ReadCdata(var, fname,options):=( +ReaddataCold(var, fname):=ReaddataC(var, fname,[]); +ReaddataC(var, fname,options):=( regional(file,dt,name,str,tmp,tmp1,opstr,gout, out3,out2); if(indexof(fname,".")==0, file=fname+".txt"; @@ -5366,7 +5433,7 @@ ReadCdata(var, fname,options):=( name=substring(fname,0,tmp-1); ); tmp=Divoptions(options); - opstr=tmp_8; + opstr=tmp_(length(tmp)-1); gout=ReadOutData(file); GLIST=Append(GLIST,"Tmpstr=ReadOutData("+Dq+file+Dq+")"); if(substring(var,length(var)-1,length(var))!="h", @@ -5380,7 +5447,7 @@ ReadCdata(var, fname,options):=( );//17.06.16until ); -ReadCdata(fnameorg):=( +ReaddataC(fnameorg):=( regional(tmp,tmp1,fname,data,out); fname=fnameorg; if(indexof(fname,".")==0, fname=fname+".txt"); @@ -5403,8 +5470,8 @@ ReadCdata(fnameorg):=( out; ); -WriteCdata(fnameorg,dataorg):=( -//help:WriteCdata(filename, 3ddata); +WritedataC(fnameorg,dataorg):=( +//help:WritedataC(filename, 3ddata); regional(tmp,fname,data,kk,nn,pt); data=dataorg; if(isstring(data),data=parse(data)); @@ -5416,9 +5483,13 @@ WriteCdata(fnameorg,dataorg):=( forall(1..(length(data_kk)),nn, pt=apply(1..3,Sprintf(data_kk_nn_#,5)); tmp=pt_1+" "+pt_2+" "+pt_3+" -99999"; - println(SCEOUTPUT,tmp); + print(SCEOUTPUT,tmp); + if(nn<length(data_kk), //180426from + println(SCEOUTPUT,""); + );//180426to ); if(kk<length(data), + println(SCEOUTPUT,"");//180426 println(SCEOUTPUT,"99999.00000 2.00000 0.00000 -99999"); ); ); @@ -5442,7 +5513,7 @@ DisplayC(dispc):=( cflg=0; tmp=Divoptions(options);//17.06.18from eqL=tmp_5; - opcindy=tmp_9; + opcindy=tmp_(length(tmp)); forall(eqL, if(Toupper(substring(#,0,2))=="CO", tmp=indexof(#,"="); @@ -5465,7 +5536,7 @@ DisplayC(dispc):=( Texcom("{"); Setcolor(color); ); - ReadCdata(var,file,options);// 17.05.24 + ReaddataC(var,file,options);// 17.05.24 if(cflg==1, Texcom("}"); ); @@ -5504,7 +5575,8 @@ Cheadsurf():=( tmp=tmp+", Eps1="+tmp1_2; tmp=tmp+", Eps2="+tmp1_3+";"; cmd=append(cmd,tmp); - tmp="const char dirname[]="+Dq+Dirwork+"/"+Dq+";"; + tmp=replace(Dirwork,"\","/"); //180523(2lines) + tmp="const char Dirname[]="+Dq+tmp+"/"+Dq+";"; cmd=append(cmd,tmp); cmd=append(cmd,"double Urng[2],Vrng[2];"); cmd=append(cmd, "int DrawE,DrawW,DrawS,DrawN;"); @@ -5519,6 +5591,7 @@ Cheadsurf():=( if(#==4,tmp="Urng",tmp="Vrng"); tmp2=tmp2+tmp+"[0]="+tmp1_1+";"+tmp+"[1]="+tmp1_2+";"; ); + tmp2=tmp2+"break;"; //180523 cmd=append(cmd,tmp2); ); cmd=append(cmd," }"); @@ -5536,6 +5609,7 @@ Cheadsurf():=( if(indexof(tmp,"s")>0,tmp2=tmp2+"1;",tmp2=tmp2+"0;"); tmp2=tmp2+"DrawN="; if(indexof(tmp,"n")>0,tmp2=tmp2+"1;",tmp2=tmp2+"0;"); + tmp2=tmp2+"break;"; //180523 cmd=append(cmd,tmp2); ); cmd=append(cmd," }"); @@ -5550,6 +5624,7 @@ Cheadsurf():=( tmp1=substring(tmp1,tmp,length(tmp1)); tmp2=tmp2+"p["+text(#-1)+"]="+tmp1+";"; ); + tmp2=tmp2+"break;"; //180523 cmd=append(cmd,tmp2); ); cmd=append(cmd," }"); @@ -5557,36 +5632,47 @@ Cheadsurf():=( cmd; ); -Ctopsurf(name):=Ctopsurf(name,[]); -Ctopsurf(name,cmdadd):=( - regional(path,cmd); +Ctopsurf(name):=Ctopsurf(name,CutFunList); +Ctopsurf(name,cutfunLorg):=( + regional(cutfunL,path,cmd,tmp,tmp1,tmp2); + cutfunL=cutfunLorg; //180601from + if(length(cutfunL)==0, + cutfunL=["1"]; + );//180601to path=DirlibC+"/"; path=replace(path,"\","/"); cmd=[ - "#include <stdio.h>", "#include <math.h>", + "#include <stdio.h>","#include <math.h>", + "#include <stdlib.h>","#include <string.h>", //180530 "#include "+Dqq(Fhead+name+"header.h"), "#include "+Dqq(path+"ketcommonhead.h"), "#include "+Dqq(path+"ketcommon.h"), "#include "+Dq+path+"surflibhead.h"+Dq, "#include "+Dq+path+"surflib.h"+Dq, - "double cutfun1(short ch,double u, double v){", + "double cutfun(short chfd, short chcut, double u, double v){", " double p[3],val;", - " surffun(ch,u,v,p);", - " val=1;", - " return val;", - "}", - "double cutfun(short ch, int chcut, double u, double v){", - " double p[3],val;", - " switch(chcut){", - " case 1: val=cutfun1(ch,u,v);", + " surffun(chfd,u,v,p);", + " switch(chcut){" + ]; + tmp1=[]; + forall(1..(length(cutfunL)), + tmp2=replace(cutfunL_#,"x","p[0]"); + tmp2=replace(tmp2,"y","p[1]"); + tmp2=replace(tmp2,"z","p[2]"); + tmp2=" case "+text(#)+": val="+tmp2+";"; + tmp2=tmp2+"break;"; //180523 + tmp1=append(tmp1,tmp2); + ); + cmd=concat(cmd,tmp1); + cmd=concat(cmd,[ " }", " return val;", "}", "int main(void){", - " double out[DsizeL][3], data[DsizeLL][3];", - " int i, j, nall, din[DsizeS][2];", + " double data[DsizeL][3],sfbd[DsizeL][3],out[DsizeL][3];", //180601 + " int i, j, nall;", " char dirfname[256] = {'\0'};" - ]; + ]); cmd; ); @@ -5630,15 +5716,23 @@ CalcbyC(name,path,cmd,optionorg):=( body=cmd_3; options=optionorg; tmp=divoptions(options); -// eqL=tmp_5; + eqL=tmp_5; strL=tmp_7; - waiting=30; - wfile="resultC"+Fhead+name+".txt"; + waiting=40; + wfile=Fhead+name+"end.txt"; //180517 hfile=Fhead+name+"header.h"; println(Dirwork); println(hfile); mfile=Fhead+name+".c"; wflg=0; + forall(eqL, + tmp=Strsplit(#,"="); + tmp1=Toupper(substring(tmp_1,0,1)); + if(tmp1=="W", + waiting=parse(tmp_2); + options=remove(options,[#]); + ); + ); forall(strL, tmp=Toupper(substring(#,0,1)); if(tmp=="M", @@ -5693,13 +5787,9 @@ CalcbyC(name,path,cmd,optionorg):=( repeat(tmp1, if(flg==0, tmp=load(wfile); - if(length(tmp)>=4, - tmp2=substring(tmp,length(tmp)-4,length(tmp)); - if(tmp2=="////", - tmp=substring(tmp,0,length(tmp)-4); - flg=1; - tmp2=#*WaitUnit/1000; - ); + if(indexof(tmp,"////")>0, //180523from + flg=1; + tmp2=#*WaitUnit/1000;//180523to , if(wflg==-1, flg=-1; @@ -5722,19 +5812,122 @@ CalcbyC(name,path,cmd,optionorg):=( ); ); +ExeccmdC(nm):=ExeccmdC(nm,[],["do"]); //180531 +ExeccmdC(nm,options):=ExeccmdC(nm,options,["do"]); +ExeccmdC(nm,optionorg,optionhorg):=( +//help:ExeccmdC("1",["m/r","Wait=30"],["do"]); + regional(options,optionsh,name2,name3,waiting,dirbkup, + eqL,reL,strL,fname,tmp,tmp1,tmp2,flg,wflg,varL); + fname=Fhead+nm+".txt"; + options=optionorg; + optionsh=optionhorg; + optionsh=select(optionsh,length(#)>0); + if(length(optionsh)==0,optionsh=["do"]); + tmp=Divoptions(options); + eqL=tmp_5; + reL=tmp_6; + strL=tmp_7; + waiting=30; + wflg=0; + cmdflg=0; + forall(strL, + tmp=Toupper(substring(#,0,1)); + if(tmp=="M", + wflg=1; + options=remove(options,[#]); + ); + if(tmp=="R", + wflg=-1; + options=remove(options,[#]); + ); + ); + forall(eqL, + tmp=Strsplit(#,"="); + if(Toupper(tmp_1)=="WAIT", + waiting=parse(tmp_2); + options=remove(options,[#]); + ); + ); + options=remove(options,reL); + options=select(options,length(#)>0); + if(CommonMake==1,//180609from + tmp1=append(options,"m"); + wflg=0; + ); + if(CommonMake==-1, + tmp1=append(options,"r"); + wflg=0; + );//180609to + if(wflg==1,tmp1=append(options,"m")); + if(wflg==-1,tmp1=append(options,"r")); + tmp1=append(tmp1,"Wait="+text(waiting)); + CommandListC=prepend(" char fnameall[]="+Dqq(fname)+";",CommandListC); + CommandListC=prepend(" printf("+Dqq("%s\n")+","+Dqq(Fhead)+");",CommandListC); //180608 + tmp=select(CommandListC,indexof(#,"outputend")>0); + if(length(tmp)==0, + CommandListC=append(CommandListC," outputend(dirfname);"); + ); + if(length(CommandListC)<=2,ErrFlag=1); + if(ErrFlag==0, + CalcbyC(nm,[Cheadsurf(),Ctopsurf(nm),CommandListC],tmp1); + ); + if(ErrFlag==1, + err("CommandListC is empty or execcmd is not completed"); + , + varL=ReadOutData(fname); + GLIST=append(GLIST,"ReadOutData("+Dqq(fname)+")"); + tmp1=select(varL,indexof(#,"h3d")==0); + tmp2=remove(varL,tmp1); + tmp1=select(tmp1,indexof(#,"3d")>0); + tmp=""; + if(length(options)>0, + forall(options, + tmp=tmp+Dqq(#)+","; + ); + tmp=substring(tmp,0,length(tmp)-1); + ); + if(length(tmp)>0,tmp=tmp+","); //180602 + tmp=tmp+Dqq("Msg=no"); //180602 + tmp1=apply(tmp1,replace(#,"3d","2d")+"=Projpara("+Dqq(#)+",["+tmp+"]);"); + forall(tmp1,parse(#)); + tmp=""; + if(length(optionsh)>0, + forall(optionsh, + tmp=tmp+Dqq(#)+","; + ); + tmp=substring(tmp,0,length(tmp)-1); + ); + tmp2=apply(tmp2,replace(#,"3d","2d")+"=Projpara("+Dqq(#)+",["+tmp+"]);"); + forall(tmp2,parse(#)); + Changestyle3d(EraseList,["nodisp"]);//180601 + ); + varL=select(varL,length(parse(#))>0); + if(length(addpath)>0,Changework(dirbkup,["Sub=n"])); //180605 + varL; +); + SfbdparadataC(nm,fd):= SfbdparadataC(nm,fd,[],["nodisp"]); SfbdparadataC(nm,fd,options):= SfbdparadataC(nm,fd,options,["nodisp"]); SfbdparadataC(nm,fdorg,optionorg,optionsh):=( //help:SfbdparadataC("1",Fd); -//help:SfbdparadataC(options2=["r/m"]); +//help:SfbdparadataC(options2=["c(default)/r/m"]); regional(funnm,fd,options,name2,name3,name2h,name3h,waiting, - eqL,reL,strL,fname,tmp,tmp1,tmp2,flg,wflg); + eqL,reL,strL,fname,tmp,tmp1,tmp2,flg,wflg,cmdflg); if(ChNumber==0,ChNumber=Ch); fd=ConvertFdtoC(fdorg); - FuncListC=append(FuncListC,fd); - funnm=text(length(FuncListC)); + tmp1=0; //180606from + forall(1..(length(FuncListC)), + if(FuncListC_#==fd, + funnm=#; + tmp1=1; + ); + ); + if(tmp1==0, + FuncListC=append(FuncListC,fd); + funnm=text(length(FuncListC)); + ); //180606to name2="sfbd2d"+nm; name3="sfbd3d"+nm; name2h="sfbdh2d"+nm; @@ -5745,80 +5938,100 @@ SfbdparadataC(nm,fdorg,optionorg,optionsh):=( eqL=tmp_5; reL=tmp_6; strL=tmp_7; - waiting=120; + waiting=60; wflg=0; + cmdflg=1; forall(strL, tmp=Toupper(substring(#,0,1)); if(tmp=="M", + cmdflg=0; wflg=1; options=remove(options,[#]); ); if(tmp=="R", + cmdflg=0; wflg=-1; options=remove(options,[#]); ); + if(tmp=="C", //180531 + cmdflg=1; + options=remove(options,[#]); + ); ); options=remove(options,eqL); options=remove(options,reL); options=select(options,length(#)>0); cmdL=[ - " double sfbd"+funnm+"[DsizeL][3];", - " char fname"+funnm+"[]="+Dqq(fname)+";", + " char fname"+nm+"[]="+Dqq(fname)+";", " rangeUV("+funnm+");", " boundary("+funnm+");", - " sfbdparadata("+funnm+",sfbd"+funnm+");", - " sprintf(dirfname,"+Dqq("%s%s")+",dirname,fname"+funnm+");", - " output3h("+Dqq("sfbd3d"+nm)+","+Dqq("sfbdh3d"+nm)+",dirfname,sfbd"+funnm+");"; + " sfbdparadata("+funnm+",sfbd);", + " sprintf(dirfname,"+Dqq("%s%s")+",Dirname,fname"+nm+");", + " output3h("+Dqq("w")+","+Dqq("sfbd3d"+nm)+","+Dqq("sfbdh3d"+nm)+",dirfname,sfbd);", + " outputend(dirfname);" ]; - if(wflg==1,tmp1=append(options,"m")); - if(wflg==-1,tmp1=append(options,"r")); - if(ErrFlag==0, - tmp="sfbd"+nm; - CalcbyC(tmp,[Cheadsurf(),Ctopsurf(tmp),cmdL],tmp1); - ); - if(ErrFlag==1, - err("Sfbdparadata not completed"); + if(cmdflg==1, //180531from + println(" ExeccmdC will generate "+ name3+","+name3h); + tmp=replace(cmdL_5,"fname"+funnm,"fnameall");cmdL_5=tmp; + tmp=select(CommandListC,indexof(#,"output3")>0); //180601from + if(length(tmp)>0, + tmp=replace(cmdL_6,Dqq("w"),Dqq("a"));cmdL_6=tmp; + ); //180601from + cmdL=remove(cmdL,[cmdL_1,cmdL_(length(cmdL))]); + CommandListC=concat(CommandListC,cmdL); //180531to , - ReadOutData(fname); - GLIST=append(GLIST,"ReadOutData("+Dqq(fname)+")"); - if(islist(parse(name3)), - tmp1=name2+"=Projpara("+Dqq(name3)+",["; - tmp2=""; - if(length(options)>0, - forall(options, - tmp2=tmp2+Dqq(#)+","; + if(wflg==1,tmp1=append(options,"m")); + if(wflg==-1,tmp1=append(options,"r")); + if(ErrFlag==0, + tmp="sfbd"+nm; + CalcbyC(tmp,[Cheadsurf(),Ctopsurf(tmp),cmdL],tmp1); + ); + if(ErrFlag==1, + err("Sfbdparadata not completed"); + , + ReadOutData(fname); + GLIST=append(GLIST,"ReadOutData("+Dqq(fname)+")"); + if(islist(parse(name3)), + tmp1=name2+"=Projpara("+Dqq(name3)+",["; + tmp2=""; + if(length(options)>0, + forall(options, + tmp2=tmp2+Dqq(#)+","; + ); + tmp2=substring(tmp2,0,length(tmp2)-1); ); - tmp2=substring(tmp2,0,length(tmp2)-1); - ); - tmp1=tmp1+tmp2+"]);"; - parse(tmp1); - if(length(optionsh)==0,tmp2=["nodisp"],tmp2=optionsh); - tmp1=name2h+"=Projpara("+Dqq(name3h)+",["; - forall(tmp2, - tmp1=tmp1+Dqq(#)+","; + tmp1=tmp1+tmp2+"]);"; + parse(tmp1); + tmp2=select(optionsh,length(#)>0); //180517(2lines) + if(length(tmp2)==0,tmp2=["nodisp"]); + tmp1=name2h+"=Projpara("+Dqq(name3h)+",["; + forall(tmp2, + tmp1=tmp1+Dqq(#)+","; + ); + tmp1=substring(tmp1,0,length(tmp1)-1)+"]);"; + parse(tmp1); + , + ErrFlag=1; ); - tmp1=substring(tmp1,0,length(tmp1)-1)+"]);"; - parse(tmp1); - , - ErrFlag=1; ); ); ); -CrvsfparadataC(nm,fk,fbdy,fd):= - CrvsfparadataC(nm,fk,fbdy,fd,[],["nodisp"]); -CrvsfparadataC(nm,fk,fbdy,fd,options):= - SfbdparadataC(nm,fk,fbdy,fd,options,["nodisp"]); -CrvsfparadataC(nm,Fk,Fbdy,fdorg,optionorg,optionsh):=( +CrvsfparadataC(nm,fk,sfbd,fd):= + CrvsfparadataC(nm,fk,sfbd,fd,[],["nodisp"]); +CrvsfparadataC(nm,fk,sfbd,fd,options):= + SfbdparadataC(nm,fk,sfbd,fd,options,["nodisp"]); +CrvsfparadataC(nm,Fk,sfbdorg,fdorg,optionorg,optionsh):=( //help:CrvsfparadataC("1","ax3d","sfbd3d1",Fd); -//help:CrvsfparadataC(options2=["r/m"]); +//help:CrvsfparadataC(options2=["c(default)/r/m"]); //help:CrvsfparadataC(optionsh=["nodisp"]); - regional(funnm,fd,options,name2,name3,name2h,name3h,waiting, - eqL,reL,strL,fname,tmp,tmp1,tmp2,flg,wflg,flg,ii,jj,eps); + regional(funnm,sfbd,fd,options,name2,name3,name2h,name3h,waiting, + eqL,reL,strL,fname,tmp,tmp1,tmp2,flg,wflg,flg,ii,jj,eps,cmdlfg); eps=10^(-5); + sfbd=replace(sfbdorg,"bdy","sfbd"); fd=ConvertFdtoC(fdorg); tmp=select(1..(length(FuncListC)),FuncListC_#==fd); - funcnum=tmp_1; + funnm=text(tmp_1); //180426 name2="crvsf2d"+nm; name3="crvsf3d"+nm; name2h="crvsfh2d"+nm; @@ -5829,30 +6042,35 @@ CrvsfparadataC(nm,Fk,Fbdy,fdorg,optionorg,optionsh):=( eqL=tmp_5; reL=tmp_6; strL=tmp_7; - waiting=120; + waiting=60; wflg=0; + cmdflg=1; forall(strL, tmp=Toupper(substring(#,0,1)); if(tmp=="M", + cmdflg=0; wflg=1; options=remove(options,[#]); ); if(tmp=="R", + cmdflg=0; wflg=-1; options=remove(options,[#]); ); + if(tmp=="C", //180531 + cmdflg=1; + options=remove(options,[#]); + ); ); options=remove(options,eqL); options=remove(options,reL); options=select(options,length(#)>0); -// tmp1=[Dqq(fname),Dqq(name3),name3,Dqq(name2),name2]; -// tmp1=concat(tmp1,[Dqq(name3h),name3h,Dqq(name2h),name2h]); - tmp2=parse(Fbdy); + tmp2=parse(Fk); flg=0; - tmp=Fhead+Fbdy+".dat"; + tmp=Fhead+Fk+".dat"; if(!isexists(Dirwork,tmp),flg=1); if(flg==0, - tmp1=ReadCdata(tmp); + tmp1=ReaddataC(tmp); if(length(tmp1)!=length(tmp2),flg=1); if(flg==0, forall(1..(length(tmp1)),ii, @@ -5865,13 +6083,131 @@ CrvsfparadataC(nm,Fk,Fbdy,fdorg,optionorg,optionsh):=( ); ); ); - if(flg==1,WriteCdata(tmp,Fbdy)); - tmp2=parse(Fk); + if(flg==1,WritedataC(tmp,Fk)); + if(cmdflg==1, + EraseList=append(EraseList,Fk); + , + Changestyle3d(Fk,["nodisp"]); + ); + cmdL=[ + " 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 + " 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);" + ]; + 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 + tmp=replace(cmdL_(length(cmdL)-1),Dqq("w"),Dqq("a")); cmdL_(length(cmdL)-1)=tmp; + cmdL=remove(cmdL,[cmdL_(length(cmdL))]); + CommandListC=concat(CommandListC,cmdL); //180531to + , + if(wflg==1,tmp1=append(options,"m")); + if(wflg==-1,tmp1=append(options,"r")); + if(ErrFlag==0, + tmp="crvsf"+nm; + CalcbyC(tmp,[Cheadsurf(),Ctopsurf(tmp),cmdL],tmp1); + ); + if(ErrFlag==1, + err("Crvsfparadata not completed"); + , + ReadOutData(fname); + GLIST=append(GLIST,"ReadOutData("+Dqq(fname)+")"); + if(islist(parse(name3)), + tmp1=name2+"=Projpara("+Dqq(name3)+",["; + tmp2=""; + if(length(options)>0, + forall(options, + tmp2=tmp2+Dqq(#)+","; + ); + tmp2=substring(tmp2,0,length(tmp2)-1); + ); + tmp1=tmp1+tmp2+"]);"; + parse(tmp1); + tmp2=select(optionsh,length(#)>0); //180517(2lines) + if(length(tmp2)==0,tmp2=["nodisp"]); + tmp1=name2h+"=Projpara("+Dqq(name3h)+",["; + forall(tmp2, + tmp1=tmp1+Dqq(#)+","; + ); + tmp1=substring(tmp1,0,length(tmp1)-1)+"]);"; + parse(tmp1); + , + ErrFlag=1; + ); + ); + ); +); + +Crv3onsfparadataC(nm,crv3d,sfbd,fd):= + Crv3onsfparadataC(nm,crv3d,sfbd,fd,[],["nodisp"]); +Crv3onsfparadataC(nm,crv3d,sfbd,fd,options):= + Crv3onsfparadataC(nm,crv3d,sfbd,fd,options,["nodisp"]); +Crv3onsfparadataC(nm,crv3d,sfbdorg,fdorg,optionorg,optionsh):=( +//help:Crv3onsfparadataC("1","sc3","sfbd3d1",fd); + regional(funnm,sfbd,fd,options,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); + if(contains(tmp,tmp1), + if(cmdflg==1, + EraseList=append(EraseList,tmp1); + , + Changestyle3d(tmp1,["nodisp"]);//180428 + ); + ); + eps=10^(-5); + sfbd=replace(sfbdorg,"bdy","sfbd"); + fd=ConvertFdtoC(fdorg); + tmp=select(1..(length(FuncListC)),FuncListC_#==fd); + funnm=text(tmp_1); //180426 + name3="crv3onsf3d"+nm; + name3h="crv3onsfh3d"+nm; + name2=replace(name3,"3d","2d"); + name2h=replace(name3h,"3d","2d"); + fname=Fhead+"crv3onsf"+nm+".txt"; + tmp=apply(fdorg,if(isstring(#),Dqq(#),#)); + tmp=text(tmp); + options=optionorg; + tmp=Divoptions(options); + eqL=tmp_5; + reL=tmp_6; + strL=tmp_7; + waiting=60; + wflg=0; + cmdflg=1; + forall(strL, + tmp=Toupper(substring(#,0,1)); + if(tmp=="M", + cmdflg=0; + wflg=1; + options=remove(options,[#]); + ); + if(tmp=="R", + cmdflg=0; + wflg=-1; + options=remove(options,[#]); + ); + if(tmp=="C", //180531 + cmdflg=1; + options=remove(options,[#]); + ); + ); + options=remove(options,eqL); + options=remove(options,reL); + options=select(options,length(#)>0); + tmp2=parse(crv3d); flg=0; - tmp=Fhead+Fk+".dat"; + tmp=Fhead+crv3d+".dat"; if(!isexists(Dirwork,tmp),flg=1); if(flg==0, - tmp1=ReadCdata(tmp); + tmp1=ReaddataC(tmp); if(length(tmp1)!=length(tmp2),flg=1); if(flg==0, forall(1..(length(tmp1)),ii, @@ -5883,50 +6219,432 @@ CrvsfparadataC(nm,Fk,Fbdy,fdorg,optionorg,optionsh):=( ); ); ); - ); - if(flg==1,WriteCdata(tmp,Fk)); + ); + if(flg==1,WritedataC(tmp,crv3d)); cmdL=[ - " double fbdy[DsizeL][3],fk[DsizeL][3];", - " char fname"+nm+"[]="+Dqq(fname)+";", + " char fname"+nm+"[]="+Dqq(fname)+";", " rangeUV("+funnm+");", " boundary("+funnm+");", - " readdata3("+Dqq(Fhead+Fbdy+".dat")+",fbdy);", - " readdata3("+Dqq(Fhead+Fk+".dat")+",fk);", - " crvsfparadata(fk,fbdy, 0, out);", - " sprintf(dirfname,"+Dqq("%s%s")+",dirname,fname"+nm+");", - " output3h("+Dqq("crvsf3d"+nm)+","+Dqq("crvsfh3d"+nm)+",dirfname,out);" + " readdataC("+Dqq(Fhead+crv3d+".dat")+",data);", + " readoutdata3("+Dqq(Fhead+replace(sfbd,"3d","")+".txt")+","+Dqq(sfbd)+",sfbd);", //180531 + " crv3onsfparadata("+funnm+",data,sfbd,out);", + " sprintf(dirfname,"+Dqq("%s%s")+",Dirname,fname"+nm+");", + " output3h("+Dqq("w")+","+Dqq("crv3onsf3d"+nm)+","+Dqq("crv3onsfh3d"+nm)+",dirfname,out);", + " outputend(dirfname);" ]; - if(wflg==1,tmp1=append(options,"m")); - if(wflg==-1,tmp1=append(options,"r")); - if(ErrFlag==0, - tmp="crvsf"+nm; - CalcbyC(tmp,[Cheadsurf(),Ctopsurf(tmp),cmdL],tmp1); + if(cmdflg==1,//180531from + println(" ExeccmdC will generate "+ name3+","+name3h); + 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))]); + CommandListC=concat(CommandListC,cmdL); //180531to + , + if(wflg==1,tmp1=append(options,"m")); + if(wflg==-1,tmp1=append(options,"r")); + if(ErrFlag==0, + tmp="crv3onsf"+nm; + CalcbyC(tmp,[Cheadsurf(),Ctopsurf(tmp),cmdL],tmp1); + ); + if(ErrFlag==1, + err("Crvonsfparadata not completed"); + , + ReadOutData(fname); + GLIST=append(GLIST,"ReadOutData("+Dqq(fname)+")"); + if(islist(parse(name3)), + tmp1=name2+"=Projpara("+Dqq(name3)+",["; + tmp2=""; + if(length(options)>0, + forall(options, + tmp2=tmp2+Dqq(#)+","; + ); + tmp2=substring(tmp2,0,length(tmp2)-1); + ); + tmp1=tmp1+tmp2+"]);"; + parse(tmp1); + tmp2=select(optionsh,length(#)>0); //180517(2lines) + if(length(tmp2)==0,tmp2=["nodisp"]); + tmp1=name2h+"=Projpara("+Dqq(name3h)+",["; + forall(tmp2, + tmp1=tmp1+Dqq(#)+","; + ); + tmp1=substring(tmp1,0,length(tmp1)-1)+"]);"; + parse(tmp1); + , + ErrFlag=1; + ); + ); ); - if(ErrFlag==1, - err("Crvsfparadata not completed"); +); + +Crv2onsfparadataC(nm,crv2d,sfbd,fd):= + Crv2onsfparadataC(nm,crv2d,sfbd,fd,["c"],["do"]); +Crv2onsfparadataC(nm,crv2d,sfbd,fd,options):= + Crv2onsfparadataC(nm,crv2d,sfbd,fd,options,["do"]); +Crv2onsfparadataC(nm,crv2d,sfbd,fdorg,options,optionsh):=( +//help:Crv2onsfparadataC("1","gp1","sfbd3d1",fd); + regional(fd,uname,vname,str,tmpfun,ii,jj,crv3d,tmp,tmp1,tmp2); + Changestyle3d(crv2d,["nodisp"]); + crv3d=crv2d+"3d"; + fd=Fullformfunc(fdorg); + tmp=Strsplit(fd_5,"="); + uname=tmp_1; + tmp=Strsplit(fd_6,"="); + vname=tmp_1; + str="["+fd_2+","+fd_3+","+fd_4+"]"; + tmp="tmpfun("+uname+","+vname+"):="+str+";"; + parse(tmp); + tmp1=parse(crv2d); + tmp2=[]; + forall(tmp1, + tmp2=append(tmp2,tmpfun(#_1,#_2)); + ); + tmp=crv3d+"="+textformat(tmp2,6); + parse(tmp); + Crv3onsfparadataC(nm,crv3d,sfbd,fdorg,options,optionsh); +); + +WireparadataC(nm,sfbd,fd,wr1,wr2):= + WireparadataC(nm,sfbd,fd,wr1,wr2,[],["nodisp"]); +WireparadataC(nm,sfbd,fd,wr1,wr2,options):= + WireparadataC(nm,sfbd,fd,wr1,wr2,options,["nodisp"]); +WireparadataC(nm,sfbd,fdorg,wr1,wr2,optionorg,optionsh):=( +//help:WireparadataC("1","sfbd3d1",fd,5,5); + regional(funnm,fd,options,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); + tmp=select(1..(length(FuncListC)),FuncListC_#==fd); + funnm=text(tmp_1); + name2="wire2d"+nm; + name3="wire3d"+nm; + name2h="wireh2d"+nm; + name3h="wireh3d"+nm; + fname=Fhead+"wire"+nm+".txt"; + fnameh=replace(fname,".txt","h.txt"); + options=optionorg; + tmp=Divoptions(options); + eqL=tmp_5; + reL=tmp_6; + strL=tmp_7; + waiting=60; + wflg=0; + options=remove(options,reL); + wflg=0; + cmdflg=1; + forall(strL, + tmp=Toupper(substring(#,0,1)); + if(tmp=="M", + cmdflg=0; + wflg=1; + options=remove(options,[#]); + ); + if(tmp=="R", + cmdflg=0; + wflg=-1; + options=remove(options,[#]); + ); + if(tmp=="C", //180531 + cmdflg=1; + options=remove(options,[#]); + ); + ); + options=remove(options,eqL); + options=remove(options,reL); + options=select(options,length(#)>0); + if(islist(wr1), + udata=prepend(length(wr1),wr1); , - ReadOutData(fname); - GLIST=append(GLIST,"ReadOutData("+Dqq(fname)+")"); - if(islist(parse(name3)), - tmp1=name2+"=Projpara("+Dqq(name3)+",["; - tmp2=""; - if(length(options)>0, - forall(options, - tmp2=tmp2+Dqq(#)+","; + tmp=Fullformfunc(fdorg); + tmp1=tmp_5; + tmp=indexof(tmp1,"="); + tmp=substring(tmp1,tmp,length(tmp1)); + tmp=parse(tmp); + tmp1=tmp_1; tmp2=tmp_2; + udata=apply(1..wr1,tmp1+#*(tmp2-tmp1)/(wr1+1)); + udata=prepend(wr1,udata); + ); + udata=textformat(udata,6); + udata=substring(udata,1,length(udata)-1); + if(islist(wr2), + vdata=prepend(length(wr2),wr2); + , + tmp=Fullformfunc(fdorg); + tmp1=tmp_6; + tmp=indexof(tmp1,"="); + tmp=substring(tmp1,tmp,length(tmp1)); + tmp=parse(tmp); + tmp1=tmp_1; tmp2=tmp_2; + vdata=apply(1..wr2,tmp1+#*(tmp2-tmp1)/(wr2+1)); + vdata=prepend(wr2,vdata); + ); + vdata=textformat(vdata,6); + vdata=substring(vdata,1,length(vdata)-1); + cmdL=[ + " double wireu[]={"+udata+"};", + " double wirev[]={"+vdata+"};", + " char fname[]="+Dqq(fname)+";", + " char fnameh[]="+Dqq(fnameh)+";", + " rangeUV("+funnm+");", + " boundary("+funnm+");", + " readoutdata3("+Dqq(Fhead+replace(sfbd,"3d","")+".txt")+","+Dqq(sfbd)+",sfbd);", //180531 + " wireparadata("+funnm+",sfbd,wireu,wirev,fname,fnameh);" + ]; + if(cmdflg==1,//180531from + println(" ExeccmdC will generate "+ name3+","+name3h); + tmp=replace(cmdL_8,"fnameh",Dqq("")); + tmp=replace(tmp,"fname","fnameall"); cmdL_8=tmp; + cmdL_7=" readoutdata3(fnameall,"+Dqq(sfbd)+",sfbd);"; + cmdL=append(cmdL," outputend(dirfname);"); + CommandListC=concat(CommandListC,cmdL); //180531to + , + if(wflg==1,tmp1=append(options,"m")); + if(wflg==-1,tmp1=append(options,"r")); + if(ErrFlag==0, + tmp="wire"+nm; + CalcbyC(tmp,[Cheadsurf(),Ctopsurf(tmp),cmdL],tmp1); + ); + if(ErrFlag==1, + err("Wireparadata not completed"); + , + ReadOutData(fname); + GLIST=append(GLIST,"ReadOutData("+Dqq(fname)+")"); + ReadOutData(fnameh); + GLIST=append(GLIST,"ReadOutData("+Dqq(fnameh)+")"); + if(islist(parse(name3)), + tmp1=name2+"=Projpara("+Dqq(name3)+",["; + tmp2=""; + if(length(options)>0, + forall(options, + tmp2=tmp2+Dqq(#)+","; + ); + tmp2=substring(tmp2,0,length(tmp2)-1); + ); + tmp1=tmp1+tmp2+"]);"; + parse(tmp1); + tmp2=select(optionsh,length(#)>0); //180517(2lines) + if(length(tmp2)==0,tmp2=["nodisp"]); + tmp1=name2h+"=Projpara("+Dqq(name3h)+",["; + forall(tmp2, + tmp1=tmp1+Dqq(#)+","; ); - tmp2=substring(tmp2,0,length(tmp2)-1); + tmp1=substring(tmp1,0,length(tmp1)-1)+"]);"; + parse(tmp1); + , + ErrFlag=1; ); - tmp1=tmp1+tmp2+"]);"; - parse(tmp1); - if(length(optionsh)==0,tmp2=["nodisp"],tmp2=optionsh); - tmp1=name2h+"=Projpara("+Dqq(name3h)+",["; - forall(tmp2, - tmp1=tmp1+Dqq(#)+","; + ); + ); +); + +IntersectcrvsfC(nm,crv,fd):=IntersectcrvsfC(nm,crv,fd,"",[]); +IntersectcrvsfC(nm,crv,fd,Arg):=( + if(isstring(Arg), + IntersectcrvsfC(nm,crv,fd,Arg,[]); + , + IntersectcrvsfC(nm,crv,fd,"",Arg); + ); +); +IntersectcrvsfC(nm,crv3d,fdorg,bdyeq,optionorg):=( +//help:IntersectcrvsfC("1",curve,fd); + regional(fd,funnm,name,crv,fd,options,reL,fname,crvfname,argR, + waiting,tmp,tmp1,tmp2,flg,wflg,pts,cmdflg); + fd=ConvertFdtoC(fdorg); + tmp=select(1..(length(FuncListC)),FuncListC_#==fd); + funnm=text(tmp_1); //180426 + name="intercrvsf"+nm; + fname=Fhead+name+".txt"; + crvfname=Fhead+"crv"+nm+".txt"; + fd=apply(fdorg,if(isstring(#),Dqq(#),#)); + options=optionorg; + tmp=Divoptions(options); + eqL=tmp_5; + reL=tmp_6; + strL=tmp_7; + waiting=60; + wflg=0; + cmdflg=1; + forall(strL, + tmp=Toupper(substring(#,0,1)); + if(tmp=="M", + cmdflg=0; + wflg=1; + options=remove(options,[#]); + ); + if(tmp=="R", + cmdflg=0; + wflg=-1; + options=remove(options,[#]); + ); + if(tmp=="C", //180531 + cmdflg=1; + options=remove(options,[#]); + ); + ); + options=remove(options,eqL); + options=remove(options,reL); + options=select(options,length(#)>0); + tmp2=parse(crv3d); + flg=0; + tmp=Fhead+crv3d+".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=substring(tmp1,0,length(tmp1)-1)+"]);"; - parse(tmp1); + ); + ); + if(flg==1,WritedataC(tmp,crv3d)); + cmdL=[ + " double crv3d[DsizeL][3];", + " char fname"+nm+"[]="+Dqq(fname)+";", + " rangeUV("+funnm+");", + " boundary("+funnm+");", + " readdataC("+Dqq(Fhead+crv3d+".dat")+",crv3d);", + " intersectcrvsf("+Dqq("w")+","+funnm+",crv3d,"+Dqq(fname)+");", + " sprintf(dirfname,"+Dqq("%s%s")+",Dirname,fname"+nm+");" + ]; + if(cmdflg==1,//180531from + cmdL_6=" intersectcrvsf("+Dqq("a")+","+funnm+",crv3d,fnameall);"; + cmdL=remove(cmdL,[cmdL_2]); + cmdL=remove(cmdL,[cmdL_(length(cmdL))]); + CommandListC=concat(CommandListC,cmdL); //180531to + , + if(wflg==1,tmp1=append(options,"m")); + if(wflg==-1,tmp1=append(options,"r")); + if(ErrFlag==0, + tmp="crv3onsf"+nm; + CalcbyC(tmp,[Cheadsurf(),Ctopsurf(tmp),cmdL],tmp1); + ); + if(ErrFlag==1, + err("Intersectcrvsf not completed"); , - ErrFlag=1; + ReadOutData(fname); + ); + println("generate "+name); + parse(name); + ); +); + +SfcutparadataC(nm,cutfunL,sfbd,fd):=(//180505 + SfcutparadataC(nm,cutfunL,sfbd,fd,[],["nodisp"]); +); +SfcutparadataC(nm,cutfunL,sfbd,fd,options):= + SfcutparadataC(nm,cutfunL,sfbd,fd,options,["nodisp"]); +SfcutparadataC(nm,cutfunLorg,sfbd,fdorg,optionorg,optionsh):=( +//help:SfcutparadataC("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); + eps=10^(-5); + fd=ConvertFdtoC(fdorg); + tmp=select(1..(length(FuncListC)),FuncListC_#==fd); + funnm=text(tmp_1); + cutfunL=cutfunLorg; + if(!islist(cutfunL),cutfunL=[cutfunL]); + forall(1..(length(cutfunL)), + tmp1=Strsplit(cutfunL_#,"="); + if(length(tmp1)>1, + tmp2=tmp1_1+"-("+tmp1_2+")"; //180516 + cutfunL_#=Cform(tmp2); + ); + ); + CutFunList=cutfunL; //180601 + name2="sfcut2d"+nm; + name3="sfcut3d"+nm; + name2h="sfcuth2d"+nm; + name3h="sfcuth3d"+nm; + fname=Fhead+"sfcut"+nm+".txt"; + fnameh=replace(fname,".txt","h.txt"); + options=optionorg; + tmp=Divoptions(options); + eqL=tmp_5; + reL=tmp_6; + strL=tmp_7; + waiting=60; + wflg=0; + options=remove(options,reL); + wflg=0; + cmdflg=1; + forall(strL, + tmp=Toupper(substring(#,0,1)); + if(tmp=="M", + cmdflg=0; + wflg=1; + options=remove(options,[#]); + ); + if(tmp=="R", + cmdflg=0; + wflg=-1; + options=remove(options,[#]); + ); + if(tmp=="C", //180531 + cmdflg=1; + options=remove(options,[#]); + ); + ); + options=remove(options,eqL); + options=remove(options,reL); + options=select(options,length(#)>0); + tmp1=text(length(cutfunL)); + cmdL=[ + " char fname[]="+Dqq(fname)+";", + " char fnameh[]="+Dqq(fnameh)+";", + " rangeUV("+funnm+");", + " boundary("+funnm+");", + " readoutdata3("+Dqq(Fhead+replace(sfbd,"3d","")+".txt")+","+Dqq(sfbd)+",sfbd);", //180531 + " sfcutparadata("+funnm+","+tmp1+",sfbd,fname,fnameh);" + ]; + if(cmdflg==1,//180531from + println(" ExeccmdC will generate "+ name3+","+name3h); + tmp=replace(cmdL_6,"fnameh",Dqq("")); + tmp=replace(tmp,"fname","fnameall"); cmdL_6=tmp; + cmdL_5=" readoutdata3(fnameall,"+Dqq(sfbd)+",sfbd);"; + cmdL=append(cmdL," outputend(dirfname);"); + CommandListC=concat(CommandListC,cmdL); //180531to + , + if(wflg==1,tmp1=append(options,"m")); + if(wflg==-1,tmp1=append(options,"r")); + if(ErrFlag==0, + tmp="sfcut"+nm; + CalcbyC(tmp,[Cheadsurf(),Ctopsurf(tmp),cmdL],tmp1); //180601 + ); + if(ErrFlag==1, + err("Sfcutparadata not completed"); + , + ReadOutData(fname); + GLIST=append(GLIST,"ReadOutData("+Dqq(fname)+")"); + ReadOutData(fnameh); + GLIST=append(GLIST,"ReadOutData("+Dqq(fnameh)+")"); + if(islist(parse(name3)), + tmp1=name2+"=Projpara("+Dqq(name3)+",["; + tmp2=""; + if(length(options)>0, + forall(options, + tmp2=tmp2+Dqq(#)+","; + ); + tmp2=substring(tmp2,0,length(tmp2)-1); + ); + tmp1=tmp1+tmp2+"]);"; + parse(tmp1); + tmp2=select(optionsh,length(#)>0); //180517(2lines) + if(length(tmp2)==0,tmp2=["nodisp"]); + tmp1=name2h+"=Projpara("+Dqq(name3h)+",["; + forall(tmp2, + tmp1=tmp1+Dqq(#)+","; + ); + tmp1=substring(tmp1,0,length(tmp1)-1)+"]);"; + parse(tmp1); + , + ErrFlag=1; + ); ); ); ); diff --git a/Master/texmf-dist/scripts/ketcindy/ketlib/ketpiccurrent.r b/Master/texmf-dist/scripts/ketcindy/ketlib/ketpiccurrent.r index dc54682b443..84bfd5d0553 100644..100755 --- a/Master/texmf-dist/scripts/ketcindy/ketlib/ketpiccurrent.r +++ b/Master/texmf-dist/scripts/ketcindy/ketlib/ketpiccurrent.r @@ -16,12 +16,34 @@ ######################################### -ThisVersion<- "KeTpic for R v5_2_4(20180327)" +ThisVersion<- "KeTpic for R v5_2_4(20180603)" print(ThisVersion) +# 20180603 +# Setcolor debugged (length(Iro)) +# Scaledata,Reflectdata,Rotatedata,Translatedata changed ( for point list) +# 20180602 +# Setcolor changed (rgb supported) +# 20180523 +# Mkskeletondata debugged +# 20180517 +# Sfbdparadata debugged ( tmp2[]=>tmp[2]) +# 20180511 +# Arrowhead,Arrowheaddata debugged ( for closed curve) +# 20180510 +# Plotdata,Paramplot changed ( Assign added for KeTCindy ) +# Texsetctr debugged (grep, fixed=T) +# Anglemark debugged ( for PB,PA,angle) +# 20180509 +# Crvonsfparadata renamed to Crv2onsfparadata +# Makecurves debugged ( Looprange used ) +# 20180506 +# Anglemark changed ( PB,PA,angle) supported +# 20180501 +# Wireparadata changed and debugged ( is.numeric => length==1 ) # 20180402 -# Implicitplot greatly changed +# Implicitplot largely changed # 20180327 # Kyoukai debugged # 20180317 @@ -768,41 +790,62 @@ Integrate<- function(...) #-------------------------------------- ######################### +# 180506 (pB,pA,angle) supported Anglemark<- function(...) { varargin<- list(...) Nargs<- length(varargin) Eps<- 10^(-3) - PA<- varargin[[1]] - PB<- varargin[[2]] + PB<- varargin[[1]] + PA<- varargin[[2]] PC=varargin[[3]] r <- 0.5 if(Nargs>=4){ r<- varargin[[4]]*r } Out=c() - if(r>min(Norm(PA-PB),Norm(PC-PB))){ + if(length(PC)>1){ #180506from + Tmp=min(Norm(PB-PA),Norm(PC-PA)) + }else{ + Tmp=Norm(PB-PA) + } + if(r>Tmp){ #180506to return(Out) } - Cir<- Circledata(c(PB,r)) #17.11.29 + Cir<- Circledata(c(PA,r)) #17.11.29 Tmp<- IntersectcrvsPp(Cir,Listplot(PA,PB)) P1<- Op(2,Op(1,Tmp)) - Tmp<- IntersectcrvsPp(Cir,Listplot(PC,PB)) - P2<- Op(2,Op(1,Tmp)) - if(abs(P1-P2)<Eps){ - Out<-c() - return(Out) - } - if(P1<P2-Eps){ - Out<- Partcrv(P1,P2,Cir) - } - else{ - Tmp<- Numptcrv(Cir) - Tmp1<- Partcrv(P1,Tmp,Cir) - Tmp2<- Partcrv(1,P2,Cir) - Out<- Joincrvs(Tmp1,Tmp2) + if(length(PC)>1){ + Tmp<- IntersectcrvsPp(Cir,Listplot(PA,PC)) + P2<- Op(2,Op(1,Tmp)) + if(abs(P1-P2)<Eps){ + Out<-c() + return(Out) + } + if(P1<P2-Eps){ + Out<- Partcrv(P1,P2,Cir) + } + else{ + Tmp<- Numptcrv(Cir) + Tmp1<- Partcrv(P1,Tmp,Cir) + Tmp2<- Partcrv(1,P2,Cir) + Out<- Joincrvs(Tmp1,Tmp2) + } + }else{ + Tmp1=Pointoncurve(1,Cir)-PA + Tmp2=Pointoncurve(2,Cir)-PA + Tmp=Dotprod(Tmp1,Tmp2)/(Norm(Tmp1)*Norm(Tmp2)) + Tmp=PC/acos(Tmp) + if(P1+Tmp<Length(Cir)){ + Out<- Partcrv(P1,P1+Tmp,Cir) + }else{ + Tmp1= Partcrv(P1,Length(Cir),Cir) + Tmp2= Partcrv(1,P1+Tmp-Length(Cir)+1,Cir) + Out<- Joincrvs(Tmp1,Tmp2) + } } + Out } ############################################## @@ -876,6 +919,7 @@ Arrowdata<- function(...) Arrowhead<-function(...) { ## Scaling is implemented ## 12.01.08 Kirikomi + Eps=10^(-3) varargin<-list(...) Nargs<-length(varargin) P<-varargin[[1]] @@ -916,15 +960,20 @@ Arrowhead<-function(...) if(Nrow(Houkou)>1){ P<- Doscaling(P) Houkou<- Doscaling(Houkou) - Tmp<-Nearestpt(P,Houkou) + Tmp<-Nearestpt(P,Houkou) A<-Tmp[[1]] I<-floor(Tmp[[2]]) + if(I==1){# 180511 + if(Norm(Ptend(Houkou)-Ptstart(Houkou))<Eps){ + I=Numptcrv(Houkou) + } + } G<-Circledata(c(P,Ookisa*cos(Theta)),N=10) #17.11.29 Flg<- 0 # 13.11.13 JL<-seq(I,1,by=-1) for (J in JL){ B<-Ptcrv(J,Houkou) - Tmp<-IntersectcrvsPp(Listplot(list(A,B)),G) + Tmp<-IntersectcurvesPp(Listplot(list(A,B)),G) #180510 if(length(Tmp)>0){ Flg<- 1 break @@ -951,7 +1000,7 @@ Arrowhead<-function(...) } A<-P+Ookisa*cos(Theta)*Ev+Ookisa*sin(Theta)*Nv B<-P+Ookisa*cos(Theta)*Ev-Ookisa*sin(Theta)*Nv - if(length(grep("l",Str))>0){ + if(length(grep("l",Str,fixed=TRUE))>0){ Tmp<-Listplot(list(A,P,B)) Tmp1<- Unscaling(Tmp) Drwline(Tmp1,Futosa) @@ -973,6 +1022,7 @@ Arrowhead<-function(...) Arrowheaddata<- function(...) { ## Scaling is implemented + Eps=10^(-3) varargin<- list(...) Nargs<- length(varargin) P<- varargin[[1]] @@ -1012,6 +1062,11 @@ Arrowheaddata<- function(...) Tmp<-Nearestpt(P,Houkou) A<-Tmp[[1]] I<-floor(Tmp[[2]]) + if(I==1){# 180511 + if(Norm(Ptend(Houkou)-Ptstart(Houkou))<Eps){ + I=Numptcrv(Houkou) + } + } G<-Circledata(c(P,Ookisa*cos(Theta)),N=10) #17.11.29 Flg<- 0 # 13.11.13 JL<-seq(I,1,by=-1) @@ -4267,9 +4322,9 @@ MakeCurves<-function(...){ ## Scaling is implemented Eps<-10.0^(-6) IndM<-Dataindex(Figdata) Atos<-c() - for (Nd in 1:Nrow(IndM)){ + for (Nd in Looprange(1,Nrow(IndM))){ #180509 Tmp<-IndM[Nd,] - Motos<-Figdata[Tmp[1]:Tmp[2],] + Motos<- Figdata[Tmp[1]:Tmp[2],] All<-Nrow(Motos) if(Nrow(Motos)==1){ if(InWindow(Motos)=="o"){ @@ -5046,7 +5101,9 @@ Paramplot<- function(...) Nargs<- length(varargin) Fnflg<- 0 Fnstr<- varargin[[1]]; Is=2 + Fnstr=Assign(Fnstr) #180510(for KeTCindy) Rgstr<- varargin[[Is]]; Is<- Is+1 + Rgstr=Assign(Rgstr) #180510(for KeTCindy) Range<- c(0,2*pi) N<- 50 # Numpoints E<-c() # Exclusions @@ -5260,8 +5317,10 @@ Plotdata<- function(...) varargin<- list(...) Eps<- 10^(-5) Fnstr<- varargin[[1]]; Is<- 2 + Fnstr=Assign(Fnstr) #180510(for KeTCindy) Fnflg<- 0 Rgstr<- varargin[[Is]]; Is<- Is+1 + Rgstr=Assign(Rgstr) #180510(for KeTCindy) Tmp<- strsplit(Rgstr,"=") K<-Tmp[[1]] if(length(K)>1){ @@ -6129,17 +6188,14 @@ Reflectdata<- function(...) PtA<- Pts[1:2]; PtB<- Pts[3:4] } } + ML=Flattenlist(ML) #180603 OutL<- list() - for (N in Looprange(1,length(ML))){ + for (N in Looprange(1,Length(ML))){ GL<- Op(N,ML) + if(!is.matrix(GL)){GL=matrix(GL,ncol=2)} #180603 Out<- c() - for (I in Looprange(1,Nrow(GL))){ - if(is.matrix(GL)){ # 10.12.07 - Tmp<- GL[I,] - } - else{ - Tmp<- GL - } + for (I in Looprange(1,Length(GL))){ + Tmp<- GL[I,] X1<- Tmp[1] Y1<- Tmp[2] if(X1==Inf){ @@ -6389,18 +6445,15 @@ Rotatedata<- function(..., deg=FALSE) else{ Pt<- varargin[[3]] } + ML=Flattenlist(ML) #180603 Cx<- Pt[1]; Cy<- Pt[2] OutL<- c() - for (N in Looprange(1,length(ML))){ + for (N in Looprange(1,Length(ML))){ GL<- Op(N,ML) + if(!is.matrix(GL)){GL=matrix(GL,ncol=2)} #180603 Out<- c() - for (I in Looprange(1,Nrow(GL))){ - if(is.matrix(GL)){ - Tmp<- GL[I,] - } - else{ - Tmp<- GL - } + for (I in Looprange(1,Length(GL))){ + Tmp<- GL[I,] X1<- Tmp[1] Y1<- Tmp[2] if(X1==Inf){ @@ -6443,17 +6496,14 @@ Scaledata<- function(...) else{ Pt<- varargin[[4]] } + ML=Flattenlist(ML) #180603 OutL<- list() - for (N in Looprange(1,length(ML))){ + for (N in Looprange(1,Length(ML))){ GL<- Op(N,ML) + if(!is.matrix(GL)){GL=matrix(GL,ncol=2)} #180603 Out<- c() - for (I in Looprange(1,Nrow(GL))){ - if(is.matrix(GL)){ # 10.12.07 - Tmp<- GL[I,] - } - else{ - Tmp<- GL - } + for (I in Looprange(1,Length(GL))){ + Tmp<- GL[I,] X1<- Tmp[1] Y1<- Tmp[2] if(X1==Inf){ @@ -6624,10 +6674,14 @@ Setcolor<- function(...){ } Iro<- Ratiocmyk(Color) if(length(Iro)==0) return(c()) - Str<- "\\color[cmyk]{" #17.09.22 - for(J in 1:4){ + if(length(Iro)==4){ #180602from + Str<- "\\color[cmyk]{" + }else{ + Str<- "\\color[rgb]{" + } #180602to + for(J in 1:length(Iro)){ Str<- paste(Str,as.character(Kosa*Iro[J]),sep="") - if(J<4){ + if(J<length(Iro)){ #180603 Str<- paste(Str,",",sep="") } } @@ -7462,7 +7516,7 @@ Texsetctr<- function(Nctr,Opstr) Va<- paste(Va,Tmp,sep="") next } - if(length(grep(Tmp,OperL))==0){ + if(length(grep(Tmp,OperL,fixed=TRUE))==0){ #180510 Va<- paste(Va,Tmp,sep="") } else{ @@ -7609,17 +7663,14 @@ Translatedata<- function(...) B<- 0 } } + ML=Flattenlist(ML) #180603 OutL<- list() - for (N in Looprange(1,length(ML))){ + for (N in Looprange(1,Length(ML))){ GL<- Op(N,ML) + if(!is.matrix(GL)){GL=matrix(GL,ncol=2)} #180603 Out<- c() - for (I in Looprange(1,Nrow(GL))){ - if(is.matrix(GL)){ # 10.12.07 - Tmp<- GL[I,] - } - else{ - Tmp<- GL - } + for (I in Looprange(1,Length(GL))){ + Tmp<- GL[I,] #180603 X1<- Tmp[1] Y1<- Tmp[2] if(X1==Inf){ @@ -8441,7 +8492,7 @@ Kukannozoku<- function(Jokyo,KukanL){ ######################################## Makeskeletondata<- function(Obj2L,Plt2L,R0,Eps2){ - Eps<- 10.0^(-3) + Eps<- 10.0^(-3) Dmat<- c() Dind<- c() for (I in Looprange(1,Mixlength(Plt2L))){ @@ -8467,7 +8518,7 @@ Makeskeletondata<- function(Obj2L,Plt2L,R0,Eps2){ for (I in Looprange(1,Nrow(Dind))){ Tmp<- Dmat[Dind[I,1]:Dind[I,2],] P2<- Tmp[,1:2] - KC<- IntersectcrvsPp(P1,P2,Eps) + KC<- IntersectcrvsPp(P1,P2) if(Mixlength(KC)>0){ for (J in 1:Mixlength(KC)){ P<- Op(1,Op(J,KC)) @@ -8858,8 +8909,8 @@ MakeveLfaceL<- function(VfL){ } ########################### -#// 09.10.29 -#// 09.11.15 +# 09.10.29 +# 09.11.15 Menkakusi2<- function(Face,Nf,Ptype){ # global THETA PHI EyePoint FocusPoint VELNO VELHI @@ -8955,7 +9006,7 @@ Menkakusi2<- function(Face,Nf,Ptype){ Tmp1<- Invparapt(P,Spaceline(Face)) } P3<- Tmp[[1]]; Q3<- Tmp1[[1]] - if(Ts>1-Eps){# // P3, Q3 are necessary + if(Ts>1-Eps){# P3, Q3 are necessary Flg<- I break } @@ -9067,8 +9118,8 @@ Parapt<- function(Plist){ # 18.02.19 changed (for point list) Partcrv3<- function(T1,T2,Fk){ Eps0=10^(-4) -#// Tmp=Mixop(1,Fk) -#// new part from +# Tmp=Mixop(1,Fk) +# new part from if(T1>(T2+Eps0)){ Npt<- Nrow(Fk) Out1<- Partcrv3(T1,Npt,Fk) @@ -10464,7 +10515,7 @@ Xyzaxpersname<- function(...){ ######################### #100815 -Zparapt<- function(P){#function Out=Zparapt(P) +Zparapt<- function(P){ x<- P[1]; y<- P[2]; z<- P[3] Out<- x*cos(PHI)*sin(THETA)+y*sin(PHI)*sin(THETA)+z*cos(THETA) return(Out) @@ -12622,7 +12673,7 @@ IntersectcurvesPp<- function(...){ for(ii in Looprange(1,length(tmp2))){ tmp=Collectsameseg(tmp1) out=c(out,list(Op(1,tmp))) - if(length(Op(2,tmp))==0){ + if(length(Op(2,tmp))==0){ break }else{ tmp1=Op(2,tmp) @@ -13208,10 +13259,7 @@ Envelopedata<- function(...){ Eval11=Evlpfun(Uval1,Vval1) Eval12=Evlpfun(Uval1,Vval2) for(I in 1:(Mdv)){ -# Uval1=URNG[1]+(I-1)*Du Uval2=URNG[1]+I*Du -# Eval11=Evlpfun(Uval1,Vval1) -# Eval12=Evlpfun(Uval1,Vval2) Eval21=Evlpfun(Uval2,Vval1) Eval22=Evlpfun(Uval2,Vval2) a1=Uval1;b1=Vval1;c1=Eval11 @@ -13276,8 +13324,6 @@ Dropnumlistcrv<- function(QdL,Eps1){ if(Norm(P-Op(K,Pd))>Eps1){ #18.02.12 eps PtL=c(PtL,K) } -# if(length(PtL)==1){ #180306 -# } OutL=c(OutL,list(PtL)) } return(OutL) @@ -13460,12 +13506,8 @@ PthiddenQ<- function(PtA,Vec,Uveq,Np,Eps1,Eps2){ Uval1=URNG[1] #180306(3lines) Eval11=Eqfun(Uval1,Vval1) Eval12=Eqfun(Uval1,Vval2) - Uval1=URNG[1] #180305(3lines) for(I in Looprange(1,Np[1])){ #180227 -# Uval1=URNG[1]+(I-1)*Dx Uval2=URNG[1]+I*Dx -# Eval11=Eqfun(Uval1,Vval1) -# Eval12=Eqfun(Uval1,Vval2) Eval21=Eqfun(Uval2,Vval1) Eval22=Eqfun(Uval2,Vval2) a1=Uval1;b1=Vval1;c1=Eval11 @@ -13483,7 +13525,6 @@ PthiddenQ<- function(PtA,Vec,Uveq,Np,Eps1,Eps2){ next } if(abs(M2)<Eps0){ -# QL=Appendrow(QL,P2) next } if((M1> 0) && (M2> 0)){ @@ -13547,8 +13588,8 @@ PthiddenQ<- function(PtA,Vec,Uveq,Np,Eps1,Eps2){ } } Tmp1=Crossprod(Pt-PtA,Vec) - if(Norm(Tmp1)<Eps1){ #18.02.19 - if(Zparapt(Pt)>Zparapt(PtA)+Eps2){ + if(Norm(Tmp1)<Eps1){ #18.02.19 + if(Zparapt(Pt)>Zparapt(PtA)+Eps2){ return(list(1,Pt,Zparapt(Pt),Zparapt(PtA))) }else{ Out=Appendrow(Out,Pt) @@ -13599,14 +13640,14 @@ Nohiddenpara2<- function (Par,Fk,Uveq,Np,Eps1,Eps2){ PaL[length(PaL)]=tmp2 }else{ PaL=c(PaL,tmp2) - } #18.02.26until + } #18.02.26to SeL=c() for(N in Looprange(1,length(PaL)-1)){ S=(PaL[N]+PaL[N+1])/2 Tmp=Invparapt(S,Fh,Fk) - PtA=Op(1,Tmp) + PtA=Op(1,Tmp) PtAp=Parapt(PtA) - Vec=c(sin(THETA)*cos(PHI),sin(THETA)*sin(PHI),cos(THETA)) + Vec=c(sin(THETA)*cos(PHI),sin(THETA)*sin(PHI),cos(THETA)) Flg=PthiddenQ(PtA,Vec,Uveq,Np,Eps1,Eps2) if(Flg[[1]]==0){ SeL=c(SeL,N) @@ -13838,9 +13879,6 @@ Sfbdparadata<- function(...){ } } starttime=proc.time() -# tmp=Evlptablepara(Np) -# Zval=tmp[[1]]; Xval=tmp[[2]]; Yval=tmp[[3]] -# Out3=Implicitplot(Zval,Xval,Yval) Out3=Envelopedata(Fd) #180306 tmp3=list() pts=list() #180306 @@ -13857,7 +13895,6 @@ Sfbdparadata<- function(...){ tmp=Op(1,Nlist) tmp=Op(tmp,tmp1) pts=c(pts,list(tmp)) -# pts=c(pts,list(XYZfunc(tmp[1],tmp[2])))#180306until }else{ tmp=c() for(kk in Looprange(1,length(Nlist))){ @@ -13873,11 +13910,11 @@ Sfbdparadata<- function(...){ pts=list() for(ii in Looprange(1,length(tmp3))){ tmp=Op(ii,tmp3) - tmp1=XYZfunc(tmp[1],tmp2[]) + tmp1=XYZfunc(tmp[1],tmp[2]) flg=0 for(jj in Looprange(1,length(pts))){ tmp=Op(jj,pts) - tmp2=XYZfunc(tmp[1],tmp2[]) + tmp2=XYZfunc(tmp[1],tmp[2]) #180517 if(Norm(tmp1-tmp2)<Eps1){ flg=1; break } @@ -13908,7 +13945,7 @@ Sfbdparadata<- function(...){ next } } - } #180306until + } #180306to IMPLICITDATA<<- Out3 Tmp=proc.time()-starttime print(paste('ImplicitData obtained : Time =',sprintf("%6.3f",Tmp[1]),sep='')) @@ -13950,10 +13987,7 @@ Meetpoints<- function(PtA,PtB,Uveq,Np,Eps1){ Eval11=Eqfun(Uval1,Vval1) Eval12=Eqfun(Uval1,Vval2) for(I in Looprange(1,Np[1])){ -# Uval1=URNG[1]+(I-1)*Dx Uval2=URNG[1]+I*Dx -# Eval11=Eqfun(Uval1,Vval1) -# Eval12=Eqfun(Uval1,Vval2) Eval21=Eqfun(Uval2,Vval1) Eval22=Eqfun(Uval2,Vval2) a1=Uval1;b1=Vval1;c1=Eval11 @@ -13971,7 +14005,6 @@ Meetpoints<- function(PtA,PtB,Uveq,Np,Eps1){ next } if(abs(M2)<Eps0){ -# QL=Appendrow(QL,P2) next } if((M1> 0) && (M2> 0)){ @@ -14037,7 +14070,7 @@ Meetpoints<- function(PtA,PtB,Uveq,Np,Eps1){ Tmp1=Crossprod(Pt-PtA,Vec) if(Norm(Tmp1)<Eps1){ #18.02.19 Tmp1=Dotprod(Pt-PtA,Vec) #18.02.21 - if((Tmp1>-Eps0)&&(Tmp1<Norm(PtB-PtA)+Eps0)){ + if((Tmp1>-Eps0)&&(Norm(Pt-PtA)<Norm(PtB-PtA)+Eps0)){#180429 Out=c(Out,list(Pt)) } } @@ -14253,7 +14286,7 @@ Crv3onsfparadata<- function(...){ return(Out) } -Crvonsfparadata<- function(...){ +Crv2onsfparadata<- function(...){ starttime=proc.time() varargin=list(...) Nargs=length(varargin) @@ -14306,7 +14339,7 @@ Wireparadata<- function(...){ DvL=varargin[[4]] Np=c(50,50) Eps1=0.01 - Eps2=0.05 + Eps2=0.1 ctr=0 for(jj in Looprange(5,Nargs)){ tmp=varargin[[jj]] @@ -14321,7 +14354,7 @@ Wireparadata<- function(...){ if(ctr==2){Eps2=tmp} } } - if(is.numeric(DuL)){ + if(length(DuL)==1){ #180430 tmp1=DuL DuL=list() for(jj in Looprange(1,tmp1)){ @@ -14329,7 +14362,7 @@ Wireparadata<- function(...){ DuL=c(DuL,list(tmp)) } } - if(is.numeric(DvL)){ + if(length(DvL)==1){ #180430 tmp1=DvL DvL=list() for(jj in Looprange(1,tmp1)){ @@ -14519,10 +14552,7 @@ Sfcutparadata<- function(...){ Eval11=Eqfun(Uval1,Vval1) Eval12=Eqfun(Uval1,Vval2) for(I in Looprange(1,Np[1])){ -# Uval1=URNG[1]+(I-1)*Du Uval2=URNG[1]+I*Du -# Eval11=Eqfun(Uval1,Vval1) -# Eval12=Eqfun(Uval1,Vval2) Eval21=Eqfun(Uval2,Vval1) Eval22=Eqfun(Uval2,Vval2) a1=Uval1;b1=Vval1;c1=Eval11 @@ -14540,7 +14570,6 @@ Sfcutparadata<- function(...){ next } if(abs(M2)<Eps0){ -# QL=Appendrow(QL,P2) next } if((M1> 0) && (M2> 0)){ diff --git a/Master/texmf-dist/scripts/ketcindy/ketlib/ketpiccurrent_rep2e.r b/Master/texmf-dist/scripts/ketcindy/ketlib/ketpiccurrent_rep2e.r index 370339480ae..370339480ae 100644..100755 --- a/Master/texmf-dist/scripts/ketcindy/ketlib/ketpiccurrent_rep2e.r +++ b/Master/texmf-dist/scripts/ketcindy/ketlib/ketpiccurrent_rep2e.r diff --git a/Master/texmf-dist/scripts/ketcindy/ketlibC/ketcommon.h b/Master/texmf-dist/scripts/ketcindy/ketlibC/ketcommon.h index 27a5434fe41..84de58498f3 100644 --- a/Master/texmf-dist/scripts/ketcindy/ketlibC/ketcommon.h +++ b/Master/texmf-dist/scripts/ketcindy/ketlibC/ketcommon.h @@ -108,6 +108,15 @@ void pull6(int num, double ptL[][6],double pt[6]){ pt[3]=ptL[num][3]; pt[4]=ptL[num][4]; pt[5]=ptL[num][5]; } +int add1(double gdata[], double x){ + int nall; + nall=length1(gdata); + nall++; + gdata[nall]=x; + gdata[0]=nall; + return nall; +} + int add2(double gdata[][2], double x, double y){ int nall; nall=push2(x, y, gdata); @@ -189,6 +198,28 @@ int appendd3(int level, int from,int upto, double gdata[][3],double mat[][3]){ return nall+np; } +int appendd6(int level, int from,int upto, double gdata[][6],double mat[][6]){ + int j, np, nall=length6(mat); + np=upto-from+1; + if(np<0){np=0;} + if(np>0){ + if(level>0){ + if(nall>0){ + nall=push6(Inf,level,0,0,0,0,mat); + } + } + for(j=1; j<=np; j++){ + mat[nall+j][0]=gdata[from+j-1][0]; + mat[nall+j][1]=gdata[from+j-1][1]; + mat[nall+j][2]=gdata[from+j-1][2]; + mat[nall+j][3]=gdata[from+j-1][3]; + mat[nall+j][4]=gdata[from+j-1][4]; + mat[nall+j][5]=gdata[from+j-1][5]; } + } + mat[0][0]=nall+np; + return nall+np; +} + int prependd2(int from,int upto, double gdata[][2],double mat[][2]){ int j,np, nall=length2(mat); if(from<=upto){ @@ -216,7 +247,38 @@ int prependd2(int from,int upto, double gdata[][2],double mat[][2]){ return nall+np; } -int appendd1(double numvec[], double num){ +int prependd3(int from,int upto, double gdata[][3],double mat[][3]){ + int j,np, nall=length3(mat); + if(from<=upto){ + np=upto-from+1; + for(j=nall; j>=1; j--){ + mat[np+j][0]=mat[j][0]; + mat[np+j][1]=mat[j][1]; + mat[np+j][2]=mat[j][2]; + } + for(j=1; j<=np; j++){ + mat[j][0]=gdata[from+j-1][0]; + mat[j][1]=gdata[from+j-1][1]; + mat[j][2]=gdata[from+j-1][2]; + } + }else{ + np=from-upto+1; + for(j=nall; j>=1; j--){ + mat[np+j][0]=mat[j][0]; + mat[np+j][1]=mat[j][1]; + mat[np+j][2]=mat[j][2]; + } + for(j=1; j<=np; j++){ + mat[nall+j][0]=gdata[from-j+1][0]; + mat[nall+j][1]=gdata[from-j+1][1]; + mat[nall+j][2]=gdata[from-j+1][2]; + } + } + mat[0][0]=nall+np; + return nall+np; +} + +int appendd1(double num,double numvec[]){ int n; n=floor(numvec[0]+0.5); numvec[n+1]=num; @@ -224,7 +286,7 @@ int appendd1(double numvec[], double num){ return n+1; } -int appendi1(int numvec[],int num){ +int appendi1(int num,int numvec[]){ int n; n=numvec[0]; numvec[n+1]=num; @@ -232,6 +294,17 @@ int appendi1(int numvec[],int num){ return n+1; } +int prependd1(double num, double numvec[]){ + int i,n; + n=numvec[0]; + for(i=n; i>=1; i--){ + numvec[i+1]=numvec[i]; + } + numvec[1]=num; + numvec[0]=n+1; + return n+1; +} + int prependi1(int num, int numvec[]){ int i,n; n=numvec[0]; @@ -259,6 +332,19 @@ int removei2(int nrmv,int mat[][2]){ } } +void removed3(int nrmv,double mat[][3]){ + int j,nall=length3(mat); + if(nall>0){ + for(j=nrmv; j<=nall-1; j++){ + mat[j][0]=mat[j+1][0]; + mat[j][1]=mat[j+1][1]; + mat[j][2]=mat[j+1][2]; + } + mat[0][0]=nall-1; + return; + } +} + int dataindexd1(double out[],int din[][2]){ int n1=1, j, ctr=0, nall=floor(out[0]+0.5); if(nall==0){ @@ -349,6 +435,29 @@ int dataindexd4(int level, double out[][4],int din[][2]){ return ctr; } +int dataindexd6(int level, double out[][6],int din[][2]){ + int n1=1, j, ctr=0, nall=length6(out); + if(nall==0){ + din[0][0]=0; + return 0; + } + for(j=1; j<=nall; j++){ + if(out[j][0]>Inf-1){ + if((level==0) || (out[j][1]==level)){ + ctr++; + din[ctr][0]=n1; + din[ctr][1]=j-1; + n1=j+1; + } + } + } + ctr++; + din[ctr][0]=n1; + din[ctr][1]=nall; + din[0][0]=ctr; + return ctr; +} + int dataindexi1(int out[],int din[][2]){ int n1=1, j, ctr=0, nall=out[0], ninfp=0; if(nall==0){ @@ -379,6 +488,102 @@ int dataindexi1(int out[],int din[][2]){ return ctr; } +void replacelistd1(int ii,double out[],double rep[]){ + int din[DsizeS][2],k,j,js,je, nall=length1(out),nr=length1(rep); + double tmpd1[DsizeL]; + dataindexd1(out,din); + tmpd1[0]=0; + for(k=1;k<=din[0][0];k++){ + if(k!=1){ + appendd1(Inf,tmpd1); + } + if(k!=ii){ + js=din[k][0]; je=din[k][1]; + for(j=js;j<=je;j++){ + appendd1(out[j],tmpd1); + } + }else{ + for(j=1;j<=nr;j++){ + appendd1(rep[j],tmpd1); + } + } + } + nall=length1(tmpd1); + out[0]=0; + for(j=1;j<=nall;j++){ + appendd1(tmpd1[j],out); + } +} + +void replacelistd2(int level,int ii,double out[][2],double rep[][2]){//180419 + int din[DsizeS][2],k,js,je, nall=length2(out),nr=length2(rep); + double tmpmd2[DsizeL][2]; + dataindexd2(level,out,din); + tmpmd2[0][0]=0; + for(k=1;k<=din[0][0];k++){ + if(k!=ii){ + js=din[k][0]; je=din[k][1]; + appendd2(level,js,je,out,tmpmd2); + }else{ + appendd2(level,1,nr,rep,tmpmd2); + } + } + nall=length2(tmpmd2); + out[0][0]=0; + appendd2(level,1,nall,tmpmd2,out); +} + +void replacelistd3(int level,int ii,double out[][3],double rep[][3]){//180428 + int din[DsizeS][2],k,js,je, nall=length3(out),nr=length3(rep); + double tmpmd3[DsizeL][3]; + dataindexd3(level,out,din); + tmpmd3[0][0]=0; + for(k=1;k<=din[0][0];k++){ + if(k!=ii){ + js=din[k][0]; je=din[k][1]; + appendd3(level,js,je,out,tmpmd3); + }else{ + appendd3(level,1,nr,rep,tmpmd3); + } + } + nall=length3(tmpmd3); + out[0][0]=0; + appendd3(level,1,nall,tmpmd3,out); +} + +void replacelistd6(int level,int ii,double out[][6],double rep[][6]){//180421 + int din[DsizeS][2],k,js,je, nall=length6(out),nr=length6(rep); + double tmpmd6[DsizeL][6]; + dataindexd6(level,out,din); + js=din[ii][0]; je=din[ii][1]; + tmpmd6[0][0]=0; + for(k=1;k<=din[0][0];k++){ + if(k!=ii){ + js=din[k][0]; je=din[k][1]; + appendd6(level,js,je,out,tmpmd6); + }else{ + appendd6(level,1,nr,rep,tmpmd6); + } + } + nall=length6(tmpmd6); + out[0][0]=0; + appendd6(level,1,nall,tmpmd6,out); +} + +void removelistd2(int level,int ii,double out[][2]){//180503 + int din[DsizeS][2],k,js,je,nall=length2(out); + double tmpmd[DsizeL][2]; + dataindexd2(level,out,din); + js=din[ii][0]; je=din[ii][1]; + tmpmd[0][0]=0; + appendd2(0,je+1,nall,out,tmpmd); + out[0][0]=0; + if(js>1){ + out[0][0]=js-2; + } + appendd2(0,1,length2(tmpmd),tmpmd,out); +} + void dispvec(int n,double dt[]){ int i; for(i=0; i<n; i++){ @@ -433,6 +638,15 @@ void dispmatd6(int from, int upto, double mat[][6]){ } } +void dispmatd1all(double dt[]){ + int i,n; + n=length1(dt); + for(i=1; i<=n; i++){ + printf("%f ",dt[i]); + } + printf("\n"); +} + void dispmatd2all(double mat[][2]){ int i; if(mat[0][0]==0){printf("%s\n","no data");return;} @@ -490,58 +704,68 @@ void dispmati1(int from, int upto, int mat[]){ } } +void writedata3(const char *fname, double out[][3]){ + int i, nall; + FILE *fp; + nall=length3(out); + fp=fopen(fname,"w"); + for(i=1; i<=nall; i++){ + fprintf(fp,"%7.5f %7.5f %7.5f",out[i][0],out[i][1],out[i][2]); + if(i<nall){fprintf(fp,"\n");} + } + fclose(fp); +} + void readdata3(const char *fname, double out[][3]){ - double data[DsizeL][4]; - int i, j, ndata, nall; + int n,j; FILE *fp; fp=fopen(fname,"r"); if(fp==NULL){ printf("file not found\n"); return; } - ndata=0; - i=1; - while( ! feof(fp) && i<DsizeL){ - for(j=0;j<4;j++){ - fscanf(fp,"%lf",&data[i][j]); + n=1; + while( ! feof(fp) && n<DsizeL){ + for(j=0;j<3;j++){ + fscanf(fp,"%lf",&out[n][j]); } - i++; - ndata++; + n++; } - ndata--; + n--; fclose(fp); - out[0][0]=0; nall=0; - for(i=1; i<=ndata; i++){ - nall=add3(out, data[i][0], data[i][1], data[i][2]); + out[0][0]=n; +} + +void writedata2(const char *fname, double out[][2]){ + int i, nall; + FILE *fp; + nall=length2(out); + fp=fopen(fname,"w"); + for(i=1; i<=nall; i++){ + fprintf(fp,"%7.5f %7.5f",out[i][0],out[i][1]); + if(i<nall){fprintf(fp,"\n");} } - return; + fclose(fp); } void readdata2(const char *fname, double out[][2]){ - double data[DsizeL][3]; - int i, j, ndata, nall; + int n,j; FILE *fp; fp=fopen(fname,"r"); if(fp==NULL){ printf("file not found\n"); return; } - ndata=0; - i=1; - while( ! feof(fp) && i<DsizeL){ - for(j=0;j<3;j++){ - fscanf(fp,"%lf",&data[i][j]); + n=1; + while( ! feof(fp) && n<DsizeL){ + for(j=0;j<2;j++){ + fscanf(fp,"%lf",&out[n][j]); } - i++; - ndata++; + n++; } - ndata--; + n--; fclose(fp); - out[0][0]=0; nall=0; - for(i=1; i<=ndata; i++){ - nall=add2(out, data[i][0], data[i][1]); - } - return; + out[0][0]=n; } int output2(const char *var, const char *fname, int level, double out[][2]){ @@ -729,6 +953,7 @@ int connectseg(double pdata[][2], double eps, double out[][2]){ int nall=length2(pdata), nout=0; double qd[DsizeM][2], ah[2], ao[2], p[2], q[2], tmp[2]; out[0][0]=0; + if(length2(pdata)==0){return 0;} //180613 nd=dataindexd2(0,pdata,din); qd[0][0]=0; nq=appendd2(0,din[1][0],din[1][1],pdata,qd); @@ -780,6 +1005,63 @@ int connectseg(double pdata[][2], double eps, double out[][2]){ return nout; } +int connectseg3(double pdata[][3], double eps, double out[][3]){ + int din[DsizeM][2],i,j,nd,nq,flg, st, en, ntmp; + int nall=length3(pdata), nout=0; + double qd[DsizeM][3], ah[3], ao[3], p[3], q[3], tmp[3]; + out[0][0]=0; + if(length3(pdata)==0){return 0;} //180613 + nd=dataindexd3(0,pdata,din); + qd[0][0]=0; + nq=appendd3(0,din[1][0],din[1][1],pdata,qd); + removei2(1,din); + while(nd>0){ + pull3(1,qd,ah); + pull3(nq,qd,ao); + flg=0; + for(j=1; j<=nd; j++){ + st=din[j][0]; + en=din[j][1]; + pull3(st,pdata,p); + pull3(en,pdata,q); + if(dist(3,p,ao)<eps){ + nq=appendd3(0,st+1,en,pdata,qd); + nd=removei2(j,din); + flg=1; + break; + } + if(dist(3,q,ao)<eps){ + nq=appendd3(0,en-1,st,pdata,qd); + nd=removei2(j,din); + flg=1; + break; + } + if(dist(3,p,ah)<eps){ + nq=prependd3(en,st+1,pdata,qd); + nd=removei2(j,din); + flg=1; + break; + } + if(dist(3,q,ah)<eps){ + nq=prependd3(st,en-1,pdata,qd); + nd=removei2(j,din); + flg=1; + break; + } + } + if(flg==0){ + nout=appendd3(2,1,nq,qd,out); + qd[0][0]=0; + nq=appendd3(0,din[1][0],din[1][1],pdata,qd); + nd=removei2(1,din); + } + } + if(nq>0){ + nout=appendd3(2,1,nq,qd,out); + } + return nout; +} + void koutenseg(double a[2], double b[2], double c[2], double d[2], double eps, double eps2, double out[4]){ double v[2], epss,eps0=Eps, sv2, p1, p2, q1,q2,m1, m2, M1, M2, t; @@ -1227,26 +1509,26 @@ int dropnumlistcrv(double qd[][2], double eps1, int out[]){ pd[0][0]=0; npd=0; npd=appendd2(0,se,en,qd,pd); ptL[0]=0; nptL=0; - nptL=appendi1(ptL,1); + nptL=appendi1(1,ptL); pull2(1,pd,p); for(k=2; k<=npd-1; k++){ pull2(k,pd,tmp2d); if(dist(2,p,tmp2d)>eps1){ - nptL=appendi1(ptL,k); + nptL=appendi1(k,ptL); pull2(k,pd,p); } } pull2(npd-1,pd,p); pull2(npd,pd,tmp2d); if(dist(2,p,tmp2d)>eps){ // eps -> eps1 ? - nptL=appendi1(ptL,npd); + nptL=appendi1(npd,ptL); } if(nptL==1){ptL[0]=0; nptL=0;} if(nout>0){ - nout=appendi1(out,Infint); + nout=appendi1(Infint,out); } for(i=1; i<=nptL; i++){ - nout=appendi1(out,ptL[i]); + nout=appendi1(ptL[i],out); } } out[0]=nout; @@ -1955,7 +2237,7 @@ void intersectpartseg(double crv1[][2],double crv2[][2],int ii, int jj,int num,d void collectsameseg(double ptdL[][6],double rL[][6]){ double Eps00=pow(10,-8.0),tmp1d[2],tmp2d[2],tmp1d6[6],tmp2d6[6]; - int ii,jj,kk,nr,ctr,numL[40],diffL[40]; + int ii,jj,kk,istr,nr,numL[40],diffL[40]; double s1,e1,s2,e2,dst,tmp1,tmp2,tmp1md6[40][6]; rL[0][0]=0; if(length6(ptdL)==0){ @@ -1979,13 +2261,13 @@ void collectsameseg(double ptdL[][6],double rL[][6]){ }else{ s2=kk-Eps00; e2=s2+1+2*Eps00; } - ctr=1;numL[0]=0; + numL[0]=0; for(ii=1;ii<=length6(rL);ii++){ pull6(ii,rL,tmp1d6); tmp1=tmp1d6[2]; tmp2=tmp1d6[3]; if((tmp1>s1)&&(tmp1<e1)&&(tmp2>s2)&&(tmp2<e2)){ addptd6(tmp1md6,tmp1d6); - numL[ctr]=ii;ctr++; + appendi1(ii,numL); } } dst=100; @@ -2005,7 +2287,7 @@ void collectsameseg(double ptdL[][6],double rL[][6]){ for(ii=0;ii<=length6(rL);ii++){ diffL[ii]=0; } - for(ii=1;ii<=ctr;ii++){ + for(ii=1;ii<=numL[0];ii++){ kk=numL[ii]; diffL[kk]=1; } @@ -2018,12 +2300,12 @@ void collectsameseg(double ptdL[][6],double rL[][6]){ } } -void intersectcurvesPp(double crv1s[][2],double crv2s[][2],int num,double out[][6]){ +void intersectcurvesPp(double crv1s[][2],double crv2s[][2],int nbez,double out[][6]){ double Eps00=pow(10,-8.0),Dist=10*Eps2, crv1[DsizeL][2],crv2[DsizeL][2]; - double tmp1md6[DsizeS][6],tmp2md6[DsizeS][6]; + double tmp1md6[DsizeS][6],tmp2md6[DsizeS][6],tmpmd1[DsizeS]; double tmpd[2],tmp1d[2],tmp2d[2],tmpd6[6],tmp1d6[6]; - double sx,sy,dst,ans[4]; - int ii,jj,kk,nall,self,js,je; + double sx,sy,dst,ans1[4],ans2[4]; + int ii,jj,kk,nall,self,js,je,din[DsizeS][2]; crv1[0][0]=0; pull2(1,crv1s,tmpd);addptd2(crv1,tmpd); for(ii=2;ii<=length2(crv1s);ii++){ @@ -2063,7 +2345,7 @@ void intersectcurvesPp(double crv1s[][2],double crv2s[][2],int num,double out[][ js=ii+2; je=length2(crv2)-1; } for(jj=js;jj<=je;jj++){ - intersectpartseg(crv1,crv2,ii,jj,num,tmpd6); + intersectpartseg(crv1,crv2,ii,jj,nbez,tmpd6); if(tmpd6[0]<Inf-Eps){ tmpd[0]=tmpd6[0];tmpd[1]=tmpd6[1]; if(length6(tmp1md6)==0){ @@ -2085,41 +2367,48 @@ void intersectcurvesPp(double crv1s[][2],double crv2s[][2],int num,double out[][ tmp2md6[0][0]=0; while(length6(tmp1md6)>0){ collectsameseg(tmp1md6,tmp2md6); - dst=100; - for(ii=1;ii<=length6(tmp1md6);ii++){ - pull6(ii,tmp1md6,tmpd6); - if(tmpd6[4]<dst){ - dst=tmpd6[4]; - } + appendd6(2,1,length6(tmp1md6),tmp1md6,out); + tmp1md6[0][0]=0; + for(ii=1;ii<=length6(tmp2md6);ii++){ + pull6(ii,tmp2md6,tmpd6);addptd6(tmp1md6,tmpd6); } - sx=0; sy=0;nall=0; - for(ii=1;ii<=length6(tmp1md6);ii++){ - pull6(ii,tmp1md6,tmpd6); - if(tmpd6[4]<dst+Eps00){ - nall++; - sx=sx+tmpd6[0]; sy=sy+tmpd6[1]; + } + dataindexd6(2,out,din); + for(ii=1;ii<=length2i(din);ii++){ + tmp1md6[0][0]=0; + appendd6(2,din[ii][0],din[ii][1],out,tmp1md6); + if(length6(tmp1md6)==1){ + replacelistd6(2,ii,out,tmp1md6); + }else{ + dst=100; + for(jj=1;jj<=length6(tmp1md6);jj++){ + pull6(jj,tmp1md6,tmpd6); + if(tmpd6[4]<dst){ + dst=tmpd6[4]; + } + } + sx=0; sy=0;nall=0; + for(jj=1;jj<=length6(tmp1md6);jj++){ + pull6(jj,tmp1md6,tmpd6); + if(tmpd6[4]<dst+Eps00){ + nall++; + sx=sx+tmpd6[0]; sy=sy+tmpd6[1]; + } } tmp1d[0]=sx/nall; tmp1d[1]=sy/nall; - tmp1d6[0]=tmp1d[0];tmp1d6[1]=tmp1d[1]; - nearestptpt(tmp1d,crv1,ans); - tmp1d6[2]=ans[2]; - nearestptpt(tmp1d,crv2,ans); - tmp1d6[3]=ans[2]; - tmp1d6[4]=dst; - tmp1d6[5]=tmpd6[5]; - addptd6(out,tmp1d6); - } - tmp1md6[0][0]=0; - for(ii=1;ii<=length6(tmp2md6);ii++){ - pull6(ii,tmp2md6,tmpd6);addptd6(tmp1md6,tmpd6); + nearestptpt(tmp1d,crv1,ans1); + nearestptpt(tmp1d,crv2,ans2); + tmp2md6[0][0]=0; + push6(sx/nall,sy/nall,ans1[2],ans2[2],dst,tmp1md6[1][5],tmp2md6); + replacelistd6(2,ii,out,tmp2md6); } } } -void intersectcurves(double crv1[][2],double crv2[][2],int num,double out[][2]){ +void intersectcurves(double crv1[][2],double crv2[][2],int nbez,double out[][2]){ double out6[DsizeS][6],tmpd[2],tmpd6[6]; int jj; - intersectcurvesPp(crv1,crv2,num,out6); + intersectcurvesPp(crv1,crv2,nbez,out6); out[0][0]=0; for(jj=1;jj<=length6(out6);jj++){ pull6(jj,out6,tmpd6);push2(tmpd6[0],tmpd6[1],out); diff --git a/Master/texmf-dist/scripts/ketcindy/ketlibC/ketcommonhead.h b/Master/texmf-dist/scripts/ketcindy/ketlibC/ketcommonhead.h index 7e83a2b9e83..7b22ddfba83 100644 --- a/Master/texmf-dist/scripts/ketcindy/ketlibC/ketcommonhead.h +++ b/Master/texmf-dist/scripts/ketcindy/ketlibC/ketcommonhead.h @@ -12,6 +12,7 @@ int addptd3(double gdata[][3], double pt[3]); int addptd4(double gdata[][4], double pt[4]); int addptd5(double gdata[][5], double pt[5]); int addptd6(double gdata[][6], double pt[6]); +int add1(double gdata[], double x); int add2(double gdata[][2], double x, double y); int add3(double gdata[][3], double x, double y, double z); int push2(double x, double y, double ptL[][2]); @@ -26,18 +27,29 @@ void pull5(int num, double ptL[][5],double pt[5]); void pull6(int num, double ptL[][6],double pt[6]); int appendd2(int level, int from,int upto, double gdata[][2],double mat[][2]); int appendd3(int level, int from,int upto, double gdata[][3],double mat[][3]); +int appendd6(int level, int from,int upto, double gdata[][6],double mat[][6]); int prependd2(int from,int upto, double gdata[][2],double mat[][2]); -int appendd1(double numvec[], double num); -int appendi1(int numvec[],int num); +int prependd3(int from,int upto, double gdata[][3],double mat[][3]); +int appendd1(double num,double numvec[]); +int prependd1(double num, double numvec[]); +int appendi1(int num,int numvec[]); int prependi1(int num, int numvec[]); int removei2(int nrmv,int mat[][2]); +void removed3(int nrmv,double mat[][3]); int dataindexi1(int out[],int din[][2]); int dataindexd1(double out[],int din[][2]); int dataindexd2(int level,double out[][2],int din[][2]); int dataindexd3(int level, double out[][3],int din[][2]); int dataindexd4(int level, double out[][4],int din[][2]); +int dataindexd6(int level, double out[][6],int din[][2]); +void replacelistd1(int ii,double out[],double rep[]); +void replacelistd2(int level,int jj,double out[][2],double rep[][2]); +void replacelistd3(int level,int jj,double out[][3],double rep[][3]); +void replacelistd6(int level,int ii,double out[][6],double rep[][6]); +void removelistd2(int level,int ii,double out[][2]); void dispvec(int n,double dt[]); void dispveci(int n,int dt[]); +void dispmatd1all(double dt[]); void dispmatd2(int from, int upto, double mat[][2]); void dispmatd3(int from, int upto, double mat[][3]); void dispmatd4(int from, int upto, double mat[][4]); @@ -50,7 +62,9 @@ void dispmatd5all(double mat[][5]); void dispmatd6all(double mat[][6]); void dispmati2(int from, int upto, int mat[][2]); void dispmati1(int from, int upto, int mat[]); +void writedata3(const char *fname, double out[][3]); void readdata3(const char *fname, double out[][3]); +void writedata2(const char *fname, double out[][2]); void readdata2(const char *fname, double out[][2]); int output2(const char *var, const char *fname, int level, double out[][2]); void simplesort(double number[]); @@ -64,6 +78,7 @@ void pointoncurve(double t, double gdata[][2], double eps, double pt[]); int partcrv(double a,double b,double pkL[][2], double pL[][2]); int partcrv3(double a,double b,double pkL[][3], double pL[][3]); int connectseg(double pdata[][2], double eps, double out[][2]); +int connectseg3(double pdata[][3], double eps, double out[][3]); void koutenseg(double a[2], double b[2], double c[2], double d[2], double eps, double eps2, double out[4]); double paramoncurve(double p[2], int n, double ptL[][2]); @@ -90,8 +105,8 @@ void intersectseg(double seg1[][2],double seg2[][2], double out[5]); int osplineseg(double ptlist[5][2],int num,double out[][2]); void intersectpartseg(double crv1[][2],double crv2[][2],int ii, int jj,int num,double out[6]); void collectsameseg(double ptdL[][6],double rL[][6]); -void intersectcurvesPp(double crv1s[][2],double crv2s[][2],int num,double out[][6]); -void intersectcurves(double crv1[][2],double crv2[][2],int num,double out[][2]); +void intersectcurvesPp(double crv1s[][2],double crv2s[][2],int nbez,double out[][6]); +void intersectcurves(double crv1[][2],double crv2[][2],int nbez,double out[][2]); const double Inf=99999; const int Infint=30000; diff --git a/Master/texmf-dist/scripts/ketcindy/ketlibC/ketlibClog.txt b/Master/texmf-dist/scripts/ketcindy/ketlibC/ketlibClog.txt new file mode 100644 index 00000000000..414cc1e0346 --- /dev/null +++ b/Master/texmf-dist/scripts/ketcindy/ketlibC/ketlibClog.txt @@ -0,0 +1,18 @@ +180613 + connectseg,connectseg3 changed ( for null data ) + output3h debugged (case where din1[0][0]==1) +180609 + crv3onsfparadata debugged ( case where curve has multi parts) + connectseg3 added +180601 + wireparadata changed (for cmdflg=1) + sfcutparadata changed ( for cmdflg=1) +180531 + outputend added + output3,output3h changed + readoutdata3 changed ( varname added ) + intersectcrvsf changed (ws added) +180530 + readoutdata3 added ( hidden data not included ) +180523 + crvsfparadata debugged (npar removed) diff --git a/Master/texmf-dist/scripts/ketcindy/ketlibC/surflib.h b/Master/texmf-dist/scripts/ketcindy/ketlibC/surflib.h index d9c0fbdc18c..7f5d9923c9a 100644 --- a/Master/texmf-dist/scripts/ketcindy/ketlibC/surflib.h +++ b/Master/texmf-dist/scripts/ketcindy/ketlibC/surflib.h @@ -1,19 +1,24 @@ -// 17.06.16 crvsfparadata changed ( num of devision ) +// 180430 +// crv2sfparadata,wireparadata added +// output3h,output3 chanded +// 180426 readdataC,writedataC changed +// 180420 newly rewrited +// 170616 crvsfparadata changed ( num of devision ) -int output3(const char *var, const char *fname, int level, double out[][3]){ - int nall=floor(out[0][0]+0.5), ndin, din[DsizeM][2],i,j,ctr; +int output3(short head, const char *wa,const char *var, const char *fname,double out[][3]){ + int din[DsizeS][2],i,j,ctr; double tmpd[3]; FILE *fp; - fp=fopen(fname,"w"); + fp=fopen(fname,wa); if (fp == NULL) { printf("cannot open\n"); return -1; -// exit(1); } - ndin=dataindexd3(level, out,din); - fprintf(fp,"%s//\n",var); //17.05.29 -// fprintf(fp,"%s3d//\n",var2); - for(i=1; i<=ndin; i++){ + dataindexd3(2, out,din); + if(head==1){ + fprintf(fp,"%s//\n",var); + } + for(i=1; i<=length2i(din); i++){ fprintf(fp,"start//\n"); fprintf(fp,"["); ctr=0; @@ -22,32 +27,31 @@ int output3(const char *var, const char *fname, int level, double out[][3]){ fprintf(fp,"[ %7.5f, %7.5f, %7.5f]",tmpd[0],tmpd[1],tmpd[2]); ctr++; if(ctr==5){ - fprintf(fp,"]//\n["); + fprintf(fp,"]//\n"); ctr=0; + if(j<din[i][1]){ + fprintf(fp,"["); + } }else{ if(j<din[i][1]){ fprintf(fp,","); + }else{ + fprintf(fp,"]//\n"); } } } - fprintf(fp,"]//\n"); - if(i<ndin){ - fprintf(fp,"end//\n"); - } - else{ - fprintf(fp,"end////\n"); - } + fprintf(fp,"end//\n"); } fclose(fp); return 0; } -int output3h(const char *var, const char *varh, const char *fname, double out[][3]){ +int output3h(const char *wa,const char *var, const char *varh, const char *fname, double out[][3]){ // 17.06.09 double out1[DsizeLL][3], tmpd[3]; int din1[DsizeM][2],din2[DsizeM][2], i, j,ctr; FILE *fp; - fp=fopen(fname,"w"); + fp=fopen(fname,wa); if (fp == NULL) { printf("cannot open\n"); return -1; @@ -81,7 +85,9 @@ int output3h(const char *var, const char *varh, const char *fname, double out[][ } out1[0][0]=0; fprintf(fp,"%s//\n",varh); //17.06.16from - appendd3(0, din1[2][0],din1[2][1],out,out1); + if(din1[0][0]>1){ //180613from + appendd3(0, din1[2][0],din1[2][1],out,out1); + }//180613to dataindexd3(2, out1,din2); for(i=1; i<=length2i(din2); i++){ fprintf(fp,"start//\n"); @@ -102,52 +108,54 @@ int output3h(const char *var, const char *varh, const char *fname, double out[][ } } fprintf(fp,"]//\n"); -// if(i<ndin2){ - fprintf(fp,"end//\n"); -// } -// else{ -// fprintf(fp,"end////\n"); -// } + fprintf(fp,"end//\n"); } - fprintf(fp,"//\n"); +// fprintf(fp,"//\n"); //180531 fclose(fp); return 0; } +void outputend(const char *fname){ + FILE *fp; + fp=fopen(fname,"a"); + fprintf(fp,"//\n"); + fclose(fp); +} + int writedataC(const char *fname, double out[][3]){ int i, nall; FILE *fp; nall=length3(out); + printf("123 %d\n",nall); fp=fopen(fname,"w"); for(i=1; i<=nall; i++){ - fprintf(fp,"%7.5f %7.5f %7.5f\n",out[i][0],out[i][1],out[i][2]); + fprintf(fp,"%7.5f %7.5f %7.5f %6s",out[i][0],out[i][1],out[i][2],"-99999"); + if(i<nall){ + fprintf(fp,"\n"); + }; } - fprintf(fp,"%7.5f %7.5f %7.5f\n",Inf,Inf,Inf); fclose(fp); return nall; } int readdataC(const char *fname, double data[][3]){ int i, j, ndata=0; + double tmpd4[4]; FILE *fp; fp=fopen(fname,"r"); if(fp==NULL){ printf("file not found\n"); return 1; } + data[0][0]=0; while( ! feof(fp) && ndata<DsizeL){ - ndata++; - for(j=0;j<=2;j++){ - fscanf(fp,"%lf",&data[ndata][j]); - } - if(data[ndata][1]==Inf){ - ndata--; - break; + for(j=0;j<=3;j++){ + fscanf(fp,"%lf",&tmpd4[j]); } + push3(tmpd4[0],tmpd4[1],tmpd4[2],data); } fclose(fp); - data[0][0]=ndata; - return ndata; + return length3(data); } void parapt(double pt3[3],double pt2[2]){ @@ -160,6 +168,12 @@ void parapt(double pt3[3],double pt2[2]){ } } +double zparapt(double p[3]){ + double x=p[0], y=p[1], z=p[2], out; + out=x*cos(PHI)*sin(THETA)+y*sin(PHI)*sin(THETA)+z*cos(THETA); + return out; +} + int projpara(double p3[][3], double p2[][2]){ double pt3[3], pt2[2]; int i, nall, nall2; @@ -198,67 +212,17 @@ double invparapt(double ph, double fh[][2], double fk[][3],double out[3]){ return n+s0; } -int surfcurve(short ch,int level, double crv[][2], double pdata[][3]){ - double p2[2], pt[3]; - int i, n, nall; - n=length2(crv); +void surfcurve(short ch,double crv[][2], double pdata[][3]){ + double pd2[2], pt[3]; + int i; pdata[0][0]=0; - for(i=1; i<=n; i++){ - pull2(i,crv,p2); - surffun(ch,p2[0],p2[1],pt); - nall=addptd3(pdata,pt); + for(i=1; i<=length2(crv); i++){ + pull2(i,crv,pd2); + surffun(ch,pd2[0],pd2[1],pt); + addptd3(pdata,pt); } - return nall; } -int xyzax3data(double x0, double x1, double y0, double y1, double z0, double z1, - double out[][3]){ - int nall; - double pd3[10][3]; - out[0][0]=0; nall=0; - pd3[0][0]=2; - pd3[1][0]=x0; pd3[1][1]=0; pd3[1][2]=0; - pd3[2][0]=x1; pd3[2][1]=0; pd3[2][2]=0; - nall=appendd3(2,1,2,pd3,out); - pd3[1][0]=0; pd3[1][1]=y0; pd3[1][2]=0; - pd3[2][0]=0; pd3[2][1]=y1; pd3[2][2]=0; - nall=appendd3(2,1,2,pd3,out); - pd3[1][0]=0; pd3[1][1]=0; pd3[1][2]=z0; - pd3[2][0]=0; pd3[2][1]=0; pd3[2][2]=z1; - nall=appendd3(2,1,2,pd3,out); - return nall; -} - -void evlptablepara(short ch){ - int i, j; - double u,v,u1,u2,v1,v2,pt1[3],pt2[3],pt2d1[2],pt2d2[2],dxu,dyu,dxv,dyv; - double du=(Urng[1]-Urng[0])/Mdv, dv=(Vrng[1]-Vrng[0])/Ndv; - double eps=0.00001; - for (j= 0; j < Ndv+1; j++) { - v=Vrng[0]+j*dv; - v1=v-eps/2; v2=v+eps/2; - for (i = 0; i < Mdv+1; i++) { - u=Urng[0]+i*du; - u1=u-eps/2; u2=u+eps/2; - surffun(ch,u1,v,pt1); parapt(pt1,pt2d1); - surffun(ch,u2,v,pt2); parapt(pt2,pt2d2); - dxu=(pt2d2[0]-pt2d1[0])/eps; - dyu=(pt2d2[1]-pt2d1[1])/eps; - surffun(ch,u,v1,pt1); parapt(pt1,pt2d1); - surffun(ch,u,v2,pt2); parapt(pt2,pt2d2); - dxv=(pt2d2[0]-pt2d1[0])/eps; - dyv=(pt2d2[1]-pt2d1[1])/eps; - Zval[j][i]=dxu*dyv-dxv*dyu; - } - } - for (i = 0; i < Mdv+1; i++) { - Xval[i]=Urng[0]+i*du; - } - for (j= 0; j < Ndv+1; j++) { - Yval[j]=Vrng[0]+j*dv; - } -}; - double evlpfun(short ch, double u, double v){ double u1,u2,v1,v2,pt1[3],pt2[3],pt2d1[2],pt2d2[2],dxu,dyu,dxv,dyv; double du=(Urng[1]-Urng[0])/Mdv, dv=(Vrng[1]-Vrng[0])/Ndv; @@ -285,7 +249,7 @@ int envelopedata(short ch, double out[][2]){ double uval1,uval2,vval1,vval2,eval11,eval12,eval21,eval22; double pl[5][2], vl[5], ql[11][2], out2[DsizeM][2]; double du=(Urng[1]-Urng[0])/Mdv; - double dv=(Vrng[1]-Vrng[0])/Mdv; + double dv=(Vrng[1]-Vrng[0])/Ndv; //180427 ctr=0; for (j = 0; j < Ndv; j++) { vval1=Vrng[0]+j*dv; @@ -351,67 +315,6 @@ int envelopedata(short ch, double out[][2]){ return nall; } -/* - -int implicitplot(double out[][2]){ - int i, j, k, ctrq=0,ctr, nall; - double pl[5][2], vl[5], ql[11][2], out2[DsizeM][2]; - ctr=0; - for (j = 0; j < Ndv; j++) { - for (i = 0; i < Mdv; i++) { - pl[0][0]=Xval[i]; pl[0][1]=Yval[j]; vl[0]=Zval[j][i]; - pl[1][0]=Xval[i+1]; pl[1][1]=Yval[j]; vl[1]=Zval[j][i+1]; - pl[2][0]=Xval[i+1]; pl[2][1]=Yval[j+1]; vl[2]=Zval[j+1][i+1]; - pl[3][0]=Xval[i]; pl[3][1]=Yval[j+1]; vl[3]=Zval[j+1][i]; - pl[4][0]=Xval[i]; pl[4][1]=Yval[j]; vl[4]=Zval[j][i]; - ctrq=0; - for (k = 0; k < 4; k++) { - if(fabs(vl[k])<=Eps){ - ql[ctrq][0]=pl[k][0]; - ql[ctrq][1]=pl[k][1]; - ctrq++; - } - else if(vl[k]>Eps){ - if(vl[k+1]< -Eps){ - ql[ctrq][0]=1/(vl[k]-vl[k+1])*(-vl[k+1]*pl[k][0]+vl[k]*pl[k+1][0]); - ql[ctrq][1]=1/(vl[k]-vl[k+1])*(-vl[k+1]*pl[k][1]+vl[k]*pl[k+1][1]); - ctrq++; - } - } - else{ - if(vl[k+1]>Eps){ - ql[ctrq][0]=1/(-vl[k]+vl[k+1])*(vl[k+1]*pl[k][0]-vl[k]*pl[k+1][0]); - ql[ctrq][1]=1/(-vl[k]+vl[k+1])*(vl[k+1]*pl[k][1]-vl[k]*pl[k+1][1]); - ctrq++; - } - } - } - if(ctrq==2){ - if(ctr>0){ - ctr++; - out[ctr][0]=Inf; - out[ctr][1]=2; // 2 <- 0 ? - } - ctr++; - out[ctr][0]=ql[0][0]; - out[ctr][1]=ql[0][1]; - ctr++; - out[ctr][0]=ql[1][0]; - out[ctr][1]=ql[1][1]; - } - } - } - out[0][0]=ctr; - if(ctr>0){ - nall=connectseg(out, Eps, out2); - out[0][0]=0; - nall=appendd2(2,1,nall,out2,out); - } - return nall; -} - -*/ - int cuspsplitpara(short ch,double pdata[][2], double outkL[][3]){ int i, j, ng, n, nd, ndd, ndrop, is, ncusp=0, ncusppt,st, en, npk,nph, cflg; int cusp[DsizeM], cuspflg; @@ -508,24 +411,24 @@ int cuspsplitpara(short ch,double pdata[][2], double outkL[][3]){ ntmp=trunc((i+j)*0.5); i=j; if(cusp[0]==0){ - ncusp=appendi1(cusp,ntmp); + ncusp=appendi1(ntmp,cusp); } else{ - ncusp=appendi1(cusp,ntmp); + ncusp=appendi1(ntmp,cusp); } } } } if(cflg==0){ ncusp=prependi1(1,cusp); - ncusp=appendi1(cusp,nph); + ncusp=appendi1(nph,cusp); } else if(ncusp==0){ ncusp=prependi1(1,cusp); - ncusp=appendi1(cusp,nph); + ncusp=appendi1(nph,cusp); } else if(cusp[1]==1){ - ncusp=appendi1(cusp,nph); + ncusp=appendi1(nph,cusp); } else{ ntmp=cusp[1]; @@ -543,7 +446,7 @@ int cuspsplitpara(short ch,double pdata[][2], double outkL[][3]){ for(i=1; i<=cusp[0]; i++){ cusp[i]=cusp[i]-ntmp+1; } - ncusp=appendi1(cusp,nph); + ncusp=appendi1(nph,cusp); } if(ncusp==2){ pull2(nph,pth,tmp); @@ -579,7 +482,7 @@ int cuspsplitpara(short ch,double pdata[][2], double outkL[][3]){ ntmp=appendd3(0,din[i][0],din[i][1],outkL,tmp3d); tmpnum[0]=0; ntmpnum=0; for(j=dind[i][0]; j<=dind[i][1]; j++){ - ntmpnum=appendi1(tmpnum,drop[j]); + ntmpnum=appendi1(drop[j],tmpnum); } tmp3d1[0][0]=0; ntmp1=0; for(j=1; j<=ntmpnum; j++){ @@ -639,32 +542,32 @@ int makexybdy(short ch,double ehL[][2]){ } void partitionseg(double fig[][2],double gL[][2], int ns, double parL[]){ - int ii,jj,kk,n,din[DsizeM][2],din2[DsizeM][2]; + int ii,jj,kk,n,din[DsizeM][2]; double eps0=pow(10,-5.0),tmpd4[4], tmpd6[6],tmp,tmp2; double p[2], q[2], pd3[3], ans[4], tmp1d1[DsizeM], tmp2d1[DsizeM]; double other[DsizeM], g[DsizeM][2], kouL[DsizeS][4],kouL6[DsizeS][6]; - if(ns>1){ + if(ns>0){ dataindexd1(Otherpartition,din); other[0]=0; for(ii=din[ns][0]; ii<=din[ns][1]; ii++){ - appendd1(other,Otherpartition[ii]); + appendd1(Otherpartition[ii],other); } }else{ other[0]=0; } parL[0]=0; - appendd1(parL,1); - appendd1(parL,length2(fig)); + appendd1(1,parL); + appendd1(length2(fig),parL); if(length1(other)>0){ for(ii=1; ii<=length1(other); ii++){ - appendd1(parL,other[ii]); + appendd1(other[ii],parL); } } dataindexd2(2,gL,din); - for(n=ns; n<=din[0][0]; n++){ + for(n=fmax(ns,1); n<=din[0][0]; n++){ g[0][0]=0; appendd2(2,din[n][0],din[n][1],gL,g); - intersectcurvesPp(fig,g,20,kouL6); + intersectcurvesPp(fig,g,20,kouL6); kouL[0][0]=0; for(ii=1;ii<=length6(kouL6);ii++){ pull6(ii,kouL6,tmpd6); @@ -675,58 +578,42 @@ void partitionseg(double fig[][2],double gL[][2], int ns, double parL[]){ pull4(jj,kouL,tmpd4); tmp=tmpd4[2]; if((tmp>1+Eps)&&(tmp<length2(fig)-Eps)){ - appendd1(tmp1d1,tmp); + appendd1(tmp,tmp1d1); } tmp=tmpd4[3]; if((tmp>1+Eps)&&(tmp<length2(g)-Eps)){ - appendd1(tmp2d1,tmp); + appendd1(tmp,tmp2d1); } } for(jj=1;jj<=length1(tmp1d1);jj++){ - appendd1(parL,tmp1d1[jj]); + appendd1(tmp1d1[jj],parL); } if((ns>0)&&(n>ns)&&(length1(tmp2d1)>0)){ dataindexd1(Otherpartition,din); tmp1d1[0]=0; - for(ii=1;ii<=length2i(din);ii++){ - if(ii==n){ - for(kk=1;kk<=length1(tmp2d1);kk++){ - appendd1(tmp1d1,tmp2d1[kk]); - } - } - for(jj=din[ii][0]; jj<=din[ii][1];jj++){ - appendd1(tmp1d1,Otherpartition[jj]); - } - if(ii<length2i(din)){ - appendd1(tmp1d1,Inf); - } - } - } - dataindexd1(tmp1d1,din); - Otherpartition[0]=0; - for(ii=1;ii<=length2i(din);ii++){ - for(jj=din[ii][0];jj<=din[ii][1];jj++){ - appendd1(Otherpartition,tmp1d1[jj]); + for(jj=din[n][0];jj<=din[n][1];jj++){ + appendd1(Otherpartition[jj],tmp1d1); } + replacelistd1(n,Otherpartition,tmp2d1); } } simplesort(parL); tmp1d1[0]=0; for(ii=1;ii<=length1(parL);ii++){ - appendd1(tmp1d1,parL[ii]); + appendd1(parL[ii],tmp1d1); } parL[0]=0; tmp2=-1; for(jj=1;jj<=length1(tmp1d1);jj++){ tmp=tmp1d1[jj]; if(fabs(tmp-tmp2)>Eps1){ - appendd1(parL,tmp); + appendd1(tmp,parL); tmp2=tmp; } } } -double funpthiddenQ(short ch,double u, double v, double pa[3]){ +double funpthiddenQ(short ch,double u, double v,double pa[3]){ double Vec[3]={sin(THETA)*cos(PHI),sin(THETA)*sin(PHI),cos(THETA)}; double eps0=pow(10,-4.0)*(XMAX-XMIN)/10, pt[3], out; surffun(ch,u, v, pt); @@ -739,248 +626,120 @@ double funpthiddenQ(short ch,double u, double v, double pa[3]){ return out; } -void makevaltable(double pta[3]){ - double eps0=pow(10,-6.0), u, v, du, dv, p[3]; - int i, j, nx=0, ny=0; ; - du=(Urng[1]-Urng[0])/Mdv; - dv=(Vrng[1]-Vrng[0])/Ndv; - for(j=0; j<=Ndv; j++){ - v=Vrng[0]+j*dv; - for(i=0; i<=Mdv; i++){ - u=Urng[0]+i*du; - Zval[j][i]=funpthiddenQ(Ch,u, v, pta); - } - } - for(i=0; i<=Mdv; i++){ - Xval[i]=Urng[0]+i*du; - } - for(j=0; j<=Ndv; j++){ - Yval[j]=Vrng[0]+j*dv; - } -} - -int pthiddenQ(short ch,double pta[3], int uveq, double eps[2]){ - int i, j, k, out, nqL, nsL, nptL, flg, nxt; +double pthiddenQ(short ch,double pta[3], int uveq){ + int i, j, k; double Vec[3]={sin(THETA)*cos(PHI),sin(THETA)*sin(PHI),cos(THETA)}; - double eps0, epspt, vec1[3], po[3]={0,0,0}, tmpd1, tmp1d1, tmp2d1, m1, m2; - double tmp3d1, tmp4d1, tmp5d1, tmp6d1, tmpd3[3], v1, v2, v3; - double tmpd2[2], p1[2], p2[2], ptuv[2], puv1[2], puv2[2]; - double p1d3[3], p2d3[3], ptd3[3]; - double ptL[DsizeM][6], sL[DsizeM][7], qL[DsizeM][2], pL[5][2], vL[5]; + double v1,v2,v3,out=-Inf; + double du=(Urng[1]-Urng[0])/Mdv, dv=(Vrng[1]-Vrng[0])/Ndv; + double uval1,uval2,vval1,vval2,eval11,eval12,eval21,eval22; + double pl[5][2], vl[5], ql[11][2],p1[2],p2[2],m1,m2; + double ptuv[2], puv1[2], puv2[2],p1d3[3], p2d3[3], ptd3[3]; + double tmpd1, tmpd2[2],tmpd3[3],tmp1d3[3]; // Out=1 : hidden // SL : List of segments near PtA+Vec - eps0=pow(10,-4.0)*(XMAX-XMIN)/10.0; - epspt=eps[0]*(XMAX-XMIN)/10.0; - out=0; - po[0]=0; po[1]=0; po[2]=0; - tmpd1=1/dist(3,Vec,po); - vec1[0]=tmpd1*Vec[0]; - vec1[1]=tmpd1*Vec[1]; - vec1[2]=tmpd1*Vec[2]; - nptL=0; - makevaltable(pta); - nsL=0; for(j=0; j<=Ndv-1; j++){ + vval1=Vrng[0]+j*dv; + vval2=Vrng[0]+(j+1)*dv; + uval1=Urng[0]; + eval11=funpthiddenQ(ch,uval1,vval1,pta); + eval12=funpthiddenQ(ch,uval1,vval2,pta); for(i=0; i<=Mdv-1; i++){ - pL[0][0]=Xval[i]; pL[0][1]=Yval[j]; vL[0]=Zval[j][i]; - pL[1][0]=Xval[i+1]; pL[1][1]=Yval[j]; vL[1]=Zval[j][i+1]; - pL[2][0]=Xval[i+1]; pL[2][1]=Yval[j+1]; vL[2]=Zval[j+1][i+1]; - pL[3][0]=Xval[i]; pL[3][1]=Yval[j+1]; vL[3]=Zval[j+1][i]; - pL[4][0]=Xval[i]; pL[4][1]=Yval[j]; vL[4]=Zval[j][i]; - qL[0][0]=0; nqL=0; + uval2=Urng[0]+(i+1)*du; + eval21=funpthiddenQ(ch,uval2,vval1,pta); + eval22=funpthiddenQ(ch,uval2,vval2,pta); + pl[0][0]=uval1; pl[0][1]=vval1; vl[0]=eval11; + pl[1][0]=uval2; pl[1][1]=vval1; vl[1]=eval21; + pl[2][0]=uval2; pl[2][1]=vval2; vl[2]=eval22; + pl[3][0]=uval1; pl[3][1]=vval2; vl[3]=eval12; + pl[4][0]=uval1; pl[4][1]=vval1; vl[4]=eval11; + ql[0][0]=0; for(k=0; k<=3; k++){ - p1[0]=pL[k][0]; p1[1]=pL[k][1]; - p2[0]=pL[k+1][0]; p2[1]=pL[k+1][1]; - m1=vL[k]; m2=vL[k+1]; - if((m1>=eps0)&&(m2>=eps0)){ + pull2(k,pl,p1); + pull2(k+1,pl,p2); + m1=vl[k]; m2=vl[k+1]; + if(fabs(m1)<Eps){ + addptd2(ql, p1); continue; } - if((m1<=-eps0)&&(m2<=-eps0)){ + if(fabs(m2)<Eps){ continue; } - if(fabs(m1)<eps0){ - tmpd2[0]=p1[0]; tmpd2[1]=p1[1]; - } - else if(fabs(m2)<eps0){ + if((m1>0)&&(m2>0)){ continue; } - else{ - tmpd2[0]=1/(m1-m2)*(-m2*p1[0]+m1*p2[0]); - tmpd2[1]=1/(m1-m2)*(-m2*p1[1]+m1*p2[1]); + if((m1< 0)&&(m2< 0)){ + continue; } - nqL++; - qL[nqL][0]=tmpd2[0]; qL[nqL][1]=tmpd2[1]; + tmpd2[0]=1/(m1-m2)*(-m2*p1[0]+m1*p2[0]); + tmpd2[1]=1/(m1-m2)*(-m2*p1[1]+m1*p2[1]); + addptd2(ql, tmpd2); } - if(nqL==2){ - puv1[0]=qL[1][0]; puv1[1]=qL[1][1]; - puv2[0]=qL[2][0]; puv2[1]=qL[2][1]; + uval1=uval2; + eval11=eval21; + eval12=eval22; + if(length2(ql)==2){ + puv1[0]=ql[1][0]; puv1[1]=ql[1][1]; + puv2[0]=ql[2][0]; puv2[1]=ql[2][1]; surffun(ch,puv1[0],puv1[1],p1d3); surffun(ch,puv2[0],puv2[1],p2d3); - if(dist(2,p1d3,p2d3)<eps0){ - continue; - } - tmp1d1=dist(3,p1d3,pta); - tmpd3[0]=p1d3[0]-pta[0]; - tmpd3[1]=p1d3[1]-pta[1]; - tmpd3[2]=p1d3[2]-pta[2]; - tmp2d1=dotprod(3,tmpd3,vec1); - tmp3d1=sqrt(fabs(pow(tmp1d1,2.0)-pow(tmp2d1,2.0))); - tmp4d1=dist(3,p2d3, pta); - tmpd3[0]=p2d3[0]-pta[0]; - tmpd3[1]=p2d3[1]-pta[1]; - tmpd3[2]=p2d3[2]-pta[2]; - tmp5d1=dotprod(3,tmpd3,vec1); - tmp6d1=sqrt(fabs(pow(tmp4d1,2.0)-pow(tmp5d1,2.0))); - if(tmp2d1<tmp5d1){ - tmpd3[0]=p1d3[0]; tmpd3[1]=p1d3[1]; tmpd3[2]=p1d3[2]; - p1d3[0]=p2d3[0]; p1d3[1]=p2d3[1]; p1d3[2]=p2d3[2]; - p2d3[0]=tmpd3[0]; p2d3[1]=tmpd3[1]; p2d3[2]=tmpd3[2]; - tmpd1=tmp2d1; tmp2d1=tmp5d1; tmp5d1=tmpd1; - tmpd1=tmp3d1; tmp3d1=tmp6d1; tmp6d1=tmpd1; - } - if((tmp3d1<eps[1]*epspt)&&(tmp6d1<eps[1]*epspt)){ - if(tmp2d1>-eps0){ - if(tmp5d1<-eps0){ - nsL++; - sL[nsL][0]=p1d3[0]; sL[nsL][1]=p1d3[1]; sL[nsL][2]=p1d3[2]; - sL[nsL][3]=p2d3[0]; sL[nsL][4]=p2d3[1]; sL[nsL][5]=p2d3[2]; - sL[nsL][6]=-1; - } - else{ - nsL++; - sL[nsL][0]=p1d3[0]; sL[nsL][1]=p1d3[1]; sL[nsL][2]=p1d3[2]; - sL[nsL][3]=p2d3[0]; sL[nsL][4]=p2d3[1]; sL[nsL][5]=p2d3[2]; - sL[nsL][6]=1; - } - } - } - v1=vec1[0]; v2=vec1[1]; v3=vec1[2]; - if(fabs(v1)>eps0){ + v1=Vec[0]; v2=Vec[1]; v3=Vec[2]; + if(fabs(v1)>Eps){ m1=pta[2]+v3/v1*(p1d3[0]-pta[0])-p1d3[2]; m2=pta[2]+v3/v1*(p2d3[0]-pta[0])-p2d3[2]; - } - else if(fabs(v2)>eps0){ + }else if(fabs(v2)>Eps){ m1=pta[2]+v3/v2*(p1d3[1]-pta[1])-p1d3[2]; m2=pta[2]+v3/v2*(p2d3[1]-pta[1])-p2d3[2]; - } - else{ + }else{ m1=pta[1]-p1d3[1]; - m2=pta[1]-p2d3[1]; + m2=pta[1]-p2d3[2]; } - if(m1*m2>=0){ - if(((m1>eps0)&&(m2>eps0))||((m1<-eps0)&&(m2<-eps0))){ + if(m1*m2>= 0){ + if(((m1>0) && (m2>0)) || ((m1< 0) && (m2< 0))){ continue; } - if(fabs(m1)<=eps0){ - ptd3[0]=p1d3[0]; ptd3[1]=p1d3[1]; ptd3[2]=p1d3[2]; + if(m1==0){ + ptd3[0]=p1d3[0]; ptd3[1]=p1d3[1]; ptd3[2]=p1d3[2]; ptuv[0]=puv1[0]; ptuv[1]=puv1[1]; - } - else{ - ptd3[0]=p2d3[0]; ptd3[1]=p2d3[1]; ptd3[2]=p2d3[2]; + }else{ + ptd3[0]=p2d3[0]; ptd3[1]=p2d3[1]; ptd3[2]=p2d3[2]; ptuv[0]=puv2[0]; ptuv[1]=puv2[1]; } - } - else{ + }else{ ptd3[0]=1/(m1-m2)*(-m2*p1d3[0]+m1*p2d3[0]); ptd3[1]=1/(m1-m2)*(-m2*p1d3[1]+m1*p2d3[1]); ptd3[2]=1/(m1-m2)*(-m2*p1d3[2]+m1*p2d3[2]); - ptuv[0]=1/(m1-m2)*(-m2*puv1[0]+m1*puv2[1]); + ptuv[0]=1/(m1-m2)*(-m2*puv1[0]+m1*puv2[0]); + ptuv[1]=1/(m1-m2)*(-m2*puv1[1]+m1*puv2[1]); } tmpd3[0]=ptd3[0]-pta[0]; - tmpd3[1]=ptd3[1]-pta[1]; + tmpd3[1]=ptd3[1]-pta[1]; tmpd3[2]=ptd3[2]-pta[2]; - tmp1d1=dotprod(3,tmpd3,vec1); - tmp2d1=fabs(tmp1d1); - tmpd3[0]=p1d3[0]-p2d3[0]; - tmpd3[1]=p1d3[1]-p2d3[1]; - tmpd3[2]=p1d3[2]-p2d3[2]; - tmp3d1=dotprod(3,tmpd3,vec1); - tmp4d1=dist(3,p1d3,p2d3); - tmp6d1=tmp3d1/tmp4d1; - if(tmp1d1>eps0){ - if(fabs(tmp6d1)>0.75){ - nptL++; - ptL[nptL][0]=ptd3[0]; ptL[nptL][1]=ptd3[1]; ptL[nptL][2]=ptd3[2]; - ptL[nptL][3]=p2d3[0]; ptL[nptL][4]=p2d3[1]; ptL[nptL][5]=p2d3[2]; - continue; - } - if(tmp2d1>epspt){ - return 1; - } - if(tmp2d1<2*epspt){ - continue; + crossprod(3,tmpd3,Vec, tmp1d3); + if(norm(3,tmp1d3)<Eps1){ + tmpd1=zparapt(ptd3)-zparapt(pta)-Eps2; + if(tmpd1>0){ + return tmpd1; + }else{ + out=fmax(out,tmpd1); } } } } } - if(nptL==0){ - return 0; - } - for(i=1; i<=nsL; i++){ - p2d3[0]=sL[i][3]; p2d3[1]=sL[i][4]; p2d3[2]=sL[i][5]; - flg=0; - for(j=1; j<=nsL; j++){ - p1d3[0]=sL[j][0]; p1d3[1]=sL[j][1]; p1d3[2]=sL[j][2]; - if(dist(3,p1d3,p2d3)<eps0){ - sL[i][6]=j; - flg=1; - break; - } - } - if((flg==0)&&(sL[i][6]>0)){ - sL[i][6]=-2; - } - } - for(i=1; i<=nptL; i++){ - p2d3[0]=ptL[i][3]; p2d3[1]=ptL[i][4]; p2d3[2]=ptL[i][5]; - flg=0; - for(j=1; j<=nsL; j++){ - p1d3[0]=sL[j][0]; p1d3[1]=sL[j][1]; p1d3[2]=sL[j][2]; - if(dist(3,p1d3,p2d3)<eps0){ - flg=1; - break; - } - } - if(flg==0){ - ptd3[0]=ptL[i][0]; ptd3[1]=ptL[i][1]; ptd3[2]=ptL[i][2]; - tmpd1=dist(3,p2d3,ptd3); - tmpd3[0]=p2d3[0]-ptd3[0]; - tmpd3[1]=p2d3[1]-ptd3[1]; - tmpd3[2]=p2d3[2]-ptd3[2]; - tmp1d1=fabs(dotprod(3,tmpd3,vec1)); - tmp2d1=sqrt(fabs(pow(tmpd1,2.0)-pow(tmp1d1,2.0))); - tmp3d1=tmp2d1*dist(3,ptd3,pta)/tmpd1; - if(tmp3d1>epspt/5){ - return 1; - } - else{ - continue; - } - } - nxt=sL[j][6]; - while(nxt>0){ - ptd3[0]=sL[nxt][3]; ptd3[1]=sL[nxt][4]; ptd3[2]=sL[nxt][5]; - nxt=sL[nxt][6]; - } - if(nxt==-2){ - return 1; - } - else{ - out=0; - } - } return out; } -int nohiddenpara2(double paL[], double fk[][3], int uveq, double figkL[][3]){ - double eps0=pow(10,-5.0), s, p1[2], p2[2], q[2],tmpd1, tmpd2[2], epstmp[2]; - double fh[DsizeM][2], pta[3], ptap[2], vec[3]; +int nohiddenpara2(short ch,double par[], double fk[][3], int uveq, double figkL[][3]){ + double eps0=pow(10,-4.0), s, p1[2], p2[2], q[2],tmpd1, tmpd2[2],tmp1,tmp2; + double paL[DsizeM], fh[DsizeM][2], pta[3], ptap[2], vec[3],flgd; double figL[DsizeM][2], tmpmd2[DsizeM][2], tmpmd3[DsizeM][3]; double tmp1d2[2], tmp2d2[2], tmp3d2[2], tmpd3[3],tmpd4[4]; double pd2[2], qd2[2], pd3[3], qd3[3], sp, sq, tp, tq, dtmp, dtmp1, dtmp2; - int ncusp=floor(Cusppt[0][0]+0.5), seL[DsizeM], npaL=floor(paL[0]+0.5); - int i, n, nfh, nfk, nfigL, nfigkL, nhidden, cspflg, nseL=0, ntmp, flg, tmpi1[DsizeM]; + int ncusp=floor(Cusppt[0][0]+0.5), seL[DsizeM]; + int i,j,n, nfh, nfk, cspflg,tmpi1[DsizeM]; + vec[0]=sin(THETA)*cos(PHI); + vec[1]=sin(THETA)*sin(PHI); + vec[2]=cos(THETA); nfk=length3(fk); nfh=projpara(fk, fh); pull2(1,fh,p1); @@ -1007,30 +766,34 @@ int nohiddenpara2(double paL[], double fk[][3], int uveq, double figkL[][3]){ continue; } } - seL[0]=0; nseL=0; - for(n=1; n<=npaL-1; n++){ - s=(paL[n]+paL[n+1])/2.0; - ntmp=invparapt(s,fh,fk, pta); + paL[0]=0; + tmp2=-1; + for(j=1;j<=length1(par)-1;j++){ + tmp1=par[j]; + if(fabs(tmp1-tmp2)>Eps){ + add1(paL,tmp1); + tmp2=tmp1; + } + } + tmp1=paL[length1(paL)]; + tmp2=par[length1(par)]; + if(fabs(tmp1-tmp2)<Eps){ + paL[length1(paL)]=tmp2; + }else{ + add1(paL,tmp2); + } + seL[0]=0; + for(n=1; n<=length1(paL)-1; n++){ + s=(paL[n]+paL[n+1])/2.0; + invparapt(s,fh,fk, pta); parapt(pta,ptap); - epstmp[0]=Eps1; epstmp[1]=1; - if((n==1)&&(cspflg % 2==0)){ - pull2(1,fh,p1); - dtmp=fmin(Eps1*dist(2,ptap, p1),Eps1); - epstmp[0]=dtmp; epstmp[1]=1; - } - if((n==npaL-1)&&(cspflg % 3==0)){ - pull2(nfh,fh,p1); - dtmp=fmin(Eps1*dist(2, ptap, p1), Eps1); - epstmp[0]=dtmp; epstmp[1]=1; - } - flg=pthiddenQ(Ch,pta, uveq, epstmp); - if(flg==0){ - nseL=appendi1(seL,n); + flgd=pthiddenQ(ch,pta, uveq); + if(flgd<=0){ //180518 + appendi1(n,seL); } } - figL[0][0]=0; nfigL=0; - figkL[0][0]=0; nfigkL=0; - for(i=1; i<=nseL; i++){ + figL[0][0]=0;figkL[0][0]=0; + for(i=1; i<=seL[0]; i++){ pointoncurve(paL[seL[i]], fh, Eps, tmp1d2); pointoncurve(paL[seL[i]+1], fh, Eps, tmp2d2); if(i==1){ @@ -1045,12 +808,12 @@ int nohiddenpara2(double paL[], double fk[][3], int uveq, double figkL[][3]){ sq=paL[seL[i]+1]; } else{ - ntmp=partcrv(sp,sq,fh,tmpmd2); - nfigL=appendd2(2,1,ntmp,tmpmd2,figL); + partcrv(sp,sq,fh,tmpmd2); + appendd2(2,1,length2(tmpmd2),tmpmd2,figL); tp=invparapt(sp,fh,fk, tmpd3); tq=invparapt(sq,fh,fk,tmpd3); - ntmp=partcrv3(tp,tq,fk,tmpmd3); - nfigkL=appendd3(2,1,ntmp,tmpmd3,figkL); + partcrv3(tp,tq,fk,tmpmd3); + appendd3(2,1,length3(tmpmd3),tmpmd3,figkL); copyd(0,1,tmp1d2,pd2); sp=paL[seL[i]]; copyd(0,1,tmp2d2,qd2); @@ -1058,34 +821,34 @@ int nohiddenpara2(double paL[], double fk[][3], int uveq, double figkL[][3]){ } } } - if(nseL>0){ + if(seL[0]>0){ if(dist(2,pd2,qd2)>Eps1){ nearestptpt(pd2,fh,tmpd4); dtmp1=tmpd4[2]; nearestptpt(qd2,fh,tmpd4); dtmp2=tmpd4[2]; - ntmp=partcrv(dtmp1,dtmp2,fh,tmpmd2); - nfigL=appendd2(2,1,ntmp,tmpmd2,figL); + partcrv(dtmp1,dtmp2,fh,tmpmd2); + appendd2(2,1,length2(tmpmd2),tmpmd2,figL); tp=invparapt(sp,fh,fk,tmpd3); tq=invparapt(sq,fh,fk,tmpd3); - ntmp=partcrv3(tp,tq,fk,tmpmd3); - nfigkL=appendd3(2,1,ntmp, tmpmd3, figkL); + partcrv3(tp,tq,fk,tmpmd3); + appendd3(2,1,length3(tmpmd3), tmpmd3, figkL); } else{ - nfigL=appendd2(2,1,nfh, fh, figL); - nfigkL=appendd3(2,1,nfk,fk,figkL); + appendd2(2,1,nfh, fh, figL); + appendd3(2,1,nfk,fk,figkL); } } - tmpi1[0]=0; ntmp=0; - for(i=1; i<=npaL-1; i++){ + tmpi1[0]=0; + for(i=1; i<=length1(paL)-1; i++){ if(memberi(i,seL)==0){ - ntmp=appendi1(tmpi1,i); + appendi1(i,tmpi1); } } - copyi(0,ntmp,tmpi1,seL); - seL[0]=ntmp; nseL=ntmp; - Hiddendata[0][0]=0; nhidden=0; - for(i=1; i<=nseL; i++){ + copyi(0,tmpi1[0],tmpi1,seL); + seL[0]=tmpi1[0]; + Hiddendata[0][0]=0; + for(i=1; i<=seL[0]; i++){ dtmp=paL[seL[i]]; pointoncurve(dtmp,fh,Eps,tmp1d2); dtmp=paL[seL[i]+1]; @@ -1104,8 +867,8 @@ int nohiddenpara2(double paL[], double fk[][3], int uveq, double figkL[][3]){ else{ tp=invparapt(sp,fh,fk,tmpd3); tq=invparapt(sq,fh,fk,tmpd3); - ntmp=partcrv3(tp,tq,fk,tmpmd3); - nhidden=appendd3(2,1,ntmp,tmpmd3,Hiddendata); + partcrv3(tp,tq,fk,tmpmd3); + appendd3(2,1,length3(tmpmd3),tmpmd3,Hiddendata); copyd(0,1,tmp1d2,pd2); sp=paL[seL[i]]; copyd(0,1,tmp2d2,qd2); @@ -1113,106 +876,108 @@ int nohiddenpara2(double paL[], double fk[][3], int uveq, double figkL[][3]){ } } } - if(nseL>0){ + if(seL[0]>0){ if(dist(2,pd2,qd2)>Eps1){ tp=invparapt(sp,fh,fk,tmpd3); tq=invparapt(sq,fh,fk,tmpd3); - ntmp=partcrv3(tp,tq,fk,tmpmd3); - nhidden=appendd3(2,1,ntmp,tmpmd3,Hiddendata); + partcrv3(tp,tq,fk,tmpmd3); + appendd3(2,1,length3(tmpmd3),tmpmd3,Hiddendata); } else{ - nhidden=appendd3(2,1,nfk,fk,Hiddendata); + appendd3(2,1,length3(fk),fk,Hiddendata); } } - return nfigkL; + return length3(figkL); } -int borderparadata(short ch,double fkL[][3], double fsL[][3]){ +void borderparadata(short ch,double fkL[][3], double fsL[][3]){ double ekL[DsizeL][3], fall[DsizeL][2], fbdxy[DsizeL][2]; double tmpd3[DsizeM][3], tmpd2[DsizeM][2], p[2], p3[3]; double figkL[DsizeM][3], du, dv; - int i, j, nall, nekL, nfsL, nfkL=length3(fkL), nfall, nfbdxy; - int ndin, din[DsizeS][2], ndin2,din2[DsizeM][2]; - int ntmp, ntmpd3,ntmpd2, npar=0, nfigkL; + int i, j; + int din[DsizeS][2],din2[DsizeM][2]; + int ntmp, ntmpd3,ntmpd2; double par[DsizeM]; du=(Urng[1]-Urng[0])/Mdv; dv=(Vrng[1]-Vrng[0])/Ndv; fsL[0][0]=0; - ekL[0][0]=0; nekL=0; + ekL[0][0]=0;; if(DrawE==1){ - tmpd2[0][0]=0; nall=0; + tmpd2[0][0]=0;; for(j=0; j<=Ndv; j++){ - nall=add2(tmpd2, Urng[1], Vrng[0]+j*dv); + add2(tmpd2, Urng[1], Vrng[0]+j*dv); } - nall=surfcurve(ch,2, tmpd2,tmpd3); - nekL=appendd3(2,1,nall,tmpd3,ekL); + surfcurve(ch,tmpd2,tmpd3); + appendd3(2,1,length3(tmpd3),tmpd3,ekL); } if(DrawN==1){ - tmpd2[0][0]=0; nall=0; + tmpd2[0][0]=0; for(j=0; j<=Mdv; j++){ - nall=add2(tmpd2, Urng[0]+j*du, Vrng[1]); + add2(tmpd2, Urng[0]+j*du, Vrng[1]); } - nall=surfcurve(ch,2, tmpd2,tmpd3); - nekL=appendd3(2,1,nall,tmpd3,ekL); + surfcurve(ch,tmpd2,tmpd3); + appendd3(2,1,length3(tmpd3),tmpd3,ekL); } if(DrawW==1){ - tmpd2[0][0]=0; nall=0; + tmpd2[0][0]=0; for(j=0; j<=Ndv; j++){ - nall=add2(tmpd2, Urng[0], Vrng[0]+j*dv); + add2(tmpd2, Urng[0], Vrng[0]+j*dv); } - nall=surfcurve(ch,2, tmpd2,tmpd3); - nekL=appendd3(2,1,nall,tmpd3,ekL); + surfcurve(ch,tmpd2,tmpd3); + appendd3(2,1,length3(tmpd3),tmpd3,ekL); } if(DrawS==1){ - tmpd2[0][0]=0; nall=0; + tmpd2[0][0]=0; for(j=0; j<=Mdv; j++){ - nall=add2(tmpd2, Urng[0]+j*du, Vrng[0]); + add2(tmpd2, Urng[0]+j*du, Vrng[0]); } - nall=surfcurve(ch,2, tmpd2,tmpd3); - nekL=appendd3(2,1,nall,tmpd3,ekL); + surfcurve(ch,tmpd2,tmpd3); + appendd3(2,1,length3(tmpd3),tmpd3,ekL); } - if(nekL>0){ - nfkL=appendd3(2,1,nekL,ekL,fkL); + if(length3(ekL)>0){ + appendd3(2,1,length3(ekL),ekL,fkL); } - nfall=projpara(fkL,fall); - nfbdxy=makexybdy(ch,fbdxy); - ndin=dataindexd2(2,fall,din); + projpara(fkL,fall); + makexybdy(ch,fbdxy); + dataindexd2(2,fall,din); Borderpt[0][0]=0; Otherpartition[0]=0; - for(i=1; i<=ndin-1; i++){ + for(i=1; i<=length2i(din)-1; i++){ Otherpartition[i]=Inf; Otherpartition[0]++; } Borderhiddendata[0][0]=0; - ndin2=dataindexd3(2,fkL,din2); - for(i=1; i<= ndin2; i++){ + dataindexd3(2,fkL,din2); + for(i=1; i<= length2i(din2); i++){ tmpd3[0][0]=0; - ntmpd3=appendd3(0,din2[i][0],din2[i][1],fkL,tmpd3); - ntmpd2=projpara(tmpd3,tmpd2); - partitionseg(tmpd2,fall, 1,par); + appendd3(0,din2[i][0],din2[i][1],fkL,tmpd3); + projpara(tmpd3,tmpd2); + partitionseg(tmpd2,fall,0,par); +/* if(length1(par)>2){ - ntmp=npar-1; - tmpd2[0][0]=0; ntmpd2=0; + ntmp=length1(par)-1; + tmpd2[0][0]=0; for(j=2; j<=ntmp; j++){ pull2(j,Partitionpt,p); - ntmpd2=addptd2(tmpd2, p); + addptd2(tmpd2, p); } - ntmp=appendd2(0, 1,ntmpd2,tmpd2,Borderpt); + appendd2(0, 1,length2(tmpd2),tmpd2,Borderpt); } - tmpd3[0][0]=0; - for(j=din2[i][0]; j<=din2[i][1]; j++){ - pull3(j,fkL,p3); - ntmpd3=addptd3(tmpd3,p3); - } - nfigkL=nohiddenpara2(par,tmpd3,1, figkL); - if(nfigkL>0){ - nfsL=appendd3(2,1,nfigkL,figkL, fsL); +*/ + tmpd3[0][0]=0; + appendd3(0,din2[i][0],din2[i][1],fkL,tmpd3); +// for(j=din2[i][0]; j<=din2[i][1]; j++){ +// pull3(j,fkL,p3); +// addptd3(tmpd3,p3); +// } + nohiddenpara2(ch,par,tmpd3,1, figkL); + if(length3(figkL)>0){ + appendd3(2,1,length3(figkL),figkL, fsL); } - ntmp=length3(Hiddendata); + ntmp=length3(Hiddendata); if(ntmp>0){ appendd3(2,1,ntmp,Hiddendata,Borderhiddendata); } } - return nfsL; } int dropnumlistcrv3(double qd[][3], double eps1, int out[]){ @@ -1226,48 +991,47 @@ int dropnumlistcrv3(double qd[][3], double eps1, int out[]){ pd[0][0]=0; npd=0; npd=appendd3(0,se,en,qd,pd); ptL[0]=0; nptL=0; - nptL=appendi1(ptL,1); + nptL=appendi1(1,ptL); pull3(1,pd,p); for(k=2; k<=npd-1; k++){ pull3(k,pd,tmp2d); if(dist(3,p,tmp2d)>eps1){ - nptL=appendi1(ptL,k); + nptL=appendi1(k,ptL); pull3(k,pd,p); } } pull3(npd-1,pd,p); pull3(npd,pd,tmp2d); if(dist(3,p,tmp2d)>eps){ // eps -> eps1 ? - nptL=appendi1(ptL,npd); + nptL=appendi1(npd,ptL); } -// if(nptL==1){ptL[0]=0; nptL=0;}//180318db if(nout>0){ - nout=appendi1(out,Infint); + nout=appendi1(Infint,out); } for(i=1; i<=nptL; i++){ - nout=appendi1(out,ptL[i]); + nout=appendi1(ptL[i],out); } } out[0]=nout; return nout; } -int sfbdparadata(short ch,double outd3[][3]){ +void sfbdparadata(short ch,double outd3[][3]){ double pdatad3[DsizeL][3]; double pts[DsizeL][2],out3md[DsizeL][2],eps; double tmpmd[DsizeL][2],tmp1md[DsizeL][2],tmp2md[DsizeL][2],tmp3md[DsizeL][2]; double tmpd[2],tmp1d[2],tmpd3[3],tmp1d3[3],tmp2d3[3],tmp2md3[DsizeL][3]; int din[DsizeS][2],nlist[DsizeL]; int ii,jj,kk,n,nall,flg; - envelopedata(ch, tmp3md); - out3md[0][0]=0; + envelopedata(ch, out3md); //180517from + tmp3md[0][0]=0; pts[0][0]=0; - dataindexd2(2,tmp3md,din); + dataindexd2(2,out3md,din); for(jj=1;jj<=length2i(din);jj++){ tmp1md[0][0]=0; tmp2md3[0][0]=0; for(kk=din[jj][0];kk<=din[jj][1];kk++){ - pull2(kk,tmp3md,tmpd); + pull2(kk,out3md,tmpd); addptd2(tmp1md,tmpd); surffun(ch,tmpd[0],tmpd[1],tmpd3); addptd3(tmp2md3,tmpd3); @@ -1283,12 +1047,14 @@ int sfbdparadata(short ch,double outd3[][3]){ addptd2(tmpmd,tmpd); } if(length2(tmpmd)>0){ - appendd2(2,1,length2(tmpmd),tmpmd,out3md); + appendd2(2,1,length2(tmpmd),tmpmd,tmp3md); } - } + } } + out3md[0][0]=0; + appendd2(0,1,length2(tmp3md),tmp3md,out3md); tmp3md[0][0]=0; - appendd2(2,1,length2(pts),pts,tmp3md); + appendd2(0,1,length2(pts),pts,tmp3md); pts[0][0]=0; for(ii=1;ii<=length2(tmp3md);ii++){ pull2(ii,tmp3md,tmpd); @@ -1307,17 +1073,12 @@ int sfbdparadata(short ch,double outd3[][3]){ } } for(ii=1;ii<=length2(pts);ii++){ - tmp3md[0][0]=0; - appendd2(2,1,length2(out3md),out3md,tmp3md); - out3md[0][0]=0; pull2(ii,pts,tmpd); surffun(ch,tmpd[0],tmpd[1],tmp1d3); - dataindexd2(2,tmp3md,din); + dataindexd2(2,out3md,din); for(jj=1;jj<=length2i(din);jj++){ tmp2md[0][0]=0; - appendd2(2,din[jj][0],din[jj][1],tmp3md,tmp2md); - pull2(jj,tmp3md,tmpd); - surffun(ch,tmpd[0],tmpd[1],tmp2d3); + appendd2(0,din[jj][0],din[jj][1],out3md,tmp2md); eps=1; for(kk=1;kk<=length2(tmp2md)-1;kk++){ pull2(kk,tmp2md,tmpd); @@ -1331,404 +1092,557 @@ int sfbdparadata(short ch,double outd3[][3]){ pull2(1,tmp2md,tmpd); surffun(ch,tmpd[0],tmpd[1],tmpd3); if(dist(3,tmp1d3,tmpd3)<eps+Eps){ - appendd2(2,ii,ii,pts,out3md); - for(kk=1;kk<=length2(tmp2md);kk++){ - pull2(kk,tmp2md,tmpd); - addptd2(out3md,tmpd); - } + prependd2(ii,ii,pts,tmp2md); + replacelistd2(2,jj,out3md,tmp2md); + dataindexd2(2,out3md,din);//180517 continue; } pull2(length2(tmp2md),tmp2md,tmpd); surffun(ch,tmpd[0],tmpd[1],tmpd3); if(dist(3,tmp1d3,tmpd3)<eps+Eps){ - appendd2(2,1,length2(tmp2md),tmp2md,out3md); - pull2(ii,pts,tmpd); - addptd2(out3md,tmpd); + appendd2(0,ii,ii,pts,tmp2md); + replacelistd2(2,jj,out3md,tmp2md); + dataindexd2(2,out3md,din);//180517 continue; } } - appendd2(2,1,length2(tmp2md),tmp2md,out3md); } nall=cuspsplitpara(ch,out3md, pdatad3); n=length2(Cuspsplitpt); Cusppt[0][0]=0; nall=appendd2(0, 1,n,Cuspsplitpt,Cusppt); - nall= borderparadata(ch,pdatad3, outd3); + borderparadata(ch,pdatad3, outd3); push3(Inf,3,0,outd3); nall=appendd3(0,1,length3(Borderhiddendata),Borderhiddendata,outd3); push3(Inf,3,0,outd3); - return nall; } -void makevaltablemeet(short ch,double pa[3], double vec[3], double eps0){ - double u, v, du, dv, pt[3]; - int i, j; - du=(Urng[1]-Urng[0])/Mdv; - dv=(Vrng[1]-Vrng[0])/Ndv; - for(j=0; j<=Ndv; j++){ - v=Vrng[0]+j*dv; - for(i=0; i<=Mdv; i++){ - u=Urng[0]+i*du; - surffun(ch,u, v, pt); - if((fabs(vec[1])>eps0)||(fabs(vec[0])>eps0)){ - Zval[j][i]=(vec[1]*(pt[0]-pa[0])-vec[0]*(pt[1]-pa[1])); +void groupnearpt3(double qlist[][3],double plist[][3]){ +// 180428 + int ii,jj,flg,din[DsizeS][2]; + double p1[3],p2[3],gl[DsizeS][3]; + while(length3(qlist)>0){ + gl[0][0]=0; + appendd3(2,1,1,qlist,gl); + removed3(1,qlist); + for(ii=1;ii<=length3(qlist);ii++){ + flg=0; + pull3(ii,qlist,p1); + for(jj=1;jj<=length3(gl);jj++){ + pull3(jj,gl,p2); + if(dist(3,p1,p2)<Eps1){ + flg=1; + break; + } } - else{ - Zval[j][i]=pt[0]-pa[0]; + if(flg==1){ + addptd3(gl,p1); + removed3(ii,qlist); } } + appendd3(2,1,length3(gl),gl,plist); } - for(i=0; i<=Mdv; i++){ - Xval[i]=Urng[0]+i*du; - } - for(j=0; j<=Ndv; j++){ - Yval[j]=Vrng[0]+j*dv; +} + +double funmeet(short ch,double u, double v,double pa[3], double vec[3]){ + double pt[3], out; + surffun(ch,u, v, pt); + if((fabs(vec[1])>Eps)||(fabs(vec[0])>Eps)){ + out=(vec[1]*(pt[0]-pa[0])-vec[0]*(pt[1]-pa[1])); + }else{ + out=pt[0]; } + return out; } -int meetpoints(short ch,double pta[3], double ptb[3], double eps, double ptL[][3]){ - double eps0=pow(10,-4.0), vec[3], out[DsizeM], pL[5][2], vL[5]; - double qL[DsizeM][2], p1d2[2], p2d2[2], tmpd2[2], puv1d2[2], puv2d2[2]; - double m1,m2, p1d3[3], p2d3[3], v1, v2, v3, ptd3[3], ptuvd2[2], tmp1d1; - double po[3]={0,0,0}, tmpmd1[DsizeM], tmp1d3[3]; - int nout, nptL, ntmp, nqL, i, j, k; - vec[0]=ptb[0]-pta[0]; vec[1]=ptb[1]-pta[1]; vec[2]=ptb[2]-pta[2]; - out[0]=0; nout=0; - ptL[0][0]=0; nptL=0; - makevaltablemeet(Ch,pta,vec,eps0); - for(j=0; j<=Ndv-2; j++){ - for(i=0; i<=Mdv-2; i++){ - pL[0][0]=Xval[i]; pL[0][1]=Yval[j]; vL[0]=Zval[j][i]; - pL[1][0]=Xval[i+1]; pL[1][1]=Yval[j]; vL[1]=Zval[j][i+1]; - pL[2][0]=Xval[i+1]; pL[2][1]=Yval[j+1]; vL[2]=Zval[j+1][i+1]; - pL[3][0]=Xval[i]; pL[3][1]=Yval[j+1]; vL[3]=Zval[j+1][i]; - pL[4][0]=Xval[i]; pL[4][1]=Yval[j]; vL[4]=Zval[j][i]; - qL[0][0]=0; nqL=0; +void meetpoints(short ch,double pta[3], double ptb[3], int uveq,double out[][3]){ + int i, j, k,flg,din[DsizeS][2]; + double vec[3],v1,v2,v3; + double du=(Urng[1]-Urng[0])/Mdv, dv=(Vrng[1]-Vrng[0])/Ndv; + double uval1,uval2,vval1,vval2,eval11,eval12,eval21,eval22; + double pl[5][2], vl[5], ql[11][2],p1[2],p2[2],m1,m2; + double ptuv[2], puv1[2], puv2[2],p1d3[3], p2d3[3], ptd3[3]; + double tmpd1, tmpd2[2],tmpd3[3],tmp1d3[3],tmp1md3[DsizeS][3]; + vec[0]=ptb[0]-pta[0]; vec[1]=ptb[1]-pta[1]; vec[2]=ptb[2]-pta[2]; + out[0][0]=0; + if(norm(3,vec)<Eps){ + return; + } + for(j=0; j<=Ndv-1; j++){ + vval1=Vrng[0]+j*dv; + vval2=Vrng[0]+(j+1)*dv; + uval1=Urng[0]; + eval11=funmeet(ch,uval1,vval1,pta,vec); + eval12=funmeet(ch,uval1,vval2,pta,vec); + for(i=0; i<=Mdv-1; i++){ + uval2=Urng[0]+(i+1)*du; + eval21=funmeet(ch,uval2,vval1,pta,vec); + eval22=funmeet(ch,uval2,vval2,pta,vec); + pl[0][0]=uval1; pl[0][1]=vval1; vl[0]=eval11; + pl[1][0]=uval2; pl[1][1]=vval1; vl[1]=eval21; + pl[2][0]=uval2; pl[2][1]=vval2; vl[2]=eval22; + pl[3][0]=uval1; pl[3][1]=vval2; vl[3]=eval12; + pl[4][0]=uval1; pl[4][1]=vval1; vl[4]=eval11; + ql[0][0]=0; for(k=0; k<=3; k++){ - pull2(k,pL,p1d2); - pull2(k+1,pL,p2d2); - m1=vL[k]; m2=vL[k+1]; - if((m1>=eps0)&&(m2>=eps0)){ + pull2(k,pl,p1); + pull2(k+1,pl,p2); + m1=vl[k]; m2=vl[k+1]; + if(fabs(m1)<Eps){ + addptd2(ql, p1); continue; } - if((m1<=-eps0)&&(m2<=-eps0)){ + if(fabs(m2)<Eps){ continue; } - if(fabs(m1)<eps0){ - copyd(0,1,p1d2,tmpd2); - } - else if(fabs(m2)<eps0){ + if((m1>0)&&(m2>0)){ continue; } - else{ - tmpd2[0]=1/(m1-m2)*(-m2*p1d2[0]+m1*p2d2[0]); - tmpd2[1]=1/(m1-m2)*(-m2*p1d2[1]+m1*p2d2[1]); + if((m1< 0)&&(m2< 0)){ + continue; } - nqL=addptd2(qL,tmpd2); + tmpd2[0]=1/(m1-m2)*(-m2*p1[0]+m1*p2[0]); + tmpd2[1]=1/(m1-m2)*(-m2*p1[1]+m1*p2[1]); + addptd2(ql, tmpd2); } - if(nqL==2){ - pull2(1, qL, puv1d2); - pull2(2, qL, puv2d2); - surffun(ch,puv1d2[0], puv1d2[1], p1d3); - surffun(ch,puv2d2[0], puv2d2[1], p2d3); + uval1=uval2; + eval11=eval21; + eval12=eval22; + if(length2(ql)==2){ + puv1[0]=ql[1][0]; puv1[1]=ql[1][1]; + puv2[0]=ql[2][0]; puv2[1]=ql[2][1]; + surffun(ch,puv1[0],puv1[1],p1d3); + surffun(ch,puv2[0],puv2[1],p2d3); v1=vec[0]; v2=vec[1]; v3=vec[2]; - if(fabs(v1)>eps0){ + if(fabs(v1)>Eps){ m1=pta[2]+v3/v1*(p1d3[0]-pta[0])-p1d3[2]; m2=pta[2]+v3/v1*(p2d3[0]-pta[0])-p2d3[2]; - } - else if(fabs(v2)>eps0){ + }else if(fabs(v2)>Eps){ m1=pta[2]+v3/v2*(p1d3[1]-pta[1])-p1d3[2]; m2=pta[2]+v3/v2*(p2d3[1]-pta[1])-p2d3[2]; - } - else{ + }else{ m1=pta[1]-p1d3[1]; - m2=pta[1]-p2d3[1]; + m2=pta[1]-p2d3[2]; } - if(m1*m2>=-eps0){ - if(((m1>eps0)&&(m2>eps0)) || ((m1<-eps0)&&(m2<-eps0))){ + if(m1*m2>= 0){ + if(((m1>0) && (m2>0)) || ((m1< 0) && (m2< 0))){ continue; } - if(fabs(m1)<=eps0){ - copyd(0,2,p1d3,ptd3); - copyd(0,1,puv1d2,ptuvd2); - } - else{ - copyd(0,2,p2d3,ptd3); - copyd(0,1,puv2d2,ptuvd2); + if(m1==0){ + ptd3[0]=p1d3[0]; ptd3[1]=p1d3[1]; ptd3[2]=p1d3[2]; + ptuv[0]=puv1[0]; ptuv[1]=puv1[1]; + }else{ + ptd3[0]=p2d3[0]; ptd3[1]=p2d3[1]; ptd3[2]=p2d3[2]; + ptuv[0]=puv2[0]; ptuv[1]=puv2[1]; } - } - else{ + }else{ ptd3[0]=1/(m1-m2)*(-m2*p1d3[0]+m1*p2d3[0]); ptd3[1]=1/(m1-m2)*(-m2*p1d3[1]+m1*p2d3[1]); ptd3[2]=1/(m1-m2)*(-m2*p1d3[2]+m1*p2d3[2]); + ptuv[0]=1/(m1-m2)*(-m2*puv1[0]+m1*puv2[0]); + ptuv[1]=1/(m1-m2)*(-m2*puv1[1]+m1*puv2[1]); } - tmp1d3[0]=ptd3[0]-pta[0]; tmp1d3[1]=ptd3[1]-pta[1]; - tmp1d3[2]=ptd3[2]-pta[2]; - tmp1d1=dotprod(3,tmp1d3,vec); - tmp1d1=tmp1d1/pow(dist(3,vec,po),2.0); - if((tmp1d1>-eps0)&&(tmp1d1<1+eps0)){ - nout=appendd1(out,tmp1d1); + tmpd3[0]=ptd3[0]-pta[0]; + tmpd3[1]=ptd3[1]-pta[1]; + tmpd3[2]=ptd3[2]-pta[2]; + crossprod(3,tmpd3,vec, tmp1d3); + if(norm(3,tmp1d3)<Eps1){ + tmpd1=dotprod(3,tmpd3,vec); + if((tmpd1>-Eps)&&(norm(3,tmpd3)<norm(3,vec)+Eps)){ + if(length3(out)==0){ + addptd3(out,ptd3); + }else{ + pull3(length3(out),out,p1d3); + if(dist(3,p1d3,ptd3)>Eps){ + addptd3(out,ptd3); + } + } + } } } } } - if(nout>>0){ - simplesort(out); - tmpmd1[1]=out[1]; ntmp=1; - for(i=2; i<=nout; i++){ - tmp1d3[0]=(out[i]-tmpmd1[ntmp])*vec[0]; - tmp1d3[1]=(out[i]-tmpmd1[ntmp])*vec[1]; - tmp1d3[2]=(out[i]-tmpmd1[ntmp])*vec[2]; - tmp1d1=dist(3,tmp1d3,po); - if(tmp1d1>eps){ - ntmp=appendd1(tmpmd1,out[i]); - } - } - nout=ntmp; - copyd(0,ntmp,tmpmd1,out); - for(i=1; i<=nout; i++){ - tmp1d3[0]=pta[0]+out[i]*vec[0]; - tmp1d3[1]=pta[1]+out[i]*vec[1]; - tmp1d3[2]=pta[2]+out[i]*vec[2]; - nptL=addptd3(ptL,tmp1d3); + tmp1md3[0][0]=0; + groupnearpt3(out,tmp1md3); + dataindexd3(2,tmp1md3,din); + out[0][0]=0; + for(i=1;i<=din[0][0];i++){ + p1d3[0]=0; p1d3[1]=0; p1d3[2]=0; + tmpd1=din[i][1]-din[i][0]+1; + for(j=din[i][0];j<=din[i][1];j++){ + p1d3[0]=p1d3[0]+tmp1md3[j][0]/tmpd1; + p1d3[1]=p1d3[1]+tmp1md3[j][1]/tmpd1; + p1d3[2]=p1d3[2]+tmp1md3[j][2]/tmpd1; } + addptd3(out,p1d3); } - return nptL; } -int crvsfparadata(double fkL[][3], double fbdkL[][3], int sepflg, double out[][3]){ - double fbdy[DsizeL][2], fk[DsizeM][3],fkp[DsizeM][3], outh[DsizeL][3]; +void crvsfparadata(short ch, double fkL[][3], double fbdkL[][3], int sepflg, double out[][3]){ + double fbdy[DsizeL][2], fk[DsizeM][3],outh[DsizeL][3]; +// double fkp[DsizeM][3], dt; double fh[DsizeM][2], parL[DsizeM], tmpmd3[DsizeM][3]; - double ptL[DsizeM][3], tmpd2[2], tmpd3[3], tmp1d1, tmp2d1, dt; + double ptL[DsizeM][3], tmpd2[2], tmpd3[3], tmp1d1, tmp2d1; double po[2]={0,0}, epsd2[2]={Eps1,1}, pa[3], pb[3]; - int nbor=length3(Borderhiddendata), nfkL,nfbdkL, nfbdy, nfk, nall; - int ncshidden, npar, ndin, din[DsizeM][2], ndin2,din2[DsizeS][2]; - int nn, i, j, k, n, nptL, nout; - nfkL=length3(fkL); - nfbdy=projpara(fbdkL,fbdy); + int nbor=length3(Borderhiddendata); + int ncshidden,din[DsizeM][2],din2[DsizeS][2]; + int nn, i, j, k, n; + projpara(fbdkL,fbdy); out[0][0]=0; outh[0][0]=0; - ndin=dataindexd3(2,fkL,din); - for(nn=1; nn<=ndin; nn++){ - fkp[0][0]=0; - nfk=appendd3(0,din[nn][0],din[nn][1],fkL,fkp); - n=fmax(1,floor((fmax(Mdv,Ndv)+1)/(nfk-1)+0.5)); //17.06.16 - dt=1.0/n; - fk[0][0]=0; - for(i=1; i<nfk; i++){ - for(j=0; j<n; j++){ - tmpd3[0]=fkp[i][0]+(fkp[i+1][0]-fkp[i][0])*j*dt; - tmpd3[1]=fkp[i][1]+(fkp[i+1][1]-fkp[i][1])*j*dt; - tmpd3[2]=fkp[i][2]+(fkp[i+1][2]-fkp[i][2])*j*dt; - addptd3(fk,tmpd3); - } - } - nfk=appendd3(0,nfk,nfk,fkp,fk); - nall=projpara(fk,fh); - partitionseg(fh, fbdy,1, parL); - if(sepflg>=0){ - for(i=1; i<=nfk-1; i++){ + dataindexd3(2,fkL,din); + for(nn=1; nn<=length2i(din); nn++){ + fk[0][0]=0; + appendd3(0,din[nn][0],din[nn][1],fkL,fk); + projpara(fk,fh); + partitionseg(fh,fbdy,0,parL); + if(sepflg==0){ //180522 + for(i=1; i<=length3(fk)-1; i++){ pull3(i,fk,pa); pull3(i+1,fk,pb); - nptL=meetpoints(Ch,pa,pb, Eps2,ptL); - for(j=1; j<=nptL; j++){ - pull3(j,ptL,tmpd3); + meetpoints(ch,pa,pb,1,ptL); + for(j=1; j<=length3(ptL); j++){ + pull3(j,ptL,tmpd3); parapt(tmpd3,tmpd2); tmp1d1=paramoncurve(tmpd2,i,fh); tmp2d1=Inf; - for(k=1; k<=npar; k++){ + for(k=1; k<=length1(parL); k++){ tmp2d1=fmin(tmp2d1,fabs(parL[k]-tmp1d1)); } tmpd3[0]=pb[0]-pa[0]; tmpd3[1]=pb[1]-pa[1]; tmpd3[2]=pb[2]-pa[2]; if(tmp2d1*dist(3,tmpd3,po)>Eps1){ - npar=appendd1(parL,tmp1d1); + appendd1(tmp1d1,parL); } } simplesort(parL); } } - nohiddenpara2(parL,fk,1, tmpmd3); + nohiddenpara2(ch,parL,fk,1, tmpmd3); appendd3(2,1,length3(tmpmd3),tmpmd3,out); appendd3(2,1, length3(Hiddendata),Hiddendata,outh); } push3(Inf,3,0,out); //17.06.17 - nout=appendd3(0,1,length3(outh),outh,out); - push3(Inf,3,0,out); //17.06.17 - return nout; + appendd3(0,1,length3(outh),outh,out); } -int wireparadata(double bdyk[][3], double udv[], double vdv[], int num, - double fsL[][3]){ - double fbdy[DsizeL][2], udiv[DsizeM], vdiv[DsizeM], fbdxy[DsizeM][2]; - double fs[DsizeL][3], u, v, d, pdata[DsizeM][3], fkL[DsizeM][3]; - double fsLh[DsizeLL][3]; - double tmpmd2[DsizeM][2], fk[DsizeM][3], par[DsizeM], p[2]; - int nfbdy, nd, i, j, k, n, nu, nv, nfbdxy, nfsL, npdata, nfkL, nfk, npar,ntmp; - int nwire, ndin, din[DsizeM][2], nfs, ndin2, din2[DsizeM][2]; - nfbdy=projpara(bdyk, fbdy); - Wirept[0][0]=0; - udiv[0]=0; nu=0; - vdiv[0]=0; nv=0; - n=floor(udv[0]+0.5); - if(n==-1){ - nd=floor(udv[1]+0.5); - d=(Urng[1]-Urng[0])/(nd+1); - for(i=1; i<=nd; i++){ - u=Urng[0]+i*d; - nu=appendd1(udiv,u); +void crv3onsfparadata(short ch,double fk[][3], double fbdyd3[][3], double out[][3]){ + // 180609 debugged(renewed) + double fbdy[DsizeL][2],fh[DsizeL][2],fks[DsizeL][3],fhs[DsizeL][2],par[DsizeM]; + double tmpmd3[DsizeL][3],outh[DsizeL][3]; + int i,j,din[DsizeS][2]; + projpara(fbdyd3,fbdy); + projpara(fk,fh); + out[0][0]=0; + outh[0][0]=0; + dataindexd2(2,fh,din); + for(i=1;i<=din[0][0];i++){ + fhs[0][0]=0; fks[0][0]=0; + appendd2(0,din[i][0],din[i][1],fh,fhs); + appendd3(0,din[i][0],din[i][1],fk,fks); + tmpmd3[0][0]=0; + if(length2(fhs)>1){ + partitionseg(fhs,fbdy,0, par); + nohiddenpara2(ch,par,fks,1,tmpmd3); + appendd3(2,1,length3(tmpmd3),tmpmd3,out); + appendd3(2,1,length3(Hiddendata),Hiddendata,outh); + }else{ + appendd3(2,1,1,fks,out); } } - else{ - for(i=1; i<=n; i++){ - nu=appendd1(udiv,udv[i]); - } + connectseg3(out, Eps1,tmpmd3); + out[0][0]=0; + appendd3(0,1,length3(tmpmd3),tmpmd3,out); + connectseg3(outh, Eps1,tmpmd3); + appendd3(3,1,length3(tmpmd3),tmpmd3,out); +} + +void crv2onsfparadata(short ch,double fh[][2], double fbdyd3[][3], double out[][3]){ + double fk[DsizeL][3]; + surfcurve(ch,fh,fk); + crv3onsfparadata(ch,fk,fbdyd3,out); +} + +void wireparadata(short ch,double bdyk[][3], double udata[], double vdata[],const char *fname,const char *fnameh){ + double crv2d[DsizeL][2],out[DsizeL][3],out1[DsizeL][3],out2[DsizeL][3]; + double du=(Urng[1]-Urng[0])/Mdv; + double dv=(Vrng[1]-Vrng[0])/Ndv; + int i,j,din[DsizeS][2]; + short allflg=0; + if(strlen(fnameh)==0){ + allflg=1; + } + char var[20]="wire3d"; + char varh[20]="wireh3d"; + char varnow[20]={'\0'}; + char varhnow[20]={'\0'}; + sprintf(var,"%s%d",var,ch); + sprintf(varh,"%s%d",varh,ch); + char dirfname[256] = {'\0'}; + char dirfnameh[256] = {'\0'}; + char varname[256] = {'\0'}; + char varnameh[256] = {'\0'}; + sprintf(varname,"%s%d",var,ch); + sprintf(varnameh,"%s%d",varh,ch); + sprintf(dirfname,"%s%s",Dirname,fname); + sprintf(dirfnameh,"%s%s",Dirname,fnameh); + if((length1(udata)==0)&&(allflg==0)){ + out[0][0]=0; + output3(1,"w",varname,dirfname,out); + output3(1,"w",varnameh,dirfnameh,out); } - n=floor(vdv[0]+0.5); - if(n==-1){ - nd=floor(vdv[1]+0.5); - d=(Vrng[1]-Vrng[0])/(nd+1); - for(i=1; i<=nd; i++){ - v=Vrng[0]+i*d; - nv=appendd1(vdiv,v); + for(i=1;i<=length1(udata);i++){ + crv2d[0][0]=0; + for(j=0; j<=Ndv; j++){ + add2(crv2d, udata[i],Vrng[0]+j*dv); + } + if(allflg==1){out[0][0]=0;} + crv2onsfparadata(ch,crv2d,bdyk,out); + if(allflg==0){ + dataindexd3(3,out,din); + out1[0][0]=0; out2[0][0]=0; + appendd3(0,din[1][0],din[1][1],out,out1); + appendd3(0,din[2][0],din[2][1],out,out2); + if(i==1){ + output3(1,"w",varname,dirfname,out1); + output3(1,"w",varnameh,dirfnameh,out2); + }else{ + output3(0,"a",varname,dirfname,out1); + output3(0,"a",varnameh,dirfnameh,out2); + } + }else{ + sprintf(varnow,"%s%s%d",var,"u",i); + sprintf(varhnow,"%s%s%d",varh,"u",i); + output3h("a",varnow, varhnow,fname,out); } } - else{ - for(i=1; i<=n; i++){ - nv=appendd1(vdiv,vdv[i]); - } - } - nfbdxy=makexybdy(Ch,fbdxy); - Wirept[0][0]=0; - fsL[0][0]=0; nfsL=0; - fsLh[0][0]=0; - for(i=1; i<=nu; i++){ - u=udiv[i]; - d=(Vrng[1]-Vrng[0])/(num*Ndv); - tmpmd2[0][0]=0; ntmp=0; - for(j=1;j<=(num*Ndv)+1; j++){ - v=Vrng[0]+(j-1)*d; - p[0]=u; p[1]=v; - ntmp=addptd2(tmpmd2,p); - } - nfkL=cuspsplitpara(Ch,tmpmd2, fkL); - ndin=dataindexd3(2,fkL,din); - for(j=1; j<=ndin; j++){ - fk[0][0]=0; - nfk=appendd3(0, din[j][0], din[j][1], fkL,fk); - ntmp=projpara(fk,tmpmd2); - partitionseg(tmpmd2, fbdy, 1, par); - ntmp=length2(Partitionpt); - if(ntmp>2){ - for(k=2; k<=ntmp; k++){ - pull2(k, Partitionpt, p); - nwire=addptd3(Wirept,p); - } - } - nfs=nohiddenpara2(par,fk,1, fs); - n=length3(Hiddendata); - ntmp=appendd3(2,1,n, Hiddendata,fsLh); - nfsL=appendd3(2,1,nfs,fs,fsL); - } - } - for(i=1; i<= nv; i++){ - v=vdiv[i]; - d=(Urng[1]-Urng[0])/(num*Mdv); - tmpmd2[0][0]=0; ntmp=0; - for(j=1;j<=(num*Mdv)+1; j++){ - u=Urng[0]+(j-1)*d; - p[0]=u; p[1]=v; - ntmp=addptd2(tmpmd2,p); - } - nfkL=cuspsplitpara(Ch,tmpmd2, fkL); - ndin=dataindexd3(2,fkL,din); - for(j=1; j<=ndin; j++){ - fk[0][0]=0; - nfk=appendd3(0, din[j][0], din[j][1], fkL,fk); - ntmp=projpara(fk,tmpmd2); - partitionseg(tmpmd2, fbdy, 1, par); - ntmp=length2(Partitionpt); - if(ntmp>2){ - for(k=2; k<=ntmp; k++){ - pull2(k, Partitionpt, p); - nwire=addptd3(Wirept,p); - } + for(j=1;j<=length1(vdata);j++){ + crv2d[0][0]=0; + for(i=0; i<=Mdv; i++){ + add2(crv2d, Urng[0]+i*du,vdata[j]); + } + if(allflg==1){out[0][0]=0;} + crv2onsfparadata(ch,crv2d,bdyk,out); + if(allflg==0){ + dataindexd3(3,out,din); + out1[0][0]=0; out2[0][0]=0; + appendd3(0,din[1][0],din[1][1],out,out1); + appendd3(0,din[2][0],din[2][1],out,out2); + if(i<length1(vdata)){ + output3(0,"a",varname,dirfname,out1); + output3(0,"a",varnameh,dirfnameh,out2); + }else{ + output3(0,"a",varname,dirfname,out1); + outputend(dirfname); + output3(0,"a",varnameh,dirfnameh,out2); + outputend(dirfnameh); } - nohiddenpara2(par,fk,1, fs); - appendd3(2,1,length3(Hiddendata), Hiddendata,fsLh); - appendd3(2,1,length3(fs),fs,fsL); + }else{ + sprintf(varnow,"%s%s%d",var,"v",j); + sprintf(varhnow,"%s%s%d",varh,"v",j); + output3h("a",varnow, varhnow,fname,out); } } - push3(Inf,3,0,fsL); - nfsL=appendd3(0,1,length3(fsLh),fsLh,fsL); - push3(Inf,3,0,fsL); - return nfsL; + if(allflg==0){ + outputend(dirfname); + outputend(dirfnameh); + } } -/* -double cutfun(int ch, double u, double v){ - double p[3],val ; - surffun(ch,u,v,p); - val=p[0]+p[1]-0.5; - return val; +void intersectcrvsf(const char *wa, short chfd,double crv[][3],const char *fname){ + double pa[3],pb[3],out[DsizeM][3],ptL[DsizeM][3]; + int i; + short chcut; + char chc[10]; + sprintf(chc,"%d",chfd); + char var[]="intercrvsf"; + char dirfname[256] = {'\0'}; + sprintf(dirfname,"%s%s",Dirname,fname); + char varname[256] = {'\0'}; + sprintf(varname,"%s%s",var,chc); + ptL[0][0]=0; + for(i=1;i<length3(crv);i++){ + pull3(i,crv,pa); + pull3(i+1,crv,pb); + meetpoints(chfd,pa,pb,1,out); + appendd3(0,1,length3(out),out,ptL); + } + output3(1,wa,varname,dirfname,ptL); } -*/ -void makevaltablecut(int chcut){ - double eps0=pow(10,-6.0), u, v, du, dv; - int i, j, nx=0, ny=0; ; - du=(Urng[1]-Urng[0])/Mdv; - dv=(Vrng[1]-Vrng[0])/Ndv; - for(j=0; j<=Ndv; j++){ - v=Vrng[0]+j*dv; - for(i=0; i<=Mdv; i++){ - u=Urng[0]+i*du; - Zval[j][i]=cutfun(Ch,chcut, u,v); +void sfcutparadata(short chfd, short ncut, double fbdy3[][3],const char *fname,const char *fnameh){ + double Vec[3]={sin(THETA)*cos(PHI),sin(THETA)*sin(PHI),cos(THETA)}; + double v1=Vec[0],v2=Vec[1],v3=Vec[2]; + double out[DsizeM][2],out2[DsizeM][2],outd3[DsizeL][3]; + double ekL[DsizeL][3],out1d3[DsizeL][3],out2d3[DsizeL][3]; + double uval1,uval2,vval1,vval2,eval11,eval12,eval21,eval22; + double pl[5][2], vl[5], ql[11][2],diff1,diff2; + double tmp1md[DsizeM][2],tmp2md[DsizeM][2],tmpd[2],tmp1d[2],tmp2d[2]; + double tmp2md3[DsizeM][3],tmpd3[3],tmp1d3[3]; + double du=(Urng[1]-Urng[0])/Mdv; + double dv=(Vrng[1]-Vrng[0])/Ndv; + double p1[2],p2[2],m1,m2,q11,q12,q21,q22,a1,a3,b1,b3; + int i,j,k,din[DsizeS][2],ns,ne,rmv[DsizeS]; + short chcut, allflg=0; + if(strlen(fnameh)==0){ + allflg=1; + } + char var[20]="sfcut3d"; + char varh[20]="sfcuth3d"; + sprintf(var,"%s%d",var,chfd); + sprintf(varh,"%s%d",varh,chfd); + char varnow[20]={'\0'}; + char varhnow[20]={'\0'}; + char dirfname[256] = {'\0'}; + char dirfnameh[256] = {'\0'}; + char varname[256] = {'\0'}; + char varnameh[256] = {'\0'}; + sprintf(varname,"%s%d",var,chfd); + sprintf(varnameh,"%s%d",varh,chfd); + sprintf(dirfname,"%s%s",Dirname,fname); + sprintf(dirfnameh,"%s%s",Dirname,fnameh); + for(chcut=1;chcut<=ncut;chcut++){ + out[0][0]=0; out2[0][0]=0; + for(j=0; j<=Ndv-1; j++){ + vval1=Vrng[0]+j*dv; + vval2=Vrng[0]+(j+1)*dv; + uval1=Urng[0]; + eval11=cutfun(chfd, chcut,uval1, vval1); + eval12=cutfun(chfd, chcut,uval1, vval2); + for(i=0; i<=Mdv-1; i++){ + uval2=Urng[0]+(i+1)*du; + eval21=cutfun(chfd, chcut,uval2, vval1); + eval22=cutfun(chfd, chcut,uval2, vval2); + pl[0][0]=uval1; pl[0][1]=vval1; vl[0]=eval11; + pl[1][0]=uval2; pl[1][1]=vval1; vl[1]=eval21; + pl[2][0]=uval2; pl[2][1]=vval2; vl[2]=eval22; + pl[3][0]=uval1; pl[3][1]=vval2; vl[3]=eval12; + pl[4][0]=uval1; pl[4][1]=vval1; vl[4]=eval11; + ql[0][0]=0; + for(k=0; k<=3; k++){ + pull2(k,pl,p1); + pull2(k+1,pl,p2); + m1=vl[k]; m2=vl[k+1]; + if(fabs(m1)<Eps){ + addptd2(ql, p1); + continue; + } + if(fabs(m2)<Eps){ + continue; + } + if((m1>0)&&(m2>0)){ + continue; + } + if((m1< 0)&&(m2< 0)){ + continue; + } + tmpd[0]=1/(m1-m2)*(-m2*p1[0]+m1*p2[0]); + tmpd[1]=1/(m1-m2)*(-m2*p1[1]+m1*p2[1]); + addptd2(ql, tmpd); + } + uval1=uval2; + eval11=eval21; + eval12=eval22; + if(length2(ql)==2){ + q11=ql[1][0];q12=ql[1][1];q21=ql[2][0];q22=ql[2][1]; + a1=uval1;a3=uval2;b1=vval1;b3=vval2; + if(((q11==a1)&&(q21==a1))||((q11==a3)&&(q21==a3))){ + if(((q21==b1)&&(q22==b1))||((q21==b3)&&(q22==b3))){ + appendd2(2,1,2,ql,out2); + }else{ + appendd2(2,1,2,ql,out); + } + continue; + } + if(((q12==b1)&&(q22==b1))||((q12==b3)&&(q22==b3))){ + if(((q11==a1)&&(q21==a1))||((q11==a3)&&(q21==a3))){ + appendd2(2,1,2,ql,out2); + }else{ + appendd2(2,1,2,ql,out); + } + continue; + } + appendd2(2,1,2,ql,out); + } + } + } + dataindexd2(2,out2,din); + while(length2i(din)>0){ + ns=din[1][0];ne=din[1][1]; + tmp1md[0][0]=0; + appendd2(0,ns,ne,out2,tmp1md); + appendd2(2,ns,ne,out2,out); + removelistd2(2,1,out2); + dataindexd2(2,out2,din); + rmv[0]=0; + for(j=1;j<=length2i(din);j++){ + ns=din[j][0];ne=din[j][1]; + tmp2md[0][0]=0; + appendd2(0,ns,ne,out2,tmp2md); + pull2(1,tmp2md,tmp2d);pull2(1,tmp1md,tmp1d); + diff1=dist(2,tmp1d,tmp2d); + pull2(2,tmp2md,tmp2d);pull2(2,tmp1md,tmp1d); + diff1=diff1+dist(2,tmp1d,tmp2d); + pull2(1,tmp2md,tmp2d);pull2(2,tmp1md,tmp1d); + diff2=dist(2,tmp1d,tmp2d); + pull2(2,tmp2md,tmp2d);pull2(1,tmp1md,tmp1d); + diff2=diff2+dist(2,tmp1d,tmp2d); + if((diff1<Eps)||(diff2<Eps)){ + appendi1(j,rmv); + continue; + } + } + for(j=1;j<=rmv[0];j++){ + removelistd2(2,rmv[j],out2); + } + dataindexd2(2,out2,din); + } + connectseg(out, Eps1, out2); + dataindexd2(2,out2,din); + outd3[0][0]=0; + for(i=1;i<=length2i(din);i++){ + ns=din[i][0];ne=din[i][1]; + tmp1md[0][0]=0; + appendd2(0,ns,ne,out2,tmp1md); + tmp2md3[0][0]=0; + for(j=1;j<=length2(tmp1md);j++){ + pull2(j,tmp1md,tmpd); + surffun(chfd,tmpd[0],tmpd[1],tmpd3); + if(length3(tmp2md3)>0){ + pull3(length3(tmp2md3),tmp2md3,tmp1d3); + if(dist(3,tmpd3,tmp1d3)<Eps1){ + continue; + } + } + addptd3(tmp2md3,tmpd3); + } + appendd3(2,1,length3(tmp2md3),tmp2md3,outd3); + } + crv3onsfparadata(chfd,outd3,fbdy3,ekL); + if(allflg==0){ + dataindexd3(3,ekL,din); + out1d3[0][0]=0; out2d3[0][0]=0; + appendd3(0,din[1][0],din[1][1],ekL,out1d3); + appendd3(0,din[2][0],din[2][1],ekL,out2d3); + if(chcut==1){ + output3(1,"w",varname,dirfname,out1d3); + output3(1,"w",varnameh,dirfnameh,out2d3); + }else{ + output3(0,"a",varname,dirfname,out1d3); + output3(0,"a",varnameh,dirfnameh,out2d3); + } + }else{ + sprintf(varnow,"%s%d",var,chcut); + sprintf(varhnow,"%s%d",varh,chcut); + output3h("a",varnow, varhnow,fname,ekL); } } - for(i=0; i<=Mdv; i++){ - Xval[i]=Urng[0]+i*du; - } - for(j=0; j<=Ndv; j++){ - Yval[j]=Vrng[0]+j*dv; + if(allflg==0){ + outputend(dirfname); + outputend(dirfnameh); } } -int sfcutdata(int ch, double ekL[][3]){ - double cutuvL[DsizeL][2], out1[DsizeM][2], out2[DsizeM][3], pt[3]; - int i, j, nall, ndin, din[DsizeM][2], nekL,nout1,nout2; -// makevaltablecut(ch); //180320 -// nall=implicitplot(cutuvL); //180320 - ekL[0][0]=0; nekL=0; - ndin=dataindexd2(2,cutuvL,din); - for(i=1; i<=ndin; i++){ - out1[0][0]=0; - nout1=appendd2(2,din[i][0],din[i][1],cutuvL,out1); - out2[0][0]=0; - for(j=1; j<=nout1; j++){ - surffun(ch,out1[j][0], out1[j][1], pt); - nout2=addptd3(out2,pt); - } - nekL=appendd3(2,1,nout2,out2,ekL); - } - return nekL; -} - -int crv3onsfparadata(double fk[][3], double fbdyd3[][3], double out[][3]){ - double fbdy[DsizeL][2], fh[DsizeL][2], tmpmd2[DsizeL][2], par[DsizeM]; - int n, nall, nfbdy, nfbdxy, npar, nout; - out[0][0]=0; - nfbdy=projpara(fbdyd3,fbdy); -// nall=ospline3(2,fk,2,fk1); - projpara(fk,fh); - partitionseg(fh,fbdy, 1, par); - nohiddenpara2(par,fk, 1,out); - push3(Inf,3,0,out); - nall=appendd3(0,1,length3(Hiddendata),Hiddendata,out); - push3(Inf,3,0,out); //17.06.16 - return nall; -} - int projcoordcurve(double curve[][3], double out[][3]){ double SP=sin(PHI), CP=cos(PHI), ST=sin(THETA), CT=cos(THETA); double pt[3], xz, yz, zz; @@ -2058,41 +1972,80 @@ int skeletondata3(double data[][3], double r00, return length3(allres); } -/* -void writesfbd(const char *var, const char *fname, const char *fnameh,double sf[][3]){ - sfbdparadata(sf); - output3(var, "", fname,2,sf); - output3(var, "h", fnameh,2,Borderhiddendata); -} - -void writecrv(const char *var, const char *fname, const char *fnameh, - double crv[][3],double sf[][3]){ - crvsfparadata(crv, sf, 1,Crvdata); - output3(var, "", fname,2,Crvdata); - output3(var, "h", fnameh,2,Crvsfhiddendata); -} - -void writewire(const char *var, const char *fname, const char *fnameh, - double sf[][3], int num, double udv[], double vdv[]){ - wireparadata(sf, num, udv,vdv, Wiredata); - output3(var, "", fname,2,Wiredata); - output3(var, "h", fnameh,2,Hiddenwiredata); -} - -void writesfcut(const char *var, const char *fname, const char *fnameh, - double crv[][3], double sf[][3]){ - sfcutdata(crv); - crv3onsfparadata(crv, sf, Crvonsfdata); - output3(var, "", fname,2,Crvonsfdata); - output3(var, "h", fnameh,2,Crv3onsfhiddendata); -} - -void writecrvonsf(const char *var, const char *fname, const char *fnameh, - double crv[][3],double sf[][3]){ - crv3onsfparadata(crv, sf, Crvonsfdata); - output3(var, "", fname,2,Crvonsfdata); - output3(var, "h", fnameh,2,Crv3onsfhiddendata); +void readoutdata3(const char *fname, const char *var, double data[][3]){ + double x,y,z; + float xx; + char dstr[256] = {'\0'}; + char str[10] = {'\0'},tmp[2]={'\0'}; + int linectr=0, start=0, jj,nn,nctr; + FILE *fp; + fp=fopen(fname,"r"); + if(fp==NULL){ + printf("file not found\n"); + return; + } + data[0][0]=0; + nn=strlen(var); + while( !feof(fp)){ + fgets(dstr,250,fp); + linectr++; + if(strncmp(dstr,var,nn)==0){ + start=linectr; + }else{ + if(start==0){ + continue; + } + } + if(linectr==start){ + continue; + } + if(strncmp(dstr,"sta",3)==0){ + if(linectr>start+1){ + add3(data,Inf,2,0); + } + continue; + } + if(strncmp(dstr,"end",3)==0){ + continue; + } + if(strncmp(dstr,"[",1)!=0){ + break; + } + str[0]='\0'; + nctr=0; + for(jj=2;jj<250;jj++){ + tmp[0]='\0'; sprintf(tmp,"%s%c",tmp,dstr[jj]); + if(strncmp(tmp,"/",1)==0){ + break; + } + if(strncmp(tmp," ",1)==0){ + continue; + } + if(strncmp(tmp,",",1)==0){ + nctr++; + if(nctr==1){ + x=atof(str); str[0]='\0'; + continue; + } + if(nctr==2){ + y=atof(str);str[0]='\0'; + continue; + } + } + if(strncmp(tmp,"]",1)==0){ + z=atof(str);str[0]='\0'; + add3(data,x,y,z); + nctr=0; + jj++; + tmp[0]='\0'; sprintf(tmp,"%s%c",tmp,dstr[jj]); + if(strncmp(tmp,",",1)==0){ + jj++; + } + continue; + } + sprintf(str,"%s%s",str,tmp); + } + } + fclose(fp); } -*/ - diff --git a/Master/texmf-dist/scripts/ketcindy/ketlibC/surflibhead.h b/Master/texmf-dist/scripts/ketcindy/ketlibC/surflibhead.h index df31a4d812f..0adc7779221 100644 --- a/Master/texmf-dist/scripts/ketcindy/ketlibC/surflibhead.h +++ b/Master/texmf-dist/scripts/ketcindy/ketlibC/surflibhead.h @@ -8,7 +8,7 @@ short Ch=1; double Cuspsplitpt[DsizeL][2]; double Cusppt[DsizeM][2]; double Otherpartition [DsizeM]; -double Partitionpt[DsizeM][2]; +//double Partitionpt[DsizeM][2]; double Cuspdata[DsizeM]; double Wirept[DsizeM][3]; double Hiddendata[DsizeL][3]; @@ -16,43 +16,41 @@ double Borderpt[DsizeM][2]; double Borderhiddendata[DsizeL][3]; double Surf[DsizeL][3]; double Crvdata[DsizeL][3]; -double Wiredata[DsizeLL][3]; +//double Wiredata[DsizeLL][3]; -int output3(const char *var, const char *fname, int level, double out[][3]); -int output3h(const char *var, const char *varh, const char *fname, double out[][3]); +int output3(short head,const char *wa,const char *var, const char *fname,double out[][3]); +int output3h(const char *wa,const char *var, const char *varh, const char *fname, double out[][3]); +void outputend(const char *fname); int writedataC(const char *fname, double out[][3]); int readdataC(const char *fname, double data[][3]); +void readoutdata3(const char *fname, const char *var, double data[][3]); void parapt(double pt3[3],double pt2[2]); +double zparapt(double p[3]); int projpara(double p3[][3], double p2[][2]); double invparapt(double ph, double fh[][2], double fk[][3],double out[3]); -int surfcurve(short ch,int level, double crv[][2], double pdata[][3]); -int xyzax3data(double x0, double x1, double y0, double y1, double z0, double z1, - double out[][3]); +void surfcurve(short ch,double crv[][2], double pdata[][3]); double evlpfun(short ch, double u, double v); int envelopedata(short ch, double out[][2]); -void evlptablepara(short ch); -//int implicitplot(double out[][2]); int cuspsplitpara(short ch,double pdata[][2], double outkL[][3]); -double funpthiddenQ(short ch,double u, double v, double pa[3]); int makexybdy(short ch,double ehL[][2]); void partitionseg(double fig[][2],double gL[][2], int ns, double parL[]); -void makevaltablepth(short ch,double pta[3]); -int pthiddenQ(short ch,double pta[3], int uveq, double eps[2]); -int nohiddenpara2(double paL[], double fk[][3], int uveq, double figkL[][3]); -int borderparadata(short ch,double fkL[][3], double fsL[][3]); +double funpthiddenQ(short ch,double u, double v,double pa[3]); +double pthiddenQ(short ch,double pta[3], int uveq); +int nohiddenpara2(short ch,double paL[], double fk[][3], int uveq, double figkL[][3]); +void borderparadata(short ch,double fkL[][3], double fsL[][3]); int dropnumlistcrv3(double qd[][3], double eps1, int out[]); -int sfbdparadata(short ch,double outd3[][3]); -void makevaltablemeet(short ch,double pa[3], double vec[3], double eps0); -int meetpoints(short ch,double pta[3], double ptb[3], double eps, double ptL[][3]); -int crvsfparadata(double fkL[][3], double fbdkL[][3], int sepflg, double out[][3]); -int sfcutdata(int ch, double ekL[][3]); -int crv3onsfparadata(double fk[][3], double fbdyd3[][3], double out[][3]); -int wireparadata(double bdyk[][3], double udv[], double vdv[], int num, - double fsL[][3]); +void sfbdparadata(short ch,double outd3[][3]); +double funmeet(short ch,double u, double v,double pa[3], double vec[3]); +void meetpoints(short ch,double pta[3], double ptb[3], int uveq,double out[][3]); +void crvsfparadata(short ch,double fkL[][3], double fbdkL[][3], int sepflg, double out[][3]); +void crv3onsfparadata(short ch,double fk[][3], double fbdyd3[][3], double out[][3]); +void crv2onsfparadata(short ch,double fh[][2], double fbdyd3[][3], double out[][3]); +void intersectcrvsf(const char *wa, short chfd,double crv[][3],const char *fname); +void wireparadata(short ch,double bdyk[][3], double udata[], double vdata[],const char *fname,const char *fnameh); +void sfcutparadata(short chfd, short ncut, double fbdy3[][3],const char *fname,const char *fnameh); int projcoordcurve(double curve[][3], double out[][3]); int kukannozoku(double jokyo[2], double kukanL[][2], double res[][2]); int skeletondata3(double data[][3], double r00, double eps1, double eps2, double allres[][3]); -double cutfun(short ch,int chcut,double u, double v); -void makevaltablecut(int chcut); +double cutfun(short chfd,short chcut,double u, double v); diff --git a/Master/texmf-dist/scripts/ketcindy/ketoutset.txt b/Master/texmf-dist/scripts/ketcindy/ketoutset.txt index 38381ef2ed3..8153d6e98c8 100644 --- a/Master/texmf-dist/scripts/ketcindy/ketoutset.txt +++ b/Master/texmf-dist/scripts/ketcindy/ketoutset.txt @@ -1,68 +1,54 @@ +if(!isstring(PathThead),
+ PathThead="";
+);
+PathT=PathThead+"uplatex";
if(iswindows(),
-// PathThead="C:\kettex\texlive\bin\win32\";
-// PathThead="";
-// PathT=PathThead+"platex";
- PathT=PathThead+"uplatex";
-// PathT=PathThead+"platex";
-// PathT=PathThead+"latex";
-// PathT=PathThead+"pdflatex";
-// PathT=PathThead+"lualatex";
-// PathS="C:\Program Files\scilab-5.5.2\bin\scilex";
PathS="C:\Program Files\scilab-6.0.0\bin\scilex";
PathC="C:\MinGW\bin\gcc.exe";
-// PathC="C:\MinGW32\bin\gcc.exe";
Pathpdf="C:\Program Files\SumatraPDF\SumatraPDF.exe";
PathR="C:\Program Files\R\R-3.4.2\bin";
PathA="C:\Program Files\asir\bin\asir";
PathM="C:\maxima-5.37.3\bin\maxima.bat";
PathV3="C:\Program Files\VCG\MeshLab\meshlab";
PathF="C:\cygwin\bin";
-// PathAd="C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe";
PathAd="C:\Program Files\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe";
);
if(ismacosx(),
-// PathThead="/Applications/kettex/texlive/bin/x86_64-darwin/";
-// PathThead="/Library/TeX/texbin/";
-// PathThead="";
-// PathT=PathThead+"platex";
- PathT=PathThead+"uplatex";
-// PathT=PathThead+"latex";
-// PathT=PathThead+"xelatex";
-// PathT=PathThead+"pdflatex";
-// PathT=PathThead+"lualatex";
-// PathS="/Applications/scilab-5.5.2.app/Contents/MacOS/bin/scilab";
PathS="/Applications/scilab-6.0.0.app/Contents/MacOS/bin/scilab";
Pathpdf="preview";
-// Pathpdf="skim";
-// Pathpdf="/Applications/skim.app/Contents/MacOS/Skim";
PathC="gcc";
-// PathR="R";
-// PathR="/Library/Frameworks/R.framework/Versions/3.3/Resources/bin/R";
PathR="/Library/Frameworks/R.framework/Versions/Current/Resources/bin/R";
PathA="/Applications/cfep.app/OpenXM/rc/asir";
PathM="/Applications/Maxima.app/Contents/Resources/maxima.sh";
PathV3="/Applications/meshlab.app/Contents/MacOS/MeshLab";
PathF="/Applications/FriCAS.app/Contents/Resources/bin/fricas";
-// PathAd="Adobe Reader";
PathAd="/Applications/Adobe Acrobat Reader DC.app/Contents/MacOS/AdobeReader";
Mackc="sh";
-// Mackc="open";
);
if(islinux(),
- PathT="uplatex";
PathS="scilab";
Pathpdf="evince";
-// Pathpdf="/usr/bin/xpdf";
+ PathC="gcc";
PathR="R";
- PathA="";
+ PathA="asir";
PathM="maxima";
- PathV3="";
- PathF="";
- PathAd="";
+ PathV3="Meshlab";
+ PathF="fricas";
+ PathAd="acroread";
);
+if(iswindows(), //180420from
+ Changesetting([gethome(), gethome()+"\Desktop","C:"]);
+,
+ Changesetting([gethome(),gethome()+"/Desktop"]);
+);//180420to
+
if(indexof(PathT,"platex")>0,
Helplist(["+","+3d","+mv"],"helpJ");
,
Helplist(["+","+3d","+mv"],"helpE");
);
+
+setdirectory(Dircdy);
+
+
diff --git a/Master/texmf-dist/scripts/ketcindy/template1basic.cdy b/Master/texmf-dist/scripts/ketcindy/template1basic.cdy Binary files differindex 806d69f2c34..c4cae01defe 100644 --- a/Master/texmf-dist/scripts/ketcindy/template1basic.cdy +++ b/Master/texmf-dist/scripts/ketcindy/template1basic.cdy diff --git a/Master/texmf-dist/scripts/ketcindy/template2advanced.cdy b/Master/texmf-dist/scripts/ketcindy/template2advanced.cdy Binary files differindex 3fa2e25abe4..2a5443784f5 100755..100644 --- a/Master/texmf-dist/scripts/ketcindy/template2advanced.cdy +++ b/Master/texmf-dist/scripts/ketcindy/template2advanced.cdy |