Line passing through a point and parallel to another: Where am I wrong?
Clash Royale CLAN TAG#URR8PPP
documentclassstandalone
usepackagetikz
usetikzlibraryintersections
usetikzlibrarycalc
begindocument
begintikzpicture
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);
endtikzpicture
enddocument
Question: The second drawn line, which is supposed to also be a parallel, is not. What am I doing wrong?
tikz-pgf
add a comment |
documentclassstandalone
usepackagetikz
usetikzlibraryintersections
usetikzlibrarycalc
begindocument
begintikzpicture
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);
endtikzpicture
enddocument
Question: The second drawn line, which is supposed to also be a parallel, is not. What am I doing wrong?
tikz-pgf
add a comment |
documentclassstandalone
usepackagetikz
usetikzlibraryintersections
usetikzlibrarycalc
begindocument
begintikzpicture
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);
endtikzpicture
enddocument
Question: The second drawn line, which is supposed to also be a parallel, is not. What am I doing wrong?
tikz-pgf
documentclassstandalone
usepackagetikz
usetikzlibraryintersections
usetikzlibrarycalc
begindocument
begintikzpicture
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);
endtikzpicture
enddocument
Question: The second drawn line, which is supposed to also be a parallel, is not. What am I doing wrong?
tikz-pgf
tikz-pgf
asked Dec 25 '18 at 6:10
blackened
1,449714
1,449714
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
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.
documentclassstandalone
usepackagetikz
usetikzlibraryintersections
usetikzlibrarycalc
begindocument
begintikzpicture
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) ;
endtikzpicture
enddocument
As you see, the red lines are parallel.
One may want cast this into a style:
documentclassstandalone
usepackagetikz
usetikzlibraryintersections
usetikzlibrarycalc
begindocument
tikzsetline through/.style args=#1 parallel to line through #2 and #3 and
length #4insert path=%
let p1=($(#3)-(#2)$),n1=atan2(y1,x1) in (#1) -- ++ (n1:#4)
begintikzpicture
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) ;
endtikzpicture
enddocument
Thank you. I was following this answer.
– blackened
Dec 25 '18 at 6:35
@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 ofintersection 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
Dec 25 '18 at 6:37
No worries at all. I just assumed that that answer encompassed all cases. How can I turn your approach to atikz
style definition?
– blackened
Dec 25 '18 at 6:39
@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
Dec 25 '18 at 6:42
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
Dec 25 '18 at 6:44
|
show 1 more comment
Use second line=(C)--($(C)+(D)-(E)$))
. The first one works as expected because (A)=(0,0)
documentclassarticle
usepackagetikz
usetikzlibraryintersections
usetikzlibrarycalc
begindocument
begintikzpicture
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);
endtikzpicture
enddocument
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
documentclassstandalone
usepackagetikz
usetikzlibraryintersections
usetikzlibrarycalc
begindocument
begintikzpicture
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) ;
endtikzpicture
enddocument
As you see, the red lines are parallel.
One may want cast this into a style:
documentclassstandalone
usepackagetikz
usetikzlibraryintersections
usetikzlibrarycalc
begindocument
tikzsetline through/.style args=#1 parallel to line through #2 and #3 and
length #4insert path=%
let p1=($(#3)-(#2)$),n1=atan2(y1,x1) in (#1) -- ++ (n1:#4)
begintikzpicture
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) ;
endtikzpicture
enddocument
Thank you. I was following this answer.
– blackened
Dec 25 '18 at 6:35
@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 ofintersection 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
Dec 25 '18 at 6:37
No worries at all. I just assumed that that answer encompassed all cases. How can I turn your approach to atikz
style definition?
– blackened
Dec 25 '18 at 6:39
@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
Dec 25 '18 at 6:42
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
Dec 25 '18 at 6:44
|
show 1 more comment
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.
documentclassstandalone
usepackagetikz
usetikzlibraryintersections
usetikzlibrarycalc
begindocument
begintikzpicture
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) ;
endtikzpicture
enddocument
As you see, the red lines are parallel.
One may want cast this into a style:
documentclassstandalone
usepackagetikz
usetikzlibraryintersections
usetikzlibrarycalc
begindocument
tikzsetline through/.style args=#1 parallel to line through #2 and #3 and
length #4insert path=%
let p1=($(#3)-(#2)$),n1=atan2(y1,x1) in (#1) -- ++ (n1:#4)
begintikzpicture
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) ;
endtikzpicture
enddocument
Thank you. I was following this answer.
– blackened
Dec 25 '18 at 6:35
@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 ofintersection 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
Dec 25 '18 at 6:37
No worries at all. I just assumed that that answer encompassed all cases. How can I turn your approach to atikz
style definition?
– blackened
Dec 25 '18 at 6:39
@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
Dec 25 '18 at 6:42
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
Dec 25 '18 at 6:44
|
show 1 more comment
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.
documentclassstandalone
usepackagetikz
usetikzlibraryintersections
usetikzlibrarycalc
begindocument
begintikzpicture
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) ;
endtikzpicture
enddocument
As you see, the red lines are parallel.
One may want cast this into a style:
documentclassstandalone
usepackagetikz
usetikzlibraryintersections
usetikzlibrarycalc
begindocument
tikzsetline through/.style args=#1 parallel to line through #2 and #3 and
length #4insert path=%
let p1=($(#3)-(#2)$),n1=atan2(y1,x1) in (#1) -- ++ (n1:#4)
begintikzpicture
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) ;
endtikzpicture
enddocument
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.
documentclassstandalone
usepackagetikz
usetikzlibraryintersections
usetikzlibrarycalc
begindocument
begintikzpicture
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) ;
endtikzpicture
enddocument
As you see, the red lines are parallel.
One may want cast this into a style:
documentclassstandalone
usepackagetikz
usetikzlibraryintersections
usetikzlibrarycalc
begindocument
tikzsetline through/.style args=#1 parallel to line through #2 and #3 and
length #4insert path=%
let p1=($(#3)-(#2)$),n1=atan2(y1,x1) in (#1) -- ++ (n1:#4)
begintikzpicture
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) ;
endtikzpicture
enddocument
edited Dec 25 '18 at 6:50
answered Dec 25 '18 at 6:30
marmot
89.1k4102191
89.1k4102191
Thank you. I was following this answer.
– blackened
Dec 25 '18 at 6:35
@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 ofintersection 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
Dec 25 '18 at 6:37
No worries at all. I just assumed that that answer encompassed all cases. How can I turn your approach to atikz
style definition?
– blackened
Dec 25 '18 at 6:39
@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
Dec 25 '18 at 6:42
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
Dec 25 '18 at 6:44
|
show 1 more comment
Thank you. I was following this answer.
– blackened
Dec 25 '18 at 6:35
@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 ofintersection 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
Dec 25 '18 at 6:37
No worries at all. I just assumed that that answer encompassed all cases. How can I turn your approach to atikz
style definition?
– blackened
Dec 25 '18 at 6:39
@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
Dec 25 '18 at 6:42
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
Dec 25 '18 at 6:44
Thank you. I was following this answer.
– blackened
Dec 25 '18 at 6:35
Thank you. I was following this answer.
– blackened
Dec 25 '18 at 6:35
@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
Dec 25 '18 at 6:37
@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
Dec 25 '18 at 6:37
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
Dec 25 '18 at 6:39
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
Dec 25 '18 at 6:39
@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
Dec 25 '18 at 6:42
@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
Dec 25 '18 at 6:42
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
Dec 25 '18 at 6:44
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
Dec 25 '18 at 6:44
|
show 1 more comment
Use second line=(C)--($(C)+(D)-(E)$))
. The first one works as expected because (A)=(0,0)
documentclassarticle
usepackagetikz
usetikzlibraryintersections
usetikzlibrarycalc
begindocument
begintikzpicture
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);
endtikzpicture
enddocument
add a comment |
Use second line=(C)--($(C)+(D)-(E)$))
. The first one works as expected because (A)=(0,0)
documentclassarticle
usepackagetikz
usetikzlibraryintersections
usetikzlibrarycalc
begindocument
begintikzpicture
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);
endtikzpicture
enddocument
add a comment |
Use second line=(C)--($(C)+(D)-(E)$))
. The first one works as expected because (A)=(0,0)
documentclassarticle
usepackagetikz
usetikzlibraryintersections
usetikzlibrarycalc
begindocument
begintikzpicture
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);
endtikzpicture
enddocument
Use second line=(C)--($(C)+(D)-(E)$))
. The first one works as expected because (A)=(0,0)
documentclassarticle
usepackagetikz
usetikzlibraryintersections
usetikzlibrarycalc
begindocument
begintikzpicture
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);
endtikzpicture
enddocument
edited Dec 25 '18 at 6:56
answered Dec 25 '18 at 6:38
Hafid Boukhoulda
2,0321517
2,0321517
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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