问题多路口

问题多路口
\documentclass{book}
\usepackage{tikz}
\usetikzlibrary{intersections}
\usetikzlibrary{calc}

\begin{document}

\begin{tikzpicture}
\draw[dotted](-10,-5) grid (5,5);
\path(0,0) node{0};
\draw(-10,0)--(5,0);
\coordinate(I')at(-2,2);
\coordinate(F'1)at(4,0);
\coordinate(F2)at(-3,0);
\draw[name path=D2](0,-5)--(0,5);
\draw(-9,2)--(I') node {};
\draw[name path=1'](I')--(F'1) node {};
\fill[red,name intersections={of=1' and D2,by={U'}}](intersection-1) circle(2pt);
\draw[shorten <=-5.5cm,name path=2'](F2)--+($(I')-(F'1)$) node {Y};
%so far so good, the intersection is at the right location (0,1.3)
\fill[green,name intersections={of=2' and D2,by={X}}](intersection-1) circle (1pt);
%here is the problem : the green circle is also located where the red circle (first intersection) is instead of (0,-1)
\end{tikzpicture}
\end{document}

答案1

2'的扩展不是命名路径的一部分。因此和shorten <-5.5cm之间没有交集。2'D2

你必须将你的路径改为2'类似

\draw[name path=2']($(F2)+(I')-(F'1)$) node{Y}--(F2)--([turn=0]0:5.5cm);

或者

\draw[name path=2']($(F2)+(I')-(F'1)$) node(Y) {Y}--($(F2)!-5.5cm!(Y)$);

在此处输入图片描述

代码:

\documentclass{book}
\usepackage{tikz}
\usetikzlibrary{intersections}
\usetikzlibrary{calc}

\begin{document}
\begin{tikzpicture}
\draw[dotted](-10,-5) grid (5,5);
\path(0,0) node{0};
\draw(-10,0)--(5,0);
\coordinate(I')at(-2,2);
\coordinate(F'1)at(4,0);
\coordinate(F2)at(-3,0);
\draw[name path=D2](0,-5)--(0,5);
\draw(-9,2)--(I') node {};
\draw[name path=1'](I')--(F'1) node {};
\fill[red,name intersections={of=1' and D2,by={U'}}](U') circle[radius=1pt];
\draw[name path=2']($(F2)+(I')-(F'1)$) node{Y}--(F2)--([turn=0]0:5.5cm);
%so far so good, the intersection is at the right location (0,1.3)
\fill[green,name intersections={of=2' and D2,by={X}}](X) circle [radius=1pt];
%here is the problem : the green circle is also located where the red circle (first intersection) is instead of (0,-1)
\end{tikzpicture}
\end{document}

请注意,我使用了您明确定义的名称U'和。Xintersection-1

相关内容