4

The below MWE draws a certain isosceles triangle:

\documentclass[tikz, border=1cm]{standalone}
\usetikzlibrary{intersections, positioning}

\begin{document}%

\begin{tikzpicture}
\coordinate (A) at (0,0);
\coordinate (B) at (2,0);    
\path[name path=AC] (A)--++(80:6cm);
\path[name path=BC] (B)--++(100:6cm);
\path[name intersections={of=AC and BC, by=C}];
\draw (A)--(B)--(C)--cycle;
\end{tikzpicture}

\end{document}

enter image description here

However, if the named paths are not extended long enough, for example \path[name path=AC] (A)--++(80:1cm); I get an error. Though this is not a problem (that one just enters an arbitrary big number), is there a way (a notation perhaps, or whatever) to tell Tikz that the paths are intersecting (even if the defined path is not long enough)?

2

There is a syntax that still works for the intersection of two lines. It is no longer documented since version 3 of TikZ, but you will find its syntax in the old manuals version 1 and 2.

Its interest is that the intersection is found even if the segments are not intersecting, it is enough that the lines carrying them are not parallel.

It does not need any TikZ library to be used.

screenshot

\documentclass[tikz, border=1cm]{standalone}

\begin{document}%

\begin{tikzpicture}
\coordinate (A) at (0,0);
\coordinate (B) at (2,0);    
\path(A)--++(80:6cm)coordinate(u);
\path(B)--++(100:6cm)coordinate(v);
%\path[name intersections={of=AC and BC, by=C}];
\draw (A)--(B)--(intersection of A--u and B--v)--cycle;
\end{tikzpicture}

\end{document}
| improve this answer | |
1

Yes, you can, at least when the intersecting curves are lines. The idea is to use intersection in a let ... in action. I saw this construction in AndréC answer Drawing a circle through 3 non-collinear points.

I consider that two lines are given through a point and a vector for each---A and v for the first and B and w for the second. We need their meeting point C.

\documentclass[tikz, border=1cm]{standalone}
\usetikzlibrary{calc, intersections}

\begin{document}

\begin{tikzpicture}[every node/.style={scale=.8}]
  % points and directions
  \path
  (0, 0) coordinate (A) (80:1) coordinate (v)
  (2, 0) coordinate (B) (100:1) coordinate (w);

  % intersection point
  \path let
  \p1 = (A),
  \p2 = ($(A)+(v)$),
  \p3 = (B),
  \p4 = ($(B)+(w)$),
  \p5 = (intersection of \p1--\p2 and \p3--\p4)
  in
  (\p5) coordinate (C);
  
  \draw (A) -- (B) -- (C) -- cycle;

  \draw[blue, very thick, ->] (A) -- +(v) node[above left] {$v$};
  \draw[blue, very thick, ->] (B) -- +(w) node[above right] {$w$};
  
  \foreach \P/\pos in {A/below left, B/below right, C/above left}{%
    \draw[fill=white] (\P) circle (1.2pt) node[\pos] {$\P$};
  }
\end{tikzpicture}
\end{document}

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.