From 138f77fe71e43adc24ecb030d73df81cc5c4eb7e Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 4 Sep 2017 09:45:51 +0900 Subject: add ketpic --- .../ketpic/ketlib/ketpicscifiles6/MeetWindow.sci | 91 ++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100755 texmf-dist/scripts/ketpic/ketlib/ketpicscifiles6/MeetWindow.sci (limited to 'texmf-dist/scripts/ketpic/ketlib/ketpicscifiles6/MeetWindow.sci') diff --git a/texmf-dist/scripts/ketpic/ketlib/ketpicscifiles6/MeetWindow.sci b/texmf-dist/scripts/ketpic/ketlib/ketpicscifiles6/MeetWindow.sci new file mode 100755 index 00000000..65f543ea --- /dev/null +++ b/texmf-dist/scripts/ketpic/ketlib/ketpicscifiles6/MeetWindow.sci @@ -0,0 +1,91 @@ +// +// 08.05.30 debugged +// 08.08.14 (horner) +// 09.12.31 (gsort) +// 15.10.23 ( horner not used ) +// 16.12.29 (msprintf("%3.10f",..) used ) + +function R=MeetWindow(PA,PB) + global XMIN XMAX YMIN YMAX + if InWindow(PA)=='i' & InWindow(PB)=='i' + R=[PA;PB]; + return + end; + Eps=10.0^(-6); + t=poly(0,'T'); + PT="(1-(t))*PA+(t)*PB"; + Txm=-1; TxM=-1; Tym=-1; TyM=-1; + if PA(1)~=PB(1) + Txm=(XMIN-PA(1))/(PB(1)-PA(1)); + TxM=(XMAX-PA(1))/(PB(1)-PA(1)); + end + if PA(2)~=PB(2) + Tym=(YMIN-PA(2))/(PB(2)-PA(2)); + TyM=(YMAX-PA(2))/(PB(2)-PA(2)); + end; +// Tmp=horner(PT(2),Txm); + Tmp1=strsubst(PT,"t",msprintf("%3.10f",Txm)); + Tmp1=evstr(Tmp1) + Tmp=Tmp1(2); + if TmpYMAX+Eps + Txm=-1; + end +// Tmp=horner(PT(2),TxM); + Tmp1=strsubst(PT,"t",msprintf("%3.10f",TxM)); + Tmp1=evstr(Tmp1) + Tmp=Tmp1(2); + if TmpYMAX+Eps + TxM=-1 + end +// Tmp=horner(PT(1),Tym); + Tmp1=strsubst(PT,"t",msprintf("%3.10f",Tym)); + Tmp1=evstr(Tmp1) + Tmp=Tmp1(1); + if TmpXMAX+Eps + Tym=-1 + end +// Tmp=horner(PT(1),TyM); + Tmp1=strsubst(PT,"t",msprintf("%3.10f",TyM)); + Tmp1=evstr(Tmp1) + Tmp=Tmp1(1); + if TmpXMAX+Eps + TyM=-1 + end + Tmp=gsort([Txm,TxM,Tym,TyM]); + Tans=Tmp(length(Tmp):-1:1); + Tmp=[]; + for I=1:length(Tans) + Tmp1=Tans(I); + if Tmp1>-Eps & Tmp1<1+Eps + if length(Tmp)==0 + Tmp=[Tmp1]; + elseif abs(Tmp(length(Tmp))-Tmp1)>Eps + Tmp=[Tmp,Tmp1] + end + end + end + Tans=Tmp; + if length(Tans)==0 + R=[]; + return; + end + if length(Tans)==1 +// Ten1=horner(PT,Tans(1)); + Tmp1=strsubst(PT,"t",string(Tans(1))); + Ten1=evstr(Tmp1) + if InWindow(PA)=='i' + R=[PA;Ten1]; + return; + else + R=[Ten1;PB]; + return + end + end +// Ten1=horner(PT,Tans(1)); + Tmp1=strsubst(PT,"t",string(Tans(1))); + Ten1=evstr(Tmp1) +// Ten2=horner(PT,Tans(2)); + Tmp1=strsubst(PT,"t",string(Tans(2))); + Ten2=evstr(Tmp1) + R=[Ten1;Ten2]; +endfunction -- cgit v1.2.3