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.cs363
1 files changed, 180 insertions, 183 deletions
diff --git a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic1r.cs b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic1r.cs
index be7bd1adedf..a3376741a8d 100644
--- a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic1r.cs
+++ b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic1r.cs
@@ -14,7 +14,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>
//
-println("KeTCindy V.3.2.3(20181201)");
+println("KeTCindy V.3.2.3(20181216)");
println(ketjavaversion());
println("ketcindylibbasic1(20181125) loaded");
@@ -66,7 +66,7 @@ Ketinit(work,sy,rangex,rangey):=(//181001to
TenSizeInit=0.02;
TenSize=TenSizeInit;
YaSize=1; YaAngle=18; YaPosition=1;
- YaThick=1; YaStyle="tf";
+ YaCut=0; YasenStyle="dr,1"; Yajiristyle="tf";
KETPICCOUNT=1;
KCOLOR=[0,0,0];
GLIST=[];
@@ -82,6 +82,8 @@ Ketinit(work,sy,rangex,rangey):=(//181001to
COM2ndlist=[];
COM2ndlistb=[]; //180612
ADDAXES="1";
+ AXSTYLE=["l","x","e","y","n","O","sw","","",""]; //181216
+ AXCOUNT=1; //181215
LFmark=unicode("000a");
CRmark=unicode("000d");//16.12.13
Dq=unicode("0022");
@@ -91,6 +93,7 @@ Ketinit(work,sy,rangex,rangey):=(//181001to
OutComList=[];
OutFileLIst=[]; // 15.10.22
FigPdfList=[]; // 16.04.08
+ Fillstore(); //181212
ADDPACK=[]; // 16.05.16
GPACK="tpic"; //180817
ErrFlag=0;
@@ -167,11 +170,6 @@ Ketinit(work,sy,rangex,rangey):=(//181001to
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";
- ,
- LibnameS=Dirlib+pathsep()+"ketpicscifiles6";
- );
if(indexof(PathT,"pdflatex")+indexof(PathT,"lualatex")>0,
LibnameS=replace(LibnameS,"ketpic","ketpic2e");
);//17.12.03until
@@ -180,10 +178,34 @@ Ketinit(work,sy,rangex,rangey):=(//181001to
////%Fillstore start////
Fillstore():=(
- regional(tmp,tmp1,out);
+ regional(tmp,tmp1,out,dtL,txtL,clrL,txt,clr,nn,jj);
+ dtL=[ //181209from
+ ["Figure",[1,0.29,0.29]],["Parent",[1,1,0]],
+ ["ParaF",[0,1,1]],["Flip",[0,0,1]],["Anime",[0.51,0.95,1]],
+ ["Title",[0,1,0]],["Slide",[0.47,0,0.72]],["Digest",[1,0.74,0.47]],
+ ["KeTJS",[0,1,1]],["KeTJSoff",[0,1,1]],
+ ["Objview",[0,1,0]]
+ ];
+ txtL=apply(dtL,#_1);
+ clrL=apply(dtL,#_2);
tmp1=allelements();
tmp1=select(tmp1,indexof(#.name,"Text")>0);
- out=apply(tmp1,[#.name,#.fillcolor]);
+ out=[];
+ forall(1..(length(tmp1)),nn,
+ tmp=tmp1_nn;
+ txt=tmp.text;
+ tmp=select(1..(length(txtL)),txtL_#==txt);
+ if(length(tmp)>0,
+ jj=tmp_1;
+ clr=clrL_jj;
+ tmp=tmp1_nn;
+ tmp.fillcolor=clr;
+ ,
+ tmp=tmp1_nn;
+ clr=tmp.fillcolor;
+ );
+ out=append(out,[tmp.name,clr,tmp.text]);
+ ); //181209to
out;
);
////%Fillstore end////
@@ -192,9 +214,7 @@ Fillstore():=(
Fillblack():=Fillblack("Running");
Fillblack(str):=(
regional(tmp,tmp1,store);
- tmp1=allelements();
- tmp1=select(tmp1,indexof(#.name,"Text")>0);
- store=apply(tmp1,[#.name,#.fillcolor,#.text]);
+ store=Fillstore(); //181209
tmp=select(tmp1,#.name=="Text0");
if(length(tmp)==0,
forall(store,
@@ -474,6 +494,34 @@ Sep1000(va):=( //17.07.18
);
////%Sep1000 end////
+////%Acos start////
+Acos(x):=(
+//help:Acos(1.000001);
+ re(arccos(x));
+);
+////%Acos end////
+
+////%Asin start////
+Asin(x):=(
+//help:Asin(1.000001);
+ re(arcsin(x));
+);
+////%Asin end////
+
+////%Atan start////
+Atan(x):=(
+//help:Atan(1);
+ re(arctan(x));
+);
+////%Atan end////
+
+////%Sqr start////
+Sqr(x):=(
+//help:Sqr(-0.00001);
+ if(x<0,0,sqrt(x));
+);
+////%Sqr end////
+
////%Factorial start////
Factorial(n):=(
//help:Factorial(5);
@@ -1225,14 +1273,7 @@ Divoptions(options):=(
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);
+ tmp1=Colorname2rgb(tmp2); color=tmp1; //181212
);
tmp="color->"+text(tmp1);
opcindy=opcindy+","+tmp;
@@ -3042,8 +3083,12 @@ ColorRgb2Cmyk(clr):=(
regional(clrnew,tmp,black);
tmp=apply(clr,1-#);
black=min(tmp);
- tmp=apply(clr,(1-#-black)/(1-black));
- clrnew=append(tmp,black);
+ if(black!=1, //181112from
+ tmp=apply(clr,(1-#-black)/(1-black));
+ clrnew=append(tmp,black);
+ ,
+ clrnew=[0,0,0,1];
+ ); //181112to
clrnew;
);
////%ColorRgb2Cmyk end////
@@ -3178,7 +3223,7 @@ Colorhslrgb(hsl):=(
);
////%Colorhslrgb end////
-////%hue2rgb start////
+////%Colorhue2rgb start////
hue2rgb(vv1,vv2,vh):=(
regional(out);
if ( vh < 0.0 ,vh =vh+1);
@@ -3198,7 +3243,7 @@ hue2rgb(vv1,vv2,vh):=(
);
out;
);
-////%hue2rgb end////
+////%Colorhue2rgb end////
////%Colorrgbhwb start////
Colorrgbhwb(sL):=(
@@ -3239,160 +3284,74 @@ Colorhwbrgb(sLorg):=(
);
////%Colorhwbrgb end////
-////%Colorhslhsv start////
-Colorhslhsv(sL):=(
- regional(dl1,dl2,dl3,dL);
- dl1=sL_1;
- if(sL_3 == 0,
- // no need to do calc on black
- // also avoids divide by 0 error
- dL= [0, 0, 0];
- ,
- sL_3 = sL_3 * 2;
- if(sL_3 <= 1,sL_2 = sL_2 * sL_3,sL_2 = sL_2 * (2 - sL_3));
- dl3 = (sL_3 + sL_2) / 2;
- dl2 = (2 * sL_2) / (sL_3 + sL_2);
- dL = [dl1, dl2, dl3];
- );
- dL;
-);
-////%Colorhslhsv end////
-
////%Colorcode start////
-Colorcode(src,dest,sL):=(
+Colorcode(src,dest,sL):=( // 181212 some colorchange deleted
//help:Colorcode("rgb","cmyk",[1,0.5,0]);
regional(tmp,tmp1,tmp2,tmp3,mn,mx,delta,black,dL,flg);
regional(dl1,dl2,dl3);
+ if(src=="rgb" & dest=="cmyk",dL=Colorrgb2cmyk(sL));
+ if(src=="cmyk" & dest=="rgb",dL=Colorcmyk2rgb(sL));
if(src=="rgb" & dest=="hsv", dL=Colorrgbhsv(sL));
- if(src=="hsv" & dest=="rgb", dL=Colorhsvrgb(sL));
if(src=="rgb" & dest=="hsl", dL=Colorrgbhsl(sL));
- if(src=="hsl" & dest=="rgb", dL=Colorhslrgb(sL));
if(src=="rgb" & dest=="hwb", dL=Colorrgbhwb(sL));
+ if(src=="hsv" & dest=="rgb", dL=Colorhsvrgb(sL));
+ if(src=="hsl" & dest=="rgb", dL=Colorhslrgb(sL));
if(src=="hwb" & dest=="rgb", dL=Colorhwbrgb(sL));
- if(src=="hsl" & dest=="hsv", dL=Colorhslhsv(sL));
- if(src=="hsv" & dest=="hsl",
- dl1 = sL_1;
- dl3 = (2 - sL_2) * sL_3;
- dl2 = sL_2 * sL_3;
- if(dl3 <= 1,dl2 = dl2/dl3,dl2=dl2/(2 - dl3));
- dl3 =d l3/ 2;
- dL = [dl1, dl2 , dl3 ];
- );
-
- if(src=="rgb" & dest=="cmyk",
- tmp=apply(sL,1-#);
- black=min(tmp);
- tmp=apply(sL,(1-#-black)/(1-black));
- dL=append(tmp,black);
- );
- if(src=="cmyk" & dest=="rgb",
- black=sL_4;
- tmp=apply(sL,1-min(1,#*(1-black)+black));
- dL=tmp_(1..3);
- );
- if(src=="hsv" & dest=="cmyk",
- tmp=Colorcode("hsv","rgb",sL);
- dL=Colorcode("rgb","cmyk",tmp);
- );
- if(src=="cmyk" & dest=="hsv",
- tmp=Colorcode("cmyk","rgb",sL);
- dL=Colorcode("rgb","hsv",tmp);
- );
-
- if(src=="hsv" & dest=="hwb",
- tmp = Colorcode("hsv","rgb",sL);
- dL = Colorcode("rgb","hwb",tmp);
- );
- if(src=="hwb" & dest=="hsv",
- tmp = Colorcode("hwb","rgb",sL);
- dL = Colorcode("rgb","hsv",tmp);
- );
- if(src=="hsl" & dest=="hwb",
- tmp = Colorcode("hsl","rgb",sL);
- dL = Colorcode("rgb","hwb",tmp);
- );
- if(src=="hwb" & dest=="hsl",
- tmp = Colorcode("hwb","rgb",sL);
- dL = Colorcode("rgb","hsl",tmp);
- );
- if(src=="hsl" & dest=="cmyk",
- tmp = Colorcode("hsl","rgb",sL);
- dL = Colorcode("rgb","cmyk",tmp);
- );
- if(src=="hwb" & dest=="cmyk",
- tmp = Colorcode("hwb","rgb",sL);
- dL = Colorcode("rgb","cmyk",tmp);
- );
- if(src=="cmyk" & dest=="hsl",
- tmp = Colorcode("cmyk","rgb",sL);
- dL = Colorcode("rgb","hsl",tmp);
- );
- if(src=="cmyk" & dest=="hwb",
- tmp = Colorcode("cmyk","rgb",sL);
- dL = Colorcode("rgb","hwb",tmp);
- );
- if(src=="hsb" & dest=="rgb",dL=Colorcode("hsv","rgb",sL));
- if(src=="rgb" & dest=="hsb",dL=Colorcode("rgb","hsv",sL));
-
- if(src=="hsb" & dest=="hsl",dL=Colorcode("hsv","hsl",sL));
- if(src=="hsl" & dest=="hsb",dL=Colorcode("hsl","hsv",sL));
-
- if(src=="hsb" & dest=="hwb",dL=Colorcode("hsv","hwb",sL));
- if(src=="hwb" & dest=="hsb",dL=Colorcode("hwb","hsv",sL));
-
- if(src=="hsb" & dest=="cmyk",dL=Colorcode("hsv","cmyk",sL));
- if(src=="cmyk" & dest=="hsb",dL=Colorcode("cmyk","hsv",sL));
-
dL;
);
////%Colorcode end////
-////%Colorinfile start////
-Colorinfile(filename,clrf,clrt):=(
- regional(tmp,tmp1,tmp2,head,cstrL,chstrL,head,body);
- if(length(clrf_1)==3,
- head="[rgb]{";
- ,
- head="[cmyk]{";
- );
- tmp=apply(clrf,text(#));
- cstrL=apply(tmp,head+substring(#,1,length(#)-1)+"}");
- if(length(clrt_1)==3,
- head="[rgb]{";
+////%Colorname2rgb start////
+Colorname2rgb(name):=( //181212
+//help:Colorname2rgb("sepia");
+ regional(dL,nameL,codeL,tmp);
+ dL=[
+ ["greenyellow",[0.15,0,0.69,0]],["yellow",[0,0,1,0]],
+ ["goldenrod",[0,0.1,0.84,0]],["dandelion",[0,0.29,0.84,0]],
+ ["apricot",[0,0.32,0.52,0]],["peach",[0,0.5,0.7,0]],
+ ["melon",[0,0.46,0.5,0]],["yelloworange",[0,0.42,1,0]],
+ ["orange",[0,0.61,0.87,0]],["burntorange",[0,0.51,1,0]],
+ ["bittersweet",[0,0.75,1,0.24]],["redorange",[0,0.77,0.87,0]],
+ ["mahogany",[0,0.85,0.87,0.35]],["maroon",[0,0.87,0.68,0.32]],
+ ["brickred",[0,0.89,0.94,0.28]],["red",[0,1,1,0]],
+ ["orangered",[0,1,0.5,0]],["rubinered",[0,1,0.13,0]],
+ ["wildstrawberry",[0,0.96,0.39,0]],["salmon",[0,0.53,0.38,0]],
+ ["carnationpink",[0,0.63,0,0]],["magenta",[0,1,0,0]],
+ ["violetred",[0,0.81,0,0]],["rhodamine",[0,0.82,0,0]],
+ ["mulberry",[0.34,0.9,0,0.02]],["redviolet",[0.07,0.9,0,0.34]],
+ ["fuchsia",[0.47,0.91,0,0.08]],["lavender",[0,0.48,0,0]],
+ ["thistle",[0.12,0.59,0,0]],["orchid",[0.32,0.64,0,0]],
+ ["darkorchid",[0.4,0.8,0.2,0]],["purple",[0.45,0.86,0,0]],
+ ["plum",[0.5,1,0,0]],["violet",[0.79,0.88,0,0]],
+ ["royalpurple",[0.75,0.9,0,0]],["blueviolet",[0.86,0.91,0,0.04]],
+ ["periwinkle",[0.57,0.55,0,0]], ["cadetblue",[0.62,0.57,0.23,0]],
+ ["cornflowerblue",[0.65,0.13,0,0]],["midnightblue",[0.98,0.13,0,0.43]],
+ ["navyblue",[0.94,0.54,0,0]],["royalblue",[1,0.5,0,0]],
+ ["blue",[1,1,0,0]],["cerulean",[0.94,0.11,0,0]],
+ ["cyan",[1,0,0,0]],["processblue",[0.96,0,0,0]],
+ ["skyblue",[0.62,0,0.12,0]],["turquoise",[0.85,0,0.2,0]],
+ ["tealblue",[0.86,0,0.34,0.02]],["aquamarine",[0.82,0,0.3,0]],
+ ["bluegreen",[0.85,0,0.33,0]],["emerald",[1,0,0.5,0]],
+ ["junglegreen",[0.99,0,0.52,0]],["seagreen",[0.69,0,0.5,0]],
+ ["green",[1,0,1,0]],["forestgreen",[0.91,0,0.88,0.12]],
+ ["pinegreen",[0.92,0,0.59,0.25]],["limegreen",[0.5,0,1,0]],
+ ["yellowgreen",[0.44,0,0.74,0]],["springgreen",[0.26,0,0.76,0]],
+ ["olivegreen",[0.64,0,0.95,0.4]],["rawsienna",[0,0.72,1,0.45]],
+ ["sepia",[0,0.83,1,0.7]],["brown",[0,0.81,1,0.6]],
+ ["tan",[0.14,0.42,0.56,0]],["gray",[0,0,0,0.5]],
+ ["black",[0,0,0,1]],["white",[0,0,0,0]]
+ ];
+ tmp=select(dL,#_1==name);
+ if(length(tmp)>0,
+ tmp=tmp_1;
+ code=tmp_2;
+ code=Colorcmyk2rgb(code);
,
- head="[cmyk]{";
- );
- tmp=apply(clrt,text(#));
- chstrL=apply(tmp,head+substring(#,1,length(#)-1)+"}");
- tmp1=load(filename);
- tmp=tokenize(tmp1,"{\unitlength");
- head=tokenize(tmp_1,"%%%");
- head=head_(2..(length(head)));
- head=apply(head,"%%%"+#);
- tmp2=tmp_2;
- forall(1..5,
- tmp2=replace(tmp2,cstrL_#,chstrL_#);
- );
- body=tokenize(tmp2,"%");
- body_1="{\unitlength"+body_1;
- body=apply(body,#+"%");
- body=body_(1..(length(body)-1));
- tmp=replace(filename,".tex","new.tex");
- SCEOUT=openfile(tmp);
- forall(head,
- println(SCEOUT,#);
- );
- forall(1..(length(body)),
- tmp=body_#;
- if(#<length(body),
- println(SCEOUT,tmp);
- ,
- print(SCEOUT,tmp)
- );
+ println(" "+name+" not found");
+ code=[0,0,0];
);
- closefile(SCEOUT);
);
-////%Colorinfile end////
+////%Colorname2rgb end////
////%GetLinestyle start////
GetLinestyle(str,name):=(
@@ -5279,6 +5238,37 @@ Putintersect(nm,pdata1,pdata2,ptno):=(
);
////%Putintersect end////
+////%Setarrow start////
+Setarrow():=Setarrow([]);
+Setarrow(arglist):=(
+//help:Setarrow([-1,-1,-1,1,0.3]);
+//help:Setarrow([size(1),angle(18),position(1),cut(0),segstyle("dr,1")]);
+ regional(tmp);
+ tmp=select(arglist,isreal(#));
+ if(length(tmp)==0,
+ println([YaSize,YaAngle,YaPosition,YaCut,YasenStyle]);
+ );
+ if(length(tmp)>=1,
+ if((tmp_1>0),YaSize=tmp_1);
+ );
+ if(length(tmp)>=2,
+ if((tmp_2>0)&(tmp_2<90),YaAngle=tmp_2);
+ );
+ if(length(tmp)>=3,
+ if((tmp_3>=0)&(tmp_3<=1),YaPosition=tmp_3);
+ );
+ if(length(tmp)>=4,
+ if((tmp_4>=0)&(tmp_4<1),YaCut=tmp_4);
+ );
+ tmp=select(arglist,isstring(#));
+ if(length(tmp)>0,
+ YasenStyle=tmp_1;
+ );
+ [YaSize,YaAngle,YaPosition,YaCut,YasenStyle];
+);
+////%Setarrow start////
+
+
////%Arrowheaddata start////
Arrowheaddata(point,direction):=Arrowheaddata(point,direction,[]);
Arrowheaddata(point,direction,options):=(
@@ -5387,7 +5377,8 @@ Arrowhead(Arg1,Arg2,Arg3):=(
);
Arrowhead(nm,point,direction,optionsorg):=(//181018from
//help:Arrowhead("1",B,B-A);
-//help:Arrowhead(options=[size(1),angle(18),position(1),cut(0),"Coor=P(L)"]);
+//help:Arrowhead(options=[size(1),angle(18),position(1),cut(0),"Coord=P(L)"]);
+//help:Arrowhead(the default is -1 for numeric option);
//help:Arrowhead(A,"gr1");
regional(name,Ltype,Noflg,reL,opstr,opcindy,color,eqL,coord,
options,cut,pP,Houkou,ptstr,hostr,tmp,tmp1,tmp2,list);
@@ -5410,13 +5401,17 @@ Arrowhead(nm,point,direction,optionsorg):=(//181018from
options=remove(options,[#]);
);
); //181018to
- cut=0; //181110from
- if(length(reL)>3,
- cut=reL_4;
- tmp=reL_(1..3);
- options=remove(options,reL);
- options=concat(options,tmp);
- ); //181110from
+ tmp1=[YaSize,YaAngle,YaPosition,YaCut]; //181214from
+ forall(1..(length(reL)),
+ if(reL_#<0, reL_#=tmp1_#);
+ );
+ forall((length(reL)+1)..4,
+ reL=append(reL,tmp1_#);
+ );
+ cut=reL_4;
+ tmp=reL_(1..3);
+ options=select(options,!isreal(#));
+ options=concat(options,tmp); //181214to
if(ispoint(direction),Houkou=direction.xy); //181018
if(isstring(direction),Houkou=parse(direction),Houkou=direction);
if(MeasureDepth(Houkou)==2,Houkou=Houkou_1);
@@ -5487,10 +5482,14 @@ Arrowdata(nm,ptlist,optionsorg):=(
//help:Arrowdata("1",[A,B]);
//help:Arrowdata("1",[pt1,pt2]);
//help:Arrowdata(options=[size(1),angle(18),pos(1),cut(0),"Cutend=0,0","Coord=p/l"]);
+//help:Arrowdata(optionsadded=["line"]);
regional(options,Ltype,Noflg,name,opstr,opcindy,eqL,reL,strL,color,size,coord,
flg,lineflg,cutend,tmp,tmp1,tmp2,pA,pB,angle,segpos,cut);
name="ar"+nm;
options=optionsorg;
+ tmp=select(options,isstring(#)); //181214from
+ tmp1=select(tmp,contains(["dr","da","do","id"],substring(#,0,2)));
+ if(length(tmp1)==0,options=append(options,YasenStyle)); //181214to
tmp=Divoptions(options);
Ltype=tmp_1;
Noflg=tmp_2;
@@ -5500,19 +5499,17 @@ Arrowdata(nm,ptlist,optionsorg):=(
color=tmp_(length(tmp)-2);
opstr=tmp_(length(tmp)-1);
opcindy=tmp_(length(tmp));
- size=1; // 15.06.11
- angle=18;
- segpos=1;
- cut=0; //181110from
+ tmp1=[YaSize,YaAngle,YaPosition,YaCut]; //181214from
forall(1..(length(reL)),
- tmp=reL_#;
- if(#==1,size=tmp);
- if(#==2,angle=tmp);
- if(#==3,
- segpos=tmp;
- );
- if(#==4,cut=tmp);
- ); //181110to
+ if(reL_#<0, reL_#=tmp1_#);
+ );
+ forall((length(reL)+1)..4,
+ reL=append(reL,tmp1_#);
+ );
+ size=reL_1;
+ angle=reL_2;
+ segpos=reL_3;
+ cut=reL_4;
lineflg=0;
if(contains(strL,"l")%contains(strL,"L"),
lineflg=1;