// Copyright (C) 2014 Setsuo Takato, KETCindy Japan project team // //This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // 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. // // You should have received a copy of the GNU General Public License // along with this program. If not, see // println("ketcindylib3d[20190822] loaded"); //help:start(); ////%Ketinit3d start//// Ketinit3d():=Ketinit3d(1); Ketinit3d(subflg):=( //help:Ketinit3d(); //help:Ketinit3d(0); regional(ctr,tmp,tmp1,tmp2,tmp3,tmp4); BezierNumber3=1; //15.02.28 // no ketjs on if(!islist(BZLIST3), BZLIST3=[]; //15.02.28 , tmp=apply(allpoints(),#.name); //190505 tmp1=select(tmp,substring(#,length(#)-1,length(#))=="p"); tmp2=[]; forall(tmp1,ctr, tmp=substring(ctr,0,length(ctr)-1); tmp=select(BZLIST3,#_1==tmp); if(length(tmp)>0, tmp2=append(tmp2,tmp_1); ); ); BZLIST3=tmp2; ); // no ketjs off SUBSCR=subflg; // no ketjs // SUBSCR=0 // only ketjs Setwindow("Msg=no"); Addax(0); TSIZE=10; TSIZEZ=10; ErrFlg=0; xPos=-5; yTh=tmp-0.5; yPh=tmp-1; Slider("TH",[xPos,yTh],[xPos+9,yTh],["Color=green"]); //190713from Slider("FI",[xPos,yPh],[xPos+9,yPh],["Color=green"]); drawtext([xPos-0.8,yTh-0.1],Sprintf((TH.x-xPos)*20,2),align->"right"); drawtext([xPos-0.8,yPh-0.1],Sprintf((FI.x-xPos)*40,2),align->"right"); THETA=(TH.x-xPos)*20*pi/180; PHI=(FI.x-xPos)*40*pi/180; //190713to ); ////%Ketinit3d end//// ////%Start3d start//// Start3d():=Start3d([],[]); Start3d(Arg):=( //190503from regional(tmp); tmp=select(Arg,isstring(#)); //190822 tmp=select(tmp,indexof(#,"=")>0); if(length(tmp)==0, Start3d(Arg,[]); , Start3d([],Arg); ); ); Start3d(ptexception,optionjs):=(//190503to //help:Start3d(); //help:Start3d(["A","B"](exceptionptlist)); //help:Start3d(optionjs=["Slider=n","Removept=[]"); regional(xmn,xMx,ymn,yMx,pt,pt3,pt2, xPos,yTh,yPh,Eps,tmp,tmp1,tmp2,tmp3,tmp4); PTEXCEPTION=[]; SLIDEFLG="Y"; forall(optionjs, tmp=Strsplit(#,"="); tmp1=Toupper(substring(tmp_1,0,1)); if(tmp1=="S", SLIDEFLG=Toupper(substring(tmp_2,0,1)); ); if(tmp1=="R", tmp2=tmp_2; if(substring(tmp2,0,1)=="[",tmp2=substring(tmp2,1,length(tmp2)-1)); tmp2=tokenize(tmp2,","); REMOVEPTJS=concat(REMOVEPTJS,tmp2); ); ); Setfiles(Namecdy); //180608 // no ketjs ConstantListC=[[50,50],[5000,1500,500,200],[0.00001,0.01,0.1]]; // no ketjson FuncListC=[]; CommandListC=[]; //180531 CutFunList=[];//180601 EraseList=[];//180601 ADDPACK=[]; //180606 // no ketjs off GCLIST=[]; GLIST=[]; // no ketjs on FUNLIST=[]; COM0thlist=[]; COM1stlist=[]; COM2ndlist=[]; // no ketjs off SEG3dlist=[]; OutFileList=[]; // no ketjs on FigPdfList=[]; // 16.04.08 ErrFlag=0; OBJCMD=[]; // 161129from OCNAME=Fhead; OCOPTION=["m","v"];// 161129to //no ketjs off KETJSOP=[]; //190129 REMOVEPTJS=[]; SLIDEFLG="Y"; //190504 KetcindyjsDataList=[]; //190511 ArrowlineNumber=1; // 16.01.31 ArrowheadNumber=1; BezierNumber=1; //16.01.31 BezierNumber3=1; //16.08.19 Fnametex=Fhead+".tex"; // 15.04.06 //no ketjs on FnameR=Fhead+".r"; FnameRbody=Fhead+"body.r"; Fnameout=Fhead+".txt"; // no ketjs off Setwindow("Msg=no"); // 16.06.20from tmp=round(4*SW.y)/4; xPos=-5; yTh=tmp-0.5; yPh=tmp-1; // if(SLIDEFLG=="Y", // only ketjs //190503from Slider("TH",[xPos,yTh],[xPos+9,yTh],["Color=green"]); //190209 Slider("FI",[xPos,yPh],[xPos+9,yPh],["Color=green"]); //190209 drawtext([xPos-0.8,yTh-0.1],Sprintf((TH.x-xPos)*20,2),align->"right"); //17.05.02 drawtext([xPos-0.8,yPh-0.1],Sprintf((FI.x-xPos)*40,2),align->"right"); //17.05.02 // ); // only ketjs //190503to tmp="Setangle(" //no ketjs on +format((TH.x-xPos)*20,5)+"," +format((FI.x-xPos)*40,5)+")"; GLIST=append(GLIST,tmp); //no ketjs off THETA=(TH.x-xPos)*20*pi/180; PHI=(FI.x-xPos)*40*pi/180; // 16.06.20until if(Ptselected(TH) % Ptselected(FI), //190505 if(length(Ch)>0, ChNum=Ch_(length(Ch)); if(ChNum==0, ChNum=1); , ChNum=1; ); Ch=[0]; ); if(SUBSCR==1, // no ketjs on xmn=SW.x+NE.x-SW.x; xMx=NE.x+NE.x-SW.x; ymn=SW.y; yMx=NE.y; drawpoly([[xMx,yMx],[xmn,yMx], [xmn,ymn],[xMx,ymn]],color->[1,1,1]); connect([[NE.x-SW.x,yMx],[NE.x-SW.x,ymn]], color->[0.5,0.5,0.5]); ); // no ketjs off // for Presentation //17.07.01from //no ketjs on letterc=[0.98,0.13,0,0.43]; boxc=[0,0.32,0.52,0]; 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]; ThinDense=0.1; //17.07.01to //no ketjs off tmp=ptexception; //181106 if(!islist(tmp),tmp=[tmp]); //190209 PTEXCEPTION=concat(PTEXCEPTION,tmp); //190209 // if(!islist(tmp),PTEXCEPTION=[tmp],PTEXCEPTION=tmp); Ptseg3data(PTEXCEPTION);//16.08.23 // PTEXCEPTION=ptexception; //180916 //190209[del] ); ////%Start3d end//// ////%Setangle start//// Setangle(angL):=Setangle(ang_1,ang_2);//180614 Setangle(theta,phi):=( //16.12.24 //help:Setangle(60,30); regional(xmn,xMx,ymn,yMx,pt,pt3,pt2, xPos,yTh,yPh,Eps,tmp,tmp1,tmp2,tmp3,tmp4); tmp=round(4*SW.y)/4; xPos=-5;yTh=tmp-0.5;yPh=tmp-1; if(theta=="",theta=THETA*180/pi); // 17.01.19 if(phi=="",phi=PHI*180/pi); THETA=theta*pi/180; TH.x=theta/20+xPos; PHI=phi*pi/180; FI.x=phi/40+xPos; // drawtext([xPos-0.8,yTh-0.1],text(theta)); //17.05.05 // drawtext([xPos-0.8,yPh-0.1],text(phi)); tmp="Setangle(" // no ketjs on +format(theta,5)+","+format(phi,5)+")"; GLIST=append(GLIST,tmp); //no ketjs off if(length(VLIST)==0, // 16.06.20 tmp=apply(allpoints(),#.name); //190505 tmp4=remove(tmp,PTEXCEPTION); //190329 forall(tmp4,pt, tmp1=pt; tmp=substring(tmp1,length(tmp1)-1,length(tmp1)); if(tmp!="z", tmp=parse(tmp1+"z.xy"); //181028[2lines]; pt3=Xyzcoord(pt.xy,tmp); Defvar(tmp1+"3d",pt3); pt2=Parapt(pt3); // 16.05.28from Defvar(tmp1+"2d",pt2); // 16.05.28to ); ); , if(Ptselected(NE) % Ptselected(SW), //190505 tmp4=apply(allpoints(),#.name); //190505 tmp4=remove(tmp4,PTEXCEPTION); forall(tmp4,pt, tmp1=pt; tmp=substring(tmp1,length(tmp1)-1,length(tmp1)); if(tmp!="z", tmp=select(VLIST,#_1==tmp1+"3d"); pt3=tmp_1_2; tmp=tmp1+".xy=Parapt("+pt3+")_[1,2];"; parse(tmp); ); ); , tmp=apply(allpoints(),#.name); //190505 tmp4=remove(tmp,PTEXCEPTION); //180916 forall(tmp4,pt, tmp1=pt; tmp=substring(tmp1,length(tmp1)-1,length(tmp1)); if(tmp!="z", tmp2=parse(tmp1+"z"); if(Ptselected(pt) % Ptselected(tmp2), Defvar(tmp1+"2d",pt.xy); tmp=parse(tmp1+"z.xy"); //181028[2lines] tmp=Xyzcoord(pt.xy,tmp); Defvar(tmp1+"3d",tmp); ); ); ); ); ); forall(Datalist3d(),#, tmp1=replace(#,"3d","2d"); tmp2=Projpara(#,["nodata"]); tmp=tmp1+"="+textformat(tmp2,5)+";"; //190415 parse(tmp); ); Ptseg3data(PTEXCEPTION); //180916 ); ////%Setangle end//// ////%Getangle start//// Getangle():=getangle(["Disp=y"]); //180613from Getangle(option):=( regional(tmp,tmp1,dispflg,eqL); tmp=divoptions(option); dispflg="Y"; eqL=tmp_5; //181111 forall(eqL, tmp=Strsplit(#,"="); //181111(4lines) tmp1=Toupper(substring(tmp_1,0,1)); if(tmp1=="D", dispflg=Toupper(substring(tmp_2,0,1)); ); ); tmp=[THETA*180/pi, PHI*180/pi]; if(dispflg=="Y", println(textformat(tmp,6)); ); tmp; //180607 ); //180613to ////%Getangle end//// ////%Angleselected start//// Angleselected():=IsAngle(); //180713 //isAngle():=Isangle(); //180517 ////%Angleselected end//// ////%Isangle start//// Isangle():=Ptselected(TH)%Ptselected(FI); //180517 ////%Isangle end//// ////%Changestyle3d start//// Changestyle3d(nameL,style):=( //help:Changestyle3d(["geoseg3d","ax3d"],["notex"]); regional(nmL,name,tmp,tmp1,tmp2); if(islist(nameL),nmL=nameL,nmL=[nameL]); tmp1=[]; forall(nmL,name, tmp=parse(name); if(islist(tmp), if(isstring(tmp_1), tmp1=concat(tmp1,tmp); , tmp1=append(tmp1,name); ); tmp=apply(tmp1,replace(#,"3d","2d")); Changestyle(tmp,style); tmp=apply(tmp,"sub"+#); // 15.05.24 Changestyle(tmp,style); ); ); ); ////%Changestyle3d end//// ////%Dist3d start//// Dist3d(pt1):=Dist3d(pt1,[0,0,0]); Dist3d(pt1,pt2):=( //help:Dist3d(A3d,B3d); //help:Dist3d(A,B); //help:Dist3d("A","B"); regional(p1,p2); if(islist(pt1), p1=pt1; , if(ispoint(pt1),p1=pt1.name,p1=pt1); //190505 p1=parse(p1+"3d"); ); if(islist(pt2), p2=pt2; , if(ispoint(pt2),p2=pt2.name,p2=pt2); //190505 p2=parse(p2+"3d"); ); sqrt((p2-p1)*(p2-p1)); ); ////%Dist3d end//// ////%Findangle start//// Findangle(vec):=( //help:Findangle([2,1,4]); //help:Findangle([0,0,1,0]); regional(vec3,vec2,Eps,th,ph,tmp); Eps=10^(-4); vec3=vec_(1..3); vec2=vec_(1..2); th=arccos(vec_3/|vec3|); if(|vec2|>Eps, ph=arccos(vec_1/|vec2|); if(vec_2<0, ph=2*pi-ph; // 15.03.28 ); , if(length(vec)>3,ph=vec_4*pi/180,ph=PHI); ); [th,ph]; ); ////%Findangle end//// ////%Cancoordpara start//// Cancoordpara(pc):=( //help:Cancoordpara([1,2,0]); regional(Xz,Yz,Zz,tmp1,tmp2,tmp3); Xz=pc_1; Yz=pc_2; Zz=pc_3; tmp1=-Xz*sin(PHI)-Yz*cos(PHI)*cos(THETA)+Zz*cos(PHI)*sin(THETA); tmp2=Xz*cos(PHI)-Yz*sin(PHI)*cos(THETA)+Zz*sin(PHI)*sin(THETA); tmp3=Yz*sin(THETA)+Zz*cos(THETA); [tmp1,tmp2,tmp3]; ); ////%Cancoordpara end//// ////%Zparapt start//// Zparapt(cc):=( regional(x,y,z); x=cc_1; y=cc_2; z=cc_3; x*cos(PHI)*sin(THETA)+y*sin(PHI)*sin(THETA)+z*cos(THETA); ); ////%Zparapt end//// ////%Projcoordpara start//// Projcoordpara(cc):=( //help:Projcoordpara([3,1,2]); regional(tmp); tmp=Parapt(cc); [tmp_1,tmp_2,Zparapt(cc)]; ); ////%Projcoordpara end//// ////%Parapt start//// Parapt(pt):=( //help:Parapt([2,1,5]); regional(Xz,Yz); Xz=-pt_1*sin(PHI)+pt_2*cos(PHI); Yz=-pt_1*cos(PHI)*cos(THETA)-pt_2*sin(PHI)*cos(THETA)+pt_3*sin(THETA); [Xz,Yz]; ); ////%Parapt end//// ////%Parasubpt start//// Parasubpt(pt):=( //181027 regional(mv,dp,xs); mv=NE.x-SW.x; dp=pi/24; xs=-pt_1*sin(PHI+dp)+pt_2*cos(PHI+dp); [xs+mv,pt_3]; ); ////%Parasubpt end//// ////%Parasubptlog start//// Parasubptlog(pt):=( //181027 regional(dp,xs); dp=pi/24; xs=-pt_1*sin(PHI+dp)+pt_2*cos(PHI+dp); [xs,pt_3]; ); ////%Parasubptlog end//// ////%Mainsubpt3d start//// Mainsubpt3d(pm,psv):=( //181027 regional(Eps,mv,dp,v,x,y,z); // when Th neq 90, psv=ps_2, else psv=ps_1 Eps=10^(-4); mv=NE.x-SW.x; dp=pi/24; if(abs(cos(THETA))>Eps, if(length(psv)>1,v=psv_2, v=psv); x=(v*cos(PHI)*sin(THETA)-pm_1*sin(PHI)*cos(THETA)-pm_2*cos(PHI))/cos(THETA); y=(v*sin(PHI)*sin(THETA)+pm_1*cos(PHI)*cos(THETA)-pm_2*sin(PHI))/cos(THETA); z=v; , if(length(psv)>1,v=psv_1, v=psv); x=(pm_1*cos(PHI+dp)-(v-mv)*cos(PHI))/sin(dp); y=(pm_1*sin(PHI+dp)-(v-mv)*sin(PHI))/sin(dp); z=pm_2; ); [x,y,z]; ); ////%Mainsubpt3d end//// ////%Projcurve start//// Projcurve(crv):=( //help:Projcurve("sl3d1"); regional(CurveL,Curve,Eps,AnsL,Out,sp,cp,st,,ct,ii,pt, Xz,Yz,tmp,tmp1,tmp2); Eps=10^(-6); sp=sin(PHI); cp=cos(PHI); st=sin(THETA); ct=cos(THETA); if(isstring(crv),CurveL=parse(crv),CurveL=crv); if(Measuredepth(CurveL)==1,CurveL=[CurveL]); Out=[]; forall(CurveL,Curve, AnsL=[]; forall(1..length(Curve),ii, pt=Curve_ii; if(pt_1!="inf", Xz=-pt_1*sp+pt_2*cp; Yz=-pt_1*cp*ct-pt_2*sp*ct+pt_3*st; tmp=[Xz,Yz]; if(ii==1, AnsL=[tmp]; , tmp1=AnsL_(length(AnsL)); if(tmp1_1=="inf" % |tmp-tmp1|>Eps, AnsL=append(AnsL,tmp); ); ); , AnsL=append(AnsL,["inf"]); ); ); tmp1=[]; tmp2=select(1..length(AnsL),AnsL_#==["inf"]); tmp=1; forall(tmp2, if(#>tmp, tmp1=concat(tmp1,[AnsL_(tmp..(#-1))]) ); tmp=#+1; ); if(tmp0, //17.05.24 name2=replace(name3,"3d","2d"); , name2="para"+name3; ); ptL=Projcurve(name3); ptL=select(ptL,length(#)>1);//17.06.02 if(length(ptL)==1, ptL=ptL_1; ); Out=append(Out,ptL); if(Noflg<3, if(msgflg==1,//180602from println("generate projparadata "+name2); );//180602to tmp=name2+"="+textformat(ptL,5)+";"; //190415 parse(tmp); tmp=name2+"=Projpara("+name3+")"; GLIST=append(GLIST,tmp); ); if(Noflg<3, //190818 if(isstring(Ltype), if(color!=KCOLOR, //180904 Texcom("{");Com2nd("Setcolor("+color+")");//180722 ); Ltype=Getlinestyle(text(Noflg)+Ltype,name2); if(color!=KCOLOR, //180904 Texcom("}");//180722 ); , if(Noflg==1,Ltype=0); ); GCLIST=append(GCLIST,[name2,Ltype,opcindy]); ); ); if(length(Out)==1,Out=Out_1); if(length(Out)==1,Out=Out_1); // 15.02.24 tmp=[]; forall(Out, if(length(#)>0,tmp=append(tmp,#)); ); Out=tmp; Out; ); ////%Projpara end//// ////%Invparaptpp start//// Invparaptpp(pt,pd):=( regional(Eps,fk,nfk,ph,fh,ah,bh,ak,bk,v1,v2, nn,s0,t2,out,tmp,tmp1,tmp2,flg); Eps=10^(-4); if(isstring(pd), fk=pd; , fk=textformat(pd,5); ); nfk=Numptcrv(parse(fk)); flg=0; tmp=pt; if(length(tmp)==1, ph=tmp; fh=pd; , fh=Projpara(fk,["nodata"]); if(nfk>2, tmp1=Nearestpt(tmp,fh); ph=tmp1_2; , ah=Ptcrv(1,fh); bh=Ptcrv(2,fh); v1=tmp-ah; v2=bh-ah; tmp1=Crossprod(v1,v2); if(abs(tmp1)>Eps, println(" Not on the line"); out=[]; flg=1; , ph=Dotprod(v1,v2)/|v2|^2+1; ); ); ); if(flg==0, if(nfk>2, nn=re(floor(ph)); //190505 s0=ph-nn; if(ph>Numptcrv(fh)-Eps, out=[Ptend(fk),Numptcrv(fh)]; flg=1; ); , nn=1; s0=ph-1; ); ); if(flg==0, ak=Ptcrv(nn,fk); bk=Ptcrv(nn+1,fk); ah=Ptcrv(nn,fh); bh=Ptcrv(nn+1,fh); ph=(1-s0)*ah+a0*bh; t2=s0; pk=(1-t2)*ak+t2*bk; out=[pk,nn+t2]; ); out; ); ////%Invparaptpp end//// ////%Invparapt start//// Invparapt(pt,pd):=( regional(tmp); tmp=Invparaptpp(pt,pd); tmp_1; ); ////%Invparapt end//// ////%Subgraph start//// Subgraph(name3,opcindy):=( //181029 regional(name,crvL,sub2d,color,tmp,tmp1,tmp2); name=replace("sub"+name3,"3d","2d"); crvL=parse(name3); if(Measuredepth(crvL)==1,crvL=[crvL]); sub2d=[]; forall(crvL,tmp1, tmp2=[]; forall(tmp1, tmp2=append(tmp2,Parasubpt(#)); ); sub2d=append(sub2d,tmp2); ); tmp=name+"="+Textformat(sub2d,5)+";"; parse(tmp); GCLIST=append(GCLIST,[name,[0,1],opcindy]); //190127 sub2d; ); ////%Subgraph end//// ////%Spaceline start//// Spaceline(ptlist):=Spaceline(ptlist,[]); // 16.02.22 from Spaceline(Arg1,Arg2):=( regional(name,tmp,tmp1,tmp2); if(isstring(Arg1), Spaceline(Arg1,Arg2,[]); , tmp=Arg1.name; //190505 tmp=substring(tmp,1,length(tmp)-1); name="-"+replace(tmp,",",""); Spaceline(name,Arg1,Arg2); ); ); // 16.02.22 to Spaceline(nm,ptlistorg,optionorg):=( //help:Spaceline("1",[[2,5,1],[4,2,3]]); //help:Spaceline([A,B]); //help:Spaceline(options=["Msg=y(n)"]); regional(name2,name3,options,Out,tmp,tmp1,tmp2, opstr,opcindy,Ltype,Noflg,eqL,ptlist, Msg,color); ptlist=apply(ptlistorg,if(ispoint(#),parse(#.name+"3d"),#)); // 190505 ptlist=apply(ptlist,if(isstring(#),parse(#),#)); //190330 if(substring(nm,0,2)=="bz", name2=replace(nm,"bz","bz2d"); name3=replace(nm,"bz","bz3d"); , if(substring(nm,0,1)=="-", tmp=substring(nm,1,length(nm)); if(indexof(tmp,"3d")>0,name3=tmp,name3=tmp+"3d"); name2=replace(name3,"3d","2d"); , name2="sl2d"+nm; name3="sl3d"+nm; ); ); options=select(optionorg,length(#)>0); // 160415 tmp=Divoptions(options); Ltype=tmp_1; Noflg=tmp_2; eqL=tmp_5; color=tmp_(length(tmp)-2); opcindy=tmp_(length(tmp)); Msg=1; forall(eqL, tmp=substring(#,0,1); if(Toupper(tmp)=="M", tmp=indexof(#,"="); tmp1=substring(#,tmp,tmp+1); if(Toupper(tmp1)=="N", Msg=0; ); ); ); if(Noflg<3, if(Msg==1, println("generate Spaceline "+name3); ); tmp=name3+"="+Textformat(ptlist,6)+";"; //190330//190415 parse(tmp); tmp1=Projpara(name3,["nodata"]); tmp=name2+"="+Textformat(tmp1,5)+";"; //190415 parse(tmp); tmp="["; forall(ptlist, //17.07.13from if(isstring(#), tmp=tmp+#+","; , tmp=tmp+Textformat(#,5)+","; ); ); tmp=substring(tmp,0,length(tmp)-1)+"]"; tmp=name3+"=Spaceline("+tmp+")"; //17.07.13to // tmp=name3+"=Spaceline("+Textformat(ptlist,5)+")"; //17.05.24 GLIST=append(GLIST,tmp); tmp=name2+"=Projpara("+name3+")"; GLIST=append(GLIST,tmp); ); if(Noflg<3, //190818 if(isstring(Ltype), if(color!=KCOLOR, //180904 Texcom("{");Com2nd("Setcolor("+color+")");//180722 ); Ltype=Getlinestyle(text(Noflg)+Ltype,name2); if(color!=KCOLOR, //180904 Texcom("}");//180722 ); , if(Noflg==1,Ltype=0); ); GCLIST=append(GCLIST,[name2,Ltype,opcindy]); if(SUBSCR==1, //no ketjs on// 15.02.11 Subgraph(name3,opcindy); ); //no ketjs off ); ptlist; ); ////%Spaceline end//// ////%Spacecurve start//// Spacecurve(nm,funstr,variable):=Spacecurve(nm,funstr,variable,[]); Spacecurve(nm,funstr,variable,optionorg):=( //help:Spacecurve("1","[cos(t),sin(t),0.5*t]","t=[0,4*pi]",["Num=200"]); regional(name2,name3,options,Out,tmp,tmp1,tmp2,vname,tmpfn,str,Rng,Num,Msg, Ec,Exfun,Dc,opstr,opcindy,Fntmp,Vatmp,Ltype,Noflg,eqL,t1,t2,dt,tt,pa,ke,color); if(substring(nm,0,2)=="bz", name2=replace(nm,"bz","bz2d"); name3=replace(nm,"bz","bz3d"); , name2="sc2d"+nm; name3="sc3d"+nm; ); Eps=10^(-4); Num=50; Ec=[]; Exfun=""; Dc=1000; options=select(optionorg,length(#)>0); // 160415 tmp=Divoptions(options); Ltype=tmp_1; Noflg=tmp_2; eqL=tmp_5; color=tmp_(length(tmp)-2); opstr=tmp_(length(tmp)-1); opcindy=tmp_(length(tmp)); Msg=1; forall(eqL, tmp=substring(#,0,1); if(Toupper(tmp)=="M", tmp=indexof(#,"="); tmp1=substring(#,tmp,tmp+1); if(Toupper(tmp1)=="N", Msg=0; ); ); tmp=indexof(#,"N="); if(tmp>0, tmp1=substring(#,tmp+1,length(#)); Num=parse(tmp1); opstr=opstr+",'"+#+"'"; ); tmp=indexof(#,"Num="); if(tmp>0, tmp1=substring(#,tmp+3,length(#)); Num=parse(tmp1); opstr=opstr+",'"+#+"'"; ); tmp=indexof(#,"E="); if(tmp>0, tmp1=substring(#,tmp+1,length(#)); if(substring(tmp1,0,1)=="[", Ec=parse(tmp1); , Exfun=tmp1; ); opstr=opstr+",'"+#+"'"; ); tmp=indexof(#,"Exc="); if(tmp>0, tmp1=substring(#,tmp+3,length(#)); if(substring(tmp1,0,1)=="[", Ec=parse(tmp1); , Exfun=tmp1; ); ); ); tmp=indexof(variable,"="); vname=substring(variable,0,tmp-1); str=substring(variable,tmp,length(variable)); Rng=parse(str); t1=Rng_1; t2=Rng_2; dt=(t2-t1)/Num; // differ from Scilab tmp="tmpfn("+vname+"):="+funstr+";"; parse(tmp); Out=[]; Ec=append(sort(Ec),10000); ke=1; forall(0..Num, pt=[]; tt=Rng_1+#*dt; if(tt-Ec_ke<-Eps, pa=tmpfn(tt); ); if(abs(tt-Ec_ke)<=Eps, if(length(Out)>0, if(Out_(length(Out))_1!="inf", pa=["inf"]; ); ); ); if(tt-Ec_ke>Eps, pa=tmpfn(tt); ke=ke+1; ); if(length(pa)>0, if(pa_1=="inf", Out=append(Out,pa); , if(length(Out)==0, Out=[pa]; , tmp=Out_(length(Out)); if(tmp_1=="inf", Out=append(Out,pa); , if(|tmp-pa|tmp, tmp1=concat(tmp1,[Out_(tmp..(#-1))]) ); tmp=#+1; ); if(tmp0, Subgraph(name3,opcindy); ); // 15.08.17 ); ); Out; ); ////%Spacecurve end//// ////%Partcrv3d start//// Partcrv3d(nm,pA,pB,PkLstr):=Partcrv3d(nm,pA,pB,PkLstr,[]); Partcrv3d(nm,pA,pB,PkLstr,options):=( //help:Partcrv3d("1",A,B,"sl3d1"); //help:Partcrv3d("1",1.3,2.5,"sl3d1"); regional(p1,p2,q1,q2,dt1,dts,dt3,tmp,tmp1,tmp2); if(isreal(pA), p1=pA; q1=pA; , if(islist(pA), tmp=pA; , if(ispoint(pA),tmp=pA.name,tmp=pA); //190505 tmp=parse(tmp+"3d"); ); p1=parapt(tmp); q1=[p1_1,tmp_3]+[NE.x-SW.x,0]; ); if(isreal(pB), p2=pB; q2=pB; , if(islist(pB), tmp=pB; , if(ispoint(pB),tmp=pB.name,tmp=pB); //190505 tmp=parse(tmp+"3d"); ); p2=parapt(tmp); q2=[p2_1,tmp_3]+[NE.x-SW.x,0]; ); tmp=replace(PkLstr,"3d","2d"); dt1=partcrv("",p1,p2,tmp,["nodata"]); dts=partcrv("",q1,q2,"sub"+tmp,["nodata"]); dt=apply(1..length(dt1), Xyzcoord(dt1_#,dts_#); //181028 ); Spaceline("-part3d"+nm,dt,options); ); ////%Partcrv3d end//// ////%Joincrvs3d( start//// Joincrvs3d(nm,plotstrL):=Joincrvs3d(nm,plotstrL,[]);//16.10.06 Joincrvs3d(nm,plotstrL,options):=( //help:Joincrvs3d("1",["bz3da1","bz3da1"]); regional(PtL,Eps,QdL,Flg,Ni,Qd,pP,pS,pQ,pR,rMN, opcindy,tmp,tmp1,tmp2,str,name2,name3,Ltype,Noflg,color); name2="join2d"+nm; name3="join3d"+nm; QdL=[]; forall(plotstrL,str, if(isstring(str), tmp=parse(str); , tmp=str; ); QdL=append(QdL,tmp); ); Eps=10^(-4); tmp=Divoptions(options); Ltype=tmp_1; Noflg=tmp_2; color=tmp_(length(tmp)-2); opcindy=tmp_(length(tmp)); tmp1=tmp_6; if(length(tmp1)>0,Eps=tmp1_1); Flg=0; if(length(QdL)==0, PtL=[]; Flg=1; ); if(Flg==0, PtL=QdL_1; forall(2..length(QdL),Ni, Qd=QdL_Ni; if(length(Qd)>1, pP=PtL_1; pS=PtL_(length(PtL)); pQ=Qd_1; pR=Qd_(length(Qd)); rMN=min([Norm(pP-pQ),Norm(pP-pR), Norm(pS-pQ),Norm(pS-pR)]); if(rMN==Norm(pP-pR), Qd=reverse(Qd); , if(rMN==Norm(pS-pQ), PtL=reverse(PtL); , if(rMN==Norm(pS-pR), PtL=reverse(PtL); Qd=reverse(Qd); ); ); ); ); if(rMN>Eps, PtL=concat(PtL,Qd); , PtL=concat(PtL,Qd_(2..length(Qd))); ); ); ); if(Noflg<3, println("generate Joincurves3d "+name3); tmp=name3+"="+textformat(PtL,5)+";"; //190415 parse(tmp); tmp1=Projpara(name3,["nodata"]); tmp=name2+"="+textformat(tmp1,5)+";"; //190415 parse(tmp); tmp=text(plotstrL); tmp=substring(tmp,1,length(tmp)-1); tmp=name3+"=Joincrvs("+tmp+")"; GLIST=append(GLIST,tmp); tmp=name2+"=Projpara("+name3+")"; GLIST=append(GLIST,tmp); ); if(Noflg<3, //190818 if(isstring(Ltype), if(color!=KCOLOR, //180904 Texcom("{");Com2nd("Setcolor("+color+")");//180722 ); Ltype=Getlinestyle(text(Noflg)+Ltype,name2); if(color!=KCOLOR, //180904 Texcom("}");//180722 ); , if(Noflg==1,Ltype=0); ); GCLIST=append(GCLIST,[name2,Ltype,opcindy]); if(SUBSCR==1, // 15.02.11 tmp=parse(name2); // 15.08.17 if(length(tmp)>0, Subgraph(name3,opcindy); ); // 15.08.17 ); ); PtL; ); ////%Joincrvs3d end//// ////%Xyzax3data start//// Xyzax3data(nm,Xrange,Yrange,Zrange):= Xyzax3data(nm,Xrange,Yrange,Zrange,[]); Xyzax3data(nm,Xrange,Yrange,Zrange,optionorg):=( //help:Xyzax3data("","x=[-5,5]","y=[-5,5]","z=[-5,5]"); //help:Xyzax3data(Options2=["a1,18","Osw"]); regional(name2,name3,Out,tmp,tmp1,tmp2,ops,eqL,reL,strL,msgflg, options,opstr,opcindy,Ltype,Noflg,Axname,Arrow,Origin,color); name2="ax2d"+nm; name3="ax3d"+nm; options=optionorg; tmp=Divoptions(options); Ltype=tmp_1; Noflg=tmp_2; eqL=tmp_5; reL=tmp_6; strL=tmp_7; color=tmp_(length(tmp)-2); opcindy=tmp_(length(tmp)); Axname=1; Arrow=[]; // 190505 Origin=""; // 16.08.14 if(length(reL)>0, Axname=reL_1; ); forall(strL, // 16.08.14from tmp1=Toupper(substring(#,0,1)); if(tmp1=="A", tmp=substring(#,1,length(#)); if(length(tmp)>0, Arrow=tokenize(tmp,","); //190505 if(length(Arrow)==1,Arrow=append(Arrow,18)); ); ); if(tmp1=="O", tmp=indexof(#,","); if(tmp>0, Origin=substring(#,tmp,length(#)); , tmp=substring(#,1,length(#)); if(length(tmp)>0, Origin=tmp; , Origin="sw"; ); ); ); ); // 16.08.14to options=remove(options,reL); options=remove(options,strL); msgflg="Y"; //190506from forall(eqL, tmp=Strsplit(#,"="); tmp1=Toupper(substring(tmp_1,0,1)); if(tmp1=="M", msgflg=Toupper(substring(tmp_2,0,1)); options=remove(options,[#]); ); ); //190506to tmp1=indexof(Xrange,"="); tmp=parse(substring(Xrange,tmp1,length(Xrange))); Px=[tmp_1,0,0]; Qx=[tmp_2,0,0]; tmp1=indexof(Yrange,"="); tmp=parse(substring(Yrange,tmp1,length(Yrange))); Py=[0,tmp_1,0]; Qy=[0,tmp_2,0]; tmp1=indexof(Zrange,"="); tmp=parse(substring(Zrange,tmp1,length(Zrange))); Pz=[0,0,tmp_1]; Qz=[0,0,tmp_2]; tmp=["nodisp","Msg=n"]; Spaceline("-axx3d"+nm,[Px,Qx],tmp); Spaceline("-axy3d"+nm,[Py,Qy],tmp); Spaceline("-axz3d"+nm,[Pz,Qz],tmp); Out=[[Px,Qx],[Py,Qy],[Pz,Qz]]; if(Axname>0, Xyzaxparaname(Xrange,Yrange,Zrange,[Axname]); ); if(Noflg<3, if(msgflg=="Y", tmp="generate axes "+name3; tmp=tmp+" : axx3d"+nm+",axy3d"+nm+",axz3d"+nm; println(tmp); ); tmp="["+"axx3d"+nm+","+"axy3d"+nm+","; tmp=tmp+"axz3d"+nm+"]"; tmp=name3+"="+tmp; parse(tmp); tmp1=Projpara([name3],["nodata"]); tmp=name2+"="+textformat(tmp1,5)+";"; //190415 parse(tmp); tmp=name3+"=Xyzax3data("+ Dq+Xrange+Dq+","+Dq+Yrange+Dq+","+Dq+Zrange+Dq+")"; GLIST=append(GLIST,tmp); tmp=name2+"=Projpara("+name3+")"; GLIST=append(GLIST,tmp); ); if(Noflg<3, //190818 if(isstring(Ltype), if(color!=KCOLOR, //180904 Texcom("{");Com2nd("Setcolor("+color+")");//180722 ); Ltype=Getlinestyle(text(Noflg)+Ltype,name2); if(color!=KCOLOR, //180904 Texcom("}");//180722 ); , if(Noflg==1,Ltype=0); ); GCLIST=append(GCLIST,[name2,Ltype,opcindy]); if(Noflg<1, // 16.08.14from if(length(Arrow)==2, //190505from tmp1=Parapt(Px); tmp2=Parapt(Qx); ops=[Arrow_1,Arrow_2,"Line=n"]; Lightarrowdata("ax1",[tmp2,tmp2-tmp1],ops); tmp1=Parapt(Py); tmp2=Parapt(Qy); Lightarrowdata("ax2",[tmp2,tmp2-tmp1],ops); tmp1=Parapt(Pz); tmp2=Parapt(Qz); Lightarrowdata("ax3",[tmp2,tmp2-tmp1],ops); ); //190505to if(length(Origin)>0, Letter([Parapt([0,0,0]),Origin,"O"]); ); ); // 16.08.14until if(SUBSCR==1, // 15.02.11 Subgraph(name3,opcindy); //181029 ); ); Out; ); ////%Xyzax3data end//// ////%Xyzaxparaname start//// Xyzaxparaname(Xrange,Yrange,Zrange):= Xyzaxparaname(Xrange,Yrange,Zrange,[]); Xyzaxparaname(Xrange,Yrange,Zrange,options):=( //help:Xyzaxparaname("x=[-5,5]","y=[-5,5]","z=[-5,5]"); regional(tmp,tmp1,tmp2,Eps,Dr,Noflg,Xname,Yname,Zname, px,qx,py,qy,pz,qz,ph,qh,rr,ch); Eps=10.0^(-6); Dr=0.19*1000/2.54/MilliIn; Noflg=0; forall(options, if(isreal(#),Dr=Dr*#); ); tmp1=Strsplit(Xrange,"="); Xname=tmp1_1; tmp=parse(tmp1_2); px=[tmp_1,0,0]; qx=[tmp_2,0,0]; tmp1=Strsplit(Yrange,"="); Yname=tmp1_1; tmp=parse(tmp1_2); py=[0,tmp_1,0]; qy=[0,tmp_2,0]; tmp1=Strsplit(Zrange,"="); Zname=tmp1_1; tmp=parse(tmp1_2); pz=[0,0,tmp_1]; qz=[0,0,tmp_2]; COM2ndlist=select(COM2ndlist,indexof(#,Dqq("$"+Xname+"$"))==0);//180608[3lines] COM2ndlist=select(COM2ndlist,indexof(#,Dqq("$"+Yname+"$"))==0); COM2ndlist=select(COM2ndlist,indexof(#,Dqq("$"+Zname+"$"))==0); ph=Parapt(px); qh=Parapt(qx); rr=|ph-qh|; if(rr>Eps, ch=qh+Dr/rr*(qh-ph); Expr(ch,"c",Xname); ); ph=Parapt(py); qh=Parapt(qy); rr=|ph-qh|; if(rr>Eps, ch=qh+Dr/rr*(qh-ph); Expr(ch,"c",Yname); ); ph=Parapt(pz); qh=Parapt(qz); rr=|ph-qh|; if(rr>Eps, ch=qh+Dr/rr*(qh-ph); Expr(ch,"c",Zname); ); ); ////%Xyzaxparaname end//// ////%Datalist3d start//// Datalist3d():=( //help:Datalist3d(); regional(out,tmp,tmp2,tmp3); tmp=apply(GCLIST,#_1); tmp=select(tmp,indexof(#,"2d")>0); tmp2=select(tmp,indexof(#,"sub")==0); tmp3=apply(tmp2,replace(#,"2d","3d")); out=tmp3; ); ////%Datalist3d end//// ////%Datalist2d start//// Datalist2d():=( //help:Datalist2d(); regional(out,tmp,tmp2,tmp3); tmp=apply(GCLIST,#_1); tmp=select(tmp,indexof(#,"2d")>0); tmp2=select(tmp,indexof(#,"sub")==0); // tmp3=apply(tmp2,replace(#,"2d","3d")); out=tmp2; ); ////%Datalist2d end//// ////%Embed start//// Embed(nm,Pd2str,funstr,varstr):= Embed(nm,Pd2str,funstr,varstr,[]); Embed(nm,Pd2str,funstr,varstr,options):=( //help:Embed("1",["gr1"],"A3d+x*(B3d-A3d)+y*(C3d-A3d)","[x,y]"); regional(name2,name3,Pd2L,Pd2,tmp,tmp1,xstr,ystr, Ltype,Noflg,opstr,opcindy,Out,color); name2="em2d"+nm; name3="em3d"+nm; if(!islist(Pd2str),Pd2L=[Pd2str],Pd2L=Pd2str); // 15.03.06 tmp1=[]; // 15.10.31 forall(Pd2L, if(isstring(#),tmp=parse(#),tmp=#); if(Measuredepth(tmp)==2, tmp1=concat(tmp1,tmp); ); if(Measuredepth(tmp)==1, tmp1=append(tmp1,tmp); ); ); Pd2L=tmp1; tmp=substring(varstr,0,1); if(tmp=="[" % tmp=="(", tmp1=substring(varstr,1,length(varstr)-1); , tmp1=varstr; ); tmp=indexof(tmp1,","); xstr=substring(tmp1,0,tmp-1); ystr=substring(tmp1,tmp,length(tmp1)); tmp=Divoptions(options); Ltype=tmp_1; Noflg=tmp_2; color=tmp_(length(tmp)-2); opcindy=tmp_(length(tmp)); Out=[]; forall(Pd2L,Pd2, tmp1=[]; forall(Pd2, tmp=Assign(funstr,xstr,"("+textformat(#_1,5)+")"); tmp=Assign(tmp,ystr,"("+textformat(#_2,5)+")"); tmp=parse(tmp); tmp1=append(tmp1,tmp); ); Out=append(Out,tmp1); ); if(length(Out)==1, Out=Out_1; ); if(Noflg<3, println("generate Embed "+name3); if(length(Out)>0, tmp=name3+"="+textformat(Out,5)+";"; //190415 parse(tmp); tmp1=Projpara(name3,["nodata"]); tmp=name2+"="+textformat(tmp1,5)+";"; //190415 parse(tmp); ); if(!islist(Pd2str), tmp=Pd2str; , tmp=text(Pd2str); tmp="list("+substring(tmp,1,length(tmp)-1)+")"; ); tmp=name3+"=Embed("+tmp+",'"+funstr+"','"+varstr+"'"+")"; GLIST=append(GLIST,tmp); tmp=name2+"=Projpara("+name3+")"; GLIST=append(GLIST,tmp); ); if(Noflg<3, //190818 if(isstring(Ltype), if(color!=KCOLOR, //180904 Texcom("{");Com2nd("Setcolor("+color+")");//180722 ); Ltype=Getlinestyle(text(Noflg)+Ltype,name2); if(color!=KCOLOR, //180904 Texcom("}");//180722 ); , if(Noflg==1,Ltype=0); ); if(length(Out)>0, GCLIST=append(GCLIST,[name2,Ltype,opcindy]); if(SUBSCR==1, // 15.02.11 Subgraph(name3,opcindy); ); ); ); Out; ); ////%Embed end//// ////%Rotate3pt start//// Rotate3pt(point,w1,w2):=Rotatepoint3d(point,w1,w2,[0,0,0]); Rotate3pt(point,w1,w2,center):=Rotatepoint3d(point,w1,w2,center); ////%Rotate3pt end//// ////%Rotatepoint3d start//// Rotatepoint3d(point,w1,w2):=Rotatepoint3d(point,w1,w2,[0,0,0]);//180809 Rotatepoint3d(point,w1org,w2org,center):=( //help:Rotatepoint3d(pt3d,[0,0,1],pi/2); //help:Rotatepoint3d(pt3d,[0,0,1],pi/2,[1,1,1]); regional(Eps,w1,w2,ct,st,v3,v1,v2,Ans,ns,PtL,num, pt,tmp,tmp1,tmp2,Retflg,x,y,z,xx,yy,zz,flg); Eps=10^(-4); w1=w1org; w2=w2org; //190709 Retflg=0; if(!islist(w2), //190709 ct=cos(w2); st=sin(w2); v3=1/|w1|*w1; if(v3_1==0, tmp=[1,0,0]; , tmp=[0,1,0]; ); w1=[tmp_2*v3_3-tmp_3*v3_2, tmp_3*v3_1-tmp_1*v3_3, tmp_1*v3_2-tmp_2*v3_1]; v1=1/|w1|*w1; v2=[v3_2*v1_3-v3_3*v1_2, v3_3*v1_1-v3_1*v1_3, v3_1*v1_2-v3_2*v1_1]; , tmp=[w1_2*w2_3-w1_3*w2_2, w1_3*w2_1-w1_1*w2_3, w1_1*w2_2-w1_2*w2_1]; if(|tmp|0, PtL=point; , PtL=[point]; ); Ans=[]; flg=0; forall(1..length(PtL),num, pt=PtL_num; if(pt_1=="inf", Ans=append(Ans,["inf"]); flg=1; ); if(flg==0, x=pt_1-center_1; y=pt_2-center_2; z=pt_3-center_3; xx=((v1_1*ct+v2_1*st)*v1_1+ (-v1_1*st+v2_1*ct)*v2_1+v3_1^2)*x +((v1_1*ct+v2_1*st)*v1_2+(-v1_1*st+v2_1*ct)*v2_2+v3_1*v3_2)*y +((v1_1*ct+v2_1*st)*v1_3+(-v1_1*st+v2_1*ct)*v2_3+v3_1*v3_3)*z; yy=((v1_2*ct+v2_2*st)*v1_1+(-v1_2*st+v2_2*ct)*v2_1+v3_1*v3_2)*x +((v1_2*ct+v2_2*st)*v1_2+(-v1_2*st+v2_2*ct)*v2_2+v3_2^2)*y +((v1_2*ct+v2_2*st)*v1_3+(-v1_2*st+v2_2*ct)*v2_3+v3_2*v3_3)*z; zz=((v1_3*ct+v2_3*st)*v1_1+(-v1_3*st+v2_3*ct)*v2_1+v3_1*v3_3)*x +((v1_3*ct+v2_3*st)*v1_2+(-v1_3*st+v2_3*ct)*v2_2+v3_2*v3_3)*y +((v1_3*ct+v2_3*st)*v1_3+(-v1_3*st+v2_3*ct)*v2_3+v3_3^2)*z; Ans=append(Ans,center+[xx,yy,zz]); ); ); if(length(Ans)==1, Ans=Ans_1; ); ); Ans; ); ////%Rotatepoint3d end//// ////%Rotatedata3d start//// Rotatedata3d(nm,P3data,w1,w2):=Rotatedata3d(nm,P3data,w1,w2,[]); Rotatedata3d(nm,P3data,w1,w2,options):=( //help:Rotatedata3d("1",["sl3d1","sc3d2"],[0,0,1],pi/3); //help:Rotatedata3d(options=[center,...]); regional(name3,name2,center,pdata,Pd3,Pd,Out,tmp,tmp1, Ltype,Noflg,opcindy,opstr,color); name3="rot3d"+nm; name2="rot2d"+nm; center=[0,0,0]; tmp=Divoptions(options); Ltype=tmp_1; Noflg=tmp_2; color=tmp_(length(tmp)-2); opstr=tmp_(length(tmp)-1); opcindy=tmp_(length(tmp)); tmp1=tmp_6; if(length(tmp1)>0, center=tmp1_1; ); if(islist(P3data) & isstring(P3data_1),Pd3=P3data,Pd3=[P3data]); Out=[]; forall(Pd3,Pd, if(isstring(Pd),Pd=parse(Pd)); // if(Measuredepth(Pd)==1,Pd=[Pd]); Ans=[]; forall(Pd, tmp=Rotatepoint3d(#,w1,w2,center); //180729 Ans=append(Ans,tmp); ); Out=append(Out,Ans); ); Out=Flattenlist(Out); if(length(Out)==1,Out=Out_1); if(Noflg<3, println("generate Rotatedata3d "+name3); tmp=name3+"="+textformat(Out,5)+";"; //190415 parse(tmp); tmp1=Projpara(name3,["nodata"]); tmp=name2+"="+textformat(tmp1,5)+";"; //190415 parse(tmp); tmp=Textformat(P3data,5); // 17.12.23 tmp=RSform(tmp,1); //180602 tmp=replace(tmp,Dq,"");//180808 // tmp=replace(tmp,"[","list("); // tmp=replace(tmp,"]",")"); tmp=name3+"=Rotate3data("+tmp+","; tmp=tmp+Textformat(w1,6)+","+Textformat(w2,6); tmp=tmp+","+Textformat(center,6)+")";//180808 GLIST=append(GLIST,tmp); tmp=name2+"=Projpara("+name3+")"; GLIST=append(GLIST,tmp); ); if(Noflg<3, //190818 if(isstring(Ltype), if(color!=KCOLOR, //180904 Texcom("{");Com2nd("Setcolor("+color+")");//180722 ); Ltype=Getlinestyle(text(Noflg)+Ltype,name2); if(color!=KCOLOR, //180904 Texcom("}");//180722 ); , if(Noflg==1,Ltype=0); ); GCLIST=append(GCLIST,[name2,Ltype,opcindy]); if(SUBSCR==1, // 15.02.11 Subgraph(name3,opcindy); ); ); Out; ); ////%Rotatedata3d end//// ////%Translatepoint3d start//// Translate3pt(point,w1):=Translatepoint3d(point,w1); Translatepoint3d(point,w1):=( //help:Translatepoint3d(pt3d,[1,2,3]); regional(Eps,Ans,PtL,pt,num,xx,yy,zz,flg); Eps=10^(-4); if(Measuredepth(point)>0, PtL=point; , PtL=[point]; ); Ans=[]; flg=0; forall(1..length(PtL),num, pt=PtL_num; if(pt_1=="inf", Ans=append(Ans,["inf"]); flg=1; ); if(flg==0, xx=pt_1+w1_1; yy=pt_2+w1_2; zz=pt_3+w1_3; Ans=append(Ans,[xx,yy,zz]); ); ); if(length(Ans)==1, Ans=Ans_1; ); Ans; ); ////%Translatepoint3d end//// ////%Translatedata3d start//// Translatedata3d(nm,P3data,w1):=Translatedata3d(nm,P3data,w1,[]); Translatedata3d(nm,P3data,w1,options):=( //help:Translatedata3d("1",["sl3d1"],[1,2,3]); regional(name3,name2,pdata,Pd3,Pd,Out,tmp,tmp1, Ltype,Noflg,opcindy,color); name3="tra3d"+nm; name2="tra2d"+nm; tmp=Divoptions(options); Ltype=tmp_1; Noflg=tmp_2; color=tmp_(length(tmp)-2); opcindy=tmp_(length(tmp)); if(islist(P3data) & isstring(P3data_1),Pd3=P3data,Pd3=[P3data]); Out=[]; forall(Pd3,Pd, if(isstring(Pd),Pd=parse(Pd)); if(Measuredepth(Pd)==1,Pd=[Pd]); Ans=[]; forall(Pd, tmp=Translatepoint3d(#,w1); Ans=append(Ans,tmp); ); Out=append(Out,Ans); ); Out=Flattenlist(Out); if(length(Out)==1,Out=Out_1); if(Noflg<3, println("generate Translatedata3d "+name3); tmp=name3+"="+textformat(Out,5)+";"; //190415 parse(tmp); tmp1=Projpara(name3,["nodata"]); tmp=name2+"="+textformat(tmp1,5)+";"; //190415 parse(tmp); tmp=textformat(P3data,5); // 17.12.23 tmp=RSform(tmp,1); // 180602 tmp=replace(tmp,Dq,""); //180808 // tmp=text(P3data); // tmp=replace(tmp,"[","list("); // tmp=replace(tmp,"]",")"); tmp=name3+"=Translate3data("+tmp+","+textformat(w1,5)+")"; GLIST=append(GLIST,tmp); tmp=name2+"=Projpara("+name3+")"; GLIST=append(GLIST,tmp); ); if(Noflg<3, //190818 if(isstring(Ltype), if(color!=KCOLOR, //180904 Texcom("{");Com2nd("Setcolor("+color+")");//180722 ); Ltype=Getlinestyle(text(Noflg)+Ltype,name2); if(color!=KCOLOR, //180904 Texcom("}");//180722 ); , if(Noflg==1,Ltype=0); ); GCLIST=append(GCLIST,[name2,Ltype,opcindy]); if(SUBSCR==1, // 15.02.11 Subgraph(name3,opcindy); ); ); Out; ); ////%Translatedata3d end//// ////%Reflectpoint3d start//// Reflect3pt(point,vecL):=Reflectpoint3d(point,vecL); Reflectpoint3d(point,vecL):=( //help:Reflectpoint3d(pt3d,[v1,v2,v3]); regional(ans,v1,v2,v3,tmp,tmp1); if(length(vecL)==1, v1=vecL_1; ans=2*v1-point; ); if(length(vecL)==2, v1=vecL_1; v2=vecL_2; v3=(v2-v1)/|v2-v1|; tmp=v1+Dotprod(point-v1,v3)*v3; ans=2*tmp-point; ); if(length(vecL)==3, v1=vecL_1; v2=vecL_2; v3=vecL_3; tmp=Crossprod(v2-v1,v3-v1); tmp1=point-Dotprod(tmp,point-v1)/|tmp|^2*tmp; ans=2*tmp1-point; ); ans; ); ////%Reflectpoint3d end//// ////%Reflectdata3d start//// Reflectdata3d(nm,P3data,vecL):=Reflectdata3d(nm,P3data,vecL,[]); Reflectdata3d(nm,P3data,vecL,options):=( //help:Reflectdata3d("1",["sl3d1"],[v1,v2,v3]); //help:Reflectdata3d("1",["sl3d1"],[v1,v2]); //help:Reflectdata3d("1",["sl3d1"],[v1]); regional(name3,name2,pdata,Pd3,Pd,Out,tmp,tmp1, Ltype,Noflg,opcindy,color); name3="ref3d"+nm; name2="ref2d"+nm; tmp=Divoptions(options); Ltype=tmp_1; Noflg=tmp_2; color=tmp_(length(tmp)-2); opcindy=tmp_(length(tmp)); if(islist(P3data) & isstring(P3data_1),Pd3=P3data,Pd3=[P3data]); Out=[]; forall(Pd3,Pd, if(isstring(Pd),Pd=parse(Pd)); // if(Measuredepth(Pd)==1,Pd=[Pd]); Ans=[]; forall(Pd, tmp=Reflectpoint3d(#,vecL); Ans=append(Ans,tmp); ); Out=append(Out,Ans); ); Out=Flattenlist(Out); if(length(Out)==1,Out=Out_1); if(Noflg<3, println("generate Reflectdata3d "+name3); tmp=name3+"="+textformat(Out,5)+";"; //190415 parse(tmp); tmp1=Projpara(name3,["nodata"]); tmp=name2+"="+Textformat(tmp1,5)+";"; //190415 parse(tmp); tmp=Textformat(P3data,5); // 17.12.23 tmp=RSform(tmp,1); // 180602 tmp=replace(tmp,Dq,""); //180807 // tmp=text(P3data); // tmp=replace(tmp,"[","list("); // tmp=replace(tmp,"]",")"); tmp=name3+"=Reflect3data("+tmp; tmp=tmp+","+RSform(Textformat(vecL,5),2)+")"; GLIST=append(GLIST,tmp); tmp=name2+"=Projpara("+name3+")"; GLIST=append(GLIST,tmp); ); if(Noflg<3, //190818 if(isstring(Ltype), if(color!=KCOLOR, //180904 Texcom("{");Com2nd("Setcolor("+color+")");//180722 ); Ltype=Getlinestyle(text(Noflg)+Ltype,name2); if(color!=KCOLOR, //180904 Texcom("}");//180722 ); , if(Noflg==1,Ltype=0); ); GCLIST=append(GCLIST,[name2,Ltype,opcindy]); if(SUBSCR==1, // 15.02.11 Subgraph(name3,opcindy); ); ); Out; ); ////%Reflectdata3d end//// // 180806 ////%Scalepoint3d start//// Scale3pt(point,ratio,center):=Scalepoint3d(point,ratio,center); Scalepoint3d(point,ratio):=Scalepoint3d(point,ratio,[0,0,0]);//180809 Scalepoint3d(point,ratio,center):=( //help:Scalepoint3d(A,[3,2,4]); //help:Scalepoint3d(A,[3,2,4],[1,2,3]); regional(ra1,ra2,ra3,X1,Y1,Z1,X2,Y2,Z2,Cx,Cy,Cz); X1=point_1; Y1=point_2; Z1=point_3; if(!islist(ratio), //1808from.190709 ra1=ratio; ra2=ratio; ra3=ratio; , ra1=ratio_1; ra2=ratio_2; ra3=ratio_3; );//1808to Cx=center_1; Cy=center_2; Cz=center_3; X2=Cx+ra1*(X1-Cx); Y2=Cy+ra2*(Y1-Cy); Z2=Cz+ra3*(Z1-Cz); [X2,Y2,Z2]; ); ////%Scalepoint3d end//// // 180808 ////%Scaledata3d start//// Scaledata3d(nm,P3data,ratio):=Scaledata3d(nm,P3data,ratio,[]); Scaledata3d(nm,P3data,ratio,options):=( //help:Scaledata3d("1",["sl3d1"],[v1,v2,v3]); regional(name3,name2,pdata,Pd3,Pd,Out,tmp,tmp1, reL,Ltype,Noflg,opcindy,color,center); name3="ref3d"+nm; name2="ref2d"+nm; tmp=Divoptions(options); Ltype=tmp_1; Noflg=tmp_2; reL=tmp_6; color=tmp_(length(tmp)-2); opcindy=tmp_(length(tmp)); center=[0,0,0]; if(length(reL)>0, center=reL_1; ); if(islist(P3data) & isstring(P3data_1),Pd3=P3data,Pd3=[P3data]); Out=[]; forall(Pd3,Pd, if(isstring(Pd),Pd=parse(Pd)); // if(Measuredepth(Pd)==1,Pd=[Pd]); Ans=[]; forall(Pd, tmp=Scalepoint3d(#,ratio,center); Ans=append(Ans,tmp); ); Out=append(Out,Ans); ); Out=Flattenlist(Out); if(length(Out)==1,Out=Out_1); if(Noflg<3, println("generate Scaledata3d "+name3); tmp=name3+"="+textformat(Out,5)+";"; //190415 parse(tmp); tmp1=Projpara(name3,["nodata"]); tmp=name2+"="+Textformat(tmp1,5)+";"; //190415 parse(tmp); tmp=Textformat(P3data,5); // 17.12.23 tmp=RSform(tmp,1); // 180602 tmp=replace(tmp,Dq,""); //180807 // tmp=text(P3data); // tmp=replace(tmp,"[","list("); // tmp=replace(tmp,"]",")"); tmp=name3+"=Scale3data("+tmp; tmp=tmp+","+Textformat(ratio,5); tmp=tmp+","+Textformat(center,5)+")"; GLIST=append(GLIST,tmp); tmp=name2+"=Projpara("+name3+")"; GLIST=append(GLIST,tmp); ); if(Noflg<3, //190818 if(isstring(Ltype), if(color!=KCOLOR, //180904 Texcom("{");Com2nd("Setcolor("+color+")");//180722 ); Ltype=Getlinestyle(text(Noflg)+Ltype,name2); if(color!=KCOLOR, //180904 Texcom("}");//180722 ); , if(Noflg==1,Ltype=0); ); GCLIST=append(GCLIST,[name2,Ltype,opcindy]); if(SUBSCR==1, // 15.02.11 Subgraph(name3,opcindy); ); ); Out; ); ////%Scaledata3d end//// ////%Xyzcoord start//// Xyzcoord(pm,ps):=Xyzcoord(pm_1,pm_2,ps); //181028from Xyzcoord(X,Y,ps):=( //help:Xyzcoord(A.x,A.y,Az.y); regional(pt3d); pt3d=Mainsubpt3d([X,Y],ps); pt3d;//181028to ); ////%Xyzcoord end//// ////%Putoncurve3d start//// Putoncurve3d(name,pdstr):=( //help:Putoncurve3d("T","sc3d1"); regional(pt,pd2str,tmp,tmp1,tmp2); pd2str=replace(pdstr,"3d","2d"); PutonCurve(name,pd2str); pt=parse(name+".xy"); tmp=Nearestpt(pt,pd2str); // 15.03.13 tmp1=Paramoncurve(tmp_1,tmp_2,pd2str); tmp="sub"+pd2str; tmp2=Pointoncurve(tmp1,tmp); // pt=append(pt,tmp2_2); //181028[2lines] pt=Xyzcoord(pt,tmp2); // 15.03.13 tmp=name+"z.xy="+textformat(tmp2,5)+";"; //190415 parse(tmp); // VLIST=select(VLIST,#_1!=name+"3d"); Defvar(name+"3d",pt); ); ////%Putoncurve3d end//// ////%Mkpointlist start//// Mkpointlist():=Mkpointlist([]); //16.11.12 Mkpointlist(options):=( //181030 regional(Eps,dp,mv,pos,worklist,plist,pt,ptstr,pt3,ptz,par, tmp,tmp1,tmp2,tmp3,tmp4,p1,p2,flg); dp=pi/24; mv=NE.x-SW.x; Eps=10^(-4); pos=[NE.x+1,NE.y+0.1]; worklist=Workprocess(); //181030 plist=select(worklist,length(#_3)!=2); plist=apply(plist,#_1); plist=remove(plist,PTEXCEPTION); tmp=apply(VLIST,#_1);//181029from tmp=select(tmp,indexof(#,"3d")>0); tmp2=apply(tmp,replace(#,"3d","")); forall(tmp2,ptstr, if(!contains(plist,ptstr), tmp=select(VLIST, (#_1==pt+"3d")%(#_1==pt+"2d")%(#_1==pt+"fix")); VLIST=remove(VLIST,tmp); ); ); //181029to if(SUBSCR==0,plist=[]); forall(plist,ptstr, pt=parse(ptstr); inspect(pt,"ptsize",3); inspect(pt,"color",2); inspect(pt,"textsize",TSIZE); ptz=pt.name+"z"; //190505 tmp=Finddef(pt); tmp=select(VLIST,#_1==pt.name+"3d"); //190505 if(length(tmp)==0, tmp=parse(ptz); //181108from if(ispoint(tmp), pt3=Mainsubpt3d(pt.xy,tmp.xy); //181108to , if(abs(cos(THETA))>Eps,//181028from tmp1=Mainsubpt3d(pt.xy,0); tmp=Parasubpt(tmp1); Putpoint(ptz,tmp,[tmp_1,parse(ptz+".y")]); pt3=Mainsubpt3d(pt.xy,parse(ptz+".xy")); , if(abs(sin(PHI))>abs(cos(PHI)), //181029from tmp=Parasubpt([-pt.x/sin(PHI),0,pt.y]); , tmp=Parasubpt([0,pt.x/cos(PHI),pt.y]); ); Putpoint(ptz,tmp,[parse(ptz+".x"),pt.y]);//181029t pt3=Mainsubpt3d(pt.xy,parse(ptz+".xy")); ); ); //181028to Defvar(pt.name+"3d",pt3); //190505 Defvar(pt.name+"fix",0); //190505 ); flg=0; if(isstring(ptz),ptz=parse(ptz));//181029from inspect(ptz,"ptsize",3); inspect(ptz,"color",3); inspect(ptz,"textsize",TSIZEZ);//181029to if(Ptselected(pt), if(parse(pt.name+"fix")!=1, //190505 tmp=select(VLIST,#_1==pt.name+"3d"); //190505 tmp1=tmp_1_2; pt3=Mainsubpt3d(pt.xy,ptz.xy); //181029 Putpoint(ptz.name,Parasubpt(pt3)); if(Norm(tmp1-pt3)>Eps, Defvar(pt.name+"3d",pt3); //190505 ); flg=1; ); ); if(Ptselected(ptz),//181108from tmp=select(VLIST,#_1==pt.name+"3d"); //190505 tmp1=tmp_1_2; tmp=Parasubpt(tmp1); //181108from if(abs(cos(THETA))>Eps, tmp=tptz.name+".x="+format(tmp_1,6)+";"; //190505 parse(tmp); tmp=Parapt([tmp1_1,tmp1_2,ptz.y]); Putpoint(pt.name,tmp); //190505 , tmp=ptz.name+".y="+format(tmp_2,6)+";"; //190505 parse(tmp); if(abs(sin(PHI+dp))>abs(cos(PHI+dp)), //181108 tmp=-(ptz.x-mv-tmp1_2*cos(PHI+dp))/sin(PHI+dp); tmp=Parapt([tmp,tmp1_2,tmp1_3]); , tmp=(ptz.x-mv+tmp1_1*sin(PHI+dp))/cos(PHI+dp); //181109pm tmp=Parapt([tmp1_1,tmp,tmp1_3]); ); Putpoint(pt.name,tmp); //190505 ); pt3=Mainsubpt3d(pt.xy,ptz.xy); Defvar(pt.name+"3d",pt3); //190505 flg=2; ); if(Ptselected(TH) % Ptselected(FI), //181029 tmp=select(VLIST,#_1==pt.name+"3d"); //190505 if(length(tmp)>0, //17.10.07 tmp1=Parapt(tmp_1_2); Putpoint(pt.name,tmp1); //190505 tmp2=Parasubpt(tmp_1_2);//181027[2lines] Putpoint(ptz.name,tmp2); //190505 flg=3; ); //17.10.07 ); if(flg==0, //181030from pt3=Mainsubpt3d(pt.xy,ptz.xy); Defvar(pt.name+"3d",pt3); //190505 ); //181030to if(Ptselected(pt) % Ptselected(ptz), drawtext(pos,pt3.xy,size->12); // no ketjs //190505 ); if(!contains(["p","q"],pt.name), //190505 ptL=append(ptL,pt); ); ); ); ////%Mkpointlist end//// ////%Mkseg3d start//// Mkseg3d():=Mkseg3d([]); Mkseg3d(options):=( regional(seg,nmseg,def,ptA,ptB,segL,opstr,opcindy, name,strg,Ltype,Noflg,tht,tmp,tmp1,tmp2,tmp3); name="geoseg3d"; strg=name+"=list("; tmp=Divoptions(options); Ltype=tmp_1; Noflg=tmp_2; opcindy=tmp_(length(tmp)); segL=[]; forall(allsegments(),seg, inspect(seg,"labeled",false); tmp=Finddef(seg); def=tmp_1; ptA=tmp_2; ptB=tmp_3; if(ispoint(parse(ptA)) & ispoint(parse(ptB)), tmp1=select(VLIST,indexof(#_1,ptA+"3d")>0); tmp2=select(VLIST,indexof(#_1,ptB+"3d")>0); if(length(tmp1)>0 & length(tmp2)>0, tmp1="["+ptA+"3d,"+ptB+"3d]"; nmseg=ptA+ptB; // Spaceline(nmseg,parse(tmp1),append(options,"Msg=nodisp")); //15.06.15 Spaceline("-"+nmseg+"3d",[ptA+"3d",ptB+"3d"], // 16.04.07 append(options,"Msg=nodisp")); //15.06.15 segL=append(segL,nmseg+"3d");// 16.04.07 strg=strg+nmseg+"3d,";// 16.04.07 ); ); ); if(length(parse(name))>0, //190401 println("generate totally "+name); ); if(length(segL)>0, // 15.03.06 strg=substring(strg,0,length(strg)-1)+")"; if(Noflg<3, GLIST=append(GLIST,strg); ); tmp1=apply(segL,Dq+#+Dq); //15.03.02 tmp=name+"="+tmp1.name; //190505 parse(tmp); ); segL; ); ////%Mkseg3d end//// ////%Ptseg3data start//// Ptseg3data():=Ptseg3data([]); //help:Ptseg3data(); //help:Ptseg3data([A,B]); Ptseg3data(options):=( regional(pt,ptz,pt3,plist,plistz,tmp,tmp1,tmp2); tmp=remove(allpoints(),options); tmp=remove(tmp,[SW,NE,TH,FI]); plist=select(tmp,indexof(#.name,"z")==0); plistz=select(tmp,indexof(#.name,"z")>0); if(Ptselected(TH) % Ptselected(FI), forall(plist,pt, tmp=select(plistz,#.name==pt.name+"z"); if(length(tmp)>0, ptz=tmp_1; , ptz=[]; ); tmp=select(VLIST,#_1==pt.name+"3d"); //190506 if(length(tmp)>0, pt3=tmp_1_2; pt.xy=Parapt(pt3); ptz.xy=Parasubpt(pt3); , pt3=Mainsubpt3d(pt.xy,ptz.xy); //181107[2lines] Defvar(pt+"3d",pt3); ); ); , Mkpointlist(options); // 16.12.18 ); forall(alllines(), // no ketjs on #.color=[0.5,0.5,1]; ); SEG3dlist=Mkseg3d(options); SEG3dlist; // no ketjs off ); ////%Ptseg3data end//// ////%Putonseg3d start//// Putonseg3d(name,ptL):=Putonseg3d(name,ptL_1,ptL_2,[]); Putonseg3d(name,Arg1,Arg2):=( if(islist(Arg1), Putonseg3d(name,Arg1_1,Arg1_2,Arg2); , Putonseg3d(name,Arg1,Arg2,[]); ); ); Putonseg3d(name,pt1,pt2,options):=( //help:Putonseg3d("C",[A,B]); //help:Putonseg3d("C",A,B); regional(par,pn1,pn2,tmp,tmp1,tmp2,tmp3); par=0.5; tmp=divoptions(options); if(length(tmp_6)>0, par=tmp_6_1; ); if(ispoint(pt1), //181030from Putonseg(name,pt1,pt2,[par]); , Putonseg(name,Parapt(pt1),Parapt(pt2),[par]); ); //181030from inspect(parse(name),"ptsize",3); inspect(parse(name),"color",2); inspect(parse(name),"textsize",TSIZEZ); Putpoint(name+"z",[parse(name+".x"),0]); inspect(parse(name+"z"),"ptsize",3); inspect(parse(name+"z"),"color",3); inspect(parse(name+"z"),"textsize",TSIZEZ); if(ispoint(pt1), pn1=pt1.name; //190505 pn2=pt2.name; //190505 tmp1=replace("PCz.xy=PAz.xy+|PC-PA|/|PB-PA|*(PBz.xy-PAz.xy)","PC",name); tmp1=replace(tmp1,"PA",pn1); tmp1=replace(tmp1,"PB",pn2)+";"; parse(tmp1); , pn1=Textformat(Parapt(pt1),5); //181030from pn2=Textformat(Parapt(pt2),5); tmp1=replace("PCz.xy=PAs+Norm(PC-PAm)/Norm(PBm-PAm)*(PBs-PAs)","PC",name); tmp1=replace(tmp1,"PAm",pn1); tmp1=replace(tmp1,"PBm",pn2); pn1=Textformat(Parasubpt(pt1),5); //181030from pn2=Textformat(Parasubpt(pt2),5); tmp1=replace(tmp1,"PAs",pn1); tmp1=replace(tmp1,"PBs",pn2)+";"; //190415 parse(tmp1); ); tmp1=parse(name+".xy"); //181028[3lines] tmp2=parse(name+"z.xy"); tmp=Xyzcoord(tmp1,tmp2); Defvar(name+"3d",tmp); ); ////%Putonseg3d end//// ////%Putpoint3d start//// Putpoint3d(ptslist):=Putpoint3d(ptslist,"",0); Putpoint3d(Arg1,Arg2):=( // 16.03.02 from if(islist(Arg1), Putpoint3d(Arg1,Arg2,0); , Putpoint3d(Arg1,Arg2,"fix"); ); ); Putpoint3d(Arg1,Arg2,Arg3):=( //help:Putpoint3d(["A",[2,1,3]]); //help:Putpoint3d(["A",[2,1,3]],"fix"); //help:Putpoint3d("A",[2,1,3]); //help:Putpoint3d(["A",[2,1,3]],["fix"]); regional(nn,kk,pt,pt3,ptslist,fixstr,tmp,tmp1,tmp2,tmp3); //16.08.19 if(isstring(Arg1), ptslist=[Arg1,Arg2]; fixstr=Arg3; , ptslist=Arg1; fixstr=Arg2; ); if(islist(fixstr),fixstr=fixstr_1);// 16.03.02 until nn=length(ptslist)/2; forall(1..nn,kk, // 16.08.19from tmp1=ptslist_(2*kk-1); pt3=ptslist_(2*kk); // 16.08.19until VLIST=select(VLIST,#_1!=tmp1+"3d"); tmp2=parse(tmp1); if(ispoint(tmp2), // 16.05.26from if(islist(fixstr),tmp=fixstr_1,tmp=fixstr); tmp=Toupper(tmp); if(tmp!="FIX", tmp=Xyzcoord(tmp2.xy,parse(tmp1+"z.xy")); //181028 , tmp=pt3; ); Defvar(tmp1+"3d",tmp); , Defvar(tmp1+"3d",pt3); ); // 16.05.26until Defvar(tmp1+"fix",0); pt=Parapt(pt3); Putpoint(tmp1,pt,parse(tmp1+".xy")); inspect(parse(tmp1),"ptsize",3); inspect(parse(tmp1),"color",2); inspect(parse(tmp1),"textsize",TSIZE); if(SUBSCR==1, tmp2=tmp1+"z"; Putpoint(tmp2,Parasubpt(pt3)); inspect(parse(tmp2),"ptsize",3); inspect(parse(tmp2),"color",3); inspect(parse(tmp2),"textsize",TSIZEZ); ); ); if(islist(fixstr),tmp=fixstr_1,tmp=fixstr); if(tmp=="fix" % tmp=="Fix", Fixpoint3d(ptslist); ); ); ////%Putpoint3d end//// ////%Fixpoint3d start//// Fixpoint3d(ptlist):=( // help:Fixpoint3d(["O",[0,0,0],"X",[1,0,0]]); regional(name,pt3,pt2,tmp,tmp1,tmp2); forall(1..(length(ptlist)/2), name=ptlist_(2*#-1); Defvar(name+"fix",1); pt3=ptlist_(2*#); pt2=Parapt(pt3); tmp1=textformat(pt2_1,5); tmp2=textformat(pt2_2,5); tmp=name+".xy=["+tmp1+","+tmp2+"];"; parse(tmp); tmp1=name+".x+NE.x-SW.x"; tmp2=textformat(pt3_3,5); tmp=name+"z.xy=["+tmp1+","+tmp2+"];"; parse(tmp); ); ); ////%Fixpoint3d end//// ////%Letter3d start//// Letter3d(dtlist):=Letter3d(dtlist,[]); //181218from Letter3d(pt3d,dir,name):=Letter3d([pt3d,dir,name],[]); Letter3d(pt3d,dir,name,options):=Letter3d([pt3d,dir,name],options); Letter3d(dtlist,options):=( //help:Letter3d(point3d,,direction,name); //help:Letter3d([point3d,,direction,name],options]); regional(dt,nall,jj); dt=dtlist; if(mod(length(dt),3)!=0, println(" Improper data"); , nall=length(dt)/3; forall(1..nall, jj=#*3-2; tmp=dt_jj; if(ispoint(tmp),tmp=parse(tmp.name+"3d")); //190505 dt_jj=Parapt(tmp); ); Letter(dt,options); ); ); //181218to ////%Letter3d end//// ////%Expr3d start//// Expr3d(dtlist):=Expr3d(dtlist,[]); //181218from Expr3d(pt3d,dir,name):=Expr3d([pt3d,dir,name],[]); //181218from Expr3d(pt3d,dir,name,options):=Expr3d([pt3d,dir,name],options); Expr3d(dtlist,options):=( //help:Expr3d(point3d,,direction,name); //help:Expr3d([point3d,,direction,name],options]); regional(dt,nall,jj); dt=dtlist; if(mod(length(dt),3)!=0, println(" Improper data"); , nall=length(dt)/3; forall(1..nall, jj=#*3-2; tmp=dt_jj; if(ispoint(tmp),tmp=parse(tmp.name+"3d")); //190505 dt_jj=Parapt(tmp); ); Expr(dt,options); ); ); //181218to ////%Expr3d end//// ////%Perppt start//// Perppt(name,ptstr,pLstr):=Putperp(name,ptstr,pLstr,"draw"); Perppt(name,ptstr,pLstr,option):=Putperp(name,ptstr,pLstr,option); Putperp(name,ptstr,pLstr):=Putperp(name,ptstr,pLstr,"put"); Putperp(name,ptstr,pLstr,option):=( //help:Perppt("N","O","A-B-C"); //help:Perppt("N","O","A-B-C","put"); //help:Perppt("N","O","A-B","none"); regional(out,Eps,N3d,sgstr,pP,pA,pB,pC,tmp,tmp1,flgpL); Eps=10^(-4); pP=parse(ptstr+"3d"); tmp=indexof(pLstr,"-"); pA=parse(substring(pLstr,0,tmp-1)+"3d"); tmp1=substring(pLstr,tmp,length(pLstr)); tmp=indexof(tmp1,"-"); if(tmp>0, pB=parse(substring(tmp1,0,tmp-1)+"3d"); pC=parse(substring(tmp1,tmp,length(tmp1))+"3d"); flgpL=1; , pB=parse(tmp1+"3d"); flgpL=0; ); if(flgpL==1, tmp=Crossprod(pB-pA,pC-pA); if(abs(tmp)="A")&(tmp<="Z"), tmp=nm+"3d"; , tmp="pt3d"+nm; ); Defvar(tmp,pt3); //190714to ); //181017to ////%Pointdata3d end//// ////%Putaxes3d start//// Putaxes3d(size):=( //help:Putaxes3d(5); //help:Putaxes3d([1,2,3]); regional(sL); if(islist(size),sL=size,sL=[size,size,size]); Putpoint3d(["O",[0,0,0]],"fix"); //17.06.02from Putpoint3d(["X",[sL_1,0,0]],"fix"); Putpoint3d(["Y",[0,sL_2,0]],"fix"); Putpoint3d(["Z",[0,0,sL_3]],"fix"); // Fixpoint3d(["O",[0,0,0]]); // Fixpoint3d(["X",[sL_1,0,0],"Y",[0,sL_2,0],"Z",[0,0,sL_3]]);//17.06.02funtil ); ////%Putaxes3d end//// ////%IntersectsgpL start//// IntersectsgpL(name,sgstr,pLstr):= IntersectsgpL(name,sgstr,pLstr,["ie"]); IntersectsgpL(name,sgstr,pLstr,optionsorg):=( //help:IntersectsgpL("R","P-Q","A-B-C"); //help:IntersectsgpL("pR","pP-pQ","A-B-C"); //help:IntersectsgpL(options=["draw(put)","ie","Screen=n"+pointoptions,"Color="]); regional(options,eqL, strL,ptflg,out,pP,pQ,pA,pB,pC,pH,pK,pR,tseg,tt,ss,Eps, flg,scrflg,nvec,tmp,tmp1,tmp2,tmp3,tmp4); options=optionsorg; //181026from tmp1=""; if(isstring(options), tmp1=options; options=[]; ); options=remove(options,["draw","Draw"]); tmp=Divoptions(options); eqL=tmp_5; strL=tmp_7; if(length(tmp1)>0, strL=append(strL,tmp1); ); ptflg=["D","ie"]; forall(strL, tmp=Toupper(substring(#,0,1)); if(tmp=="P", ptflg_1="P"; ); if((tmp=="I")%(tmp=="E"), if(length(#)==1, ptflg_2=#+"e"; , ptflg_2=#; ); ); ); options=remove(options,strL); scrflg="Y"; //181031from forall(eqL, tmp=Strsplit(#,"="); tmp1=Toupper(substring(tmp_1,0,1)); //181111 if(tmp1=="S", scrflg=Toupper(substring(tmp_2,0,1)); options=remove(options,[#]); ); ); //181031to tmp=select(options,substring(#,0,1)=="C"); if(length(tmp)==0,options=append(options,"Color=green"));//181026to Eps=10^(-4); flg=0; if(!isstring(sgstr), // 15.05.29 pP=sgstr_1; pQ=sgstr_2; , tmp=indexof(sgstr,"-"); if(tmp>0, // 15.05.28 pP=parse(substring(sgstr,0,tmp-1)+"3d"); pQ=parse(substring(sgstr,tmp,length(sgstr))+"3d"); , tmp1=parse(sgstr); pP=tmp1_1; pQ=tmp1_2; ); ); if(!isstring(pLstr), // 16.02.02 pA=pLstr_1; pB=pLstr_2; pC=pLstr_3; , tmp=indexof(pLstr,"-"); pA=parse(substring(pLstr,0,tmp-1)+"3d"); tmp1=substring(pLstr,tmp,length(pLstr)); tmp=indexof(tmp1,"-"); pB=parse(substring(tmp1,0,tmp-1)+"3d"); pC=parse(substring(tmp1,tmp,length(tmp1))+"3d"); ); nvec=Crossprod(pB-pA,pC-pA); if(abs(Dotprod(nvec,pQ-pP))>Eps, pH=(Reflectpoint3d(pP,[pA,pB,pC])+pP)/2; //180811[2lines] pK=(Reflectpoint3d(pQ,[pA,pB,pC])+pQ)/2; tmp1=pP-pH; tmp2=tmp1+pK-pQ; tmp=select(tmp2,abs(#)==max(apply(tmp2,abs(#)))); tmp=select(1..3,tmp2_#==tmp_1); tmp=tmp_1; tseg=tmp1_tmp/tmp2_tmp; pR=(1-tseg)*pH+tseg*pK; tmp=Dotprod(pB-pA,pC-pA); tmp1=Dotprod(pB-pA,pB-pA); tmp2=Dotprod(pC-pA,pC-pA); tmp3=Dotprod(pR-pA,pB-pA); tmp4=Dotprod(pR-pA,pC-pA); ss=-(tmp*tmp4-tmp3*tmp2)/(tmp1*tmp2-tmp^2); tt=(tmp1*tmp4-tmp*tmp3)/(tmp1*tmp2-tmp^2); tmp1=(tseg>-Eps)&(tseg<1+Eps); //181027from tmp2=(ss>-Eps)&(ss<1+Eps)&(tt>-Eps)&(tt<1+Eps)&(ss+tt<1+Eps);//181029 out=[pR,tmp1,tmp2,tseg,ss,tt]; //181027to tmp=ptflg_2; tmp1=(tmp1)%(substring(tmp,0,1)=="i"); //190114 tmp2=(tmp2)%(substring(tmp,1,2)=="e"); if(tmp1&tmp2&(scrflg=="Y"), //181031 if(ptflg_1=="P", //181025 Putpoint3d([name,pR],"fix"); , Drawpoint3d(pR,options); tmp=name; //190401from if(indexof(name,"3d")==0, tmp=name+"3d"; ); tmp=tmp+"="+Textformat(pR,6)+";"; //190415 parse(tmp); //190401to ); ); , println(" "+sgstr+" and "+pLstr+" may be parallel");//181025to out=[[],false,false]; //181029 ); out; ); ////%IntersectsgpL end//// ////%Bezier3d start//// Bezier3d(nm,ptctrlist):=Bezier3(nm,ptctrlist); Bezier3d(nm,Ag1,Ag2):=Bezier3(nm,Ag1,Ag2); Bezier3d(nm,ptlistorg,ctrlistorg,options):= Bezier3(nm,ptlistorg,ctrlistorg,options); //help:Bezier3d("1",["A","B","C"],["D","E","F","G"]); Bezier3(nm,ptctrlist):=Bezier3(nm,ptctrlist_1,ptctrlist_2,[]); Bezier3(nm,Ag1,Ag2):=( if(Measuredepth(Ag1)==0, Bezier3(nm,Ag1,Ag2,[]); , if(Measuredepth(Ag1)>1, Bezier3(nm,Ag1_1,Ag1_2,Ag2); , if(isstring(Ag_1_1), Bezier3(nm,Ag1,Ag2,[]); , Bezier3(nm,Ag1_1,Ag1_2,Ag2); ); ); ); ); Bezier3(nm,ptlistorg,ctrlistorg,options):=( //17.10.08 greatly changed regional(name,name3,name2,tmp,tmp1,tmp2, Ltype,Noflg,opstr,eqL,Num,ii,knt,ctr,out,color); name="bz"+nm; name3="bz3d"+nm; name2="bz2d"+nm; tmp=Divoptions(options); Ltype=tmp_1; Noflg=tmp_2; eqL=tmp_5; color=tmp_(length(tmp)-2); opcindy=tmp_(length(tmp)); Num=20; forall(eqL, tmp=indexof(#,"="); tmp1=Toupper(substring(#,0,1)); tmp2=substring(#,tmp,length(#)); if(tmp1=="N", Num=parse(tmp2); ); ); ptlist=ptlistorg; if(isstring(ptlistorg_1),ptlist=apply(ptlistorg,parse(#+"3d"))); ctrlist=ctrlistorg; if(isstring(ctrlistorg_1),ctrlist=apply(ctrlistorg,parse(#+"3d"))); out=[]; forall(1..(length(ptlist)-1),ii, knt=[ptlist_ii,ptlist_(ii+1)]; ctr=[ctrlist_(2*ii-1),ctrlist_(2*ii)]; tmp="Bezierpt(T,ptlist,ctrlist)";//17.01.04 tmp=Assign(tmp,"ptlist",knt); tmp=Assign(tmp,"ctrlist",ctr); Spacecurve(name+text(ii),tmp,"T=[0,1]",append(eqL,"nodisp")); GLIST=GLIST_(1..(length(GLIST)-2)); out=append(out,name3+text(ii)); ); tmp1=[]; forall(1..length(out), tmp=parse(out_#); if(#==1,tmp1=tmp,tmp1=concat(tmp1,tmp_(2..length(tmp)))); ); if(Noflg<3, println("generate Beziercurve "+name3); tmp=name3+"="+tmp1+";"; //190415 parse(tmp); tmp1=Projpara(name3,["nodata"]); tmp=name2+"="+textformat(tmp1,5)+";"; //190415 parse(tmp); ptlist=apply(ptlistorg,#+"3d"); ptlist=RSform(text(ptlist),1); ctrlist=[]; forall(1..(length(ctrlistorg)/2), tmp=[ctrlistorg_(2*#-1),ctrlistorg_(2*#)]; tmp=apply(tmp,#+"3d"); ctrlist=append(ctrlist,tmp); ); ctrlist=RSform(text(ctrlist),0); tmp=name3+"=Bezier("+ptlist+","+ctrlist+","+Dq+"Num="+text(Num)+Dq+")"; GLIST=append(GLIST,tmp); tmp=name2+"=Projpara("+name3+")"; GLIST=append(GLIST,tmp); ); if(Noflg<3, //190818 if(isstring(Ltype), if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+color+")")); Ltype=Getlinestyle(text(Noflg)+Ltype,name2); if(!contains([[0,0,0],[0,0,0,1]],color),Com2nd("Setcolor("+text(KCOLOR)+")")); , if(Noflg==1,Ltype=0); ); GCLIST=append(GCLIST,[name2,Ltype,opcindy]); if(SUBSCR==1, // 15.02.11 Subgraph(name3,opcindy); ); ); out; ); ////%Bezier3d end//// ////%Putbezier3data start//// Putbezier3data(name,pt3Lorg):=Putbezier3data(name,pt3Lorg,[]); Putbezier3data(name,pt3Lorg,options):=( // 17.10.08 greatly changed regional(pt3L,psize,Deg,nn,numstr, tmp,tmp1,tmp2,tmp3,pts,ctrpts); tmp=Divoptions(options); Deg=3; tmp1=tmp_5; forall(tmp1, if(substring(#,0,1)=="D", tmp=indexof(#,"="); Deg=parse(substring(#,tmp,length(#))); ); ); pt3L=pt3Lorg; if(isstring(pt3L_1),pt3L=apply(pt3L,parse(#+"3d"))); ctrpts=[]; forall(2..length(pt3L),nn, // 16.08.19from numstr=text(nn-1); // 16.08.19 if(Deg==3, tmp1=name+numstr+"p"; tmp2=(2*pt3L_(nn-1)+pt3L_(nn))/3; VLIST=select(VLIST,#_1!=tmp1+"3d"); // 16.08.19from Putpoint3d([tmp1,tmp2]); ctrpts=append(ctrpts,tmp1); tmp1=name+numstr+"q"; tmp3=(pt3L_(nn-1)+2*pt3L_nn)/3; VLIST=select(VLIST,#_1!=tmp1+"3d"); Putpoint3d([tmp1,tmp3]); ctrpts=append(ctrpts,tmp1); , tmp1=name+numstr+"p"; tmp2=(pt3L_(nn-1)+pt3L_nn)/2; VLIST=select(VLIST,#_1!=tmp1+"3d"); // 16.08.19until Putpoint3d([tmp1,tmp2]); ctrpts=append(ctrpts,tmp1); ); ); ctrpts; ); ////%Putbezier3data end//// ////%Mkbezierptcrv3d start//// Mkbezierptcrv3d(ptdata):=Mkbezierptcrv3(ptdata); Mkbezierptcrv3d(ptdata,options):=Mkbezierptcrv3(ptdata,options); //help:Mkbezierptcrv3d(["A","B","C","D"]); Mkbezierptcrv3(ptdata):=Mkbezierptcrv3(ptdata,[]); Mkbezierptcrv3(ptdata,options):=( //17.10.08 greatly changed regional(Eps,name,bz,pt,p1,p2,p13d,p23d,pt3, Out,tt,pos,tmp,tmp1,tmp2); Eps=10^(-4); pos=[NE.x+1,NE.y]; Out=[]; tmp=re(floor((BezierNumber3-1)/26)); //190505 // 15.02.23 from if(tmp==0,tmp="",tmp=text(tmp)); tmp2=mod(BezierNumber3,26); if(tmp2==0,tmp2=26); name=unicode(text(96+tmp2),base->10)+tmp; tmp2=Putbezier3data(name,ptdata,options); Bezier3(name,ptdata,tmp2,options); Out=append(Out,tmp2); BezierNumber3=BezierNumber3+1; Out; ); ////%Mkbezierptcrv3d end//// //////////old version /////////////////////////////// Readobj(filename):=Readobj(filename,[]); Readobj(filename,options):=( //help:Readobj("file.obj",["size=-3"]); regional(eqL,size,vL,fnL,tmp,tmp1,tmp2); size=1; tmp=Divoptions(options); eqL=tmp_5; forall(eqL, if(Toupper(substring(#,0,1))=="S", tmp=indexof(#,"="); size=parse(substring(#,tmp,length(#))); ); ); tmp=load(filename); tmp=tokenize(tmp,"v"); tmp1=tmp_(2..(length(tmp)-1)); tmp2=tmp_(length(tmp)); tmp2=tokenize(tmp2,"f"); tmp1=append(tmp1,tmp2_1); tmp1=apply(tmp1,Removespace(#)); tmp1=apply(tmp1,replace(#," "," ")); tmp1=apply(tmp1,"["+replace(#," ",",")+"]"); vL=apply(tmp1,size*parse(#)); tmp2=tmp2_(2..(length(tmp2))); tmp2=apply(tmp2,Removespace(#)); tmp2=apply(tmp2,replace(#," "," ")); tmp2=apply(tmp2,"["+replace(#," ",",")+"]"); fnL=apply(tmp2,parse(#)); [vL,fnL]; ); //////////new version /////////////////////////////// ////%Readobj start//// Readobj(filename,options):=( //help:Readobj("file.obj",["size=-3"]); regional(eqL,size,vL,fnL,dtL,numer,flg,flg2, tmp,tmp1,tmp2,tmp3,tmp4,tmp5); size=1; tmp=Divoptions(options); eqL=tmp_5; forall(eqL, if(Toupper(substring(#,0,1))=="S", tmp=indexof(#,"="); size=parse(substring(#,tmp,length(#))); ); ); numer="-0123456789"; tmp=load(filename); dtL=tokenize(tmp,"v "); vL=[]; fnL=[]; flg=0; flg2=0; forall(dtL,dt, tmp1=Removespace(dt); if(indexof(numer,substring(tmp1,0,1))>0, tmp2=""; tmp=indexof(tmp1,"f"); if(tmp>0, tmp2=substring(tmp1,tmp-1,length(tmp1)); tmp1=substring(tmp1,0,tmp-1); if(substring(tmp1,length(tmp1)-1,length(tmp1))=="#", tmp2="#"+tmp2; tmp1=substring(tmp1,0,length(tmp1)-1); ); // tmp=indexof(tmp2,"#"); // if(tmp>0, // tmp2=substring(tmp2,0,tmp-1); // ); ); if(flg==1, tmp1=""; flg=0; ); if(length(tmp1)>0, tmp=indexof(tmp1,"#"); if(tmp>0, tmp1=substring(tmp1,0,tmp-1); flg=1; ); tmp=indexof(tmp1,"vt"); if(tmp>0, tmp1=substring(tmp1,0,tmp-1); ); tmp1=replace(tmp1," ",","); tmp1=replace(tmp1," ",","); tmp1="["+tmp1+"]"; tmp1=size*parse(tmp1); vL=append(vL,tmp1); ); if(length(tmp2)>0, tmp2=tokenize(tmp2,"f"); if(length(tmp2_1)==0, tmp2=tmp2_(2..length(tmp2)); // , // if(tmp2_1=="#", // tmp2=tmp2_(2..length(tmp2)); // tmp2_1="#"+tmp2_1; // ); ); forall(1..length(tmp2),tmp3, tmp=tmp2_tmp3; if(substring(tmp,length(tmp)-1,length(tmp))=="#", tmp2_(tmp3+1)="#"+Removespace(tmp2_(tmp3+1)); tmp2_tmp3=substring(tmp,0,length(tmp)-1); ); tmp5=""; if(length(tmp2_tmp3)>0, tmp4=tokenize(tmp2_tmp3," "); forall(tmp4, if(length(text(#))>0, if(indexof(text(#),"/")==0, tmp=text(#); , tmp=tokenize(text(#),"/"); tmp=tmp_1; ); if(length(tmp)>0, tmp5=tmp5+tmp+","; ); ); ); tmp5=substring(tmp5,0,length(tmp5)-1); if(length(tmp5)>0, if(substring(tmp5,0,1)!="#", tmp5="["+tmp5+"]"; fnL=append(fnL,parse(tmp5)); ); ); ); ); ); ); ); [vL,fnL]; ); ////%Readobj end//// ////%Concatobj start//// Concatobj(objL):=Concatobj(objL,[]); Concatobj(objL,options):=( //help:Concatobj([polyhed,triangle]); //help:Concatobj([polyhed,triangle],["Rmf=no"]); //help:Concatobj([[A,B,C],[A,C,D]]); regional(obj,vL,fL,vadd,vtx,faces,fnew,face,jj,kk,vctr,eps, tmp,tmp1,tmp2,tmp3,eqL,rmf); tmp=divoptions(options); eqL=tmp_5; rmf="y"; // 16.08.19 forall(eqL, tmp=indexof(#,"="); tmp1=Toupper(substring(#,0,1)); tmp2=Toupper(substring(#,tmp,tmp+1)); if(tmp1=="R", if(tmp2=="Y",rmf="y"); // 16.08.14 ); ); eps=10^(-4); vL=[]; fL=[]; vctr=0; forall(objL,obj, if(isstring(obj), tmp1=parse(obj); , tmp1=obj; ); if(length(tmp1)>2, // 16.02.28 tmp=1..length(tmp1); tmp1=[tmp1,[tmp]]; ); vtx=tmp1_1; // 16.02.11 from faces=tmp1_2; fnew=faces; vctr=0; vadd=[]; forall(1..length(vtx),jj, tmp1=vtx_jj; tmp=select(1..length(vL),dist3d(vL_#,tmp1)0, tmp1=tmp_1; fnew_kk_tmp1=tmp2; ); ); ); vL=concat(vL,vadd); fL=concat(fL,fnew); // 16.02.11 until ); tmp2=apply(1..length(fL),1); if(rmf=="y", forall(1..length(fL),jj, tmp=fL_jj; tmp1=select((jj+1)..length(fL),fL_#==tmp); forall(tmp1,tmp2_#=0); ); tmp=select(1..length(tmp2),tmp2_#==1); fL=fL_tmp; ); [vL,fL]; ); ////%Concatobj end//// if(1==0, Mkobjfile(fname,objL):=Mkobjfile(Dirwork,fname,objL); Mkobjfile(path,fnameorg,objL):=( //help:Mkobj(filename,objlist); regional(fname,obj,vtx,face,tmp,tmp1,tmp2); fname=fnameorg; if(indexof(fname,".")==0,fname=fname+".obj"); vtx=objL_1; face=objL_2; setdirectory(path); SCEOUTPUT = openfile(fname); forall(vtx,tmp1, tmp2=tmp1; if(ispoint(tmp1), tmp2=parse(tmp1.name+"3d"); //190505 ); tmp="v "+format(tmp2_1,5)+" "+format(tmp2_2,5)+" "+format(tmp2_3,5); println(SCEOUTPUT,tmp); ); forall(face,tmp1, tmp="f"; forall(tmp1, tmp=tmp+" "+text(#); ); println(SCEOUTPUT,tmp); ); closefile(SCEOUTPUT); setdirectory(Dirwork); ); ); //end of skip ////%VertexEdgeFace start//// //190502 VertexEdgeFace(nm,vfnL):=Vertexedgeface(nm,vfnL,[]); VertexEdgeFace(nm,vfnLorg,optionorg):=Vertexedgeface(nm,vfnLorg,optionorg); ////%VertexEdgeFace end//// ////%Vertexedgeface start//// Vertexedgeface(nm,vfnL):=Vertexedgeface(nm,vfnL,[]); // 16.02.10 Vertexedgeface(nm,vfnLorg,optionorg):=( //help:Vertexedgeface("1",[vL,fnL]); //help:Vertexedgeface("1",["A","B","C"]); //help:Vertexedgeface(options=["Vtx=n(y)" ',"Pt=fix") ,"Edg=n(y)","Label=8(/0)"]); regional(name3,namev,namee,namef,vfnL,options,Noflg,eqL,strL, Lsize,msgflg, Eps,vL,eL,enL,face,edge,vtx,vname,fixflg,vtxflg, edgflg,dispflg,tmp,tmp1,tmp2); Eps=10^(-5); name3="phvef"+nm; namev="phv3d"+nm; namee="phe3d"+nm; namef="phf3d"+nm; options=optionorg; vfnL=vfnLorg; // 16.06.19from if(length(vfnL)>2, vfnL=[vfnL,[1..length(vfnL)]]; ); if(length(vfnL)==1, vfnL=[vfnL_1,[1..length(vfnL_1)]]; ); // 16.06.19until tmp=Divoptions(options); Noflg=tmp_2; eqL=tmp_5; strL=tmp_7; fixflg=1; vtxflg="N"; //180905 edgflg="N"; dispflg=1; //181106 Lsize="8"; //190331 msgflg="Y"; //190506 forall(eqL, tmp=Strsplit(#,"="); tmp1=Toupper(substring(tmp_1,0,1)); tmp2=Toupper(substring(tmp_2,0,1)); if(tmp1=="P", if(tmp2=="F", fixflg=0); options=remove(options,[#]); ); if(tmp1=="V", //180905from vtxflg=tmp2; options=remove(options,[#]); ); //180905to if(tmp1=="E", edgflg=tmp2; options=remove(options,[#]); ); if(tmp1=="L", //190331from Lsize=tmp_2; if(Lsize=="0",dispflg=0); //190502 options=remove(options,[#]); ); //190331to if(tmp1=="M", //190506from msgflg=Toupper(substring(tmp_2,0,1)); options=remove(options,[#]); ); //190506to ); forall(strL, if(Toupper(#)=="FREE", fixflg=0; options=remove(options,[#]); ); ); tmp=select(allpoints(),indexof(#.name,"z")==0); //190506from tmp1=remove(tmp,[SW,NE,TH,FI]); vL=[]; forall(1..length(vfnL_1), vtx=vfnL_1_#; // 16.02.10 from if(isstring(vtx),vtx=parse(vtx)); // 16.06.19 if(ispoint(vtx), tmp=parse(vtx.name+"3d"); //190506 vname=vtx.name; , tmp=select(tmp1,|#.xy-Parapt(vtx)|0, tmp=tmp_1; vname=tmp.name; , vname="V"+nm+text(#); //181212 ); //190506to if(vtxflg=="Y", if(fixflg==1, Putpoint3d([vname,vtx],"fix"); , Putpoint3d([vname,vtx]); ); , tmp=vname+"3d="+format(vtx,6)+";"; //190415 parse(tmp); Defvar(vname+"3d",parse(vname+"3d")); tmp=vname+"2d=Parapt("+vname+"3d);"; //190415 parse(tmp); Defvar(vname+"2d",parse(vname+"2d")); if(dispflg==1, //181106 tmp="drawtext(parse(vname+"+Dqq("2d")+"),vname,size->"; //190331 parse(tmp+Lsize+");"); //190331 draw(parse(vname+"2d"),pointsize->3,color->[0,1,0]); //190128 ); ); //180905to ); vL=append(vL,vname); // 16.02.10 until ); eL=[]; forall(vfnL_2,face, forall(1..length(face), tmp1=face_#; if(#