% Copyright 2021 by marmotghost % v0.1 % % This file may be distributed and/or modified under the % LaTeX project public license (LPPL), version 1.3c % see % https://www.latex-project.org/lppl/lppl-1-3c/ \usepgflibrary{fpu} \global\let\pgf@bbox@lt@curveto@normal\pgf@lt@curveto \global\let\pgf@bbox@nlt@curveto@normal\pgf@nlt@curveto \pgfqkeys{/pgf}{bezier bounding box/.is if=pgf@bbox@switch@} \def\pgf@bbox@switch@false{% \let\pgf@lt@curveto \pgf@bbox@lt@curveto@normal \let\pgf@nlt@curveto\pgf@bbox@nlt@curveto@normal } \def\pgf@bbox@switch@true{% \let\pgf@lt@curveto \pgf@bbox@curveto \let\pgf@nlt@curveto\pgf@bbox@curveto } \def\pgf@bbox@curveto#1#2#3#4#5#6{% \begingroup \pgfkeys{/pgf/fpu,/pgf/fpu/output format=fixed}% % extrema in x % first discriminant d1, must be \ne 0 \pgfmathsetmacro{\pgf@temp@a}{(\pgf@path@lastx)-(#5)-3*(#1)+3*(#3)}% \pgfmathtruncatemacro{\pgf@temp@c}{(abs(\pgf@temp@a)>0.1?1:0)}% \ifnum\pgf@temp@c=1\relax % second discriminant d2, must be \ge 0 \pgfmathsetmacro{\pgf@temp@b}{(\pgf@path@lastx)*(#5)-(#5)*(#1)+(#1)*(#1)-(\pgf@path@lastx)*(#3)-(#1)*(#3)+(#3)*(#3)}% \pgfmathtruncatemacro{\pgf@temp@c}{sign(\pgf@temp@b)}% \ifnum\pgf@temp@c<0 \else \pgfmathsetmacro{\pgf@temp@b}{sqrt(abs(\pgf@temp@b))}% \pgfmathsetmacro{\pgf@temp@c}{max(0,min(1,((\pgf@path@lastx)-2*(#1)+(#3)-\pgf@temp@b)/\pgf@temp@a))}% \pgfmathparse{(\pgf@path@lastx)*pow((1-\pgf@temp@c),3)+3*(#1)*pow((1-\pgf@temp@c),2)*\pgf@temp@c+3*(#3)*(1-\pgf@temp@c)*\pgf@temp@c*\pgf@temp@c+(#5)*\pgf@temp@c*\pgf@temp@c*\pgf@temp@c}% \pgfutil@tempdimb=\pgfmathresult pt\relax% \pgf@protocolsizes{\pgfutil@tempdimb}{\pgf@path@lasty}% \pgfmathsetmacro{\pgf@temp@c}{max(0,min(1,((\pgf@path@lastx)-2*(#1)+(#3)+\pgf@temp@b)/\pgf@temp@a))}% \pgfmathparse{(\pgf@path@lastx)*pow((1-\pgf@temp@c),3)+3*(#1)*pow((1-\pgf@temp@c),2)*\pgf@temp@c+3*(#3)*(1-\pgf@temp@c)*\pgf@temp@c*\pgf@temp@c+(#5)*\pgf@temp@c*\pgf@temp@c*\pgf@temp@c}% \pgfutil@tempdimb=\pgfmathresult pt\relax% \pgf@protocolsizes{\pgfutil@tempdimb}{\pgf@path@lasty}% \fi \else % third discriminant d3, must be \ne 0 \pgfmathsetmacro{\pgf@temp@b}{abs((#5)+(#1)-2*(#3))}% \pgfmathtruncatemacro{\pgf@temp@c}{(abs(\pgf@temp@b)>0.1?1:0)}% \ifnum\pgf@temp@c=1\relax \pgfmathsetmacro{\pgf@temp@c}{((#5)+2*(#1)-3*(#3))/((#5)+(#1)-2*(#3))}% \pgfmathparse{(\pgf@path@lastx)*pow((1-\pgf@temp@c),3)+3*(#1)*pow((1-\pgf@temp@c),2)*\pgf@temp@c+3*(#3)*(1-\pgf@temp@c)*\pgf@temp@c*\pgf@temp@c+(#5)*\pgf@temp@c*\pgf@temp@c*\pgf@temp@c}% \pgfutil@tempdimb=\pgfmathresult pt\relax% \pgf@protocolsizes{\pgfutil@tempdimb}{\pgf@path@lasty}% \fi \fi % 0/0 \pgfmathsetmacro{\pgf@temp@a}{(#5)+(#1)-2*(#3)}% \pgfmathtruncatemacro{\pgf@temp@b}{(abs(\pgf@temp@a)>0.1?1:0)}% \ifnum\pgf@temp@b=1\relax \pgfmathsetmacro{\pgf@temp@c}{max(0,min(1,((#5)+2*(#1)-3*(#3))/(2*\pgf@temp@a)))}% \else \pgfmathsetmacro{\pgf@temp@c}{0.5}% \fi \pgfmathparse{(\pgf@path@lastx)*pow((1-\pgf@temp@c),3)+3*(#1)*pow((1-\pgf@temp@c),2)*\pgf@temp@c+3*(#3)*(1-\pgf@temp@c)*\pgf@temp@c*\pgf@temp@c+(#5)*\pgf@temp@c*\pgf@temp@c*\pgf@temp@c}% \pgfutil@tempdimb=\pgfmathresult pt\relax% \pgf@protocolsizes{\pgfutil@tempdimb}{\pgf@path@lasty}% % % y code % first discriminant d1, must be \ne 0 \pgfmathsetmacro{\pgf@temp@a}{(\pgf@path@lasty)-(#6)-3*(#2)+3*(#4)}% \pgfmathtruncatemacro{\pgf@temp@c}{(abs(\pgf@temp@a)>0.1?1:0)}% \ifnum\pgf@temp@c=1\relax % second discriminant d2, must be \ge 0 \pgfmathsetmacro{\pgf@temp@b}{(\pgf@path@lasty)*(#6)-(#6)*(#2)+(#2)*(#2)-(\pgf@path@lasty)*(#4)-(#2)*(#4)+(#4)*(#4)}% \pgfmathtruncatemacro{\pgf@temp@c}{sign(\pgf@temp@b)}% \ifnum\pgf@temp@c<0 \else \pgfmathsetmacro{\pgf@temp@b}{sqrt(abs(\pgf@temp@b))}% \pgfmathsetmacro{\pgf@temp@c}{max(0,min(1,((\pgf@path@lasty)-2*(#2)+(#4)-\pgf@temp@b)/\pgf@temp@a))}% \pgfmathparse{(\pgf@path@lasty)*pow((1-\pgf@temp@c),3)+3*(#2)*pow((1-\pgf@temp@c),2)*\pgf@temp@c+3*(#4)*(1-\pgf@temp@c)*\pgf@temp@c*\pgf@temp@c+(#6)*\pgf@temp@c*\pgf@temp@c*\pgf@temp@c}% \pgfutil@tempdimb=\pgfmathresult pt\relax% \pgf@protocolsizes{\pgf@path@lastx}{\pgfutil@tempdimb}% \pgfmathsetmacro{\pgf@temp@c}{max(0,min(1,((\pgf@path@lasty)-2*(#2)+(#4)+\pgf@temp@b)/\pgf@temp@a))}% \pgfmathparse{(\pgf@path@lasty)*pow((1-\pgf@temp@c),3)+3*(#2)*pow((1-\pgf@temp@c),2)*\pgf@temp@c+3*(#4)*(1-\pgf@temp@c)*\pgf@temp@c*\pgf@temp@c+(#6)*\pgf@temp@c*\pgf@temp@c*\pgf@temp@c}% \pgfutil@tempdimb=\pgfmathresult pt\relax% \pgf@protocolsizes{\pgf@path@lastx}{\pgfutil@tempdimb}% \fi \else % third discriminant d3, must be \ne 0 \pgfmathsetmacro{\pgf@temp@b}{abs((#6)+(#2)-2*(#4))}% \pgfmathtruncatemacro{\pgf@temp@c}{(abs(\pgf@temp@b)>0.1?1:0)}% \ifnum\pgf@temp@c=1\relax \pgfmathsetmacro{\pgf@temp@c}{((#6)+2*(#2)-3*(#4))/((#6)+(#2)-2*(#4))}% \pgfmathparse{(\pgf@path@lasty)*pow((1-\pgf@temp@c),3)+3*(#2)*pow((1-\pgf@temp@c),2)*\pgf@temp@c+3*(#4)*(1-\pgf@temp@c)*\pgf@temp@c*\pgf@temp@c+(#6)*\pgf@temp@c*\pgf@temp@c*\pgf@temp@c}% \pgfutil@tempdimb=\pgfmathresult pt\relax% \pgf@protocolsizes{\pgf@path@lastx}{\pgfutil@tempdimb}% \fi \fi % 0/0 \pgfmathsetmacro{\pgf@temp@a}{(#6)+(#2)-2*(#4)}% \pgfmathtruncatemacro{\pgf@temp@b}{(abs(\pgf@temp@a)>0.1?1:0)}% \ifnum\pgf@temp@b=1\relax \pgfmathsetmacro{\pgf@temp@c}{max(0,min(1,((#6)+2*(#2)-3*(#4))/(2*\pgf@temp@a)))}% \else \pgfmathsetmacro{\pgf@temp@c}{0.5}% \fi \pgfmathparse{(\pgf@path@lasty)*pow((1-\pgf@temp@c),3)+3*(#2)*pow((1-\pgf@temp@c),2)*\pgf@temp@c+3*(#4)*(1-\pgf@temp@c)*\pgf@temp@c*\pgf@temp@c+(#6)*\pgf@temp@c*\pgf@temp@c*\pgf@temp@c}% \pgfutil@tempdimb=\pgfmathresult pt\relax% \pgf@protocolsizes{\pgf@path@lastx}{\pgfutil@tempdimb}% % \pgf@protocolsizes{\pgf@path@lastx}{\pgf@path@lasty}% \pgf@protocolsizes{#5}{#6}% \endgroup \pgfsyssoftpath@curveto{\the#1}{\the#2}{\the#3}{\the#4}{\the#5}{\the#6}% } \endinput