I'm having some problems with my figure: I want the thick arrows (labeled epsilon+ and epsilon-) to extend all the way to the intersections they are pointing towards.
If I change the line length in the "intersection of" statement like:
(intersection of 100:2--+10:100 and 30:2--+120:100)
i.e. 100 instead of 4, the arrows get longer, but still not all the way there…
What explains this behaviour? Is it caused by the relative coordinates specifying the lines?
Do lines have to actually intersect to specify a coordinate using the "intersection of" or are they extended as needed to perform the calculation? (In my case, they are, but just wondering)
This is my first figure made with TikZ, and all input is appreciated. I'm thinking of resorting to using GeoGebra and exporting as TikZ or PDF, but I haven't quite given in yet.
Kind regards,
Snorre Olsen
\documentclass[•]{article}
\usepackage{tikz}
\usepackage{amsmath}
\begin{document}
\begin{tikzpicture}[scale=1]
\tikzstyle weak=[gray, very thin, text=black]
% Direction arrows
\draw[->] (0,0) -- (210:6) node[below] {To base station B};
\draw[->] (0,0) -- (280:4) node[below] {To base station A};
\draw (210:0.5) arc(210:280:0.5) node[midway, below] {$\gamma$};
% Shifted versions of LoP's
\draw[weak] (0,0) -- node[left] {$\Delta_\text{A+}$} (100:2) +(190:4) -- +(10:4) node[right] {LoP$_\text{A+}$};
\draw[weak] (0,0) -- node[below right] {$\Delta_\text{B+}$} (30:2)
+(120:4) -- +(300:4) node[below] {LoP$_\text{B+}$};
\draw[weak] (0,0) -- node[right, black] {$\Delta_\text{A-}$}(280:2)
+(190:4) -- +(10:4) node[right] {LoP$_\text{A-}$};
% Resulting error vectors
\draw[->,thick] (0,0) -- node[above left] {$\epsilon_+$}(intersection of 100:2--+10:4 and 30:2--+120:4);
\draw[->,thick] (0,0) -- node[below] {$\epsilon_-$}(intersection of 280:2--+10:4 and 30:2--+300:4);
\end{tikzpicture}
\end{document}
Best Answer
If you add the
intersections
library you can give name to paths withname path
, and usename intersections={of=pathA and pathB}
to create coordinates at the intersections calledintersection-N
.Because all the lines start in (0,0), this will be the first intersection (
intersection-1
), while the second intersection (intersection-2
) is the one you want.As for why your code didn't work, I don't really know. However, the
(intersections of A--B and C--D)
syntax isn't mentioned at all in the manual for PGF/TikZ 3.0, leading me to think/guess that it is deprecated in favour of theintersections
library. That it still works is probably a remnant of code for PGF2.1, probably kept to maintain backward compatibility, and that there is something wrong with it. I'm just speculating though.Finally, I think it is recommended using
\tikzset{stylename/.style={options}}
, rather than\tikzstyle{stylename}=[options]
(Should \tikzset or \tikzstyle be used to define TikZ styles?). In your case you could add the style definition to thetikzpicture
options, as it only applies for that one picture anyway.