To get intersection points of help lines and a line, I wrote the following code.
\documentclass[margin=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,intersections}
\begin{document}
\begin{tikzpicture}
\path [draw,help lines,name path=grid] (0,0) grid (3,2);
\path [draw,name path=line] (8mm,4mm) --++ (45:2cm);
\path [name intersections={of=grid and line, by={A,B,C}}];
\draw [fill=blue!50](C)--(A)--(2,1)--cycle;
\filldraw (A)circle (0.75pt)node [below]{A};
\filldraw (B)circle (0.75pt)node [left]{B};
\filldraw (C)circle (0.75pt)node [right]{C};
\end{tikzpicture}
\end{document}
As you seen in my code, the sequence of the intersection points are {A, B, C}. But the sequence on the output is {B,A,C}.
How do I change the locations of A and B, for expected sequence?
bend left=0, i.e. pretend this is a curve, see https://tex.stackexchange.com/a/418650/121799. Would you agree that this is a duplicate of https://tex.stackexchange.com/q/418644/121799 ? E.g.\path [draw,name path=line] (8mm,4mm) to[bend left=0]++ (45:2cm); \path [name intersections={of=grid and line,sort by=line, by={A,B,C}}];works (note alsosort by.) – May 31 '19 at 22:22\documentclass[tikz,border=3.14mm]{standalone} \usetikzlibrary{positioning,intersections} \begin{document} \begin{tikzpicture} \path [draw,help lines,name path=grid] (0,0) grid (3,2); \path [draw,name path=line] (8mm,4mm) to[bend left=0]++ (45:2cm); \path [name intersections={of=grid and line,sort by=line, by={A,B,C}}]; \draw [fill=blue!50](C)--(A)--(2,1)--cycle; \filldraw foreach \X in {A,B,C} {(\X) circle (0.75pt)node [below]{\X}}; \end{tikzpicture} \end{document}– May 31 '19 at 22:26