想象一下你画两条线如下:
现在想象一下,你想在红线上画出蓝线的交叉点。你可以写和我一样的代码:
\documentclass[a4paper,12pt]{article}
\usepackage[a4paper, margin=2cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[]{circuitikzgit}
\usetikzlibrary{intersections}
\newlength{\crossing}
\makeatletter
\setlength{\crossing}{\ctikzvalof{bipoles/crossing/size}\pgf@circ@Rlen}
\makeatother
\begin{document}
\begin{circuitikz}
\draw [name path = one, color=red] (0,-1) |- (0.5,0.5) |- (1,-1);
\draw [name path = two, color=blue] (-0.5,0) -- (1.5,0);
\path[name intersections={of=one and two,by=i}];
\fill[color=white] (i) circle[radius=0.5\crossing];
\draw (i) node[jump crossing]{};
\end{circuitikz}
\end{document}
忘记蓝色和红色吧我画这样的线条只是为了向你展示线条是如何布置的。
我如何让蓝线跳到每一个与红线或者其他线的交叉口?
答案1
该intersections
库允许您找出有多少个交叉点并可以循环遍历它们,请参阅 pgfmanual v3.1.5 的第 145 页:
我在这里所做的就是将其应用到您的示例中。
\documentclass[a4paper,12pt]{article}
\usepackage[a4paper, margin=2cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[]{circuitikzgit}
\usetikzlibrary{intersections}
\newlength{\crossing}
\makeatletter
\setlength{\crossing}{\ctikzvalof{bipoles/crossing/size}\pgf@circ@Rlen}
\makeatother
\begin{document}
\begin{circuitikz}
\draw [name path = one, color=red] (0,-1) |- (0.5,0.5) |- (1,-1);
\draw [name path = two, color=blue] (-0.5,0) -- (1.5,0);
\path[name intersections={of=one and two,name=i,total=\t},fill=white]
foreach \X in {1,...,\t} {(i-\X) circle[radius=0.5\crossing]
(i-\X) node[jump crossing]{}};
\end{circuitikz}
\end{document}