Line passing through a point and parallel to another: Where am I wrong?












2














documentclass{standalone}
usepackage{tikz}
usetikzlibrary{intersections}
usetikzlibrary{calc}
begin{document}

begin{tikzpicture}

coordinate (A) at (0,0);
coordinate (B) at (2,4);
coordinate (C) at (8,0);
coordinate (M) at (4,0);

path[name path=Circle] (B) circle [radius=3cm];
path[name path=AB] (A)--(B);
path[name path=BC] (B)--(C);
path [name intersections={of=Circle and BC}];
coordinate (E) at (intersection-1);
path [name intersections={of=Circle and AB}];
coordinate (D) at (intersection-1);

draw[thick](A)--(B)--(C)--cycle;
draw[thick](B) circle [radius=3cm];
draw[thick](D)--(E) (M)--(B);

% From a point draw a parallel line by calculating the vector
coordinate (P) at (intersection cs:first line={(B)--(C)}, second line={(A) -- +($(E)-(D)$)});

% Here is my problem:
coordinate (N) at (intersection cs:first line={(B)--(M)}, second line={(C) -- +($(D)-(E)$)});

draw[thick, red] (A)--(P) (C)--(N);

end{tikzpicture}
end{document}


Question: The second drawn line, which is supposed to also be a parallel, is not. What am I doing wrong?



enter image description here










share|improve this question



























    2














    documentclass{standalone}
    usepackage{tikz}
    usetikzlibrary{intersections}
    usetikzlibrary{calc}
    begin{document}

    begin{tikzpicture}

    coordinate (A) at (0,0);
    coordinate (B) at (2,4);
    coordinate (C) at (8,0);
    coordinate (M) at (4,0);

    path[name path=Circle] (B) circle [radius=3cm];
    path[name path=AB] (A)--(B);
    path[name path=BC] (B)--(C);
    path [name intersections={of=Circle and BC}];
    coordinate (E) at (intersection-1);
    path [name intersections={of=Circle and AB}];
    coordinate (D) at (intersection-1);

    draw[thick](A)--(B)--(C)--cycle;
    draw[thick](B) circle [radius=3cm];
    draw[thick](D)--(E) (M)--(B);

    % From a point draw a parallel line by calculating the vector
    coordinate (P) at (intersection cs:first line={(B)--(C)}, second line={(A) -- +($(E)-(D)$)});

    % Here is my problem:
    coordinate (N) at (intersection cs:first line={(B)--(M)}, second line={(C) -- +($(D)-(E)$)});

    draw[thick, red] (A)--(P) (C)--(N);

    end{tikzpicture}
    end{document}


    Question: The second drawn line, which is supposed to also be a parallel, is not. What am I doing wrong?



    enter image description here










    share|improve this question

























      2












      2








      2







      documentclass{standalone}
      usepackage{tikz}
      usetikzlibrary{intersections}
      usetikzlibrary{calc}
      begin{document}

      begin{tikzpicture}

      coordinate (A) at (0,0);
      coordinate (B) at (2,4);
      coordinate (C) at (8,0);
      coordinate (M) at (4,0);

      path[name path=Circle] (B) circle [radius=3cm];
      path[name path=AB] (A)--(B);
      path[name path=BC] (B)--(C);
      path [name intersections={of=Circle and BC}];
      coordinate (E) at (intersection-1);
      path [name intersections={of=Circle and AB}];
      coordinate (D) at (intersection-1);

      draw[thick](A)--(B)--(C)--cycle;
      draw[thick](B) circle [radius=3cm];
      draw[thick](D)--(E) (M)--(B);

      % From a point draw a parallel line by calculating the vector
      coordinate (P) at (intersection cs:first line={(B)--(C)}, second line={(A) -- +($(E)-(D)$)});

      % Here is my problem:
      coordinate (N) at (intersection cs:first line={(B)--(M)}, second line={(C) -- +($(D)-(E)$)});

      draw[thick, red] (A)--(P) (C)--(N);

      end{tikzpicture}
      end{document}


      Question: The second drawn line, which is supposed to also be a parallel, is not. What am I doing wrong?



      enter image description here










      share|improve this question













      documentclass{standalone}
      usepackage{tikz}
      usetikzlibrary{intersections}
      usetikzlibrary{calc}
      begin{document}

      begin{tikzpicture}

      coordinate (A) at (0,0);
      coordinate (B) at (2,4);
      coordinate (C) at (8,0);
      coordinate (M) at (4,0);

      path[name path=Circle] (B) circle [radius=3cm];
      path[name path=AB] (A)--(B);
      path[name path=BC] (B)--(C);
      path [name intersections={of=Circle and BC}];
      coordinate (E) at (intersection-1);
      path [name intersections={of=Circle and AB}];
      coordinate (D) at (intersection-1);

      draw[thick](A)--(B)--(C)--cycle;
      draw[thick](B) circle [radius=3cm];
      draw[thick](D)--(E) (M)--(B);

      % From a point draw a parallel line by calculating the vector
      coordinate (P) at (intersection cs:first line={(B)--(C)}, second line={(A) -- +($(E)-(D)$)});

      % Here is my problem:
      coordinate (N) at (intersection cs:first line={(B)--(M)}, second line={(C) -- +($(D)-(E)$)});

      draw[thick, red] (A)--(P) (C)--(N);

      end{tikzpicture}
      end{document}


      Question: The second drawn line, which is supposed to also be a parallel, is not. What am I doing wrong?



      enter image description here







      tikz-pgf






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 1 hour ago









      blackened

      1,388713




      1,388713






















          2 Answers
          2






          active

          oldest

          votes


















          2














          If you use the + syntax in this context, it seems not to always give you what one may expect. In general, + means "relative to the first coordinate of this path". But who knows what the first coordinate is in the context of intersection cs:? It is, however, not too difficult to produce the parallel lines just by computing the slope and using it. For the sake of clarity, I labeled all coordinates.



          documentclass{standalone}
          usepackage{tikz}
          usetikzlibrary{intersections}
          usetikzlibrary{calc}
          begin{document}

          begin{tikzpicture}

          coordinate[label=left:$A$] (A) at (0,0);
          coordinate[label=above:$B$] (B) at (2,4);
          coordinate[label=right:$C$] (C) at (8,0);
          coordinate[label=45:$M$] (M) at (4,0);

          draw[name path=Circle] (B) circle [radius=3cm];
          path[name path=AB] (A)--(B);
          path[name path=BC] (B)--(C);
          path [name intersections={of=Circle and BC}];
          coordinate[label=right:$E$] (E) at (intersection-1);
          path [name intersections={of=Circle and AB}];
          coordinate[label=left:$D$] (D) at (intersection-1);

          draw[thick](A)--(B)--(C)--cycle;
          %draw[thick](B) circle [radius=3cm];
          draw[thick](D)--(E) (M)--(B);

          % From a point draw a parallel line by calculating the vector
          path let p1=($(E)-(D)$),n1={atan2(y1,x1)} in
          ($(A)+(n1:1)$) coordinate (auxA)
          ($(C)+(n1:1)$) coordinate (auxC);
          coordinate[label=right:$P$] (P) at (intersection cs:first line={(B)--(C)},
          second line={(A) -- (auxA)});

          % Here is my problem:
          coordinate[label=below:$N$]
          (N) at (intersection cs:first line={(B)--(M)},
          second line={(C) -- (auxC)});

          draw[thick, red] (A)--(P) (C)--(N) ;

          end{tikzpicture}
          end{document}


          enter image description here



          As you see, the red lines are parallel.



          One may want cast this into a style:

          documentclass{standalone}
          usepackage{tikz}
          usetikzlibrary{intersections}
          usetikzlibrary{calc}
          begin{document}
          tikzset{line through/.style args={#1 parallel to line through #2 and #3 and
          length #4}{insert path={%
          let p1=($(#3)-(#2)$),n1={atan2(y1,x1)} in (#1) -- ++ (n1:#4)}}}
          begin{tikzpicture}

          coordinate[label=left:$A$] (A) at (0,0);
          coordinate[label=above:$B$] (B) at (2,4);
          coordinate[label=right:$C$] (C) at (8,0);
          coordinate[label=45:$M$] (M) at (4,0);

          draw[name path=Circle] (B) circle [radius=3cm];
          path[name path=AB] (A)--(B);
          path[name path=BC] (B)--(C);
          path [name intersections={of=Circle and BC}];
          coordinate[label=right:$E$] (E) at (intersection-1);
          path [name intersections={of=Circle and AB}];
          coordinate[label=left:$D$] (D) at (intersection-1);

          draw[thick](A)--(B)--(C)--cycle;
          %draw[thick](B) circle [radius=3cm];
          draw[thick](D)--(E) (M)--(B);

          % From a point draw a parallel line by calculating the vector
          path[line through=A parallel to line through E and D and length 1]
          coordinate (auxA)
          [line through=C parallel to line through E and D and length 1]
          coordinate (auxC);

          coordinate[label=right:$P$] (P) at (intersection cs:first line={(B)--(C)},
          second line={(A) -- (auxA)});

          % Here is my problem:
          coordinate[label=below:$N$]
          (N) at (intersection cs:first line={(B)--(M)},
          second line={(C) -- (auxC)});

          draw[thick, red] (A)--(P) (C)--(N) ;

          end{tikzpicture}
          end{document}





          share|improve this answer























          • Thank you. I was following this answer.
            – blackened
            39 mins ago












          • @blackened Yes, there it is very clear what the first point of the path is. Therefore, it is clear what + does. However, in the context of intersection cs: it is not clear to me where single paths start and end, and hence -- +(coordinate) may not be what one may thing it is. I am sorry if you feel that my wording is offensive, would like to apologize, and change it right away.
            – marmot
            37 mins ago












          • No worries at all. I just assumed that that answer encompassed all cases. How can I turn your approach to a tikz style definition?
            – blackened
            35 mins ago










          • @blackened What precisely do you want the style to accomplish? A line through a given point with the slope coinciding with the one of another line. (And rereading my original post I think my wording did indeed not reflect what I wanted to say.)
            – marmot
            33 mins ago










          • What precisely do you want the style to accomplish? A line through a given point with the slope coinciding with the one of another line. Yes. (From your question, I understand that one may want to accomplish other options. What are they?)
            – blackened
            31 mins ago



















          2














          Use second line={(C)--($(C)+(D)-(E)$)}). The first one works as expected because (A)=(0,0)



          documentclass{article}
          usepackage{tikz}
          usetikzlibrary{intersections}
          usetikzlibrary{calc}
          begin{document}

          begin{tikzpicture}

          coordinate[label=A] (A) at (0,0);
          coordinate[label=B](B) at (2,4);
          coordinate[label=C] (C) at (8,0);
          coordinate[label=M] (M) at (4,0);

          path[name path=Circle] (B) circle [radius=3cm];
          path[name path=AB] (A)--(B);
          path[name path=BC] (B)--(C);
          path [name intersections={of=Circle and BC}];
          coordinate[label=E] (E) at (intersection-1);
          path [name intersections={of=Circle and AB}];
          coordinate[label=D] (D) at (intersection-1);

          draw[thick](A)--(B)--(C)--cycle;
          draw[thick](B) circle [radius=3cm];
          draw[thick](D)--(E) (M)--(B);

          % From a point draw a parallel line by calculating the vector
          coordinate[label=P] (P) at (intersection cs:first line={(B)--(C)}, second line={(A) -- +($(E)-(D)$)});

          % Here is my problem:
          coordinate[label=N] (N) at (intersection cs:first line={(B)--(M)}, second line={(C)--($(C)+(D)-(E)$)}); % <------


          draw[thick, red] (A)--(P) (C)--(N);

          end{tikzpicture}
          end{document}


          enter image description here






          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "85"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f467251%2fline-passing-through-a-point-and-parallel-to-another-where-am-i-wrong%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            If you use the + syntax in this context, it seems not to always give you what one may expect. In general, + means "relative to the first coordinate of this path". But who knows what the first coordinate is in the context of intersection cs:? It is, however, not too difficult to produce the parallel lines just by computing the slope and using it. For the sake of clarity, I labeled all coordinates.



            documentclass{standalone}
            usepackage{tikz}
            usetikzlibrary{intersections}
            usetikzlibrary{calc}
            begin{document}

            begin{tikzpicture}

            coordinate[label=left:$A$] (A) at (0,0);
            coordinate[label=above:$B$] (B) at (2,4);
            coordinate[label=right:$C$] (C) at (8,0);
            coordinate[label=45:$M$] (M) at (4,0);

            draw[name path=Circle] (B) circle [radius=3cm];
            path[name path=AB] (A)--(B);
            path[name path=BC] (B)--(C);
            path [name intersections={of=Circle and BC}];
            coordinate[label=right:$E$] (E) at (intersection-1);
            path [name intersections={of=Circle and AB}];
            coordinate[label=left:$D$] (D) at (intersection-1);

            draw[thick](A)--(B)--(C)--cycle;
            %draw[thick](B) circle [radius=3cm];
            draw[thick](D)--(E) (M)--(B);

            % From a point draw a parallel line by calculating the vector
            path let p1=($(E)-(D)$),n1={atan2(y1,x1)} in
            ($(A)+(n1:1)$) coordinate (auxA)
            ($(C)+(n1:1)$) coordinate (auxC);
            coordinate[label=right:$P$] (P) at (intersection cs:first line={(B)--(C)},
            second line={(A) -- (auxA)});

            % Here is my problem:
            coordinate[label=below:$N$]
            (N) at (intersection cs:first line={(B)--(M)},
            second line={(C) -- (auxC)});

            draw[thick, red] (A)--(P) (C)--(N) ;

            end{tikzpicture}
            end{document}


            enter image description here



            As you see, the red lines are parallel.



            One may want cast this into a style:

            documentclass{standalone}
            usepackage{tikz}
            usetikzlibrary{intersections}
            usetikzlibrary{calc}
            begin{document}
            tikzset{line through/.style args={#1 parallel to line through #2 and #3 and
            length #4}{insert path={%
            let p1=($(#3)-(#2)$),n1={atan2(y1,x1)} in (#1) -- ++ (n1:#4)}}}
            begin{tikzpicture}

            coordinate[label=left:$A$] (A) at (0,0);
            coordinate[label=above:$B$] (B) at (2,4);
            coordinate[label=right:$C$] (C) at (8,0);
            coordinate[label=45:$M$] (M) at (4,0);

            draw[name path=Circle] (B) circle [radius=3cm];
            path[name path=AB] (A)--(B);
            path[name path=BC] (B)--(C);
            path [name intersections={of=Circle and BC}];
            coordinate[label=right:$E$] (E) at (intersection-1);
            path [name intersections={of=Circle and AB}];
            coordinate[label=left:$D$] (D) at (intersection-1);

            draw[thick](A)--(B)--(C)--cycle;
            %draw[thick](B) circle [radius=3cm];
            draw[thick](D)--(E) (M)--(B);

            % From a point draw a parallel line by calculating the vector
            path[line through=A parallel to line through E and D and length 1]
            coordinate (auxA)
            [line through=C parallel to line through E and D and length 1]
            coordinate (auxC);

            coordinate[label=right:$P$] (P) at (intersection cs:first line={(B)--(C)},
            second line={(A) -- (auxA)});

            % Here is my problem:
            coordinate[label=below:$N$]
            (N) at (intersection cs:first line={(B)--(M)},
            second line={(C) -- (auxC)});

            draw[thick, red] (A)--(P) (C)--(N) ;

            end{tikzpicture}
            end{document}





            share|improve this answer























            • Thank you. I was following this answer.
              – blackened
              39 mins ago












            • @blackened Yes, there it is very clear what the first point of the path is. Therefore, it is clear what + does. However, in the context of intersection cs: it is not clear to me where single paths start and end, and hence -- +(coordinate) may not be what one may thing it is. I am sorry if you feel that my wording is offensive, would like to apologize, and change it right away.
              – marmot
              37 mins ago












            • No worries at all. I just assumed that that answer encompassed all cases. How can I turn your approach to a tikz style definition?
              – blackened
              35 mins ago










            • @blackened What precisely do you want the style to accomplish? A line through a given point with the slope coinciding with the one of another line. (And rereading my original post I think my wording did indeed not reflect what I wanted to say.)
              – marmot
              33 mins ago










            • What precisely do you want the style to accomplish? A line through a given point with the slope coinciding with the one of another line. Yes. (From your question, I understand that one may want to accomplish other options. What are they?)
              – blackened
              31 mins ago
















            2














            If you use the + syntax in this context, it seems not to always give you what one may expect. In general, + means "relative to the first coordinate of this path". But who knows what the first coordinate is in the context of intersection cs:? It is, however, not too difficult to produce the parallel lines just by computing the slope and using it. For the sake of clarity, I labeled all coordinates.



            documentclass{standalone}
            usepackage{tikz}
            usetikzlibrary{intersections}
            usetikzlibrary{calc}
            begin{document}

            begin{tikzpicture}

            coordinate[label=left:$A$] (A) at (0,0);
            coordinate[label=above:$B$] (B) at (2,4);
            coordinate[label=right:$C$] (C) at (8,0);
            coordinate[label=45:$M$] (M) at (4,0);

            draw[name path=Circle] (B) circle [radius=3cm];
            path[name path=AB] (A)--(B);
            path[name path=BC] (B)--(C);
            path [name intersections={of=Circle and BC}];
            coordinate[label=right:$E$] (E) at (intersection-1);
            path [name intersections={of=Circle and AB}];
            coordinate[label=left:$D$] (D) at (intersection-1);

            draw[thick](A)--(B)--(C)--cycle;
            %draw[thick](B) circle [radius=3cm];
            draw[thick](D)--(E) (M)--(B);

            % From a point draw a parallel line by calculating the vector
            path let p1=($(E)-(D)$),n1={atan2(y1,x1)} in
            ($(A)+(n1:1)$) coordinate (auxA)
            ($(C)+(n1:1)$) coordinate (auxC);
            coordinate[label=right:$P$] (P) at (intersection cs:first line={(B)--(C)},
            second line={(A) -- (auxA)});

            % Here is my problem:
            coordinate[label=below:$N$]
            (N) at (intersection cs:first line={(B)--(M)},
            second line={(C) -- (auxC)});

            draw[thick, red] (A)--(P) (C)--(N) ;

            end{tikzpicture}
            end{document}


            enter image description here



            As you see, the red lines are parallel.



            One may want cast this into a style:

            documentclass{standalone}
            usepackage{tikz}
            usetikzlibrary{intersections}
            usetikzlibrary{calc}
            begin{document}
            tikzset{line through/.style args={#1 parallel to line through #2 and #3 and
            length #4}{insert path={%
            let p1=($(#3)-(#2)$),n1={atan2(y1,x1)} in (#1) -- ++ (n1:#4)}}}
            begin{tikzpicture}

            coordinate[label=left:$A$] (A) at (0,0);
            coordinate[label=above:$B$] (B) at (2,4);
            coordinate[label=right:$C$] (C) at (8,0);
            coordinate[label=45:$M$] (M) at (4,0);

            draw[name path=Circle] (B) circle [radius=3cm];
            path[name path=AB] (A)--(B);
            path[name path=BC] (B)--(C);
            path [name intersections={of=Circle and BC}];
            coordinate[label=right:$E$] (E) at (intersection-1);
            path [name intersections={of=Circle and AB}];
            coordinate[label=left:$D$] (D) at (intersection-1);

            draw[thick](A)--(B)--(C)--cycle;
            %draw[thick](B) circle [radius=3cm];
            draw[thick](D)--(E) (M)--(B);

            % From a point draw a parallel line by calculating the vector
            path[line through=A parallel to line through E and D and length 1]
            coordinate (auxA)
            [line through=C parallel to line through E and D and length 1]
            coordinate (auxC);

            coordinate[label=right:$P$] (P) at (intersection cs:first line={(B)--(C)},
            second line={(A) -- (auxA)});

            % Here is my problem:
            coordinate[label=below:$N$]
            (N) at (intersection cs:first line={(B)--(M)},
            second line={(C) -- (auxC)});

            draw[thick, red] (A)--(P) (C)--(N) ;

            end{tikzpicture}
            end{document}





            share|improve this answer























            • Thank you. I was following this answer.
              – blackened
              39 mins ago












            • @blackened Yes, there it is very clear what the first point of the path is. Therefore, it is clear what + does. However, in the context of intersection cs: it is not clear to me where single paths start and end, and hence -- +(coordinate) may not be what one may thing it is. I am sorry if you feel that my wording is offensive, would like to apologize, and change it right away.
              – marmot
              37 mins ago












            • No worries at all. I just assumed that that answer encompassed all cases. How can I turn your approach to a tikz style definition?
              – blackened
              35 mins ago










            • @blackened What precisely do you want the style to accomplish? A line through a given point with the slope coinciding with the one of another line. (And rereading my original post I think my wording did indeed not reflect what I wanted to say.)
              – marmot
              33 mins ago










            • What precisely do you want the style to accomplish? A line through a given point with the slope coinciding with the one of another line. Yes. (From your question, I understand that one may want to accomplish other options. What are they?)
              – blackened
              31 mins ago














            2












            2








            2






            If you use the + syntax in this context, it seems not to always give you what one may expect. In general, + means "relative to the first coordinate of this path". But who knows what the first coordinate is in the context of intersection cs:? It is, however, not too difficult to produce the parallel lines just by computing the slope and using it. For the sake of clarity, I labeled all coordinates.



            documentclass{standalone}
            usepackage{tikz}
            usetikzlibrary{intersections}
            usetikzlibrary{calc}
            begin{document}

            begin{tikzpicture}

            coordinate[label=left:$A$] (A) at (0,0);
            coordinate[label=above:$B$] (B) at (2,4);
            coordinate[label=right:$C$] (C) at (8,0);
            coordinate[label=45:$M$] (M) at (4,0);

            draw[name path=Circle] (B) circle [radius=3cm];
            path[name path=AB] (A)--(B);
            path[name path=BC] (B)--(C);
            path [name intersections={of=Circle and BC}];
            coordinate[label=right:$E$] (E) at (intersection-1);
            path [name intersections={of=Circle and AB}];
            coordinate[label=left:$D$] (D) at (intersection-1);

            draw[thick](A)--(B)--(C)--cycle;
            %draw[thick](B) circle [radius=3cm];
            draw[thick](D)--(E) (M)--(B);

            % From a point draw a parallel line by calculating the vector
            path let p1=($(E)-(D)$),n1={atan2(y1,x1)} in
            ($(A)+(n1:1)$) coordinate (auxA)
            ($(C)+(n1:1)$) coordinate (auxC);
            coordinate[label=right:$P$] (P) at (intersection cs:first line={(B)--(C)},
            second line={(A) -- (auxA)});

            % Here is my problem:
            coordinate[label=below:$N$]
            (N) at (intersection cs:first line={(B)--(M)},
            second line={(C) -- (auxC)});

            draw[thick, red] (A)--(P) (C)--(N) ;

            end{tikzpicture}
            end{document}


            enter image description here



            As you see, the red lines are parallel.



            One may want cast this into a style:

            documentclass{standalone}
            usepackage{tikz}
            usetikzlibrary{intersections}
            usetikzlibrary{calc}
            begin{document}
            tikzset{line through/.style args={#1 parallel to line through #2 and #3 and
            length #4}{insert path={%
            let p1=($(#3)-(#2)$),n1={atan2(y1,x1)} in (#1) -- ++ (n1:#4)}}}
            begin{tikzpicture}

            coordinate[label=left:$A$] (A) at (0,0);
            coordinate[label=above:$B$] (B) at (2,4);
            coordinate[label=right:$C$] (C) at (8,0);
            coordinate[label=45:$M$] (M) at (4,0);

            draw[name path=Circle] (B) circle [radius=3cm];
            path[name path=AB] (A)--(B);
            path[name path=BC] (B)--(C);
            path [name intersections={of=Circle and BC}];
            coordinate[label=right:$E$] (E) at (intersection-1);
            path [name intersections={of=Circle and AB}];
            coordinate[label=left:$D$] (D) at (intersection-1);

            draw[thick](A)--(B)--(C)--cycle;
            %draw[thick](B) circle [radius=3cm];
            draw[thick](D)--(E) (M)--(B);

            % From a point draw a parallel line by calculating the vector
            path[line through=A parallel to line through E and D and length 1]
            coordinate (auxA)
            [line through=C parallel to line through E and D and length 1]
            coordinate (auxC);

            coordinate[label=right:$P$] (P) at (intersection cs:first line={(B)--(C)},
            second line={(A) -- (auxA)});

            % Here is my problem:
            coordinate[label=below:$N$]
            (N) at (intersection cs:first line={(B)--(M)},
            second line={(C) -- (auxC)});

            draw[thick, red] (A)--(P) (C)--(N) ;

            end{tikzpicture}
            end{document}





            share|improve this answer














            If you use the + syntax in this context, it seems not to always give you what one may expect. In general, + means "relative to the first coordinate of this path". But who knows what the first coordinate is in the context of intersection cs:? It is, however, not too difficult to produce the parallel lines just by computing the slope and using it. For the sake of clarity, I labeled all coordinates.



            documentclass{standalone}
            usepackage{tikz}
            usetikzlibrary{intersections}
            usetikzlibrary{calc}
            begin{document}

            begin{tikzpicture}

            coordinate[label=left:$A$] (A) at (0,0);
            coordinate[label=above:$B$] (B) at (2,4);
            coordinate[label=right:$C$] (C) at (8,0);
            coordinate[label=45:$M$] (M) at (4,0);

            draw[name path=Circle] (B) circle [radius=3cm];
            path[name path=AB] (A)--(B);
            path[name path=BC] (B)--(C);
            path [name intersections={of=Circle and BC}];
            coordinate[label=right:$E$] (E) at (intersection-1);
            path [name intersections={of=Circle and AB}];
            coordinate[label=left:$D$] (D) at (intersection-1);

            draw[thick](A)--(B)--(C)--cycle;
            %draw[thick](B) circle [radius=3cm];
            draw[thick](D)--(E) (M)--(B);

            % From a point draw a parallel line by calculating the vector
            path let p1=($(E)-(D)$),n1={atan2(y1,x1)} in
            ($(A)+(n1:1)$) coordinate (auxA)
            ($(C)+(n1:1)$) coordinate (auxC);
            coordinate[label=right:$P$] (P) at (intersection cs:first line={(B)--(C)},
            second line={(A) -- (auxA)});

            % Here is my problem:
            coordinate[label=below:$N$]
            (N) at (intersection cs:first line={(B)--(M)},
            second line={(C) -- (auxC)});

            draw[thick, red] (A)--(P) (C)--(N) ;

            end{tikzpicture}
            end{document}


            enter image description here



            As you see, the red lines are parallel.



            One may want cast this into a style:

            documentclass{standalone}
            usepackage{tikz}
            usetikzlibrary{intersections}
            usetikzlibrary{calc}
            begin{document}
            tikzset{line through/.style args={#1 parallel to line through #2 and #3 and
            length #4}{insert path={%
            let p1=($(#3)-(#2)$),n1={atan2(y1,x1)} in (#1) -- ++ (n1:#4)}}}
            begin{tikzpicture}

            coordinate[label=left:$A$] (A) at (0,0);
            coordinate[label=above:$B$] (B) at (2,4);
            coordinate[label=right:$C$] (C) at (8,0);
            coordinate[label=45:$M$] (M) at (4,0);

            draw[name path=Circle] (B) circle [radius=3cm];
            path[name path=AB] (A)--(B);
            path[name path=BC] (B)--(C);
            path [name intersections={of=Circle and BC}];
            coordinate[label=right:$E$] (E) at (intersection-1);
            path [name intersections={of=Circle and AB}];
            coordinate[label=left:$D$] (D) at (intersection-1);

            draw[thick](A)--(B)--(C)--cycle;
            %draw[thick](B) circle [radius=3cm];
            draw[thick](D)--(E) (M)--(B);

            % From a point draw a parallel line by calculating the vector
            path[line through=A parallel to line through E and D and length 1]
            coordinate (auxA)
            [line through=C parallel to line through E and D and length 1]
            coordinate (auxC);

            coordinate[label=right:$P$] (P) at (intersection cs:first line={(B)--(C)},
            second line={(A) -- (auxA)});

            % Here is my problem:
            coordinate[label=below:$N$]
            (N) at (intersection cs:first line={(B)--(M)},
            second line={(C) -- (auxC)});

            draw[thick, red] (A)--(P) (C)--(N) ;

            end{tikzpicture}
            end{document}






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited 25 mins ago

























            answered 44 mins ago









            marmot

            85.6k497182




            85.6k497182












            • Thank you. I was following this answer.
              – blackened
              39 mins ago












            • @blackened Yes, there it is very clear what the first point of the path is. Therefore, it is clear what + does. However, in the context of intersection cs: it is not clear to me where single paths start and end, and hence -- +(coordinate) may not be what one may thing it is. I am sorry if you feel that my wording is offensive, would like to apologize, and change it right away.
              – marmot
              37 mins ago












            • No worries at all. I just assumed that that answer encompassed all cases. How can I turn your approach to a tikz style definition?
              – blackened
              35 mins ago










            • @blackened What precisely do you want the style to accomplish? A line through a given point with the slope coinciding with the one of another line. (And rereading my original post I think my wording did indeed not reflect what I wanted to say.)
              – marmot
              33 mins ago










            • What precisely do you want the style to accomplish? A line through a given point with the slope coinciding with the one of another line. Yes. (From your question, I understand that one may want to accomplish other options. What are they?)
              – blackened
              31 mins ago


















            • Thank you. I was following this answer.
              – blackened
              39 mins ago












            • @blackened Yes, there it is very clear what the first point of the path is. Therefore, it is clear what + does. However, in the context of intersection cs: it is not clear to me where single paths start and end, and hence -- +(coordinate) may not be what one may thing it is. I am sorry if you feel that my wording is offensive, would like to apologize, and change it right away.
              – marmot
              37 mins ago












            • No worries at all. I just assumed that that answer encompassed all cases. How can I turn your approach to a tikz style definition?
              – blackened
              35 mins ago










            • @blackened What precisely do you want the style to accomplish? A line through a given point with the slope coinciding with the one of another line. (And rereading my original post I think my wording did indeed not reflect what I wanted to say.)
              – marmot
              33 mins ago










            • What precisely do you want the style to accomplish? A line through a given point with the slope coinciding with the one of another line. Yes. (From your question, I understand that one may want to accomplish other options. What are they?)
              – blackened
              31 mins ago
















            Thank you. I was following this answer.
            – blackened
            39 mins ago






            Thank you. I was following this answer.
            – blackened
            39 mins ago














            @blackened Yes, there it is very clear what the first point of the path is. Therefore, it is clear what + does. However, in the context of intersection cs: it is not clear to me where single paths start and end, and hence -- +(coordinate) may not be what one may thing it is. I am sorry if you feel that my wording is offensive, would like to apologize, and change it right away.
            – marmot
            37 mins ago






            @blackened Yes, there it is very clear what the first point of the path is. Therefore, it is clear what + does. However, in the context of intersection cs: it is not clear to me where single paths start and end, and hence -- +(coordinate) may not be what one may thing it is. I am sorry if you feel that my wording is offensive, would like to apologize, and change it right away.
            – marmot
            37 mins ago














            No worries at all. I just assumed that that answer encompassed all cases. How can I turn your approach to a tikz style definition?
            – blackened
            35 mins ago




            No worries at all. I just assumed that that answer encompassed all cases. How can I turn your approach to a tikz style definition?
            – blackened
            35 mins ago












            @blackened What precisely do you want the style to accomplish? A line through a given point with the slope coinciding with the one of another line. (And rereading my original post I think my wording did indeed not reflect what I wanted to say.)
            – marmot
            33 mins ago




            @blackened What precisely do you want the style to accomplish? A line through a given point with the slope coinciding with the one of another line. (And rereading my original post I think my wording did indeed not reflect what I wanted to say.)
            – marmot
            33 mins ago












            What precisely do you want the style to accomplish? A line through a given point with the slope coinciding with the one of another line. Yes. (From your question, I understand that one may want to accomplish other options. What are they?)
            – blackened
            31 mins ago




            What precisely do you want the style to accomplish? A line through a given point with the slope coinciding with the one of another line. Yes. (From your question, I understand that one may want to accomplish other options. What are they?)
            – blackened
            31 mins ago











            2














            Use second line={(C)--($(C)+(D)-(E)$)}). The first one works as expected because (A)=(0,0)



            documentclass{article}
            usepackage{tikz}
            usetikzlibrary{intersections}
            usetikzlibrary{calc}
            begin{document}

            begin{tikzpicture}

            coordinate[label=A] (A) at (0,0);
            coordinate[label=B](B) at (2,4);
            coordinate[label=C] (C) at (8,0);
            coordinate[label=M] (M) at (4,0);

            path[name path=Circle] (B) circle [radius=3cm];
            path[name path=AB] (A)--(B);
            path[name path=BC] (B)--(C);
            path [name intersections={of=Circle and BC}];
            coordinate[label=E] (E) at (intersection-1);
            path [name intersections={of=Circle and AB}];
            coordinate[label=D] (D) at (intersection-1);

            draw[thick](A)--(B)--(C)--cycle;
            draw[thick](B) circle [radius=3cm];
            draw[thick](D)--(E) (M)--(B);

            % From a point draw a parallel line by calculating the vector
            coordinate[label=P] (P) at (intersection cs:first line={(B)--(C)}, second line={(A) -- +($(E)-(D)$)});

            % Here is my problem:
            coordinate[label=N] (N) at (intersection cs:first line={(B)--(M)}, second line={(C)--($(C)+(D)-(E)$)}); % <------


            draw[thick, red] (A)--(P) (C)--(N);

            end{tikzpicture}
            end{document}


            enter image description here






            share|improve this answer




























              2














              Use second line={(C)--($(C)+(D)-(E)$)}). The first one works as expected because (A)=(0,0)



              documentclass{article}
              usepackage{tikz}
              usetikzlibrary{intersections}
              usetikzlibrary{calc}
              begin{document}

              begin{tikzpicture}

              coordinate[label=A] (A) at (0,0);
              coordinate[label=B](B) at (2,4);
              coordinate[label=C] (C) at (8,0);
              coordinate[label=M] (M) at (4,0);

              path[name path=Circle] (B) circle [radius=3cm];
              path[name path=AB] (A)--(B);
              path[name path=BC] (B)--(C);
              path [name intersections={of=Circle and BC}];
              coordinate[label=E] (E) at (intersection-1);
              path [name intersections={of=Circle and AB}];
              coordinate[label=D] (D) at (intersection-1);

              draw[thick](A)--(B)--(C)--cycle;
              draw[thick](B) circle [radius=3cm];
              draw[thick](D)--(E) (M)--(B);

              % From a point draw a parallel line by calculating the vector
              coordinate[label=P] (P) at (intersection cs:first line={(B)--(C)}, second line={(A) -- +($(E)-(D)$)});

              % Here is my problem:
              coordinate[label=N] (N) at (intersection cs:first line={(B)--(M)}, second line={(C)--($(C)+(D)-(E)$)}); % <------


              draw[thick, red] (A)--(P) (C)--(N);

              end{tikzpicture}
              end{document}


              enter image description here






              share|improve this answer


























                2












                2








                2






                Use second line={(C)--($(C)+(D)-(E)$)}). The first one works as expected because (A)=(0,0)



                documentclass{article}
                usepackage{tikz}
                usetikzlibrary{intersections}
                usetikzlibrary{calc}
                begin{document}

                begin{tikzpicture}

                coordinate[label=A] (A) at (0,0);
                coordinate[label=B](B) at (2,4);
                coordinate[label=C] (C) at (8,0);
                coordinate[label=M] (M) at (4,0);

                path[name path=Circle] (B) circle [radius=3cm];
                path[name path=AB] (A)--(B);
                path[name path=BC] (B)--(C);
                path [name intersections={of=Circle and BC}];
                coordinate[label=E] (E) at (intersection-1);
                path [name intersections={of=Circle and AB}];
                coordinate[label=D] (D) at (intersection-1);

                draw[thick](A)--(B)--(C)--cycle;
                draw[thick](B) circle [radius=3cm];
                draw[thick](D)--(E) (M)--(B);

                % From a point draw a parallel line by calculating the vector
                coordinate[label=P] (P) at (intersection cs:first line={(B)--(C)}, second line={(A) -- +($(E)-(D)$)});

                % Here is my problem:
                coordinate[label=N] (N) at (intersection cs:first line={(B)--(M)}, second line={(C)--($(C)+(D)-(E)$)}); % <------


                draw[thick, red] (A)--(P) (C)--(N);

                end{tikzpicture}
                end{document}


                enter image description here






                share|improve this answer














                Use second line={(C)--($(C)+(D)-(E)$)}). The first one works as expected because (A)=(0,0)



                documentclass{article}
                usepackage{tikz}
                usetikzlibrary{intersections}
                usetikzlibrary{calc}
                begin{document}

                begin{tikzpicture}

                coordinate[label=A] (A) at (0,0);
                coordinate[label=B](B) at (2,4);
                coordinate[label=C] (C) at (8,0);
                coordinate[label=M] (M) at (4,0);

                path[name path=Circle] (B) circle [radius=3cm];
                path[name path=AB] (A)--(B);
                path[name path=BC] (B)--(C);
                path [name intersections={of=Circle and BC}];
                coordinate[label=E] (E) at (intersection-1);
                path [name intersections={of=Circle and AB}];
                coordinate[label=D] (D) at (intersection-1);

                draw[thick](A)--(B)--(C)--cycle;
                draw[thick](B) circle [radius=3cm];
                draw[thick](D)--(E) (M)--(B);

                % From a point draw a parallel line by calculating the vector
                coordinate[label=P] (P) at (intersection cs:first line={(B)--(C)}, second line={(A) -- +($(E)-(D)$)});

                % Here is my problem:
                coordinate[label=N] (N) at (intersection cs:first line={(B)--(M)}, second line={(C)--($(C)+(D)-(E)$)}); % <------


                draw[thick, red] (A)--(P) (C)--(N);

                end{tikzpicture}
                end{document}


                enter image description here







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 19 mins ago

























                answered 37 mins ago









                Hafid Boukhoulda

                1,3641515




                1,3641515






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f467251%2fline-passing-through-a-point-and-parallel-to-another-where-am-i-wrong%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    404 Error Contact Form 7 ajax form submitting

                    How to know if a Active Directory user can login interactively

                    TypeError: fit_transform() missing 1 required positional argument: 'X'