summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic1r.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic1r.cs')
-rw-r--r--Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic1r.cs1892
1 files changed, 1341 insertions, 551 deletions
diff --git a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic1r.cs b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic1r.cs
index 9dcb76c6d09..d466f9fe530 100644
--- a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic1r.cs
+++ b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic1r.cs
@@ -9,14 +9,14 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+// f
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>
//
-println("KeTCindy V.3.2.1(20180615)");
+println("KeTCindy V.3.2.2(20181030)");
println(ketjavaversion());
-println("ketcindylibbasic1(20180613) loaded");
+println("ketcindylibbasic1(20181030) loaded");
//help:start();
@@ -37,11 +37,19 @@ println("ketcindylibbasic1(20180613) loaded");
Ch=[0]; ChNum=1;
-Ketinit():=Ketinit(1);
-//help:Ketinit();
-Ketinit(sy):=Ketinit(sy,[-5,5],[-5,5]);
-Ketinit(sy,rangex,rangey):=(
- regional(pt,tmp,tmp1,tmp2,letterc,boxc,shadowc,mboxc);
+////%Ketinit start////
+Ketinit():=Ketinit("fig",1,[-5,5],[-5,5]); //181001
+Ketinit(Arg):=(//181001from
+ if(isstring(Arg),
+ Ketinit(Arg,1,[-5,5],[-5,5]);
+ ,
+ Ketinit("fig",Arg,[-5,5],[-5,5]);
+ );
+);
+Ketinit(work,sy,rangex,rangey):=(//181001to
+ //help:Ketinit();
+ //help:Ketinit("");
+ regional(pt,tmp,tmp1,tmp2,letterc,boxc,shadowc,mboxc);
PenThickInit=8;
ULEN="1cm";
MEMORI=0.05;//18.01.15from
@@ -58,7 +66,7 @@ Ketinit(sy,rangex,rangey):=(
TenSizeInit=0.02;
TenSize=TenSizeInit;
YaSize=1; YaAngle=18; YaPosition=1;
- YaThick=1; YaStyle='tf';
+ YaThick=1; YaStyle="tf";
KETPICCOUNT=1;
KCOLOR=[0,0,0];
GLIST=[];
@@ -84,6 +92,7 @@ Ketinit(sy,rangex,rangey):=(
OutFileLIst=[]; // 15.10.22
FigPdfList=[]; // 16.04.08
ADDPACK=[]; // 16.05.16
+ GPACK="tpic"; //180817
ErrFlag=0;
setdirectory(Dirwork);
if(!isstring(Fhead), // 17.10.13from, 17.11.12
@@ -109,11 +118,10 @@ 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"]);
);
- Changework(Dircdy+pathsep()+"fig"); //180329to
+ Changesetting(Homehead+pathsep()+getname()); //180913
+ Changesetting(Dircdy); //181017
+ Changework(Dircdy+pathsep()+work); //180329to,181001
Fnametex=Fhead+".tex";
FnameR=Fhead+".r";
FnamebodyR=Fhead+"body.r";
@@ -153,6 +161,7 @@ Ketinit(sy,rangex,rangey):=(
shadowc=[0,0,0,0.5]; mboxc="yellow"; //17.03.02 regional debugged
SlideColorList=[letterc,boxc,boxc,boxc,shadowc,shadowc,6,1.3,
letterc,mboxc,mboxc,mboxc,62,2,letterc];
+ SlideMargin=[0,0]; //180908
ThinDense=0.1;//17.01.08
if(indexof(PathS,"-5.")>0,//17.12.03from
LibnameS=Dirlib+pathsep()+"ketpicsciL5";
@@ -163,29 +172,28 @@ Ketinit(sy,rangex,rangey):=(
LibnameS=replace(LibnameS,"ketpic","ketpic2e");
);//17.12.03until
);
+////%Ketinit end////
-Changesetting(dirL):=( //180329
- regional(fname,tmp1,flg);
- fname="changesetting.txt";
- tmp1=apply(dirL,#+pathsep()+"ketcindy");
- tmp1=prepend(Dircdy,tmp1);
- flg=0;
- forall(tmp1,
- if(flg==0,
- if(isexists(#,fname),
- setdirectory(#);
- import(fname);
- println(fname+" imported from "+#);
- flg=1;
- );
+////%Changesetting start////
+Changesetting(dir):=( //181017
+ regional(fname);
+ fname="ketcindychange.txt";
+ if(!isexists(dir,fname),
+ if(dir==Dircdy,
+ fname="ketcindy.conf";
+ ,
+ fname=".ketcindy.conf";
);
);
- if(flg==0,
- println(fname+" not exists in "+text(tmp1));
- println(" Put "+fname+" in one of folders above");
+ if(isexists(dir,fname),
+ println("read "+fname+" in "+dir);
+ setdirectory(dir);
+ import(fname);
);
-);
+); //181017to
+////%Changesetting end////
+////%Cindyname start////
Cindyname():=Getcdyname();
Cdyname():=Getcdyname();
Getcdyname():=( //17.12.27
@@ -194,7 +202,9 @@ Getcdyname():=( //17.12.27
out=text(curkernel());
out=replace(out,".cdy","");
);
+////%Cindyname end////
+////%Setwindow start////
Setwindow():=Setwindow("Msg=yes");
Setwindow(str):=(
regional(tmp,tmp1,tmp2,msg);
@@ -229,31 +239,56 @@ Setwindow(xrange,yrange):=(
XMAX=xrange_2;
YMIN=yrange_1;
YMAX=yrange_2;
- Putpoint("SW",Pcrd([XMIN,YMIN]));//17.05.30
- Putpoint("NE",Pcrd([XMAX,YMAX]));//17.05.30
+ Putpoint("SW",[XMIN,YMIN]);//181016
+ Putpoint("NE",[XMAX,YMAX]);//181016
// Ketinit();
);
+////%Setwindow end////
+////%Setfiles start////
+Setfiles():=Setfiles(""); //180618
Setfiles(file):=( // 17.01.16
//help:Setfiles(file);
+ if(length(file)>0, //180618
Fhead=file;
Fnametex=Fhead+".tex";
FnameR=Fhead+".r"; //17.10.14
FnamebodyR=Fhead+"body.sce";
Fnameout=Fhead+".txt";
+ OCNAME=Fhead; //180714 for obj
+ ,
+ println("Fhead="+Dqq(Fhead)); //180618
+ );
);
+////%Setfiles end////
+////%Setparent start////
+Setparent():=Setparent("");
Setparent(file):=( // 17.11.27
//help:Setparent(file);
+ if(length(file)>0, //180618
Texparent=file;
+ ,
+ if(isstring(Texparent), //180618from
+ println("Texparent="+Dqq(Texparent));
+ ,
+ println("Texparent not defined");
+ );
+ ); //180618to
);
+////%Setparent end////
+////%Dqq start////
Dqq(str):=DqDq(str); //18.02.11
+////%Dqq end////
+////%DqDq start////
DqDq(str):=(
//help(Dqq("ab"); => Dq+"ab"+Dq)
unicode("0022")+str+unicode("0022");
);
+////%DqDq end////
+////%Tab2list start////
Tab2list(dtstr):=Tab2list(dtstr,[]);
Tab2list(dtstrorg,options):=(
//help:Tab2list(datastr);
@@ -317,12 +352,16 @@ Tab2list(dtstrorg,options):=(
);
out;
);
+////%Tab2list end////
+////%Columnlist start////
Columnlist(dt,list):=( // 16.09.04
//help:Columnlist(dt,1..3);
apply(dt,#_list);
);
+////%Columnlist end////
+////%Dispmat start////
Dispmat(dt):=( // 16.09.16
//help:Dispmat(dt);
regional(htm,crm,lfm,row,tmp,tmp1,tmp2);
@@ -346,7 +385,9 @@ Dispmat(dt):=( // 16.09.16
print(tmp2);
println();
);
+////%Dispmat end////
+////%Sep1000 start////
Sep1000(va):=( //17.07.18
//help:Sep1000(1344555);
//help:Sep1000([12456,55567]);
@@ -366,9 +407,11 @@ Sep1000(va):=( //17.07.18
);
out;
);
+////%Sep1000 end////
-factorial(n):=(
-//help:factorial(5);
+////%Factorial start////
+Factorial(n):=(
+//help:Factorial(5);
regional(out);
out=1;
forall(1..n,
@@ -376,9 +419,11 @@ factorial(n):=(
);
out;
);
+////%Factorial end////
-norm(v1):=( // 16.09.01
-//help:norm([2,1,3]);
+////%Norm start////
+Norm(v1):=( // 16.09.01
+//help:Norm([2,1,3]);
regional(out,tmp,tmp1,tmp2);
out=0;
forall(1..(length(v1)),
@@ -387,11 +432,13 @@ norm(v1):=( // 16.09.01
out=sqrt(out);
out;
);
-norm(v1,v2):=(
- norm(v2-v1);
+Norm(v1,v2):=(
+ Norm(v2-v1);
);
+////%Norm end////
// 16.03.28
+////%Removespace start////
Removespace(str):=(
//help:Removespace(" a b c ");
regional(tmp,flg,out);
@@ -418,7 +465,9 @@ Removespace(str):=(
);
out=substring(out,0,tmp);
);
+////%Removespace end////
+////%Indexall start////
Indexall(str,key):=(
regional(rest,out,flg,tmp,tmp1,);
out=[];
@@ -438,8 +487,11 @@ Indexall(str,key):=(
);
out;
);
+////%Indexall end////
+////%Strsplit start////
Strsplit(str,key):=( //180505
+//help:Strsplit(string,"=");
regional(start,out,tmp1,tmp2);
tmp1=Indexall(str,key);
out=[]; start=0;
@@ -450,8 +502,12 @@ Strsplit(str,key):=( //180505
out=append(out,substring(str,start,length(str)));
out;
);
+////%Strsplit end////
+////%Parlevel start////
Parlevel(str):=Bracket(str); // 16.05.22from
+////%Parlevel end////
+////%Bracket start////
Bracket(str):=Bracket(str,"()");
Bracket(str,br):=(
//help:Bracket(string,"()");
@@ -475,7 +531,9 @@ Bracket(str,br):=(
);
out;
);
+////%Bracket end////
+////%Pardiagram start////
Pardiagram(str):=Pardiagram(str,[20]);
Pardiagram(str,options):=(
//help:Pardiagram(exprstr);
@@ -573,12 +631,15 @@ Pardiagram(str,options):=(
);
out;
);
+////%Pardiagram end////
+////%Changework start////
+Changework():=Changework(""); //180618
Changework(dirorg):=Changework(dirorg,["Sub=y"]);
Changework(dirorg,options):=( //16.10.21
//help:Changework(directory);
//help:Changework(Dircdy+"fig");
-//help:Changework(options=["Sub=y"]);
+//help:Changework(options=["Sub=n"(not to make folder fig]);
regional(dir,subdir,tmp,,eqL,makesub);
tmp=Divoptions(options);
eqL=tmp_5; //180605from
@@ -607,9 +668,14 @@ Changework(dirorg,options):=( //16.10.21
dir=substring(dir,0,tmp-1);
); //17.11.24until
if(dir=="" % !isexists(dir,""),
- println("Directory "+dir+" not exist, so set to "+Dircdy);//180604(2lines)
- Dirwork=Dircdy;
- ErrFlag=-1;
+ if(dir=="", //180618from
+ println("Dirwork="+Dqq(Dirwork));
+ ,
+ println("Directory "+dir+" not exist, so "+Dqq(Dirwork)+" not changed");
+ ); //180618to
+// println("Directory "+dir+" not exist, so set to "+Dircdy);//180604(2lines)
+// Dirwork=Dircdy;
+// ErrFlag=-1;
,
if(length(subdir)>0, //180605
if(makesub==1,//180606from
@@ -629,7 +695,9 @@ Changework(dirorg,options):=( //16.10.21
);
);
);
+////%Changework end////
+////%Changestyle start////
Changestyle(nameL,style):=(
//help:Changestyle(["sgAB"],["da"]);
regional(nmL,name,Ltype,Ltypeorg,Noflg,color,opcindy,tmp);
@@ -648,9 +716,13 @@ Changestyle(nameL,style):=(
(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+")"));
+ if((Noflg==0)&(color!=KCOLOR), //180904
+ Texcom("{");Com2nd("Setcolor("+color+")");//180722
+ );
Ltype=GetLinestyle(text(Noflg)+Ltype,name);
- if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")"));
+ if((Noflg==0)&(color!=KCOLOR), //180904
+ Texcom("}");//180722
+ );
,
if(Noflg==1,Ltype=0);
);
@@ -659,7 +731,9 @@ Changestyle(nameL,style):=(
);
);
);
+////%Changestyle end////
+////%Op start////
Op(n,object):=( // 16.05.25
//help:Op(4,[1,2,3,4]);
//help:Op(3,"abcd");
@@ -673,7 +747,27 @@ Op(n,object):=( // 16.05.25
);
out;
);
+////%Op end////
+
+////%Ptselected start////
+Ptselected():=Isptselected(allpoints());//180711(2lines)
+Ptselected(ptlist):=Isptselected(ptlist);
+Isptselected():=Isptselected(allpoints()); //180706
+Isptselected(ptlist):=(
+//help:Ptselected();
+//help:Isptselected();
+ regional(flg);
+ flg=0;
+ forall(ptlist,
+ if(flg==0,
+ if(isselected(#),flg=1);
+ );
+ );
+ if(flg==0,false,true);
+);
+////%Ptselected end////
+////%Finddef start////
Finddef(G):=(
regional(def,tmp,tmp1,tmp2,tmp3);
if(isstring(G),tmp=parse(G),tmp=G);
@@ -694,7 +788,9 @@ Finddef(G):=(
);
tmp;
);
+////%Finddef end////
+////%Findgeoinfo start////
Findgeoinfo(geo):=(
regional(out,tmp,tmp1,tmp2);
tmp=Finddef(geo);
@@ -721,7 +817,9 @@ Findgeoinfo(geo):=(
);
out;
);
+////%Findgeoinfo end////
+////%Dependgeo start////
Dependgeo(geo):=(
regional(tmp,tmp1,tmp2,out);
tmp=Finddef(geo);
@@ -743,13 +841,30 @@ Dependgeo(geo):=(
);
out;
);
+////%Dependgeo end////
-Workprocess():=Workprocess(300);
-Workprocess(nn):=Drawprocess(nn);
-Drawprocess():=Drawprocess(300);
-Drawprocess(nn):=(
+////%Workprocess start////
+Workprocess():=Drawprocess(300,["Disp=n"]); //181030
+Workprocess(nn):=(
+//help:Workprocess();
+ Drawprocess(nn,["Disp=n"]);
+);
+////%Workprocess end////
+////%Drawprocess start////
+Drawprocess():=Drawprocess(300,["Disp=y"]);
+Drawprocess(nn):=Drawprocess(nn,["Disp=y"]);
+Drawprocess(nn,options):=(
//help:Workprocess();
- regional(All,added,remain,out,flg,tmp,tmp1,tmp2);
+ regional(All,added,remain,out,flg,dispflg,eqL,tmp,tmp1,tmp2);
+ tmp=Divoptions(options); //181030from
+ eqL=tmp_5;
+ dispflg="Y";
+ forall(eqL,
+ tmp=Strsplit(#,"=");
+ tmp1=Toupper(substring(tmp_1,0,1));
+ tmp2=Toupper(substring(tmp_2,0,1));
+ if(tmp1=="D",dispflg=tmp2);
+ ); //181030to
tmp=remove(allpoints(),[NE,SW,TH,FI]);
tmp1=select(tmp,
substring(text(#),length(text(#))-1,length(text(#)))!="z");
@@ -769,13 +884,22 @@ Drawprocess(nn):=(
if(length(remain)==0,flg=1);
);
);
- println("Process of drawing");
+ if(dispflg=="Y",
+ println("Process of drawing");
+ );
+ tmp1=[];//181030from
forall(out,
- println(Dependgeo(parse(#)));
+ tmp=Dependgeo(parse(#));
+ tmp1=append(tmp1,tmp);
+ if(dispflg=="Y",
+ println(Dependgeo(parse(#)));
+ );
);
- out;
+ tmp1;//181030to
);
+////%Drawprocess end////
+////%Sortpointlist start////
Sortpointlist(list):=(
regional(plist,ilist,jj,kk,flg,p1,p2,in1,in2,
tmp,tmp1,tmp2,out);
@@ -809,7 +933,9 @@ Sortpointlist(list):=(
);
out;
);
+////%Sortpointlist end////
+////%Toupper start////
Toupper(str):=(
//help:Toupper("Abc");
regional(alphabet,out,tmp,tmp1);
@@ -826,7 +952,9 @@ Toupper(str):=(
);
out;
);
+////%Toupper end////
+////%Textformat start////
Textformat(value,dig):=(
//help:Textformat(2/3,4);
//help:Textformat([gr1,gr2],5);
@@ -852,7 +980,9 @@ Textformat(value,dig):=(
);
tmp1;
);
+////%Textformat end////
+////%Sprintf start////
Sprintf(value,dig):=(
//help:Sprintf(5.1,4);
regional(vv,tmp,tmp1);
@@ -871,6 +1001,7 @@ Sprintf(value,dig):=(
);
vv;
);
+////%Sprintf end////
Assign(str):=( // old
regional(out);
@@ -882,6 +1013,7 @@ Assign(str):=( // old
out;
);
+////%Assign start////
Assign(funstr,vrL):=(
regional(nn,out,tmp,tmp1);
nn=length(vrL)/2;
@@ -935,7 +1067,9 @@ Assign(funstr,varname,rep):=(
funstr=tmp2+funstr;
funstr;
);
+////%Assign end////
+////%MeasureDepth start////
MeasureDepth(list):=(
regional(tmp,tmp1,Depth,Flg);
Flg=0;
@@ -962,7 +1096,9 @@ MeasureDepth(list):=(
);//180501
Depth;
);
+////%MeasureDepth end////
+////%Flattenlist start////
Flattenlist(pltlist):=(
//help:Flattenlist([[2,3],[[1,2],[5,6]]]);
regional(Out,nn,Dt,ii,tmp,flg);
@@ -984,10 +1120,13 @@ Flattenlist(pltlist):=(
);
Out;
);
+////%Flattenlist end////
+////%Divoptions start////
Divoptions(options):=(
//help:Divoptions(options);
- regional(Ltype,Noflg,Inflg,Outflg,eqL,realL,strL,color,opstr,opcindy,flg,tmp,tmp1,tmp2);
+ regional(Ltype,Noflg,Inflg,Outflg,eqL,realL,strL,color,opstr,opcindy,flg,
+ tmp,tmp1,tmp2);
Ltype="dr"; // 2015.01.13
Noflg=0;
Inflg=0;
@@ -1013,7 +1152,7 @@ Divoptions(options):=(
tmp1=Toupper(tmp_1);
tmp2=tmp_2;
if(tmp1=="COLOR",
- if(substring(tmp2,0,1)=="[",
+ if(indexof(tmp2,"[")>0, //180928
tmp1=parse(tmp2);
color=tmp1;
if(length(tmp1)==4,
@@ -1095,7 +1234,9 @@ Divoptions(options):=(
);
[Ltype,Noflg,Inflg,Outflg,eqL,realL,strL,color,opstr,opcindy];
);
+////%Divoptions end////
+////%Dotprod start////
Dotprod(vec1,vec2):=(
//help:Dotprod(vec1,vec2);
regional(v1,v2,tmp);
@@ -1103,7 +1244,9 @@ Dotprod(vec1,vec2):=(
if(ispoint(vec2),v2=vec2.xy,v2=vec2);
v1*v2;
);
+////%Dotprod end////
+////%Crossprod start////
Crossprod(a,b):=(
//help:Crossprod(vec1,vec2);
regional(tmp1,tmp2,tmp3,Out);
@@ -1117,35 +1260,45 @@ Crossprod(a,b):=(
);
Out;
);
+////%Crossprod end////
+////%Ptstart start////
Ptstart(Fig):=(
//help:Ptstart("gr1");
regional(tmp);
if(isstring(Fig),tmp=parse(Fig),tmp=Fig); // 16.01.21
tmp_1;
);
+////%Ptstart end////
+////%Ptend start////
Ptend(Fig):=(
//help:Ptend("gr1");
regional(tmp);
if(isstring(Fig),tmp=parse(Fig),tmp=Fig);
tmp_(length(tmp)); // 15.04.12
);
+////%Ptend end////
+////%Numptcrv start////
Numptcrv(Fig):=(
//help:Numptcrv("gr1");
regional(tmp);
if(isstring(Fig),tmp=parse(Fig),tmp=Fig); // 15.12.23
length(tmp);
);
+////%Numptcrv end////
+////%Ptcrv start////
Ptcrv(Num,Fig):=(
//help:Ptcrv(10,"gr1");
regional(tmp);
if(isstring(Fig),tmp=parse(Fig),tmp=Fig);
tmp_Num;
);
+////%Ptcrv end////
+////%Invert start////
Invert(Fig):=(
//help:Invert("gr1");
regional(tmp);
@@ -1160,15 +1313,21 @@ Invert(nm,Fig,options):=(
tmp=Invert(Fig);
Listplot(name,tmp,options);
);// until 16.01.27
-
-Paramoncrv(pP,Gdata):=(
- regional(Tmp,PtL);
+////%Invert end////
+
+////%Paramoncrv start////
+Paramoncrv(pP,Gdata):=Paramoncurve(pP,Gdata);//180723
+////%Paramoncrv end////
+////%ParamonCurve start////
+ParamonCurve(point,Gdata):=(
+//help:ParamonCurve(A,"gr1");//180723(3lines)
+ regional(Tmp,PtL,pP);
+ if(ispoint(point),pP=point.xy,pP=point);
// Eps=10^(-8);
if(isstring(Gdata),PtL=parse(Gdata),PtL=Gdata);
Tmp=Nearestpt(pP,PtL);
Tmp_2;
);
-
ParamonCurve(pP,nN,plist):=(
//help:ParamonCurve(A,10,"gr1");
regional(PtL,Out,Pa,Pb,vV,vW,sS);
@@ -1187,8 +1346,12 @@ ParamonCurve(pP,nN,plist):=(
);
Out;
);
+////%ParamonCurve end////
+////%Pointoncrv start////
Pointoncrv(tT,PtL):=PointonCurve(tT,PtL);
+////%Pointoncrv end////
+////%PointonCurve start////
PointonCurve(tTorg,Gdata):=(
//help:PointonCurve(20.5,"gr1");
regional(tT,Out,Eps,nN,sS,Pa,Pb,PtL);
@@ -1208,7 +1371,9 @@ PointonCurve(tTorg,Gdata):=(
);
Out;
);
+////%PointonCurve end////
+////%Koutenseg start////
Koutenseg(pA,pB,pC,pD):=Koutenseg(pA,pB,pC,pD,[]);
Koutenseg(pA,pB,pC,pD,options):=(
regional(Eps0,Eps,Eps2,pV,Sv2,Out,pP,pQ,Flg,p1,p2,q1,q2,
@@ -1318,9 +1483,11 @@ Koutenseg(pA,pB,pC,pD,options):=(
);
Out;
);
+////%Koutenseg end////
///////// Start of old Intersect ////////////
+////%IntersectcrvsPp start////
IntersectcrvsPp(Gr1,Gr2):=IntersectcrvsPp(Gr1,Gr2,[]);
IntersectcrvsPp(Gr1,Gr2,options):=(
//help:IntersectcrvsPp("gr1","pa1");
@@ -1465,7 +1632,9 @@ IntersectcrvsPp(Gr1,Gr2,options):=(
); // 15.04.06 until
Out;
);
+////%IntersectcrvsPp end////
+////%Intersectcrvs start////
Intersectcrvs(Gr1,Gr2):=Intersectcrvs(Gr1,Gr2,[]);
//help:Intersectcrvs("gr1","pa1");
Intersectcrvs(Gr1,Gr2,options):=(
@@ -1473,10 +1642,13 @@ Intersectcrvs(Gr1,Gr2,options):=(
tmp1=IntersectcrvsPp(Gr1,Gr2,options);
apply(tmp1,#_1);
);
+////%Intersectcrvs end////
+
///////// End of old Intersect ////////////
/////////// Start of new Intersect //////////////
+////%Intersectline start////
Intersectline(p1,v1,p2,v2):=(
regional(Eps,d,dt,ds,t,s,pt,out,tmp,tmp1,tmp2,tmp3);
Eps=10^(-5);
@@ -1500,7 +1672,9 @@ Intersectline(p1,v1,p2,v2):=(
);
out;
);
+////%Intersectline end////
+////%Intersectseg start////
Intersectseg(seg1,seg2):=Intersectseg(seg1,seg2,0.01);
Intersectseg(seg1org,seg2org,Eps1):=(
regional(Eps,seg1,seg2,p1,p2,q1,q2,t,s,pt,n,pts,out,dist,
@@ -1602,7 +1776,9 @@ Intersectseg(seg1org,seg2org,Eps1):=(
);
out;
);
+////%Intersectseg end////
+////%Osplineseg start////
Osplineseg(list):=Osplineseg(list,[]);
Osplineseg(ptlist,optionsorg):=(
regional(tmp,tmp1,tmp2,list,ptL,ctrL,Eps,Eps0,
@@ -1621,7 +1797,9 @@ Osplineseg(ptlist,optionsorg):=(
out=Bezier("",[p1,p2],ctrL,options);
out;
);
+////%Osplineseg end////
+////%Intersectpartseg start////
Intersectpartseg(crv1,crv2,ii,jj,Eps1,Eps2):=(
Intersectpartseg(crv1,crv2,ii,jj,Eps1,Eps2,10*Eps2);
);
@@ -1640,7 +1818,7 @@ Intersectpartseg(crv1org,crv2org,ii,jj,Eps1,Eps2,Dist):=(
seg2=[crv2_jj,crv2_(jj+1)];
tmp1=seg1_2-seg1_1;
tmp2=seg2_2-seg2_1;
- snang=abs(Crossprod(tmp1,tmp2))/(norm(tmp1)*norm(tmp2));
+ snang=abs(Crossprod(tmp1,tmp2))/(Norm(tmp1)*Norm(tmp2));
tmp=Intersectseg(seg1,seg2,Eps1);
dst=tmp_1;
if(dst<Eps,
@@ -1725,39 +1903,9 @@ Intersectpartseg(crv1org,crv2org,ii,jj,Eps1,Eps2,Dist):=(
);
out;
);
+////%Intersectpartseg end////
-if(1==0,
-
-Collectnear(ptdL,Eps2):=(
- regional(Eps,gL,rL,numL,ii,jj,flg,tmp,tmp1);
- Eps=10^(-4);
- gL=[ptdL_1];
- rL=ptdL_(2..(length(ptdL)));
- flg=0;
- forall(1..(length(ptdL)-1),ii,
- if(flg==0,
- numL=[];
- forall(1..(length(rL)),jj,
- tmp1=100;
- forall(gL,
- tmp=|#_1-rL_jj_1|;
- if(tmp<tmp1,tmp1=tmp);
- );
- if(tmp1<Eps2,numL=append(numL,jj));
- );
- if(length(numL)==0,
- flg=1;
- ,
- gL=concat(gL,rL_(numL));
- rL=remove(rL,rL_(numL));
- );
- );
- );
- [gL,rL];
-);
-
-);
-
+////%Collectsameseg start////
Collectsameseg(ptdL):=(
regional(Eps,gL,rL,numL,ii,jj,flg,tmp,tmp1,tmp2,tmp1md,
dst,kk,s1,e1,s2,e2);
@@ -1801,7 +1949,9 @@ Collectsameseg(ptdL):=(
);
[gL,rL];
);
+////%Collectsameseg end////
+////%IntersectcurvesPp start////
IntersectcurvesPp(crv1org,crv2org):=IntersectcurvesPp(crv1org,crv2org,[]);
IntersectcurvesPp(crv1org,crv2org,options):=(
//help:IntersectcurvesPp(crv1,crv2);
@@ -1906,7 +2056,9 @@ IntersectcurvesPp(crv1org,crv2org,options):=(
);
out;
);
+////%IntersectcurvesPp end////
+////%Intersectcurves start////
Intersectcurves(crv1org,crv2org):=Intersectcurves(crv1org,crv2org,[]);
Intersectcurves(crv1org,crv2org,options):=(
//help:Intersectcurves(crv1,crv2);
@@ -1915,9 +2067,11 @@ Intersectcurves(crv1org,crv2org,options):=(
tmp=IntersectcurvesPp(crv1org,crv2org,options);
tmp=apply(tmp,#_1);
);
+////%Intersectcurves end////
///////////End of new Intersect //////////////
+////%NearestptcrvPhy start////
NearestptcrvPhy(point,PL):=(
regional(tmp,pP,plist);
pP=Pcrd(point);
@@ -1928,14 +2082,19 @@ NearestptcrvPhy(point,PL):=(
tmp=tmp_1;
[tmp_1/SCALEX,tmp_2/SCALEY];
);
+////%NearestptcrvPhy end////
+////%Nearestptcrv start////
Nearestptcrv(point,plist):=(
//help:Nearestptcrv(A,"gr1");
- regional(tmp);
- tmp=Nearestpt(point,plist);
+ regional(tmp,pt);//180723(3lines)
+ if(ispoint(point),pt=point.xy,pt=point);
+ tmp=Nearestpt(pt,plist);
tmp_1;
);
+////%Nearestptcrv end////
+////%Nearestpt start////
Nearestpt(point,PL2):=(
regional(PL1,PL,Ans,Flg,Eps,pA,Pm,Im,Sm,Nn,Ni,
a1,b1,a2,b2,v1,v2,x1,x2,Tmp,rT,pP,sS,Lm,Pm,Sm,Flg);
@@ -1990,8 +2149,69 @@ Nearestpt(point,PL2):=(
);
Ans;
);
-
-Derivative(fun,var,value):=Derivative(fun,var,value,[]);
+////%Nearestpt end////
+
+////%Derivative start////
+Derivative(pdstr,ptinfo):=Derivative(pdstr,ptinfo,[]);//180719
+Derivative(Arg1,Arg2,Arg3):=(//1807120
+//help:Derivative(plotdata,"x=2");
+//help:Derivative(plotdata,"y=1");
+ regional(pdstr,ptinfo,options,name,v,pt,par,p0,p1,p2,p3,
+ pQ,pR,cc,m1,m2,out,tmp,tmp1,reL,ch,flg);
+ if(!islist(Arg3),
+ Derivative(Arg1,Arg2,Arg3,[]);
+ ,
+ pdstr=Arg1; ptinfo=Arg2; options=Arg3;
+ tmp=Divoptions(options);
+ reL=tmp_5;
+ ch=1;
+ if(length(reL)>0,
+ ch=reL_1;
+ options=remove(options,reL);
+ );
+ flg=0;//1807120
+ name="";
+ if(isstring(ptinfo),
+ tmp=Strsplit(ptinfo,"=");
+ name=Toupper(substring(tmp_1,0,1));
+ v=parse(tmp_2);
+ if(name=="X",
+ tmp1=Lineplot("",[[v,0],[v,1]],["nodata"]);
+ ,
+ tmp1=Lineplot("",[[0,v],[1,v]],["nodata"]);
+ );
+ tmp=IntersectcurvesPp(pdstr,tmp1);
+ if(length(tmp)==0,
+ println(" Derivative cannot be found");
+ out="";
+ flg=1;
+ ,
+ tmp=sort(tmp,[#_3]);
+ pt=tmp_ch_1;
+ par=tmp_ch_2;
+ );
+ ,
+ pt=ptinfo_1;
+ par=ptinfo_2;
+ );
+ if(flg==0,
+ p0=Pointoncurve(par-1,pdstr);
+ p1=pt;
+ p2=Pointoncurve(par+1,pdstr);
+ p3=Pointoncurve(par+2,pdstr);
+ tmp=1+sqrt((1+Dotprod(p2-p0,p3-p1)/|p2-p0|/|p3-p1|)/2);
+ cc=4*|p2-p1|/3/(|p2-p0|+|p3-p1|)/tmp;
+ pQ=p1+cc*(p2-p0);
+ pR=p2+cc*(p1-p3);
+ m1=-p1_1+pQ_1;
+ m2=-p1_2+pQ_2;
+ if(name=="",out=[m1,m2]);
+ if(name=="X",out=m2/m1);
+ if(name=="Y",out=m1/m2);
+ );
+ out;
+ );
+);//180720to
Derivative(fun,var,value,options):=(
//help:Derivative("x^3","x",2);
regional(eqL,method,eps,str,x1,x2,y1,y2,tmp,tmp1,tmp2);
@@ -2024,24 +2244,78 @@ Derivative(fun,var,value,options):=(
(y2-y1)/(x2-x1);
);
);
+////%Derivative end////
-Integrate(pltdata,range):=Integrate(pltdata,range,[]);
-Intergrate(Arg1,Arg2,Arg3):=(
- regional(pltdata,range,options,fnstr,vartr);
- if(islist(Arg2),
- pltdata=Arg1;
- range=Arg2;
- options=Arg3;
- Integrate(pltdata,range,options);
+////%Tangentplot start////
+Tangentplot(nm,pdstr,ptinfo):=Tangentplot(nm,pdstr,ptinfo,[]); //180720
+Tangentplot(nm,pdstr,ptinfo,optionsorg):=(
+//help:Tangentplot("1",pdstr,"x=2");
+//help:Tangentplot("1",pdstr,"y=3");
+//help:Tangentplot("1",pdstr,[[1,2],20.5]);
+//help:Tangentplot(Options2=[choice(1)]);
+ regional(name,v,pt,par,options,reL,ch,tmp,flg);
+ options=optionsorg; //1807120from
+ tmp=Divoptions(options);
+ reL=tmp_6;
+ ch=1;
+ if(length(reL)>0,
+ ch=reL_1;
+ options=remove(options,reL);
+ );
+ flg=0;//1807120to
+ name="";
+ if(isstring(ptinfo),
+ tmp=Strsplit(ptinfo,"=");
+ name=Toupper(substring(tmp_1,0,1));
+ v=parse(tmp_2);
+ if(name=="X",
+ tmp1=Lineplot("",[[v,0],[v,1]],["nodata"]);
+ ,
+ tmp1=Lineplot("",[[0,v],[1,v]],["nodata"]);
+ );
+ tmp=IntersectcurvesPp(pdstr,tmp1);
+ if(length(tmp)==0,//1807120
+ println(" Derivative cannot be calculated");
+ flg=1;
+ ,
+ tmp=sort(tmp,[#_3]);//1807120(3lines)
+ pt=tmp_ch_1;
+ par=tmp_ch_2;
+ );
,
- fnstr=Arg1;
- vastr=Arg2;
- range=Arg3;
- Integrate(fnstr,vastr,range,[]);
+ pt=ptinfo_1;
+ par=ptinfo_2;
+ );
+ if(flg==0,
+ tmp=Derivative(pdstr,[pt,par]);
+ if(vname=="X",
+ Lineplot("tn"+nm,[pt,pt+tmp],options);
+ ,
+ Lineplot("tn"+nm,[pt,pt+tmp],options);
+ );
);
);
+////%Tangentplot end////
-Integrate(pltdata,range,options):=(
+////%Integrate start////
+Integrate(Arg1,Arg2):=( //180708from
+ if(isstring(Arg2),
+ Integratefn(Arg1,Arg2,[]);
+ ,
+ Integratedt(Arg1,Arg2,[]);
+ );
+);
+Integrate(Arg1,Arg2,options):=(
+ if(isstring(Arg2),
+ Integratefn(Arg1,Arg2,options);
+ ,
+ Integratedt(Arg1,Arg2,options);
+ );
+);//180708to
+////%Integrate end////
+
+////%Integratedt start////
+Integratedt(pltdata,range,options):=(
//help:Integrate("gr1",[1,3]);
//help:Integrate(options=["Rule=o"]);
regional(tmp,tmp1,eqL,Rule,pdata,Sm,ptP,ptQ,list,va1,va2);
@@ -2074,28 +2348,42 @@ Integrate(pltdata,range,options):=(
Sm;
);
);
+////%Integratedt end////
-Integrate(fnstr,vastr,range,options):=(
-//help:Integrate("sin(x)","x",[0,pi],["Num=100","Rule=s"]);
- regional(tmp,tmp1,Sm,Lx,Rx,va1,va2,Num,Waysx,ex,dx,xn,yn,x0,x1,x2,y0,y1,y2);
+////%Integratefn start////
+Integratefn(fnstr,rngstr,options):=( //180708from
+//help:Integrate("sin(x)","x=[0,pi]",["Num=100","Rule=o"]);
+ regional(Sm,Lx,Rx,va1,va2,Num,Way,sx,ex,dx,xn,yn,
+ x0,x1,x2,y0,y1,y2,tmp,tmp1,tmp2,eqL,var,range,plt);
Num=100;
- Way="t";
- forall(options,
- if(indexof(#,"=")>0,
- if(indexof(#,"N=")>0,
- Num=parse(substring(#,indexof(#,"="),length(#)));
- );
- if(indexof(#,"Num=")>0,
- Num=parse(substring(#,indexof(#,"="),length(#)));
- );
- if(Toupper(substring(#,0,1))=="R",
- tmp=indexof(#,"=");
- Way=substring(#,tmp,tmp+1);
- );
- );
+ Way="o";
+ tmp=Divoptions(options);
+ eqL=tmp_5;
+ forall(eqL,
+ tmp=Strsplit(#,"=");
+ tmp1=Toupper(substring(tmp_1,0,1));
+ tmp2=tmp_2;
+ if(tmp1=="N",
+ Num=parse(tmp2);
+ );
+ if(tmp1=="R",
+ tmp2=substring(tmp2,0,1);
+ );
);
- Sm=0;
+ tmp=Strsplit(rngstr,"=");
+ var=tmp_1;
+ range=parse(tmp_2);
+ if(Way=="o",
+ sx=range_1;
+ ex=range_2;
+ dx=(ex-sx)/Num;
+ xn=apply(0..Num,sx+#*dx);
+ yn=apply(xn,parse(Assign(fnstr,[var,textformat(#,5)])));
+ plt=apply(1..(Num+1),[xn_#,yn_#]);
+ Sm=IntegrateO(plt,range);
+ );//180708to
if(Way=="t",
+ Sm=0;
forall(1..Num,
Lx=range_1+(range_2-range_1)*(#-1)/Num;
Rx=range_1+(range_2-range_1)*#/Num;
@@ -2103,7 +2391,9 @@ Integrate(fnstr,vastr,range,options):=(
va2=parse(replace(fnstr,vastr,textformat(Rx,5)));
Sm=Sm+(va1+va2)*(Rx-Lx)/2;
);
- ,
+ );
+ if(Way=="s",
+ Sm=0;
sx=range_1;
ex=range_2;
dx=(ex-sx)/Num;
@@ -2122,7 +2412,9 @@ Integrate(fnstr,vastr,range,options):=(
);
Sm;
);
+////%Integratefn end////
+////%IntegrateO start////
IntegrateO(p0org,p1org,p2org,p3org):=(
regional(p0,p1,p2,p3,pQ,pR,cc,p01,p02,
p11,p12,p21,p22,p31,p32, tmp);
@@ -2203,8 +2495,10 @@ IntegrateO(pltdata,rangeorg):=(
);
Sm;
);
+////%IntegrateO end////
-Findarea(pdstr):=(
+////%FindareaP start////
+FindareaP(pdstr):=( //180722
//help:Findarea("sgABCA");
regional(pd,p1,p2,s,tmp);
if(isstring(pdstr),pd=parse(pdstr),pd=pdstr);
@@ -2218,24 +2512,64 @@ Findarea(pdstr):=(
if(s<0,s=-s);
s;
);
+////%FindareaP end////
-Findarea(pdstr):=( // 15.11.27
-//help:Findarea("cr1");
- regional(pd,p0,p1,p2,p3,s,tmp);
+////%FindareaO start////
+FindareaO(pdstr,len):=( // 18.10,13
+ regional(pd,p0,p1,p2,p3,s,tmp,Lflg);
if(isstring(pdstr),pd=parse(pdstr),pd=pdstr);
+ Lflg=0;
s=0;
forall(1..(length(pd)-1),
p1=pd_#;
p2=pd_(#+1);
- if(#==1,p0=pd_(length(pd)-1),p0=pd_(#-1));
- if(#==length(pd)-1,p3=pd_2,p3=pd_(#+2));
- tmp=IntegrateO(p0,p1,p2,p3);
+ if(Dist(p1,p2)<len,
+ if(#==1,p0=pd_(length(pd)-1),p0=pd_(#-1));
+ if(Dist(p0,p1)>len,p0=2*p1-p2);
+ if(#==length(pd)-1,p3=pd_2,p3=pd_(#+2));
+ if(Dist(p2,p3)>len,p3=2*p2-p1);
+ tmp=IntegrateO(p0,p1,p2,p3);
+ ,
+ tmp=(p1_2+p2_2)*(p2_1-p1_1)/2;
+ );
s=s+tmp;
);
if(s<0,s=-s);
s;
);
+////%FindareaO end////
+////%Findarea start////
+Findarea(pdstr):=Findarea(pdstr,[]);//180722from
+Findarea(pdstr,options):=(
+//help:Findarea("cr1");
+//help:Findarea(options=["Len=1"]);
+ regional(tmp,tmp1,tmp2,eqL,way,len,out);
+ tmp=Divoptions(options);
+ eqL=tmp_5;
+ way="O";
+ len=1;
+ forall(eqL,
+ tmp=Strsplit(#,"=");
+ tmp1=Toupper(substring(tmp_1,0,1));
+ tmp2=tmp_2;
+ if(tmp1=="W",
+ way=Toupper(substring(tmp2,0,1));
+ );
+ if(tmp1=="L",//181013from
+ len=parse(tmp2);
+ );//181013to
+ );
+ if(way=="O",
+ out=FindareaO(pdstr,len);//181013
+ ,
+ out=FindareaP(pdstr);
+ );
+ out;
+);//180722to
+////%Findarea end////
+
+////%Findlength start////
Findlength(pdstr):=(
//help:Findlength("gr1");
regional(pd,p1,p2,s,tmp);
@@ -2249,7 +2583,9 @@ Findlength(pdstr):=(
);
s;
);
+////%Findlength end////
+////%Inversefun start////
Inversefun(fnstr,rngstr,value):=(
regional(tmp,varstr,range,x1,x2,x3,va1,va2);
tmp=indexof(rngstr,"=");
@@ -2274,20 +2610,26 @@ Inversefun(fnstr,rngstr,value):=(
);
if(abs(va1)<=abs(va2),x1,x2);
);
+////%Inversefun end////
+////%Com0th start////
Com0th(String):=(
regional(str);
str=replace(String,LFmark,"");
COM0thlist=append(COM0thlist,str);
);
+////%Com0th end////
+////%Com1st start////
Com1st(String):=(
regional(str);
str=replace(String,LFmark,"");
GLIST=append(GLIST,str); // 15.05.27
// COM1stlist=append(COM1stlist,str);
);
+////%Com1st end////
+////%Com2nd start////
Com2nd(String):=Com2nd(String,["a"]);//180612
Com2nd(String,option):=(
// help:Com2nd(str,["before"]);
@@ -2300,13 +2642,17 @@ Com2nd(String,option):=(
COM2ndlist=append(COM2ndlist,str);
);//180612to
);
+////%Com2nd end////
+////%Com2ndpre start////
Com2ndpre(String):=(
regional(str);
str=replace(String,LFmark,"");
COM2ndlist=prepend(str,COM2ndlist);
);
+////%Com2ndpre end////
+////%Texcom start////
Texcom(strorg):=( //17.09.22
//help:Texcom("\color[cmyk]{0,0,0,0.5}");
regional(str);
@@ -2315,6 +2661,7 @@ Texcom(strorg):=( //17.09.22
str="Texcom("+Dq+str+Dq+")";
Com2nd(str);
);
+////%Texcom end////
Ketcindylogo():=(
//help:Ketcindylogo();
@@ -2367,6 +2714,7 @@ Drawlinetype(name,type):=(
);
);
+////%Setunitlen start////
Setunitlen():=(
println(ULEN);
);
@@ -2420,29 +2768,57 @@ Setunitlen(UI):=(
MARKLEN=MARKLENNow*1000/2.54/MilliIn;
MEMORI=MEMORINow*1000/2.54/MilliIn;
);
+////%Setunitlen end////
+////%Setmarklen start////
Setmarklen(ratio):=(
//help:Setmarklen(0.2);
MARKLEN=ratio*0.2;//16.11.01
Com2nd("Setmarklen("+textformat(ratio,5)+")");
);
+////%Setmarklen end////
+////%Setorigin start////
Setorigin(point):=(
//help:Setorigin([1,2]);
Com2nd("Setorigin("+textformat(point,5)+")");
);
+////%Setorigin end////
+////%Fontsize start////
Fontsize(sizestr):=(
//help:Fontsize("s");
Com2nd("Fontsize('"+sizestr+"')");
);
+////%Fontsize end////
+////%Setpen start////
Setpen(width):=(
//help:Setpen(2);
PenThick=PenThickInit*width; // 16.04.09
Com2nd("Setpen("+text(width)+")");
);
+////%Setpen end////
+
+////%Setscaling start////
+Setscaling(sc):=(
+//help:Setscaling(3);
+ regional(tmp);
+ tmp=format(sc,5);
+ if(!islist(sc),
+ SCALEX=1;
+ SCALEY=sc;
+ Com0th("Setscaling("+tmp+")");
+ ,
+ SCALEX=sc_1;
+ SCALEY=sc_2;
+ Com0th("Setscaling("+tmp_1+","+tmp_2+")");
+ );
+ Setwindow("Msg=no");
+);
+////%Setscaling end////
+////%Lcrd start////
Lcrd(pt):=(
regional(tmp);
if(ispoint(pt),
@@ -2452,7 +2828,9 @@ Lcrd(pt):=(
);
tmp;
);
+////%Lcrd end////
+////%Pcrd start////
Pcrd(pt):=(
regional(tmp);
if(ispoint(pt),
@@ -2462,7 +2840,9 @@ Pcrd(pt):=(
);
tmp;
);
+////%Pcrd end////
+////%LLcrd start////
LLcrd(pt):=(
regional(tmp);
if(ispoint(pt),
@@ -2473,7 +2853,9 @@ LLcrd(pt):=(
tmp=[tmp_1/SCALEX,tmp_2/SCALEY];
tmp;
);
+////%LLcrd end////
+////%Doscaling start////
Doscaling(pltdata):=(
regional(Level,Out,gL,gr,tmp);
if(ispoint(pltdata) % isreal(pltdata_1),
@@ -2502,7 +2884,9 @@ Doscaling(pltdata):=(
);
Out;
);
+////%Doscaling end////
+////%Unscaling start////
Unscaling(pltdata):=(
regional(Level,Out,gL,gr,tmp);
if(ispoint(pltdata) % isreal(pltdata_1),
@@ -2531,7 +2915,9 @@ Unscaling(pltdata):=(
);
Out;
);
+////%Unscaling end////
+////%Setpt start////
Setpt(n):=Ptsize(n);
//help:Setpt(5);
Ptsize(n):=(
@@ -2539,7 +2925,9 @@ Ptsize(n):=(
TenSize=TenSizeInit*n;
Com2nd("Setpt("+text(n)+")"); // 14.01.19
);
+////%Setpt end////
+////%Definecolor start////
Definecolor(name,data):=(
//help:Definecolor("mycolor",[1,1,1,0]);
regional(type,tmp);
@@ -2549,7 +2937,9 @@ Definecolor(name,data):=(
tmp="\definecolor{"+name+"}{"+type+"}{"+tmp+"}";
Texcom(tmp);
);
+////%Definecolor end////
+////%Setcolor start////
Setcolor(parorg):=( //180603renew
//help:Setcolor([1,0,0,1]);
//help:Setcolor([1,1,0]);
@@ -2578,7 +2968,9 @@ Setcolor(parorg):=( //180603renew
);
Com2nd(cstr);
);
+////%Setcolor end////
+////%ColorRgb2Cmyk start////
ColorRgb2Cmyk(clr):=(
// help:ColorRgb([0.2,0.5,0.1]);
regional(clrnew,tmp,black);
@@ -2588,7 +2980,9 @@ ColorRgb2Cmyk(clr):=(
clrnew=append(tmp,black);
clrnew;
);
+////%ColorRgb2Cmyk end////
+////%ColorCmyk2Rgb start////
ColorCmyk2Rgb(clr):=(
// help:ColorRgb([0.2,0.5,0.1,0.2]);
regional(clrnew,tmp,black);
@@ -2597,7 +2991,9 @@ ColorCmyk2Rgb(clr):=(
clrnew=tmp_(1..3);
clrnew;
);
+////%ColorCmyk2Rgb end////
+////%Colorrgbhsv start////
Colorrgbhsv(rgb):=(
regional(varR,varG,varB,varMin,varMax,delMax,hh,ss,vv,delR,delG,delB);
varR = rgb_1;
@@ -2631,7 +3027,9 @@ Colorrgbhsv(rgb):=(
);
[hh*360,ss,vv];
);
-
+////%Colorrgbhsv end////
+
+////%Colorhsvrgb start////
Colorhsvrgb(sL):=(
regional(tmp,tmp1,tmp2,tmp3,hi,ff,dL);
tmp=[sL_1/60,sL_2,sL_3];
@@ -2647,7 +3045,9 @@ Colorhsvrgb(sL):=(
if(hi==5,dL=tmp2_[4,1,2]);
dL;
);
+////%Colorhsvrgb end////
+////%Colorrgbhsl start////
Colorrgbhsl(rgb):=(
regional(rr,gg,bb,mn,mx,delta,deltaR,deltaG,deltaB,hh,ss,ll);
rr = rgb_1 ;
@@ -2685,7 +3085,9 @@ Colorrgbhsl(rgb):=(
);
[hh*360,ss,ll];
);
+////%Colorrgbhsl end////
+////%Colorhslrgb start////
Colorhslrgb(hsl):=(
regional(hh,ss,ll,rr,gg,bb,var1,var2);
hh=hsl_1/360;
@@ -2708,7 +3110,9 @@ Colorhslrgb(hsl):=(
);
[rr,gg,bb];
);
+////%Colorhslrgb end////
+////%hue2rgb start////
hue2rgb(vv1,vv2,vh):=(
regional(out);
if ( vh < 0.0 ,vh =vh+1);
@@ -2728,7 +3132,9 @@ hue2rgb(vv1,vv2,vh):=(
);
out;
);
+////%hue2rgb end////
+////%Colorrgbhwb start////
Colorrgbhwb(sL):=(
regional(dl1,dl2,dl3);
dl1 = Colorrgbhsl(sL)_1;//Colorcode("rgb","hsl",sL)_1;
@@ -2736,7 +3142,9 @@ Colorrgbhwb(sL):=(
dl3 = 1 - max(sL);
dL= [dl1, dl2 , dl3 ];
);
+////%Colorrgbhwb end////
+////%Colorhwbrgb start////
Colorhwbrgb(sLorg):=(
regional(sL,tmp,tmp1,tmp2,tmp3,ratio,ff,ii,vv,nn,dL,flg);
sL=sLorg;
@@ -2763,7 +3171,9 @@ Colorhwbrgb(sLorg):=(
);
dL;
);
+////%Colorhwbrgb end////
+////%Colorhslhsv start////
Colorhslhsv(sL):=(
regional(dl1,dl2,dl3,dL);
dl1=sL_1;
@@ -2780,7 +3190,9 @@ Colorhslhsv(sL):=(
);
dL;
);
+////%Colorhslhsv end////
+////%Colorcode start////
Colorcode(src,dest,sL):=(
//help:Colorcode("rgb","cmyk",[1,0.5,0]);
regional(tmp,tmp1,tmp2,tmp3,mn,mx,delta,black,dL,flg);
@@ -2867,7 +3279,9 @@ Colorcode(src,dest,sL):=(
dL;
);
+////%Colorcode end////
+////%Colorinfile start////
Colorinfile(filename,clrf,clrt):=(
regional(tmp,tmp1,tmp2,head,cstrL,chstrL,head,body);
if(length(clrf_1)==3,
@@ -2912,7 +3326,9 @@ Colorinfile(filename,clrf,clrt):=(
);
closefile(SCEOUT);
);
+////%Colorinfile end////
+////%GetLinestyle start////
GetLinestyle(str,name):=(
regional(noflg,tmp,tmp1,tmp2,Dop,Ltype,subflg);
Ltype=-1;
@@ -2965,7 +3381,9 @@ GetLinestyle(str,name):=(
);
Ltype;
);
+////%GetLinestyle end////
+////%Chunderscore start////
Chunderscore(str):=(
regional(flg,tmp,tmp1,tmp2,tmp3);
if(indexof(str,"]")>0,
@@ -3002,7 +3420,9 @@ Chunderscore(str):=(
);
tmp1;
);
+////%Chunderscore end////
+////%AddGraph start////
AddGraph(nm,pltdata):=AddGraph(nm,pltdata,[]);
AddGraph(nm,pltdata,options):=(
//help:AddGraph("1","imp1"); // 16.04.04
@@ -3091,16 +3511,22 @@ 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+")"));
+ if((Noflg==0)&(color!=KCOLOR), //181020
+ Texcom("{");Com2nd("Setcolor("+color+")");//180722
+ );
Ltype=GetLinestyle(text(Noflg)+Ltype,name);
- if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")"));
- ,
+ if((Noflg==0)&(color!=KCOLOR), //181020
+ Texcom("}");//180722
+ );
+ ,
if(Noflg==1,Ltype=0);
);
GCLIST=append(GCLIST,[name,Ltype,opcindy]);
);
);
+////%AddGraph end////
+////%Joincrvs start////
Joincrvs(nm,plotstrL):=Joincrvs(nm,plotstrL,[]);
Joincrvs(nm,plotstrL,options):=(
//help:Joincrvs("1",["sgAB","sgDCB"]);
@@ -3184,17 +3610,23 @@ 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==0)&(color!=KCOLOR), //181020
+ Texcom("{");Com2nd("Setcolor("+color+")");//180722
+ );
+ Ltype=GetLinestyle(text(Noflg)+Ltype,name);
+ if((Noflg==0)&(color!=KCOLOR), //181020
+ Texcom("}");//180722
+ );
+ ,
if(Noflg==1,Ltype=0);
);
GCLIST=append(GCLIST,[name,Ltype,opcindy]);
);
PtL;
);
+////%Joincrvs end////
+////%Partcrv start////
Partcrv(nm,pA,pB,PkLstr):=Partcrv(nm,pA,pB,PkLstr,[]);
Partcrv(nm,pA,pB,PkLstr,options):=(
//help:Partcrv("1",A,B,"sgABC");
@@ -3271,17 +3703,23 @@ 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==0)&(color!=KCOLOR), //181020
+ Texcom("{");Com2nd("Setcolor("+color+")");//180722
+ );
+ Ltype=GetLinestyle(text(Noflg)+Ltype,name);
+ if((Noflg==0)&(color!=KCOLOR), //181020
+ Texcom("}");//180722
+ );
+ ,
if(Noflg==1,Ltype=0);
);
GCLIST=append(GCLIST,[name,Ltype,opcindy]);
);
Ans;
);
+////%Partcrv end////
+////%Opcrvs start////
Opcrvs(num,Fig):=Opcrvs(num,Fig,["nodisp"]);
Opcrvs(num,Fig,options):=(
//help:Subgraph(2,"grfs");
@@ -3291,17 +3729,17 @@ Opcrvs(num,Fig,options):=(
tmp1=parse(tmp);
Listplot(name,tmp1,options);
);
+////%Opcrvs end////
-
+////%Pointdata start////
Pointdata(nm,list):=Pointdata(nm,list,[]);
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,color);
+ eqL,dispflg,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;
@@ -3310,15 +3748,24 @@ Pointdata(nm,listorg,options):=(
opstr=tmp_(length(tmp)-1);
color=tmp_(length(tmp)-2);
size="";
+ dispflg="Y";
if(length(eqL)>0,
forall(eqL,
- tmp=substring(#,0,1);
- if(tmp=="s" % tmp=="S",
- tmp=indexof(#,"=");
- size=substring(#,tmp,length(#));
+ tmp=Strsplit(#,"=");
+ tmp1=Toupper(substring(tmp_1,0,1));
+ tmp2=Toupper(substring(tmp_2,0,1));
+ if(tmp1=="S",
+ size=tmp2;
+ opcindy=opcindy+",size->"+text(size); //181013
+ );
+ if(tmp1=="D", //181030from
+ dispflg=tmp2;
);
);
);
+ if(dispflg=="Y",
+ println("generate pointdata "+name);
+ ); //181030to
if(isstring(listorg),list=parse(listorg),list=listorg); //17.10.23
if(MeasureDepth(list)==0,list=[list]);//180530
tmp=MeasureDepth(list);
@@ -3366,9 +3813,13 @@ 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+")"));
+ if((Noflg==0)&(color!=KCOLOR), //181020
+ Texcom("{");Com2nd("Setcolor("+color+")");//180711
+ );
Com2nd("Drwpt(list("+name+")"+opstr+")");
- if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")"));
+ if((Noflg==0)&(color!=KCOLOR), //181020
+ Texcom("}");//180711
+ );
Setpen(thick); // 16.04.09
if(length(size)>0,
Com2nd("Setpt("+textformat(TenSize/TenSizeInit,1)+")");
@@ -3377,13 +3828,15 @@ Pointdata(nm,listorg,options):=(
);
ptlist;
);
+////%Pointdata end////
+////%Listplot start////
Listplot(nm,list,options):=(
//help:Listplot([A,B]);
// 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,color);
+//help:Listplot(options2=["Msg=y","Cutend=n"]);//180719
+ regional(name,cutend,tmp,tmp1,tmp2,ptlist,Ltype,opcindy,Noflg,eqL,Msg,color);
if(substring(nm,0,1)=="-", // 16.01.27 from
name=substring(nm,1,length(nm));
,
@@ -3396,15 +3849,23 @@ Listplot(nm,list,options):=(
color=tmp_(length(tmp)-2);
opcindy=tmp_(length(tmp));
Msg=1; // 15.09.17
+ cutend=[0,0];//180719
forall(eqL,
- tmp=substring(#,0,1);
- if(Toupper(tmp)=="M",
- tmp=indexof(#,"=");
- tmp1=substring(#,tmp,tmp+1); // 16.06.28
- if(Toupper(tmp1)=="N", // 16.06.28
+ tmp=Strsplit(#,"=");
+ tmp1=Toupper(substring(tmp_1,0,1));
+ tmp2=tmp_2;
+ if(tmp1=="M",
+ tmp=Toupper(substring(tmp2,0,1));
+ if(tmp=="N", // 16.06.28
Msg=0;
);
);
+ if(tmp1=="C",//180719from
+ tmp2=replace(tmp2,"[","");
+ tmp2=replace(tmp2,"]","");
+ cutend=tokenize(tmp2,",");
+ if(length(cutend)==1,cutend=[cutend_1,cutend_1]);
+ );//180719to
);
if(Noflg<3,
if(Msg==1,
@@ -3412,15 +3873,25 @@ Listplot(nm,list,options):=(
);
if(isstring(list_1),tmp=apply(list,parse(#)),tmp=list); // 15.03.24
ptlist=apply(tmp,Pcrd(#));
+ if(|cutend|>0,//180719from
+ tmp=ptlist_(length(ptlist))-ptlist_1;
+ tmp=tmp/|tmp|;
+ ptlist_1=ptlist_1+tmp*cutend_1;
+ ptlist_(length(ptlist))=ptlist_(length(ptlist))-tmp*cutend_2;
+ );//180719to
tmp=name+"="+textformat(ptlist,5);
parse(tmp);
- GLIST=append(GLIST,name+"=Listplot("+textformat(list,5)+")"); // 15.12.23
+ GLIST=append(GLIST,name+"=Listplot("+textformat(ptlist,5)+")"); // 180719
);
if(Noflg<2,
if(isstring(Ltype),
- if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")"));
+ if((Noflg==0)&(color!=KCOLOR), //181020
+ Texcom("{");Com2nd("Setcolor("+color+")");//180711
+ );
Ltype=GetLinestyle(text(Noflg)+Ltype,name);
- if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")"));
+ if((Noflg==0)&(color!=KCOLOR), //181020
+ Texcom("}");//180711
+ );
,
if(Noflg==1,Ltype=0);
);
@@ -3446,7 +3917,9 @@ Listplot(Arg1,Arg2):=(
);
);
Listplot(list):=Listplot(list,[]);
+////%Listplot end////
+////%Lineplot start////
Lineplot(nm,list,options):=(
//help:Lineplot([A,B]);
//help:Lineplot("1",[[2,1],[3,3]]);
@@ -3485,10 +3958,14 @@ Lineplot(nm,list,options):=(
);
if(Noflg<2,
if(isstring(Ltype),
- if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")"));
+ if((Noflg==0)&(color!=KCOLOR), //181020
+ Texcom("{");Com2nd("Setcolor("+color+")");//180722
+ );
Ltype=GetLinestyle(text(Noflg)+Ltype,name);
- if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")"));
- ,
+ if((Noflg==0)&(color!=KCOLOR), //181020
+ Texcom("}");//180722
+ );
+ ,
if(Noflg==1,Ltype=0);
);
GCLIST=append(GCLIST,[name,Ltype,opcindy]);
@@ -3512,14 +3989,16 @@ Lineplot(Arg1,Arg2):=(
);
);
Lineplot(list):=Lineplot(list,[]);
+////%Lineplot end////
+////%Plotdata start////
Plotdata(name1,func,variable):=Plotdata(name1,func,variable,[]);
Plotdata(name1,func,variable,options):=(
//help:Plotdata("1","sin(x)","x",["Num=100"]);
//help:Plotdata("2","x^2","x=[-1,1]");
//help:Plotdata("3","Fout(x)","x",["out"]);
regional(Fn,Va,tmp,tmp1,tmp2,eqL,name,Vname,x1,x2,dx,
- PdL,QdL,Num,Ec,Dc,Fun,Exfun,x,Ke,Eps,Pa,
+ PdL,Num,Ec,Dc,Fun,Exfun,x,Ke,Eps,Pa,
Ltype,Noflg,Inflg,Outflg,opstr,opcindy,color);
name="gr"+name1;
tmp=Divoptions(options);
@@ -3538,19 +4017,25 @@ Plotdata(name1,func,variable,options):=(
forall(eqL,
tmp=indexof(#,"=");
tmp1=substring(#,tmp,length(#));
- opstr=opstr+",'"+#+"'";
if(substring(#,0,1)=="N",
Num=parse(tmp1);
+ opstr=opstr+","+Dqq(#);
);
if(substring(#,0,1)=="E",
- if(substring(tmp1,0,1)=="[",
+ if(substring(tmp1,0,1)=="[", //180817from
Ec=parse(tmp1);
+ tmp1=replace(tmp1,"[","c(");
+ tmp1=replace(tmp1,",",".0,");
+ tmp1=replace(tmp1,"]",".0)");
+ opstr=opstr+","+Dqq("Exc="+tmp1); //180817to
,
Exfun=tmp1;
+ opstr=opstr+","+Dqq(#);
);
);
if(substring(#,0,1)=="D",
Dc=parse(tmp1);
+ opstr=opstr+","+Dqq(#);
);
);
if(Inflg==0 & Outflg==0,
@@ -3578,10 +4063,26 @@ Plotdata(name1,func,variable,options):=(
if(length(Exfun)>0,
tmp=parse(Exfun);
if(abs(tmp)<Eps,
- if(length(Pdt)>0,
+ if(length(PdL)>0, //180817from
PdL=concat(PdL,["inf"]);
);
- );
+ ,
+ tmp=[xx,parse(Fun)];
+ if(length(PdL)>0,
+ tmp1=PdL_(length(PdL));
+ if(Norm(tmp,tmp1)<Dc,
+ PdL=append(PdL,tmp);
+ ,
+ if(tmp1=="inf",
+ PdL=append(PdL,tmp);
+ ,
+ PdL=concat(PdL,[["inf"],tmp]);
+ );
+ );
+ ,
+ PdL=[tmp];
+ );
+ ); //180817to
,
Pa=[];
if(xx-Ec_Ke<-Eps,
@@ -3655,9 +4156,13 @@ Plotdata(name1,func,variable,options):=(
);
if(Noflg<2,
if(isstring(Ltype),
- if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")"));
+ if((Noflg==0)&(color!=KCOLOR), //181020
+ Texcom("{");Com2nd("Setcolor("+color+")");//180722
+ );
Ltype=GetLinestyle(text(Noflg)+Ltype,name);
- if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")"));
+ if((Noflg==0)&(color!=KCOLOR), //181020
+ Texcom("}");//180722
+ );
,
if(Noflg==1,Ltype=0);
);
@@ -3667,9 +4172,13 @@ Plotdata(name1,func,variable,options):=(
,
if(Noflg<2,
if(isstring(Ltype),
- if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")"));
+ if((Noflg==0)&(color!=KCOLOR), //181020
+ Texcom("{");Com2nd("Setcolor("+color+")");//180722
+ );
Ltype=GetLinestyle(text(Noflg)+Ltype,name);
- if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")"));
+ if((Noflg==0)&(color!=KCOLOR), //181020
+ Texcom("}");//180722
+ );
,
if(Noflg==1,Ltype=0);
);
@@ -3679,14 +4188,20 @@ Plotdata(name1,func,variable,options):=(
);
);
);
+////%Plotdata end////
-Paramplot(name1,funstr,variable):=Paramplot(name1,funstr,variable,[]);
-Paramplot(name1,funstr,variable,options):=(
+////%Paramplot start////
+Paramplot(nm,funstr,variable):=Paramplot(nm,funstr,variable,[]);
+Paramplot(nm,funstr,variable,options):=(
//help:Paramplot("1","[2*cos(t),sin(t)]","t=[0,2*pi]");
regional(name,Out,tmp,tmp1,tmp2,vname,func,str,Rng,Num,
Ec,Exfun,Dc,eqL,Fntmp,Vatmp,t1,t2,dt,tt,pa,ke,
Ltype,Noflg,Inflg,Outflg,opstr,opcindy,color);
- name="gp"+name1;
+ if(substring(nm,0,1)=="-", // 180928from
+ name=substring(nm,1,length(nm));
+ ,
+ name="gp"+nm;
+ ); //180929to
Eps=10^(-4);
tmp=Divoptions(options);
Ltype=tmp_1;
@@ -3704,19 +4219,25 @@ Paramplot(name1,funstr,variable,options):=(
forall(eqL,
tmp=indexof(#,"=");
tmp1=substring(#,tmp,length(#));
- opstr=opstr+",'"+#+"'";
if(substring(#,0,1)=="N",
Num=parse(tmp1);
+ opstr=opstr+","+Dqq(#);
);
if(substring(#,0,1)=="E",
- if(substring(tmp1,0,1)=="[",
+ if(substring(tmp1,0,1)=="[", //180817from
Ec=parse(tmp1);
+ tmp1=replace(tmp1,"[","c(");
+ tmp1=replace(tmp1,",",".0,");
+ tmp1=replace(tmp1,"]",".0)");
+ opstr=opstr+","+Dqq("Exc="+tmp1); //180817to
,
Exfun=tmp1;
+ opstr=opstr+","+Dqq(#);
);
);
if(substring(#,0,1)=="D",
Dc=parse(tmp1);
+ opstr=opstr+","+Dqq(#);
);
);
if(Inflg==0 & Outflg==0,
@@ -3759,7 +4280,9 @@ Paramplot(name1,funstr,variable,options):=(
Out=append(Out,pa);
,
if(|tmp-pa|<Dc,
- Out=append(Out,pa);
+ if(|tmp-pa|>Eps, //180928from
+ Out=append(Out,pa);
+ ); //180928to
,
Out=concat(Out,[["inf"],pa]);
);
@@ -3803,9 +4326,13 @@ Paramplot(name1,funstr,variable,options):=(
);
if(Noflg<2,
if(isstring(Ltype),
- if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")"));
+ if((Noflg==0)&(color!=KCOLOR), //181020
+ Texcom("{");Com2nd("Setcolor("+color+")");//180722
+ );
Ltype=GetLinestyle(text(Noflg)+Ltype,name);
- if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")"));
+ if((Noflg==0)&(color!=KCOLOR), //181020
+ Texcom("}");//180722
+ );
,
if(Noflg==1,Ltype=0);
);
@@ -3815,10 +4342,14 @@ Paramplot(name1,funstr,variable,options):=(
,
if(Noflg<2,
if(isstring(Ltype),
- if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")"));
+ if((Noflg==0)&(color!=KCOLOR), //181020
+ Texcom("{");Com2nd("Setcolor("+color+")");//180722
+ );
Ltype=GetLinestyle(text(Noflg)+Ltype,name);
- if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")"));
- ,
+ if((Noflg==0)&(color!=KCOLOR), //181020
+ Texcom("}");//180722
+ );
+ ,
if(Noflg==1,Ltype=0);
);
if(Inflg==1,
@@ -3827,7 +4358,22 @@ Paramplot(name1,funstr,variable,options):=(
);
);
);
+////%Paramplot end////
+////%Polarplot start////
+// 180928
+Polarplot(name,radstr,varrng):=Polarplot(name,radstr,varrng,[]);
+Polarplot(name,radstr,varrng,option):=(
+//help:Polarplot("1","cos(t)","t=[0,2*pi]");
+ regional(tmp,var);
+ tmp=Strsplit(varrng,"=");
+ var=tmp_1;
+ tmp="("+radstr+")*[cos("+var+"),sin("+var+")]";
+ Paramplot("-polar"+name,tmp,varrng,option);
+);
+////%Polarplot end////
+
+////%Connectseg start////
Connectseg(Pdata):=(
regional(Eps,PlotL,vL,ctr,qd,ah,ao,flg,jj,
pp,qq,tmp,tmp1,tmp2);
@@ -3891,7 +4437,9 @@ Connectseg(Pdata):=(
);
PlotL;
);
+////%Connectseg end////
+////%Implicitplot start////
Implicitplot(name1,func,xrng,yrng):=Implicitplot(name1,func,xrng,yrng,[]);
Implicitplot(name1,func,xrng,yrng,options):=(
//help:Implicitplot("1","x^2+x*y+y^2=1","x=[-3,3]","y=[-3,3]");
@@ -4009,17 +4557,23 @@ 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==0)&(color!=KCOLOR), //181020
+ Texcom("{");Com2nd("Setcolor("+color+")");//180722
+ );
+ Ltype=GetLinestyle(text(Noflg)+Ltype,name);
+ if((Noflg==0)&(color!=KCOLOR), //181020
+ Texcom("}");//180722
+ );
+ ,
if(Noflg==1,Ltype=0);
);
GCLIST=append(GCLIST,[name,Ltype,opcindy]);
);
out;
);
+////%Implicitplot end////
+////%Circledata start////
Circledata(cenrad):=Circledata(cenrad,[]);
Circledata(para1,para2):=(
//help:Circledata([A,B],["Rng=[0,pi/2]"]);
@@ -4116,17 +4670,23 @@ 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==0)&(color!=KCOLOR), //181020
+ Texcom("{");Com2nd("Setcolor("+color+")");//180722
+ );
+ Ltype=GetLinestyle(text(Noflg)+Ltype,name);
+ if((Noflg==0)&(color!=KCOLOR), //181020
+ Texcom("}");//180722
+ );
+ ,
if(Noflg==1,Ltype=0);
);
GCLIST=append(GCLIST,[name,Ltype,opcindy]);
);
Out;
);
+////%Circledata end////
+////%Framedata start////
Framedata():=Framedata(["dr"]);//16.10.29from
Framedata(list):=(
regional(pA,pB);
@@ -4154,45 +4714,67 @@ Framedata(Arg1,Arg2):=(
Framedata(name,list,options);
);
);
-Framedata(nm,list,options):=(
+Framedata(nm,list,optionsorg):=(
//help:Framedata();
//help:Framedata([C,A]);
//help:Framedata("1",[C,A]);
+//help:Framedata("1",[A,B],["corner"]);
//help:Framedata("1",[C,dx,dy]);
- regional(name,Out,tmp,tmp1,pB,x1,x2,y1,y2,dx,dy,
- opcindy,Ltype,Noflg,cent,dx,dy,color);
+ regional(name,options,Out,tmp,tmp1,pB,x1,x2,y1,y2,dx,dy,
+ opcindy,Ltype,Noflg,strL,type,cent,dx,dy,color);
name="fr"+nm;
+ options=optionsorg;
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);
- dx=abs(pB_1-pA_1); dy=abs(pB_2-pA_2);
- ,
- pA=Lcrd(list_1);
- dx=list_2; dy=list_3;
- );
- x1=pA_1-dx; x2=pA_1+dx;
- y1=pA_2-dy; y2=pA_2+dy;
- Out=[[x1,y1],[x2,y1],[x2,y2],[x1,y2],[x1,y1]];
- if(Noflg<3,
- println("generate Framedata "+name);
- tmp1=apply(Out,Pcrd(#));
- tmp=name+"="+textformat(tmp1,5);
- parse(tmp);
- GLIST=append(GLIST,name+"=Framedata("+pA+","+dx+","+dy+")");
+ strL=tmp_7; //180801from
+ type="center";
+ forall(strL,
+ if(Toupper(#)=="CORNER",
+ type="corner";
+ options=remove(options,[#]);
+ );
+ if(Toupper(#)=="CENTER",
+ type="center";
+ options=remove(options,[#]);
+ );
);
- if(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(type=="corner",
+ Out=Framedata2(nm,list,options);
+ , //180801to
+ color=tmp_(length(tmp)-2);
+ opcindy=tmp_(length(tmp));
+ if(length(list)==2, // 15.05.12
+ pA=Lcrd(list_1); pB=Lcrd(list_2);
+ dx=abs(pB_1-pA_1); dy=abs(pB_2-pA_2);
,
- if(Noflg==1,Ltype=0);
+ pA=Lcrd(list_1);
+ dx=list_2; dy=list_3;
+ );
+ x1=pA_1-dx; x2=pA_1+dx;
+ y1=pA_2-dy; y2=pA_2+dy;
+ Out=[[x1,y1],[x2,y1],[x2,y2],[x1,y2],[x1,y1]];
+ if(Noflg<3,
+ println("generate Framedata "+name);
+ tmp1=apply(Out,Pcrd(#));
+ tmp=name+"="+textformat(tmp1,5);
+ parse(tmp);
+ GLIST=append(GLIST,name+"=Framedata("+pA+","+dx+","+dy+")");
+ );
+ if(Noflg<2,
+ if(isstring(Ltype),
+ if((Noflg==0)&(color!=KCOLOR), //181020
+ Texcom("{");Com2nd("Setcolor("+color+")");//180722
+ );
+ Ltype=GetLinestyle(text(Noflg)+Ltype,name);
+ if((Noflg==0)&(color!=KCOLOR), //181020
+ Texcom("}");//180722
+ );
+ ,
+ if(Noflg==1,Ltype=0);
+ );
+ GCLIST=append(GCLIST,[name,Ltype,opcindy]);
);
- GCLIST=append(GCLIST,[name,Ltype,opcindy]);
);
Out;
);
@@ -4217,17 +4799,23 @@ 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==0)&(color!=KCOLOR), //180904
+ Texcom("{");Com2nd("Setcolor("+color+")");//180722
+ );
+ Ltype=GetLinestyle(text(Noflg)+Ltype,name);
+ if((Noflg==0)&(color!=KCOLOR), //180904
+ Texcom("}");//180722
+ );
+ ,
if(Noflg==1,Ltype=0);
);
GCLIST=append(GCLIST,[name,Ltype,opcindy]);
);
Out;
);
+////%Framedata end////
+////%Framedata2 start////
Framedata2(nm,list):=Framedata2(nm,list,[]);
Framedata2(nm,list,options):=(
//help:Framedata2("1",[A,B]);
@@ -4236,7 +4824,9 @@ Framedata2(nm,list,options):=(
pB=Lcrd(list_2);
Framedata(nm,[pC,pB],options);
);
+////%Framedata2 end////
+////%Ovaldata start////
Ovaldata(nm,Pdata):=Ovaldata(nm,Pdata,[]);
Ovaldata(nm,Pdata,options):=(
//help:Ovaldata("1",[A,B]);
@@ -4264,13 +4854,17 @@ Ovaldata(nm,Pdata,options):=(
Dy=Pdata_3;
);
Point=Ctr+[Dx-Rc,Dy-Rc];
- tmp1=Circledata("1",[Point,Point+[Rc,0]],
- ["Rng=[0,pi/2]","Num=10","nodata"]);
tmp2=Listplot("1",[Ctr+[Dx-Rc,Dy],Ctr+[0,Dy]],
["nodata"]);
tmp3=Listplot("2",[Ctr+[Dx,0],Ctr+[Dx,Dy-Rc]],
["nodata"]);
- Graph=Joincrvs("1",[tmp3,tmp1,tmp2],["nodata"]);
+ if(Rc>0, //180624from
+ tmp1=Circledata("1",[Point,Point+[Rc,0]],
+ ["Rng=[0,pi/2]","Num=10","nodata"]);
+ Graph=Joincrvs("1",[tmp3,tmp1,tmp2],["nodata"]);
+ ,
+ Graph=Joincrvs("1",[tmp3,tmp2],["nodata"]);
+ ); //180624to
tmp1=Reflectdata("1",[Graph],[Ctr,Ctr+[0,1]],["nodata"]);
Graph=Joincrvs("1",[Graph,tmp1],["nodata"]);
tmp2=Reflectdata("2",[Graph],[Ctr,Ctr+[1,0]],
@@ -4286,10 +4880,14 @@ 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==0)&(color!=KCOLOR), //180904
+ Texcom("{");Com2nd("Setcolor("+color+")");//180722
+ );
+ Ltype=GetLinestyle(text(Noflg)+Ltype,name);
+ if((Noflg==0)&(color!=KCOLOR), //180904
+ Texcom("}");//180722
+ );
+ ,
if(Noflg==1,Ltype=0);
);
GCLIST=append(GCLIST,[name,Ltype,opcindy]);
@@ -4300,14 +4898,16 @@ Ovaldata(nm,Pdata,options):=(
);
Graph;
);
+////%Ovaldata end////
-Segmark(nm,ptlist):=Segmark(nm,ptlist,[]);
-Segmark(nm,ptlist,options):=Drawsegmark(nm,ptlist,options,color);
+////%Segmark start////
+Segmark(nm,ptlist):=Drawsegmark(nm,ptlist,[]);
+Segmark(nm,ptlist,options):=Drawsegmark(nm,ptlist,options);//180704
Drawsegmark(nm,ptlist):=Drawsegmark(nm,ptlist,[]);
Drawsegmark(nm,ptlist,options):=(
//help:Segmark("1",[A,B]);
//help:Segmark(options=["Type=1","Width=1","Size=1"]);
- regional(name,pA,pB,wid,mid,size,tp,dir,nor,eqL,
+ regional(name,pA,pB,wid,mid,size,tp,dir,nor,eqL,color, //180704
tmp,tmp1,tmp2);
name="mrk"+nm;
pA=ptlist_1;
@@ -4317,7 +4917,7 @@ Drawsegmark(nm,ptlist,options):=(
tp=1;
tmp1=Divoptions(options);
eqL=tmp1_5;
- color=tmp_(length(tmp)-2);
+ color=tmp1_(length(tmp1)-2);//180704
forall(eqL,
tmp=indexof(#,"=");
tmp1=substring(#,tmp,length(#));
@@ -4340,29 +4940,31 @@ Drawsegmark(nm,ptlist,options):=(
if(tp==1,
tmp1=mid+size*nor;
tmp2=mid-size*nor;
- Listplot(name,[tmp1,tmp2]);
+ Listplot(name,[tmp1,tmp2],["Color="+text(color)]);//180704
);
if(tp==2,
tmp1=mid+wid*dir+size*nor;
tmp2=mid+wid*dir-size*nor;
- Listplot(name+"r",[tmp1,tmp2]);
+ Listplot(name+"r",[tmp1,tmp2],["Color="+text(color)]);//180704
tmp1=mid-wid*dir+size*nor;
tmp2=mid-wid*dir-size*nor;
- Listplot(name+"l",[tmp1,tmp2]);
+ Listplot(name+"l",[tmp1,tmp2],["Color="+text(color)]);//180704
);
if(tp==3,
tmp1=mid;
tmp2=mid+size*dir;
- Circledata(name,[tmp1,tmp2]);
+ Circledata(name,[tmp1,tmp2],["Color="+text(color)]);//180704
);
if(tp==4,
tmp=mid+size*2/sqrt(3)*nor;
tmp1=mid+size*dir-size/sqrt(3)*nor;
tmp2=mid-size*dir-size/sqrt(3)*nor;
- Listplot(name,[tmp,tmp1,tmp2,tmp]);
+ Listplot(name,[tmp,tmp1,tmp2,tmp],["Color="+text(color)]);//180704
);
);
+////%Segmark end////
+////%Parabolaplot start////
Parabolaplot(nm,ptlist):=Parabolaplot(nm,ptlist,"[-5,5]",[]);
Parabolaplot(nm,ptlist,Arg):=(
regional(rng,options);
@@ -4404,7 +5006,9 @@ Parabolaplot(nm,ptlist,rng,options):=(
Plotdata(nm+"para",tmp,tmp2,append(options,"nodisp"));
Rotatedata(nm+"para","gr"+nm+"para",angle,append(options,pB));
);
+////%Parabolaplot end////
+////%Ellipseplot start////
Ellipseplot(nm,ptlist):=Ellipseplot(nm,ptlist,"[0,2*pi]",[]);
Ellipseplot(nm,ptlist,Arg):=(
regional(rng,options);
@@ -4449,7 +5053,9 @@ Ellipseplot(nm,ptlist,rng,options):=(
Paramplot(nm+"elp",tmp,"t="+rng,append(options,"nodisp"));
Rotatedata(nm+"elp","gp"+nm+"elp",angle,append(options,pA));
);
+////%Ellipseplot end////
+////%Hyperbolaplot start////
Hyperbolaplot(nm,ptlist):=Hyperbolaplot(nm,ptlist,"[-5/2,5/2]",[]);
Hyperbolaplot(nm,ptlist,Arg):=(
regional(rng,options);
@@ -4515,11 +5121,28 @@ Hyperbolaplot(nm,ptlist,rng,optionsorg):=(
Rotatedata(nm+"asy2","ln"+nm+"asy2",angle,append(opasy,pA));//180408
);
);
+////%Hyperbolaplot end////
+////%Polygonplot start////
Polygonplot(nm,ptlist,number):=Polygonplot(nm,ptlist,number,[]);
-Polygonplot(nm,ptlist,number,options):=(
+Polygonplot(nm,ptlist,number,optionorg):=(
//help:Polygonplot("1",[A,B],12);
- regional(rr,pA,pB,ptL,angle,tmp,tmp1,tmp2);
+//help:Polygonplot("1",[A,B],12,["Geo=n"]);
+ regional(options,eqL,geo,rr,pA,pB,ptL,angle,tmp,tmp1,tmp2);
+println([4573,ptlist]);
+ geo="N"; //180708from
+ options=optionorg;
+ tmp=Divoptions(options);
+ eqL=tmp_5;
+ forall(eqL,
+ tmp=Strsplit(#,"=");
+ tmp1=Toupper(substring(tmp_1,0,1));
+ tmp2=tmp_2;
+ if(tmp1=="G",
+ geo=Toupper(substring(tmp2,0,1));
+ options=remove(options,[#]);
+ );
+ ); //180708to
pA=Lcrd(ptlist_1);
pB=Lcrd(ptlist_2);
rr=|pB-pA|;
@@ -4538,7 +5161,9 @@ Polygonplot(nm,ptlist,number,options):=(
tmp=angle+#*2*pi/number;
tmp1=pA+rr*[cos(tmp),sin(tmp)];
if(#>0 & #<number,
- Putpoint((ptlist_2).name+text(#),tmp1);//16.10.07
+ if((ispoint(ptlist_2))&(geo=="Y"), //180708(3lines)
+ Putpoint((ptlist_2).name+text(#),tmp1);//16.10.07
+ );
//Pointdata(nm,ptL);
);
tmp2=tmp1;
@@ -4546,7 +5171,9 @@ Polygonplot(nm,ptlist,number,options):=(
);
Listplot(nm+"ply",ptL,options);
);
+////%Polygonplot end////
+////%Putintersect start////
Putintersect(nm,pdata1,pdata2):=(
//help:Putintersect("Q","gr1","gr2");
regional(pd1,pd2,tmp);
@@ -4576,23 +5203,35 @@ Putintersect(nm,pdata1,pdata2,ptno):=(
err("No intersect point");
);
);
+////%Putintersect end////
+////%Arrowheaddata start////
Arrowheaddata(point,direction):=Arrowheaddata(point,direction,[]);
Arrowheaddata(point,direction,options):=(
// 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);
+// help:Arrowheaddata(options=[1,18,"Coord=phy"]);
+ regional(list,Ookisa,Hiraki,Futosa,Houkou,Str,Flg,Ev,Nv,pA,pB,
+ reL,eqL,coord,pP,rF,gG,Flg,Nj,Eps,scx,scy,tmp,tmp1,tmp2);
Eps=10^(-3);
- pP=point;
+ coord="P";
Ookisa=0.2*YaSize;
Hiraki=YaAngle;
Futosa=0;
Str=YaStyle;
tmp=Divoptions(options);
- tmp1=tmp_6;
- if(length(tmp1)>0,Ookisa=Ookisa*tmp1_1);
- if(length(tmp1)>1,
- tmp=tmp1_2;
+ eqL=tmp_5; //181018from
+ reL=tmp_6;
+ forall(eqL,
+ tmp=Strsplit(#,"=");
+ tmp1=substring(tmp_1,0,1);
+ tmp2=substring(tmp_2,0,1);
+ if(Toupper(tmp1)=="C",
+ coord=Touppera(tmp2);
+ );
+ ); //181018to
+ if(length(reL)>0,Ookisa=Ookisa*reL_1);
+ if(length(reL)>1,
+ tmp=reL_2;
if(tmp<5,
Hiraki=Hiraki*tmp;
,
@@ -4601,17 +5240,22 @@ Arrowheaddata(point,direction,options):=(
);
Flg=0;
Hiraki=Hiraki*pi/180;
+ if(ispoint(direction),Houkou=direction.xy); //181018
if(isstring(direction),Houkou=parse(direction),Houkou=direction);
if(MeasureDepth(Houkou)==2,Houkou=Houkou_1);
+ if(coord=="P",//181018from
+ if(ispoint(point),pP=point.xy,pP=point);
+ ,
+ pP=Pcrd(point);
+ if(!islist(Houkou_1),
+ Houkou=Pcrd(Houkou);
+ ,
+ Houkou=apply(Houkou,Pcrd(#));
+ );
+ );//181018to
if(islist(Houkou_1),
-// pP=Lcrd(pP);
-// pP=Doscaling(pP);
-// Houkou=Dosscaling(Houkou);
- pP=Pcrd(pP);
- scy=SCALEY;
- SCALEY=1;
tmp=Nearestpt(pP,Houkou);
- pA=tmp_1;
+ pP=tmp_1;
rF=floor(tmp_2);
if(rF==1,
if(|Ptend(Houkou)-Ptstart(Houkou)|<Eps,
@@ -4623,34 +5267,22 @@ Arrowheaddata(point,direction,options):=(
forall(1..rF,Nj,
if(Flg==0,
pB=Ptcrv(rF+1-Nj,Houkou);
- tmp=IntersectcrvsPp([pA,pB],gG);
+ tmp1=apply([pP,pB],LLcrd(#));
+ tmp2=apply(gG,LLcrd(#));
+ tmp=IntersectcrvsPp([pP,pB],gG);
if(length(tmp)>0,
- Houkou=pP-tmp_1_1;
+ Houkou=pP-Pcrd(tmp_1_1);
Flg=1;
);
- pA=pB;
);
);
- SCALEY=scy;
if(Flg==0,
println("Arrowhead may be too large (no intersect)");
Flg=2;
);
- if(Flg==1,
- Houkou=Unscaling(Houkou);
- pP=Unscaling(pP);
- );
);
if(Flg<2,
-// pP=Doscaling(pP);
-// Houkou=Doscaling(Houkou);
- pP=Pcrd(pP);
- if(!ispoint(point),
- Houkou=Pcrd(Houkou);
- );
-// if(MeasureDepth(Houkou)==0,Houkou=Pcrd(Houkou));
Ev=-1/|Houkou|*Houkou;
- Ev=Lcrd(Ev);
Nv=[-Ev_2, Ev_1];
if(indexof(Str,"c")>0,
pP=pP-0.5*Ookisa*cos(Hiraki)*Ev;
@@ -4661,211 +5293,192 @@ Arrowheaddata(point,direction,options):=(
pA=pP+Ookisa*cos(Hiraki)*Ev+Ookisa*sin(Hiraki)*Nv;
pB=pP+Ookisa*cos(Hiraki)*Ev-Ookisa*sin(Hiraki)*Nv;
list=[pA,pP,pB];
- list=apply(list,LLcrd(#));
-// Out=Unscaling(Out);
list;
);
);
+////%Arrowheaddata end////
-Arrowhead(point,Houkou):=Arrowhead(point,Houkou,[]);
-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,color,
- ptstr,hostr,tmp,tmp1,list);
- name="arh"+text(ArrowheadNumber);
- ArrowheadNumber=ArrowheadNumber+1;
- ptstr=textformat(point,5);
- if(isstring(Houkou), // 15.01.11
- tmp=parse(Houkou);
- if(MeasureDepth(tmp)<2,
- hostr=Houkou;
- ,
- hostr=Houkou+"(1)";
- );
+////%Arrowhead start////
+Arrowhead(point,Houkou):=Arrowhead(point,Houkou,[]); //181018from
+Arrowhead(Arg1,Arg2,Arg3):=(
+ if(isstring(Arg1),
+ Arrowhead(Arg1,Arg2,Arg3,[]);
,
- if(ispoint(point),
- hostr=textformat(LLcrd(Houkou),5);
- ,
- hostr=textformat(Houkou,5);
- );
+ Arrowhead(text(ArrowheadNumber),Arg1,Arg2,Arg3);
);
+);
+Arrowhead(nm,point,direction,optionsorg):=(//181018from
+//help:Arrowhead("1",B,B-A);
+//help:Arrowhead(options=[1.5,30,"Coor=P(L)"]);
+//help:Arrowhead(A,"gr1");
+ regional(name,Ltype,Noflg,reL,opstr,opcindy,color,eqL,coord,
+ options,pP,Houkou,ptstr,hostr,tmp,tmp1,tmp2,list);
+ name="arh"+nm; //181018
+ ArrowheadNumber=ArrowheadNumber+1;
+ options=optionsorg;
tmp=Divoptions(options);
Ltype=tmp_1;
Noflg=tmp_2;
reL=tmp_6;
color=tmp_(length(tmp)-2);
- opstr=tmp_(length(tmp)-1);
- opcindy=tmp_(length(tmp));
- list=Arrowheaddata(point,Houkou,options);
+ eqL=tmp_5;
+ coord="P";
+ forall(eqL,
+ tmp=Strsplit(#,"=");
+ tmp1=substring(tmp_1,0,1);
+ tmp2=substring(tmp_2,0,1);
+ if(Toupper(tmp1)=="C",
+ coord=Touppera(tmp2);
+ options=remove(options,[#]);
+ );
+ ); //181018to
+ if(ispoint(direction),Houkou=direction.xy); //181018
+ if(isstring(direction),Houkou=parse(direction),Houkou=direction);
+ if(MeasureDepth(Houkou)==2,Houkou=Houkou_1);
+ if(coord=="P",//181018from
+ if(ispoint(point),pP=point.xy,pP=point);
+ ,
+ pP=Pcrd(point);
+ if(!islist(Houkou_1),
+ Houkou=Pcrd(Houkou);
+ ,
+ Houkou=apply(Houkou,Pcrd(#));
+ );
+ );//181018to
+ list=Arrowheaddata(pP,Houkou,options);
+ if(!Inwindow(LLcrd(pP)),Noflg=2);//181018
if(Noflg<3,
-// println("generate Arrowhead "+name);
- tmp1=apply(list,Pcrd(#));
+ tmp1=apply(list,LLcrd(#));
tmp=name+"="+textformat(tmp1,5);
parse(tmp);
-// GLIST=append(GLIST,name+"=Listplot("+list+")");
);
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;
+ Listplot("-arh"+nm,apply(list,LLcrd(#)),concat(options,["notex","Msg=n"]));
);
- GCLIST=append(GCLIST,[name,Ltype,opcindy]);
);
if(Noflg==0,
- if(length(reL)<3, // 16.04.09 from
- forall(1..(2-length(reL)),
- opstr=opstr+",1";
- );
- tmp=PenThick/PenThickInit;
- opstr=opstr+","+text(tmp);
- ); // 16.04.09 until
- Com2nd("Arrowhead("+ptstr+","+hostr+opstr+")");
- );
-);
-
-Arrowdata(ptlist):=Arrowdata(ptlist,[]);
-Arrowdata(Arg1,Arg2):=(
- regional(tmp,nm,ptlist,flg,pA,pB,options);
- flg=0;
- if(isstring(Arg1),
- nm=Arg1;
- ptlist=Arg2;
- Arrowdata(nm,ptlist,[]);
- flg=1;
- );
- if(flg==0,
- tmp=MeasureDepth(Arg1);
- if(tmp==0,
- pA=Arg1;
- pB=Arg2;
- Arrowdata(pA,pB,[]);
- ,
- ptlist=Arg1;
- options=Arg2;
- nm=text(ArrowlineNumber);
- ArrowlineNumber=ArrowlineNumber+1;
- Arrowdata(nm,ptlist,options);
- );
- );
-);
-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,color);
- Retflg=0;
- Noflg=0;
- Ltype=0;
- if(!isstring(Arg1),
- pA=Arg1;
- pB=Arg2;
- Arrowdata(pA,pB,options,"old");
- Retflg=1;
- ptlist=[pA,pB];
- );
- if(Retflg==0,
- nm=Arg1;
- ptlist=Arg2;
- name="ar"+nm;
tmp=Divoptions(options);
- Ltype=tmp_1;
- 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
- if(length(realL)>0,
- size=realL_1;
+ ptstr=Textformat(LLcrd(pP),5);
+ if(isstring(direction), //181019
+ hostr=direction;
+ ,
+ if(!islist(Houkou_1),
+ hostr=format(LLcrd(Houkou),5);
+ ,
+ hostr=format(apply(Houkou,LLcrd(#)),5);
+ );
);
- tmp2=select(strL,indexof(#,"l")>0); // 16.04.09
- if(length(tmp2)>0,lineflg=1,lineflg=0); // 16.04.09
- segpos=1;
- tmp1=tmp_5;
- if(length(tmp1)>2,
- segpos=tmp1_3;
+ if((Noflg==0)&(color!=KCOLOR), //180904
+ Texcom("{");Com2nd("Setcolor("+color+")");//180722
);
- if(Noflg<3,
-// println("generate Arrowdata "+name);
- tmp1=apply(ptlist,Pcrd(#));
- tmp=name+"="+textformat(tmp1,5);
- parse(tmp);
- tmp1=Pcrd(ptlist_1);//16.10.20
- tmp2=Pcrd(ptlist_2);//16.10.20
- if(lineflg==0, // 16.04.09 from
- tmp=tmp2-0.2*size/2*(tmp2-tmp1)/|tmp2-tmp1|; // 15.06.11
- ,
- tmp=tmp2;
- ); // 16.04.09 until
- tmp=[LLcrd(tmp1),LLcrd(tmp)];//16.10.20
- GLIST=append(GLIST,name+"=Listplot("+textformat(tmp,5)+")");
+ Com2nd("Arrowhead("+ptstr+","+hostr+opstr+")");
+ if((Noflg==0)&(color!=KCOLOR), //180904
+ Texcom("}");//180722
);
- 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);
- );
- tmp=textformat(ptlist,5);
- tmp=substring(tmp,1,length(tmp)-1);
- tmp1=indexof(tmp,"],[");
- if(tmp1>0,
- pA=substring(tmp,0,tmp1);
- pB=substring(tmp,tmp1+1,length(tmp));
- ,
- tmp1=indexof(tmp,",");
- pA=substring(tmp,0,tmp1-1);
- pB=substring(tmp,tmp1,length(tmp));
- );
- tmp1="Lcrd("+pA+")+"
- +textformat(segpos,5)+"*(Lcrd("+pB+")-"+"Lcrd("+pA+"))";
- tmp1=parse(tmp1);
- tmp2="Lcrd("+pB+")-Lcrd("+pA+")";
- tmp2=parse(tmp2);
- Arrowhead(tmp1,tmp2,options);
- GCLIST=append(GCLIST,[name,Ltype,opcindy]);
+);
+);
+////%Arrowhead end////
+
+////%Arrowdata start////
+Arrowdata(nm,ptlist):=Arrowdata(nm,ptlist,[]);
+Arrowdata(nm,ptlist,optionsorg):=(
+//help:Arrowdata("1",[A,B]);
+//help:Arrowdata("1",[pt1,pt2]);
+//help:Arrowdata(options=[1,18,pos(1),cut(0),"Cutend=0,0","Coord=p/n"]);
+ regional(options,Ltype,Noflg,name,opstr,opcindy,eqL,reL,strL,color,size,coord,
+ flg,lineflg,cutend,tmp,tmp1,tmp2,pA,pB,angle,segpos);
+ name="ar"+nm;
+ options=optionsorg;
+ tmp=Divoptions(options);
+ Ltype=tmp_1;
+ Noflg=tmp_2;
+ eqL=tmp_5;
+ reL=tmp_6;
+ strL=tmp_7;
+ color=tmp_(length(tmp)-2);
+ opstr=tmp_(length(tmp)-1);
+ opcindy=tmp_(length(tmp));
+ size=1; // 15.06.11
+ angle=18;
+ segpos=1;
+ if(length(reL)>0,
+ size=relL_1;
+ if(length(reL)>1, //180719from
+ angle=reL_2;
+ if(length(reL)>2,
+ segpos=reL_3;
+ );
+ );//180719to
+ );
+ lineflg=0;
+ if(contains(strL,"l")%contains(strL,"L"),
+ lineflg=1;
+ );//181018from
+ options=remove(options,strL);
+ cutend=[0,0];//180719
+ coord="P";//181018
+ forall(eqL,
+ tmp=Strsplit(#,"=");
+ tmp1=Toupper(substring(tmp_1,0,2));
+ tmp2=tmp_2;
+ if(tmp1=="CU",//180719from
+ tmp2=replace(tmp2,"[","");
+ tmp2=replace(tmp2,"]","");
+ cutend=tokenize(tmp2,",");
+ if(length(cutend)==1,cutend=[cutend_1,cutend_1]);
+ options=remove(options,[#]);
+ );
+ if(tmp1=="CO",//181018from
+ coord=Toupper(substring(tmp2,0,1));
+ options=remove(options,[#]);
);
);
- ptlist;
-);
-Arrowdata(pA,pB,options,str):=(
- regional(ptA,ptB,opstr,Astr,Bstr,name,tmp,opcindy);
- Astr=textformat(pA,5);
- Bstr=textformat(pB,5);
- name="ar"+pA.name+pB.name;
- println("generate Arrow "+name);
- opstr="";
- opcindy="";
- forall(options,
- if(isstring(#),
- if(indexof(#,"->")>0,
- opcindy=opcindy+","+#;
- ,
- tmp="'"+#+"'";
- );
+ if(coord=="P",
+ pA=ptlist_1; pB=ptlist_2;
+ if(ispoint(pA),pA=pA.xy);
+ if(ispoint(pB),pB=pB.xy);
+ ,
+ pA=Pcrd(ptlist_1); pB=Pcrd(ptlist_2);
+ );//181018to
+ if(Noflg<3,
+ println("generate Arrowdata "+name);
+ if(|cutend|>0,//180719from
+ tmp=ptlist_2-ptlist_1;
+ tmp=tmp/|tmp|;
+ ptlist_1=ptlist_1+tmp*cutend_1;
+ ptlist_2=ptlist_2-tmp*cutend_2;
+ );//180719to
+ tmp=name+"="+Textformat([pA,pB],5);
+ parse(tmp);
+ if(lineflg==0, // 16.04.09 from
+ tmp=pA-0.2*size/2*(pB-pA)/|pB-pA|; // 15.06.11
,
- tmp=text(#);
+ tmp=pB;
+ ); // 16.04.09 until
+ tmp=format([LLcrd(pA),LLcrd(tmp)],6);
+ );
+ if(Noflg<2,
+ if(isstring(Ltype),
+// if((Noflg==0)&(color!=KCOLOR), //180904
+// Texcom("{");Com2nd("Setcolor("+color+")");//180722
+// );
+ Listplot("-ar"+nm,[LLcrd(pA),LLcrd(pB)],append(options,"Msg=n"));
+ Arrowhead(nm,pB,pB-pA,options);
+// Ltype=GetLinestyle(text(Noflg)+Ltype,name);
+// if((Noflg==0)&(color!=KCOLOR), //180904
+// Texcom("}");//180722
+// );
+ ,
+ if(Noflg==1,Ltype=0);
);
- opstr=opstr+","+tmp;
);
- ptA=Lcrd(pA);
- ptB=Lcrd(pB);
- Arrowheaddata(ptB,ptB-ptA,options);
- tmp="connect("+textformat([ptA,ptB],5)
- +",linecolor->"+text(KCOLOR)+opcindy+");";
- parse(tmp); // 14.11.17
- Com2nd("Arrowline("+Astr+","+Bstr+opstr+")"); // 14.10.04
+ [Lcrd(pA),Lcrd(pB)];
);
+////%Arrowdata end////
+////%Anglemark start////
Anglemark(plist):=Anglemark(plist,[]);
Anglemark(Arg1,Arg2):=( // 2015.04.28 from
regional(nm,plist,options,tmp);
@@ -4958,10 +5571,14 @@ 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==0)&(color!=KCOLOR), //180904
+ Texcom("{");Com2nd("Setcolor("+color+")");//180722
+ );
+ Ltype=GetLinestyle(text(Noflg)+Ltype,name);
+ if((Noflg==0)&(color!=KCOLOR), //180904
+ Texcom("}");//180722
+ );
+ ,
if(Noflg==1,Ltype=0);
);
GCLIST=append(GCLIST,[name,Ltype,opcindy]);
@@ -4969,7 +5586,9 @@ Anglemark(nm,plist,options):=(
);
Out;
);
+////%Anglemark end////
+////%Paramark start////
Paramark(plist):=Paramark(plist,[]);
Paramark(Arg1,Arg2):=( // 17.03.27 from
regional(nm,plist,options,tmp);
@@ -4985,7 +5604,7 @@ Paramark(Arg1,Arg2):=( // 17.03.27 from
nm=substring(tmp,1,length(tmp)-1);
Paramark(nm,plist,options);
);
-);// until
+);// to
Paramark(nm,plist,options):=(
//help:Paramark([A,B,C],["E=\theta"]);
//help:Paramark("1",[p1,p2,p3],["E=\theta"]);
@@ -5012,7 +5631,7 @@ Paramark(nm,plist,options):=(
if(substring(#,0,1)=="L",Bname="Letter(");
if(substring(#,0,1)=="E",Bname="Expr(");
Bpos="md"+name;
- Bname=Bname+Dq+Bpos+Dq+","+Dq+"c"+Dq+","+Dq;
+ Bname=Bname+Bpos+","+Dq+"c"+Dq+","+Dq; //180705
tmp=substring(#,indexof(#,"="),length(#));
tmp1=indexof(tmp,",");
Bname=Bname+substring(tmp,tmp1,length(tmp))+Dq+")";
@@ -5043,17 +5662,23 @@ 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==0)&(color!=KCOLOR), //180904
+ Texcom("{");Com2nd("Setcolor("+color+")");//180722
+ );
+ Ltype=GetLinestyle(text(Noflg)+Ltype,name);
+ if((Noflg==0)&(color!=KCOLOR), //180904
+ Texcom("}");//180722
+ );
+ ,
if(Noflg==1,Ltype=0);
);
GCLIST=append(GCLIST,[name,Ltype,opcindy]);
);
Out;
);
+////%Paramark end////
+////%MakeBowdata start////
MakeBowdata(pA,pB,Hgt):=(
regional(angle,pB2,pH2,pC2,pC,tmp,Th1,Th2,ra,dMA);
angle=arctan2(pB-pA)+0;
@@ -5068,7 +5693,9 @@ MakeBowdata(pA,pB,Hgt):=(
Th2=arctan2(pB2-pC2)+angle;
[pC,ra,Th1,Th2];
);
+////%MakeBowdata end////
+////%Bowdata start////
Bowdata(plist):=Bowdata(plist,[]);
Bowdata(plist,options):=(
regional(nm,tmp);
@@ -5165,7 +5792,7 @@ Bowdata(nm,plist,options):=(
Bname=Bname+Bpos;//16.11.01
if(abs(Tmov)+abs(Nmov)>0,
tmp=Pcrd(pA)-Pcrd(pB);
- tmp1=1/norm(tmp)*tmp;
+ tmp1=1/Norm(tmp)*tmp;
tmp2=[-tmp1_2,tmp1_1];
tmp=MARKLEN*(Tmov*tmp1+Nmov*tmp2);
tmp=LLcrd(tmp);
@@ -5222,21 +5849,29 @@ 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==0)&(color!=KCOLOR), //180904
+ Texcom("{");Com2nd("Setcolor("+color+")");//180722
+ );
+ Ltype=GetLinestyle(text(Noflg)+Ltype,name);
+ if((Noflg==0)&(color!=KCOLOR), //180904
+ Texcom("}");//180722
+ );
+ ,
if(Noflg==1,Ltype=0);
);
GCLIST=append(GCLIST,[name,Ltype,opcindy]);
);
);
+////%Bowdata end////
+////%Bowname start////
Bowname(str):=Bowname("c",str);
Bowname(dir,str):=(
Expr([BOWMIDDLE,dir,str]);
);
+////%Bowname end////
+////%Bownamerot start////
Bownamerot(bwdata,str):=Bownamerot(bwdata,0,0,str,1);
Bownamerot(bwdata,str,updown):=Bownamerot(bwdata,0,0,str,updown);
Bownamerot(bwdata,tmov,nmov,str):=Bownamerot(bwdata,tmov,nmov,str,1);
@@ -5252,7 +5887,9 @@ Bownamerot(bwdata,tmov,nmov,str,updown):=(
if(updown<0,tmp=-tmp);
Exprrot(BOWMIDDLE,tmp,tmov,nmov,str);
);
+////%Bownamerot end////
+////%Deqdata start////
Deqdata(deq,rng,initt,initf,Num):=( //17.10.04
// Deqdata("[x1,...xn]`=[f1,...fn]","t=[0,20]",0,[...],50);
regional(Eps,Inf,tname,Xname,func,t1,t2,dt,tt,X0,flg,
@@ -5312,7 +5949,9 @@ Deqdata(deq,rng,initt,initf,Num):=( //17.10.04
);
pdL;
);
-
+////%Deqdata end////
+
+////%Deqplot start////
Deqplot(nm,deq,rng,initf):=Deqplot(nm,deq,rng,Lcrd(initf)_1,initf,[]);
Deqplot(nm,deq,rng,Arg1,Arg2):=(
regional(initt,initf,options);
@@ -5426,15 +6065,20 @@ 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==0)&(color!=KCOLOR), //180904
+ Texcom("{");Com2nd("Setcolor("+color+")");//180722
+ );
+ Ltype=GetLinestyle(text(Noflg)+Ltype,name);
+ if((Noflg==0)&(color!=KCOLOR), //180904
+ Texcom("}");//180722
+ );
+ ,
if(Noflg==1,Ltype=0);
);
GCLIST=append(GCLIST,[name,Ltype,opcindy]);
);
);
+////%Deqplot end////
////////// old enclosing ///////////////
@@ -5442,7 +6086,7 @@ Enclosing(nm,plist):=EnclosingS(nm,plist);
Enclosing(nm,plist,options):=EnclosingS(nm,plist,options);
EnclosingS(nm,plist):=EnclosingS(nm,plist,[]);
EnclosingS(nm,plist,options):=(
-//help:Enclosing("1",["sc2","crAB","sc2","Invert(sc1)"],[pt,"dr"]);
+// help:Enclosing("1",["sc2","crAB","sc2","Invert(sc1)"],[pt,"dr"]);
regional(name,AnsL,Start,Eps,EEps,S,Flg,Fdata,Gdata,KL,pt,qt,color
t1,t2,t3,ii,nn,tmp,tmp1,tmp2,Ltype,Noflg,realL,eqL,opstr,opcindy);
name="en"+nm;
@@ -5492,10 +6136,10 @@ EnclosingS(nm,plist,options):=(
,
pt=KL_1_1;
t1=KL_1_2;
- tmp=|pt-Start|;
+ tmp=Norm(pt-Start);
forall(2..(length(KL)),ii, // 15.04.20
tmp1=KL_ii_1;
- tmp2=|tmp1-Start|; // 15.04.20
+ tmp2=Norm(tmp1-Start); // 15.04.20
if(tmp2<tmp,
pt=tmp1;
t1=KL_ii_2;
@@ -5582,10 +6226,14 @@ EnclosingS(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==0)&(color!=KCOLOR), //180904
+ Texcom("{");Com2nd("Setcolor("+color+")");//180722
+ );
+ Ltype=GetLinestyle(text(Noflg)+Ltype,name);
+ if((Noflg==0)&(color!=KCOLOR), //180904
+ Texcom("}");//180722
+ );
+ ,
if(Noflg==1,Ltype=0);
);
GCLIST=append(GCLIST,[name,Ltype,opcindy]);
@@ -5596,13 +6244,16 @@ EnclosingS(nm,plist,options):=(
/////////// new enclosing ///////////
+////%Enclosing start////
+Enclosing(nm,plist):=Enclosing2(nm,plist,[]);//180706(2lines)
+Enclosing(nm,plistorg,options):=Enclosing2(nm,plistorg,options);
Enclosing2(nm,plist):=Enclosing2(nm,plist,[]);
Enclosing2(nm,plistorg,options):=(
-//help:Enclosing2("1",["sc2","crAB","sc2","Invert(sc1)"]);
-//help:Enclosing2(options=[Eps1(0.01),Eps2(0.1)]);
+//help:Enclosing("1",["sg2","gr1","Invert(sg2)"]);
+//help:Enclosing(options=[startpoint,epspara(1)]);
regional(name,plist,AnsL,Start,Eps,Eps1,Eps2,flg,Fdata,Gdata,KL,
t1,t2,tst,ss,ii,nn,nxtno,Ltype,Noflg,realL,eqL,opstr,opcindy,
- tmp,tmp1,tmp2,color);
+ tmp,tmp1,tmp2,color,epspara,p1,p2);
name="en"+nm;
plist=plistorg;
tmp=Divoptions(options);
@@ -5614,16 +6265,18 @@ Enclosing2(nm,plistorg,options):=(
opstr=tmp_(length(tmp)-1);
opcindy=tmp_(length(tmp));
Eps=10^(-5); // 16.12.05
+ epspara=1; //180707
Eps1=0.01;
Eps2=0.1;
Start=[];
flg=0;
forall(realL,
if(isList(#) % ispoint(#),
-// Start=Lcrd(#); // 18.02.02
+ Start=Lcrd(#); // 18.02.02
,
- if(flg==0,Eps1=#);
- if(flg==1,Eps2=#);
+ if(flg==0,epspara=#);//180707
+ if(flg==1,Eps1=#);
+ if(flg==2,Eps2=#);
flg=flg+1;
);
);
@@ -5652,7 +6305,8 @@ Enclosing2(nm,plistorg,options):=(
tmp=Listplot(name,[tmp1,tmp2],["nodisp"]);
plist=append(plist,"sg"+name);
Start=tmp2;
- tst=1; //18.02.02until
+ tst=1; //18.02.02to
+ p1=Start;
,
if(length(KL)==1,
tst=KL_1_2;
@@ -5666,7 +6320,7 @@ Enclosing2(nm,plistorg,options):=(
,
tmp=apply(KL,|#_1-Start|);
tmp=min(tmp);
- tmp1=select(KL,|#_1-Start|==tmp);
+ tmp1=select(KL,|#_1-Start|<tmp+Eps1);//180718
tst=tmp1_1_2;
Start=Pointoncurve(tst,Fdata);
);
@@ -5675,6 +6329,7 @@ Enclosing2(nm,plistorg,options):=(
);
if(flg==0,
t1=tst;
+ p1=Pointoncurve(t1,Fdata); //180713
println("Start point of enclosing is "+text(Start));
forall(1..(length(plist)),nn,
Fdata=plist_nn;
@@ -5691,11 +6346,17 @@ Enclosing2(nm,plistorg,options):=(
parse(tmp);
plist_nxtno=Gdata;
t2=Length(tmp1);
- ss=1; //18.02.02until
+ p2=Pointoncurve(t2,Fdata); //180713
+ ss=1; //18.02.02to
,
+ KL=sort(KL,[#_2]);//180706
+ tmp=parse(Fdata);
+ tmp1=t1+epspara/50*length(tmp);
+// KL=select(KL,#_2>t1+epspara/50*length(tmp)); //180707
+ KL=select(KL,(#_2>tmp1)%((#_2>t1)&(|#_1-p1|>Eps1))); //180713,16
t2=KL_1_2;
ss=KL_1_3;
- if(abs(t2-t1)<Eps,
+ if(abs(t2-t1)<Eps,//180707
if(length(KL)>1,
t2=KL_2_2;
ss=KL_2_3;
@@ -5712,12 +6373,13 @@ Enclosing2(nm,plistorg,options):=(
,
AnsL=concat(AnsL,tmp_(2..(length(tmp))));
);
- t1=ss;
);
+ t1=ss;//180706
+ p1=Pointoncurve(t1,Gdata); //180713
);
);
if(flg==0,
- AnsL=apply(AnsL,Pcrd(#));
+ AnsL=apply(AnsL,Pcrd(#));
);
if(Noflg<3,
println("generate Enclosing "+name);
@@ -5728,15 +6390,21 @@ Enclosing2(nm,plistorg,options):=(
forall(plistorg, //18.02.02
tmp1=tmp1+#+",";
);
- tmp=tmp+substring(tmp1,0,length(tmp1)-1)+"))";//18.02.02
+ tmp=tmp+substring(tmp1,0,length(tmp1)-1)+")";//18.0706from
+ if(length(Start)>0,tmp=tmp+","+Textformat(Start,6));
+ tmp=tmp+","+text(epspara)+")";//18.0706to,180707
GLIST=append(GLIST,tmp);//16.11.07until
);
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==0)&(color!=KCOLOR), //180904
+ Texcom("{");Com2nd("Setcolor("+color+")");//180722
+ );
+ Ltype=GetLinestyle(text(Noflg)+Ltype,name);
+ if((Noflg==0)&(color!=KCOLOR), //180904
+ Texcom("}");//180722
+ );
+ ,
if(Noflg==1,Ltype=0);
);
GCLIST=append(GCLIST,[name,Ltype,opcindy]);
@@ -5744,16 +6412,18 @@ Enclosing2(nm,plistorg,options):=(
tmp=apply(AnsL,LLcrd(#));//16.10.20
tmp;
);
+////%Enclosing end////
/////////// end of new enclosing ///////////
/////////// new Hatchdata(cindy) ///////////
+////%Makehatch start////
Makehatch(iolistorg,pt,vec,bdylist):=(
regional(Eps,iolist,sg,bdy,out,nb,tenL,ns,ne,ioL,
ii,jj,kk,nvec,nbdy,sgn1,sgn2,flg,rmL,p0,p1,p2,pL,
Scalebkup,tmp,tmp1,tmp2);
- Eps=10^(-6);
+ Eps=10^(-5);
nvec=[-vec_2,vec_1];
nvec=nvec/|nvec|;
if(!islist(iolistorg),iolist=[iolistorg],iolist=iolistorg);
@@ -5763,7 +6433,8 @@ Makehatch(iolistorg,pt,vec,bdylist):=(
tmp="["+substring(tmp,0,length(tmp)-1)+"]";
iolist_#=parse(tmp);
);
- Scalebkup=SCALEY;
+ Scalebkup=[SCALEX,SCALEY];//181020(2lines)
+ SCALEX=1;
SCALEY=1;
sg=Lineplot("",[pt,pt+vec],["nodata"]);
nb=length(bdylist);
@@ -5780,7 +6451,17 @@ Makehatch(iolistorg,pt,vec,bdylist):=(
tmp=Intersectseg(sg,[p1,p2],Eps);
if(abs(tmp_1)<Eps, //18.02.01
p0=tmp_2; t=tmp_3; s=tmp_4;
- pL=append(pL,[p0,t,s,ii]);
+ flg=0; //181003from
+ forall(pL,
+ if(flg==0,
+ if(Norm(#_1-p0)<Eps,
+ flg=1;
+ );
+ );
+ );
+ if(flg==0,
+ pL=append(pL,[p0,t,s,ii]);
+ ); //181003to
);
);
if(length(pL)>0,
@@ -5790,6 +6471,21 @@ Makehatch(iolistorg,pt,vec,bdylist):=(
);
);
tenL=sort(tenL,[#_2]);
+ if(length(tenL)>0, //180619from
+ tmp1=tenL; tenL=[tmp1_1];
+ forall(2..(length(tmp1)),ii, //180717from
+ tmp=tmp1_ii;
+ flg=0;
+ forall(tenL,
+ if((Norm(tmp_1-#_1)<Eps1)&(tmp_4==#_4),
+ flg=1;
+ );
+ );
+ if(flg==0,
+ tenL=append(tenL,tmp);
+ );
+ );//180717to
+ ); //180619to
ioL=apply(1..nb,0);
ns=1;
ne=length(tenL);
@@ -5804,7 +6500,7 @@ Makehatch(iolistorg,pt,vec,bdylist):=(
tmp=[sg_2,-1,2,ioL];
tenL=append(tenL,tmp);
);
- forall(ns..ne,ii,
+ forall(ns..(ne-1),ii, //180619 ne=>ne-1
tmp=tenL_ii;
tmp1=tmp_4;
tmp2=tmp_5;
@@ -5822,17 +6518,49 @@ Makehatch(iolistorg,pt,vec,bdylist):=(
);
);
);
- SCALEY=Scalebkup;
+ SCALEX=Scalebkup_1; //181020
+ SCALEY=Scalebkup_2;
out;
);
+////%Makehatch end////
-Hatchdatacindy(nm,iostr,bdylist):=Hatchdatacindy(nm,iostr,bdylist,[]);
-Hatchdata(nm,iostr,bdylist,options):=Hatchdatacindy(nm,iostr,bdylist,options);
+////%Hatchdata start////
+Hatchdata(nm,iostr,bdylist):=Hatchdatacindy(nm,iostr,bdylist,[]);//180619
+Hatchdata(nm,iostr,bdylist,optionsorg):=( //181003from
+ regional(options,tmp,tmp1,tmp2,eqL,strL,outflg);
+ options=optionsorg;
+ tmp=Divoptions(options);
+ eqL=tmp_5;
+ strL=tmp_7;
+ outflg=0;
+ forall(eqL,
+ tmp=Strsplit(#,"=");
+ tmp1=Toupper(tmp_1);
+ if(substring(tmp1,0,1)=="O",
+ tmp2=tmp_2;
+ if(tmp2!="n",
+ outflg=1;
+ option=remove(options,[#]);
+ if((tmp2=="m")%(tmp2=="r"),
+ options=append(options,tmp2);;
+ );
+ );
+ );
+ );
+ if(outflg==0,
+ options=remove(options,strL);
+ Hatchdatacindy(nm,iostr,bdylist,options);
+ ,
+ HatchdataR(nm,iostr,bdylist,options);
+ );
+); //181003to
+Hatchdatacindy(nm,iostr,bdylist):=Hatchdata(nm,iostr,bdylist,[]);
Hatchdatacindy(nm,iostr,bdylistorg,options):=(
-//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,color);
+ //help:Hatchdata("1",["ii"],[["ln1","Invert(gr1)"],["gr2","n"]]);
+//help:Hatchdata(options=["Out=n(//m/r)","Maxnum=20",angle,width]);
+ regional(name,bdylist,bdynameL,bname,Ltype,Noflg,opstr,opcindy,reL,
+ eqL,maxnum,startP,angle,interval,vec,nvec,ctr,pt,kk,delta,sha,AnsL,
+ color,tmp,tmp1,tmp2,tmp3,namep,x1,y1,x2,y2,p1,p2); //180717
name="ha"+nm;
bdylist=[];
bdynameL=[];
@@ -5843,34 +6571,55 @@ Hatchdatacindy(nm,iostr,bdylistorg,options):=(
,
tmp=tmp1_(length(tmp1));
if(contains(["n","s","e","w"],tmp),
- tmp2=parse(tmp1_1);
+ namep=tmp1_1;//180717from
+ tmp2=parse(namep);
+ if(substring(namep,0,2)=="ln", //180717from
+ if(contains(["n","s"],tmp),
+ x1=tmp2_1_1; y1=tmp2_1_2; x2=tmp2_2_1; y2=tmp2_2_2;
+ p1=[NE.x,(y2-y1)/(x2-x1)*(NE.x-x1)+y1];
+ p2=[SW.x,(y2-y1)/(x2-x1)*(SW.x-x1)+y1];
+ Listplot(name+text(kk),[p1,p2],["nodisp"]);
+ namep="sg"+name+text(kk);
+ tmp2=parse(namep);
+ );
+ if(contains(["e","w"],tmp),
+ x1=tmp2_1_1; y1=tmp2_1_2; x2=tmp2_2_1; y2=tmp2_2_2;
+ p1=[(x2-x1)/(y2-y1)*(NE.y-y1)+x1,NE.y];
+ p2=[(x2-x1)/(y2-y1)*(SW.y-y1)+x1,SW.y];
+ Listplot(name+text(kk),[p1,p2],["nodisp"]);
+ namep="sg"+name+text(kk);
+ tmp2=parse(namep);
+ );
+ );//180717to
if(tmp=="s",
- Listplot(name,[LLcrd(tmp2_1),[tmp2_1_1,YMIN],
- [tmp2_(length(tmp2))_1,YMIN],LLcrd(tmp2_(length(tmp2)))],["nodisp"]);
- Joincrvs(text(kk)+name,[tmp1_1,"sg"+name],["nodisp"]);
+ Listplot(name,[LLcrd(tmp2_1),[tmp2_1_1,2*YMIN-YMAX], //180717(2lines)
+ [tmp2_(length(tmp2))_1,2*YMIN-YMAX],LLcrd(tmp2_(length(tmp2)))],
+ ["nodisp"]);
+ Joincrvs(text(kk)+name,[namep,"sg"+name],["nodisp"]);//180717
bname="join"+text(kk)+name;
);
if(tmp=="n",
- Listplot(name,[LLcrd(tmp2_1),[tmp2_1_1,YMAX],
- [tmp2_(length(tmp2))_1,YMAX],LLcrd(tmp2_(length(tmp2)))],["nodisp"]);
- Joincrvs(text(kk)+name,[tmp1_1,"sg"+name],["nodisp"]);
+ Listplot(name,[LLcrd(tmp2_1),[tmp2_1_1,2*YMAX-YMIN], //180717(2lines)
+ [tmp2_(length(tmp2))_1,2*YMAX-YMIN],LLcrd(tmp2_(length(tmp2)))],
+ ["nodisp"]);
+ Joincrvs(text(kk)+name,[namep,"sg"+name],["nodisp"]);
bname="join"+text(kk)+name;
);
if(tmp=="e",
Listplot(name,apply([tmp2_1,[XMAX,tmp2_1_2],
[XMAX,tmp2_(length(tmp2))_2],tmp2_(length(tmp2))],LLcrd(#)),["nodisp"]);
- Joincrvs(text(kk)+name,[tmp1_1,"sg"+name],["nodisp"]);
+ Joincrvs(text(kk)+name,[namep,"sg"+name],["nodisp"]);//180717
bname="join"+text(kk)+name;
);
if(tmp=="w",
Listplot(name,apply( [tmp2_1,[XMIN,tmp2_1_2],
[XMIN,tmp2_(length(tmp2))_2],tmp2_(length(tmp2))],LLcrd(#)),["nodisp"]);
- Joincrvs(text(kk)+name,[tmp1_1,"sg"+name],["nodisp"]);
+ Joincrvs(text(kk)+name,[namep,"sg"+name],["nodisp"]);//180717
bname="join"+text(kk)+name;
);
,
- Enclosing2(text(#)+name,tmp,["nodisp"]);
- bname="en"+text(#)+name;
+ Enclosing2(text(kk)+name,tmp,["nodisp"]);//180619(2lines);
+ bname="en"+text(kk)+name;
);
);
bdylist=append(bdylist,parse(bname));
@@ -5879,13 +6628,26 @@ Hatchdatacindy(nm,iostr,bdylistorg,options):=(
tmp=Divoptions(options);
Ltype=tmp_1;
Noflg=tmp_2;
+ eqL=tmp_5;
+ reL=tmp_6;
color=tmp_(length(tmp)-2);
opstr=tmp_(length(tmp)-1);
opcindy=tmp_(length(tmp));
- reL=tmp_6;
angle=45;
- interval=0.125*1000/2.54/MilliIn;
+// interval=0.125*1000/2.54/MilliIn;
+ interval=0.25*1000/2.54/MilliIn; //180706
startP=[(XMIN+XMAX)/2, (YMIN+YMAX)/2];
+ maxnum=[30,0]; //181005 [first,second]
+ forall(eqL,
+ tmp=Strsplit(#,"=");
+ tmp1=Toupper(tmp_1);
+ if(substring(tmp1,0,1)=="M",
+ maxnum=parse(tmp_2);
+ if(!islist(maxnum),
+ maxnum=[maxnum,0];
+ );
+ );
+ );//181003to
tmp1=1;
forall(reL,
if(islist(#),
@@ -5903,28 +6665,21 @@ Hatchdatacindy(nm,iostr,bdylistorg,options):=(
vec=[cos(angle),sin(angle)];
nvec=[-sin(angle),cos(angle)];
AnsL=[];
- flg=0;
- forall(0..100,kk,
+ ctr=0;//181005(2lines)
+ forall(0..(maxnum_1), kk,
pt=startP+kk*interval*nvec;
- if(flg==0,
- sha=Makehatch(iostr,pt,vec,bdylist);
- if((sha==-1)%(length(sha)==0),
-// flg=1;
- ,
- AnsL=concat(AnsL,sha);
- );
+ sha=Makehatch(iostr,pt,vec,bdylist);
+ if((sha!=-1)&(length(sha)>0),
+ AnsL=concat(AnsL,sha);
+ ctr=ctr+1; //181005
);
);
- flg=0;
- forall(1..100,kk,
+ maxnum_2=maxnum_2+(maxnum_1-ctr); //181005
+ forall(1..(maxnum_2),kk, //181005
pt=startP-kk*interval*nvec;
- if(flg==0,
- sha=Makehatch(iostr,pt,vec,bdylist);
- if((sha==-1)%(length(sha)==0),
-// flg=1;
- ,
- AnsL=concat(AnsL,sha);
- );
+ sha=Makehatch(iostr,pt,vec,bdylist);
+ if((sha!=-1)&(length(sha)>0),
+ AnsL=concat(AnsL,sha);
);
);
if(Noflg<3,
@@ -5946,10 +6701,14 @@ 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==0)&(color!=KCOLOR), //180904
+ Texcom("{");Com2nd("Setcolor("+color+")");//180722
+ );
+ Ltype=GetLinestyle(text(Noflg)+Ltype,name);
+ if((Noflg==0)&(color!=KCOLOR), //180904
+ Texcom("}");//180722
+ );
+ ,
if(Noflg==1,Ltype=0);
);
GCLIST=append(GCLIST,[name,Ltype,opcindy]);
@@ -5961,8 +6720,9 @@ Hatchdatacindy(nm,iostr,bdylistorg,options):=(
);
tmp2;
);
+////%Hatchdata end////
-
+////%Shade start////
Shade(plist):=Shade("",plist,[]); //180613from
Shade(Arg1,Arg2):=(
if(isstring(Arg1),
@@ -5977,7 +6737,9 @@ Shade(nm,plistorg,options):=( //180613to
//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);
+//help:Shade("1",["gr2","Invert(sg1)"],["Enc=y",startpt]]);
+ regional(name,plist,jj,tmp,tmp1,tmp2,
+ opstr,opcindy,eqL,reL,Str,G2,flg,encflg,startpt,color,ctr);
name="shade"+nm;
plist=plistorg;
if(isstring(plist_1), // 16.01.24
@@ -5986,17 +6748,44 @@ Shade(nm,plistorg,options):=( //180613to
println("output Shade of lists");
);
tmp=Divoptions(options);
+ eqL=tmp_5;
+ reL=tmp_6;
color=tmp_(length(tmp)-2);
opstr=tmp_(length(tmp)-1);
opcindy=tmp_(length(tmp));
- reL=tmp_6; //180603from
- if(length(reL)>0,
- color=reL_1*color;
- );//180603to
+ tmp=select(plist,indexof(#,"Invert")>0); //180929from
+ if(length(tmp)>0,encflg=1,encflg=0);
+ forall(eqL,
+ tmp=Strsplit(#,"=");
+ tmp1=Toupper(tmp_1);
+ tmp2=Toupper(tmp_2);
+ if(substring(tmp1,0,1)=="E",
+ if(substring(tmp2,0,1)=="Y",
+ encflg=1;
+ );
+ if(substring(tmp2,0,1)=="N",
+ encflg=0;
+ );
+ );
+ );
+ startpt=[];
+ forall(reL,
+ if(islist(#),
+ startpt=#;
+ );
+ ); //180929to
if(length(color)==4, //180602from
tmp=colorCmyk2rgb(color);
);
flg=0; ctr=1;
+ if(encflg==1, //180929from
+ if(length(startpt)==2,
+ Enclosing(nm,plist,[startpt,"nodisp"]);
+ ,
+ Enclosing(nm,plist,["nodisp"]);
+ );
+ plist=["en"+nm];
+ ); //180929to
forall(1..(length(plist)),jj, //180613from
if(flg==0,
tmp1=plist_jj;
@@ -6038,13 +6827,14 @@ Shade(nm,plistorg,options):=( //180613to
);
,
tmp1=tmp1+"Listplot("+textformat(#,5)+"),";
- ); // until 16.01.24
+ ); //16.01.24to
);
- Str=Str+substring(tmp1,0,length(tmp1)-1)+")"+opstr+")";
- if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")",["before"]));
+ Str=Str+substring(tmp1,0,length(tmp1)-1)+")"+")"; //180929
+ Com2nd("Texcom("+Dqq("{")+")",["before"]);Com2nd("Setcolor("+color+")",["before"]);//180722
Com2nd(Str,["before"]);
- if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")",["before"]));
+ Com2nd("Texcom("+Dqq("}")+")",["before"]);//180722
);
+////%Shade end////
/////////// end of new Hatchdata(cindy) ///////////