| 1 |
% Copyright 2022 by Qrrbrbirlbel |
| 2 |
% |
| 3 |
% This file may be distributed and/or modified |
| 4 |
% |
| 5 |
% 1. under the LaTeX Project Public License and/or |
| 6 |
% 2. under the GNU Free Documentation License. |
| 7 |
% |
| 8 |
\unless\ifcsname tikzextset\endcsname |
| 9 |
\input tikzext-util.tex |
| 10 |
\fi |
| 11 |
|
| 12 |
\tikzextset{ |
| 13 |
arc through/.unknown/.code=\pgfkeyssetevalue{/tikz/ext/arc through/through}{\pgfkeyscurrentname}, |
| 14 |
arc through/through/.initial={(0,0)}, |
| 15 |
arc through/center suffix/.initial=, |
| 16 |
arc through/clockwise/.code=% |
| 17 |
\def\tikz@arcthrough@clockwise{% |
| 18 |
\pgfmathsubtract@{\pgfkeysvalueof{/tikz/end angle}}{360}% |
| 19 |
\pgfkeyssetevalue{/tikz/end angle}{+\pgfmathresult}}, |
| 20 |
arc through/counter clockwise/.code=\let\tikz@arcthrough@clockwise\relax, |
| 21 |
arc through/clockwise/.value forbidden, |
| 22 |
arc through/counter clockwise/.value forbidden, |
| 23 |
arc through/counter clockwise, |
| 24 |
arc through/.code={% \tikzset{every arc/.try,ext/every arc to/.try,ext/arc to/.expand once=\tikzext@arcto@options@}% |
| 25 |
\tikzset{ext/every arc through/.try}% |
| 26 |
\pgfqkeys{/tikz/ext/arc through}{#1}% |
| 27 |
\pgfkeysgetvalue{/tikz/ext/arc through/through}\tikz@temp |
| 28 |
\pgfextract@process\pgf@tostart{\tikz@scan@one@point\pgfutil@firstofone(\tikztostart)\relax}% |
| 29 |
\expandafter\pgfextract@process\expandafter\pgf@tothrough\expandafter |
| 30 |
{\expandafter\tikz@scan@one@point\expandafter\pgfutil@firstofone\tikz@temp\relax}% |
| 31 |
\pgfextract@process\pgf@totarget{\tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)\relax}% |
| 32 |
\pgfextract@process\pgf@topointMidA{\pgfpointlineattime{.5}{\pgf@tostart}{\pgf@tothrough}}% |
| 33 |
\pgfextract@process\pgf@topointMidB{\pgfpointlineattime{.5}{\pgf@totarget}{\pgf@tothrough}}% |
| 34 |
\pgfextract@process\pgf@tocenter{% |
| 35 |
\pgfpointintersectionoflines |
| 36 |
{\pgf@topointMidA}{\pgfmathrotatepointaround{\pgf@tothrough}{\pgf@topointMidA}{90}}% |
| 37 |
{\pgf@topointMidB}{\pgfmathrotatepointaround{\pgf@tothrough}{\pgf@topointMidB}{90}}}% |
| 38 |
\pgfcoordinate{arc through center\pgfkeysvalueof{/tikz/ext/arc through/center suffix}}{\pgf@tocenter}% |
| 39 |
\pgfpointdiff{\pgf@tocenter}{\pgf@tostart}% |
| 40 |
\pgfmathveclen@{\pgfmath@tonumber\pgf@x}{\pgfmath@tonumber\pgf@y}% |
| 41 |
\pgfkeyssetevalue{/tikz/x radius}{+\pgfmathresult pt}% |
| 42 |
\pgfkeyssetevalue{/tikz/y radius}{+\pgfmathresult pt}% |
| 43 |
\pgfmathanglebetweenpoints{\pgf@tocenter}{\pgf@totarget}% |
| 44 |
\pgfkeyssetevalue{/tikz/end angle}{+\pgfmathresult}% |
| 45 |
\pgfmathanglebetweenpoints{\pgf@tocenter}{\pgf@tostart}% |
| 46 |
\ifdim\pgfmathresult pt>\pgfkeysvalueof{/tikz/end angle}pt\relax |
| 47 |
\pgfmathsubtract@{\pgfmathresult}{360}% |
| 48 |
\fi |
| 49 |
\pgfkeyssetevalue{/tikz/start angle}{+\pgfmathresult}% |
| 50 |
\tikz@arcthrough@clockwise |
| 51 |
\pgfkeyslet{/tikz/delta angle}\pgfutil@empty |
| 52 |
\def\tikz@to@path{arc[]\tikztonodes}% |
| 53 |
}% |
| 54 |
} |
| 55 |
|
| 56 |
%%% Compatibility |
| 57 |
\tikzextset{ |
| 58 |
/tikz-ext/compat/add library={topaths.arcthrough}{pre 0.6}, |
| 59 |
compat/topaths.arcthrough/warn/.append code=% |
| 60 |
\tikzextutil@compatwarning@key{topaths.arcthrough}{pre 0.6}{/tikz/arc through}{/tikz/ext/arc through}, |
| 61 |
compat/topaths.arcthrough/pre 0.6/.append code=% |
| 62 |
\pgfkeysdef{/tikz/arc through}{\pgfkeysvalueof{/tikz/ext/arc through/.@cmd}##1\pgfeov}, |
| 63 |
compat/topaths.arcthrough/\pgfkeysvalueof{/tikz/ext/compat/topaths.arcthrough}% |
| 64 |
} |
| 65 |
\endinput |