Created
June 15, 2019 04:16
-
-
Save kalakay/1e1b641540e9e7c91034c050a2c7c541 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\makeatletter | |
\tikzset{ | |
@arc through/.style 2 args={ | |
to path={ | |
\pgfextra | |
\pgfextract@process\pgf@tostart{\tikz@scan@one@point\pgfutil@firstofone(\tikztostart)\relax}% | |
\pgfextract@process\pgf@tothrough{\tikz@scan@one@point\pgfutil@firstofone#1}% | |
\pgfextract@process\pgf@totarget{\tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)\relax}% | |
\pgfextract@process\pgf@topointMidA{\pgfpointlineattime{.5}{\pgf@tostart}{\pgf@tothrough}}% | |
\pgfextract@process\pgf@topointMidB{\pgfpointlineattime{.5}{\pgf@totarget}{\pgf@tothrough}}% | |
\pgfextract@process\pgf@tocenter{% | |
\pgfpointintersectionoflines{\pgf@topointMidA} | |
{\pgfmathrotatepointaround{\pgf@tothrough}{\pgf@topointMidA}{90}} | |
{\pgf@topointMidB}{\pgfmathrotatepointaround{\pgf@tothrough}{\pgf@topointMidB}{90}}}% | |
\pgfcoordinate{arc through center}{\pgf@tocenter}% | |
\pgfpointdiff{\pgf@tocenter}{\pgf@tostart}% | |
\pgfmathveclen@{\pgfmath@tonumber\pgf@x}{\pgfmath@tonumber\pgf@y}% | |
\edef\pgf@toradius{\pgfmathresult pt} | |
\pgfmathanglebetweenpoints{\pgf@tocenter}{\pgf@tostart}% | |
\let\pgf@tostartangle\pgfmathresult | |
\pgfmathanglebetweenpoints{\pgf@tocenter}{\pgf@totarget}% | |
\let\pgf@toendangle\pgfmathresult | |
\ifdim\pgf@tostartangle pt>\pgf@toendangle pt\relax | |
\pgfmathsetmacro\pgf@tostartangle{\pgf@tostartangle-360}% | |
\fi | |
#2% | |
\pgfmathsetmacro\pgf@toendangle{\pgf@toendangle-360}% | |
\fi | |
\endpgfextra | |
arc [radius=+\pgf@toradius, start angle=\pgf@tostartangle, end angle=\pgf@toendangle] \tikztonodes | |
}}, | |
arc through ccw/.style={@arc through={#1}{\iffalse}}, | |
arc through cw/.style={@arc through={#1}{\iftrue}}, | |
} | |
\makeatother |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment