Intersection between two straight lines?
Clash Royale CLAN TAG#URR8PPP
up vote
3
down vote
favorite
I'm specifically interested in the case in which lines AB and CD intersect, but outside (of at least one) of the segments AB, CD, and get the intersection I for further work. The similar questions only handle the case in which the segments intersect.
tikz-pgf
 |Â
show 1 more comment
up vote
3
down vote
favorite
I'm specifically interested in the case in which lines AB and CD intersect, but outside (of at least one) of the segments AB, CD, and get the intersection I for further work. The similar questions only handle the case in which the segments intersect.
tikz-pgf
see (tex.stackexchange.com/questions/31398/â¦)
â Denis
5 hours ago
5
Pleasssse add a minimal working example! With 3.5k rep how can you not know the drill?
â Andrew
5 hours ago
@Denis, there the intersection is inside both segments.
â vonbrand
5 hours ago
@vonbrand, in the answer is inside too if you read it carefully.
â koleygr
5 hours ago
@koleygr, I did try to decypher the answers, they mostly handle just the case (no interest to me) when the intersection is inside both segments, or perpendicular lines (in my case, they intersect outside the segments,at any angle)-
â vonbrand
2 hours ago
 |Â
show 1 more comment
up vote
3
down vote
favorite
up vote
3
down vote
favorite
I'm specifically interested in the case in which lines AB and CD intersect, but outside (of at least one) of the segments AB, CD, and get the intersection I for further work. The similar questions only handle the case in which the segments intersect.
tikz-pgf
I'm specifically interested in the case in which lines AB and CD intersect, but outside (of at least one) of the segments AB, CD, and get the intersection I for further work. The similar questions only handle the case in which the segments intersect.
tikz-pgf
tikz-pgf
asked 6 hours ago
vonbrand
3,51811128
3,51811128
see (tex.stackexchange.com/questions/31398/â¦)
â Denis
5 hours ago
5
Pleasssse add a minimal working example! With 3.5k rep how can you not know the drill?
â Andrew
5 hours ago
@Denis, there the intersection is inside both segments.
â vonbrand
5 hours ago
@vonbrand, in the answer is inside too if you read it carefully.
â koleygr
5 hours ago
@koleygr, I did try to decypher the answers, they mostly handle just the case (no interest to me) when the intersection is inside both segments, or perpendicular lines (in my case, they intersect outside the segments,at any angle)-
â vonbrand
2 hours ago
 |Â
show 1 more comment
see (tex.stackexchange.com/questions/31398/â¦)
â Denis
5 hours ago
5
Pleasssse add a minimal working example! With 3.5k rep how can you not know the drill?
â Andrew
5 hours ago
@Denis, there the intersection is inside both segments.
â vonbrand
5 hours ago
@vonbrand, in the answer is inside too if you read it carefully.
â koleygr
5 hours ago
@koleygr, I did try to decypher the answers, they mostly handle just the case (no interest to me) when the intersection is inside both segments, or perpendicular lines (in my case, they intersect outside the segments,at any angle)-
â vonbrand
2 hours ago
see (tex.stackexchange.com/questions/31398/â¦)
â Denis
5 hours ago
see (tex.stackexchange.com/questions/31398/â¦)
â Denis
5 hours ago
5
5
Pleasssse add a minimal working example! With 3.5k rep how can you not know the drill?
â Andrew
5 hours ago
Pleasssse add a minimal working example! With 3.5k rep how can you not know the drill?
â Andrew
5 hours ago
@Denis, there the intersection is inside both segments.
â vonbrand
5 hours ago
@Denis, there the intersection is inside both segments.
â vonbrand
5 hours ago
@vonbrand, in the answer is inside too if you read it carefully.
â koleygr
5 hours ago
@vonbrand, in the answer is inside too if you read it carefully.
â koleygr
5 hours ago
@koleygr, I did try to decypher the answers, they mostly handle just the case (no interest to me) when the intersection is inside both segments, or perpendicular lines (in my case, they intersect outside the segments,at any angle)-
â vonbrand
2 hours ago
@koleygr, I did try to decypher the answers, they mostly handle just the case (no interest to me) when the intersection is inside both segments, or perpendicular lines (in my case, they intersect outside the segments,at any angle)-
â vonbrand
2 hours ago
 |Â
show 1 more comment
2 Answers
2
active
oldest
votes
up vote
5
down vote
- Declare two
path
which intersect. - Computes and draw the intersection point.
- Draw (or not) some fragment of original paths.
That's all.
documentclass[tikz,border=2mm]standalone
usetikzlibraryintersections, calc
begindocument
begintikzpicture
path[name path=a] (0,0) coordinate (a1) -- (2,4) coordinate (a2);
path[name path=b] (0,4) coordinate (b1) -- (5,2) coordinate (b2);
fill[red,name intersections=of=a and b]
(intersection-1) circle (2pt);
draw (a1)--($(a1)!.5!(a2)$);
draw (b2)--($(b2)!.5!(b1)$);
endtikzpicture
enddocument
Weird... I tried something very similar, got nowhere...
â vonbrand
5 hours ago
1
(+1) The funny think is the optical illusion that the dot in over their intersection.
â koleygr
5 hours ago
Nope. The intersection is inside the segments a1-a2 and b1-b2.
â vonbrand
2 hours ago
add a comment |Â
up vote
4
down vote
There is another way to find the intersection of two intersecting lines that is no longer documented in manual 3.0.1a
but still works.
It is on page 87 of manual 1.18 which you will find here (until when?): tikz pgf manual 1.18
It consists in solving a system of 2 equations with 2 unknowns (the points that define the 2 lines). It is not necessary for the paths to intersect on the figure to find their intersection unlike the version given in manual 3.01a
of the solution given by ignasi.
The second advantage is that it is not necessary to load any library for this to work.
You will notice that the points or their coordinates are named without parentheses:
intersection of A--B and 0,3--2,2
Line A--B shorter as suggested by @marmot
documentclass[tikz,border=2mm]standalone
begindocument
begintikzpicture
draw[help lines] (0,0) grid (3,3);
draw (0,0) coordinate (A)node[below]A -- (2,1.5) coordinate (B)node[below right]B
(0,3)node[below left]C -- (2,2)node[below left]D;
fill[blue] (intersection of A--B and 0,3--2,2) circle (2pt);
endtikzpicture
enddocument
Translated with www.DeepL.com/Translator
@marmot, I don't know more than the given points A, B, C, D. Just drawing part of the line is no help.
â vonbrand
2 hours ago
@vonbrand Finally, I don't know if I understood your question correctly. Have you read the update of my answer?
â AndréC
2 hours ago
I believe this is deprecated in current TikZ... there is no section 1.18 in current version 3.0.1a of the TikZ & PGF manual. Page 118 gives an example of segments that do intersect.
â vonbrand
2 hours ago
@vonbrand No, it works. it had been deleted, then at the request of the users, it was delivered (but without the doc). it's not the only thing like that with tikz, there is alsoshorten >
which still works but is only documented in the manual 1.18.
â AndréC
2 hours ago
@vonbrand It is still official, though with a slightly different syntax. See page 118 (instead of section 1.18) of the pgfmanual. Trydraw (0,0) coordinate(A) -- (1,2) coordinate(B); draw (3.5,0) coordinate(C)-- (3,2) coordinate(D); coordinate (X) at (intersection cs:first line=(A)--(B), second line=(C)--(D)); fill[red] (X) circle (1pt);
.
â marmot
1 hour ago
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
- Declare two
path
which intersect. - Computes and draw the intersection point.
- Draw (or not) some fragment of original paths.
That's all.
documentclass[tikz,border=2mm]standalone
usetikzlibraryintersections, calc
begindocument
begintikzpicture
path[name path=a] (0,0) coordinate (a1) -- (2,4) coordinate (a2);
path[name path=b] (0,4) coordinate (b1) -- (5,2) coordinate (b2);
fill[red,name intersections=of=a and b]
(intersection-1) circle (2pt);
draw (a1)--($(a1)!.5!(a2)$);
draw (b2)--($(b2)!.5!(b1)$);
endtikzpicture
enddocument
Weird... I tried something very similar, got nowhere...
â vonbrand
5 hours ago
1
(+1) The funny think is the optical illusion that the dot in over their intersection.
â koleygr
5 hours ago
Nope. The intersection is inside the segments a1-a2 and b1-b2.
â vonbrand
2 hours ago
add a comment |Â
up vote
5
down vote
- Declare two
path
which intersect. - Computes and draw the intersection point.
- Draw (or not) some fragment of original paths.
That's all.
documentclass[tikz,border=2mm]standalone
usetikzlibraryintersections, calc
begindocument
begintikzpicture
path[name path=a] (0,0) coordinate (a1) -- (2,4) coordinate (a2);
path[name path=b] (0,4) coordinate (b1) -- (5,2) coordinate (b2);
fill[red,name intersections=of=a and b]
(intersection-1) circle (2pt);
draw (a1)--($(a1)!.5!(a2)$);
draw (b2)--($(b2)!.5!(b1)$);
endtikzpicture
enddocument
Weird... I tried something very similar, got nowhere...
â vonbrand
5 hours ago
1
(+1) The funny think is the optical illusion that the dot in over their intersection.
â koleygr
5 hours ago
Nope. The intersection is inside the segments a1-a2 and b1-b2.
â vonbrand
2 hours ago
add a comment |Â
up vote
5
down vote
up vote
5
down vote
- Declare two
path
which intersect. - Computes and draw the intersection point.
- Draw (or not) some fragment of original paths.
That's all.
documentclass[tikz,border=2mm]standalone
usetikzlibraryintersections, calc
begindocument
begintikzpicture
path[name path=a] (0,0) coordinate (a1) -- (2,4) coordinate (a2);
path[name path=b] (0,4) coordinate (b1) -- (5,2) coordinate (b2);
fill[red,name intersections=of=a and b]
(intersection-1) circle (2pt);
draw (a1)--($(a1)!.5!(a2)$);
draw (b2)--($(b2)!.5!(b1)$);
endtikzpicture
enddocument
- Declare two
path
which intersect. - Computes and draw the intersection point.
- Draw (or not) some fragment of original paths.
That's all.
documentclass[tikz,border=2mm]standalone
usetikzlibraryintersections, calc
begindocument
begintikzpicture
path[name path=a] (0,0) coordinate (a1) -- (2,4) coordinate (a2);
path[name path=b] (0,4) coordinate (b1) -- (5,2) coordinate (b2);
fill[red,name intersections=of=a and b]
(intersection-1) circle (2pt);
draw (a1)--($(a1)!.5!(a2)$);
draw (b2)--($(b2)!.5!(b1)$);
endtikzpicture
enddocument
answered 5 hours ago
Ignasi
87k4155289
87k4155289
Weird... I tried something very similar, got nowhere...
â vonbrand
5 hours ago
1
(+1) The funny think is the optical illusion that the dot in over their intersection.
â koleygr
5 hours ago
Nope. The intersection is inside the segments a1-a2 and b1-b2.
â vonbrand
2 hours ago
add a comment |Â
Weird... I tried something very similar, got nowhere...
â vonbrand
5 hours ago
1
(+1) The funny think is the optical illusion that the dot in over their intersection.
â koleygr
5 hours ago
Nope. The intersection is inside the segments a1-a2 and b1-b2.
â vonbrand
2 hours ago
Weird... I tried something very similar, got nowhere...
â vonbrand
5 hours ago
Weird... I tried something very similar, got nowhere...
â vonbrand
5 hours ago
1
1
(+1) The funny think is the optical illusion that the dot in over their intersection.
â koleygr
5 hours ago
(+1) The funny think is the optical illusion that the dot in over their intersection.
â koleygr
5 hours ago
Nope. The intersection is inside the segments a1-a2 and b1-b2.
â vonbrand
2 hours ago
Nope. The intersection is inside the segments a1-a2 and b1-b2.
â vonbrand
2 hours ago
add a comment |Â
up vote
4
down vote
There is another way to find the intersection of two intersecting lines that is no longer documented in manual 3.0.1a
but still works.
It is on page 87 of manual 1.18 which you will find here (until when?): tikz pgf manual 1.18
It consists in solving a system of 2 equations with 2 unknowns (the points that define the 2 lines). It is not necessary for the paths to intersect on the figure to find their intersection unlike the version given in manual 3.01a
of the solution given by ignasi.
The second advantage is that it is not necessary to load any library for this to work.
You will notice that the points or their coordinates are named without parentheses:
intersection of A--B and 0,3--2,2
Line A--B shorter as suggested by @marmot
documentclass[tikz,border=2mm]standalone
begindocument
begintikzpicture
draw[help lines] (0,0) grid (3,3);
draw (0,0) coordinate (A)node[below]A -- (2,1.5) coordinate (B)node[below right]B
(0,3)node[below left]C -- (2,2)node[below left]D;
fill[blue] (intersection of A--B and 0,3--2,2) circle (2pt);
endtikzpicture
enddocument
Translated with www.DeepL.com/Translator
@marmot, I don't know more than the given points A, B, C, D. Just drawing part of the line is no help.
â vonbrand
2 hours ago
@vonbrand Finally, I don't know if I understood your question correctly. Have you read the update of my answer?
â AndréC
2 hours ago
I believe this is deprecated in current TikZ... there is no section 1.18 in current version 3.0.1a of the TikZ & PGF manual. Page 118 gives an example of segments that do intersect.
â vonbrand
2 hours ago
@vonbrand No, it works. it had been deleted, then at the request of the users, it was delivered (but without the doc). it's not the only thing like that with tikz, there is alsoshorten >
which still works but is only documented in the manual 1.18.
â AndréC
2 hours ago
@vonbrand It is still official, though with a slightly different syntax. See page 118 (instead of section 1.18) of the pgfmanual. Trydraw (0,0) coordinate(A) -- (1,2) coordinate(B); draw (3.5,0) coordinate(C)-- (3,2) coordinate(D); coordinate (X) at (intersection cs:first line=(A)--(B), second line=(C)--(D)); fill[red] (X) circle (1pt);
.
â marmot
1 hour ago
add a comment |Â
up vote
4
down vote
There is another way to find the intersection of two intersecting lines that is no longer documented in manual 3.0.1a
but still works.
It is on page 87 of manual 1.18 which you will find here (until when?): tikz pgf manual 1.18
It consists in solving a system of 2 equations with 2 unknowns (the points that define the 2 lines). It is not necessary for the paths to intersect on the figure to find their intersection unlike the version given in manual 3.01a
of the solution given by ignasi.
The second advantage is that it is not necessary to load any library for this to work.
You will notice that the points or their coordinates are named without parentheses:
intersection of A--B and 0,3--2,2
Line A--B shorter as suggested by @marmot
documentclass[tikz,border=2mm]standalone
begindocument
begintikzpicture
draw[help lines] (0,0) grid (3,3);
draw (0,0) coordinate (A)node[below]A -- (2,1.5) coordinate (B)node[below right]B
(0,3)node[below left]C -- (2,2)node[below left]D;
fill[blue] (intersection of A--B and 0,3--2,2) circle (2pt);
endtikzpicture
enddocument
Translated with www.DeepL.com/Translator
@marmot, I don't know more than the given points A, B, C, D. Just drawing part of the line is no help.
â vonbrand
2 hours ago
@vonbrand Finally, I don't know if I understood your question correctly. Have you read the update of my answer?
â AndréC
2 hours ago
I believe this is deprecated in current TikZ... there is no section 1.18 in current version 3.0.1a of the TikZ & PGF manual. Page 118 gives an example of segments that do intersect.
â vonbrand
2 hours ago
@vonbrand No, it works. it had been deleted, then at the request of the users, it was delivered (but without the doc). it's not the only thing like that with tikz, there is alsoshorten >
which still works but is only documented in the manual 1.18.
â AndréC
2 hours ago
@vonbrand It is still official, though with a slightly different syntax. See page 118 (instead of section 1.18) of the pgfmanual. Trydraw (0,0) coordinate(A) -- (1,2) coordinate(B); draw (3.5,0) coordinate(C)-- (3,2) coordinate(D); coordinate (X) at (intersection cs:first line=(A)--(B), second line=(C)--(D)); fill[red] (X) circle (1pt);
.
â marmot
1 hour ago
add a comment |Â
up vote
4
down vote
up vote
4
down vote
There is another way to find the intersection of two intersecting lines that is no longer documented in manual 3.0.1a
but still works.
It is on page 87 of manual 1.18 which you will find here (until when?): tikz pgf manual 1.18
It consists in solving a system of 2 equations with 2 unknowns (the points that define the 2 lines). It is not necessary for the paths to intersect on the figure to find their intersection unlike the version given in manual 3.01a
of the solution given by ignasi.
The second advantage is that it is not necessary to load any library for this to work.
You will notice that the points or their coordinates are named without parentheses:
intersection of A--B and 0,3--2,2
Line A--B shorter as suggested by @marmot
documentclass[tikz,border=2mm]standalone
begindocument
begintikzpicture
draw[help lines] (0,0) grid (3,3);
draw (0,0) coordinate (A)node[below]A -- (2,1.5) coordinate (B)node[below right]B
(0,3)node[below left]C -- (2,2)node[below left]D;
fill[blue] (intersection of A--B and 0,3--2,2) circle (2pt);
endtikzpicture
enddocument
Translated with www.DeepL.com/Translator
There is another way to find the intersection of two intersecting lines that is no longer documented in manual 3.0.1a
but still works.
It is on page 87 of manual 1.18 which you will find here (until when?): tikz pgf manual 1.18
It consists in solving a system of 2 equations with 2 unknowns (the points that define the 2 lines). It is not necessary for the paths to intersect on the figure to find their intersection unlike the version given in manual 3.01a
of the solution given by ignasi.
The second advantage is that it is not necessary to load any library for this to work.
You will notice that the points or their coordinates are named without parentheses:
intersection of A--B and 0,3--2,2
Line A--B shorter as suggested by @marmot
documentclass[tikz,border=2mm]standalone
begindocument
begintikzpicture
draw[help lines] (0,0) grid (3,3);
draw (0,0) coordinate (A)node[below]A -- (2,1.5) coordinate (B)node[below right]B
(0,3)node[below left]C -- (2,2)node[below left]D;
fill[blue] (intersection of A--B and 0,3--2,2) circle (2pt);
endtikzpicture
enddocument
Translated with www.DeepL.com/Translator
edited 2 hours ago
answered 4 hours ago
AndréC
3,124728
3,124728
@marmot, I don't know more than the given points A, B, C, D. Just drawing part of the line is no help.
â vonbrand
2 hours ago
@vonbrand Finally, I don't know if I understood your question correctly. Have you read the update of my answer?
â AndréC
2 hours ago
I believe this is deprecated in current TikZ... there is no section 1.18 in current version 3.0.1a of the TikZ & PGF manual. Page 118 gives an example of segments that do intersect.
â vonbrand
2 hours ago
@vonbrand No, it works. it had been deleted, then at the request of the users, it was delivered (but without the doc). it's not the only thing like that with tikz, there is alsoshorten >
which still works but is only documented in the manual 1.18.
â AndréC
2 hours ago
@vonbrand It is still official, though with a slightly different syntax. See page 118 (instead of section 1.18) of the pgfmanual. Trydraw (0,0) coordinate(A) -- (1,2) coordinate(B); draw (3.5,0) coordinate(C)-- (3,2) coordinate(D); coordinate (X) at (intersection cs:first line=(A)--(B), second line=(C)--(D)); fill[red] (X) circle (1pt);
.
â marmot
1 hour ago
add a comment |Â
@marmot, I don't know more than the given points A, B, C, D. Just drawing part of the line is no help.
â vonbrand
2 hours ago
@vonbrand Finally, I don't know if I understood your question correctly. Have you read the update of my answer?
â AndréC
2 hours ago
I believe this is deprecated in current TikZ... there is no section 1.18 in current version 3.0.1a of the TikZ & PGF manual. Page 118 gives an example of segments that do intersect.
â vonbrand
2 hours ago
@vonbrand No, it works. it had been deleted, then at the request of the users, it was delivered (but without the doc). it's not the only thing like that with tikz, there is alsoshorten >
which still works but is only documented in the manual 1.18.
â AndréC
2 hours ago
@vonbrand It is still official, though with a slightly different syntax. See page 118 (instead of section 1.18) of the pgfmanual. Trydraw (0,0) coordinate(A) -- (1,2) coordinate(B); draw (3.5,0) coordinate(C)-- (3,2) coordinate(D); coordinate (X) at (intersection cs:first line=(A)--(B), second line=(C)--(D)); fill[red] (X) circle (1pt);
.
â marmot
1 hour ago
@marmot, I don't know more than the given points A, B, C, D. Just drawing part of the line is no help.
â vonbrand
2 hours ago
@marmot, I don't know more than the given points A, B, C, D. Just drawing part of the line is no help.
â vonbrand
2 hours ago
@vonbrand Finally, I don't know if I understood your question correctly. Have you read the update of my answer?
â AndréC
2 hours ago
@vonbrand Finally, I don't know if I understood your question correctly. Have you read the update of my answer?
â AndréC
2 hours ago
I believe this is deprecated in current TikZ... there is no section 1.18 in current version 3.0.1a of the TikZ & PGF manual. Page 118 gives an example of segments that do intersect.
â vonbrand
2 hours ago
I believe this is deprecated in current TikZ... there is no section 1.18 in current version 3.0.1a of the TikZ & PGF manual. Page 118 gives an example of segments that do intersect.
â vonbrand
2 hours ago
@vonbrand No, it works. it had been deleted, then at the request of the users, it was delivered (but without the doc). it's not the only thing like that with tikz, there is also
shorten >
which still works but is only documented in the manual 1.18.â AndréC
2 hours ago
@vonbrand No, it works. it had been deleted, then at the request of the users, it was delivered (but without the doc). it's not the only thing like that with tikz, there is also
shorten >
which still works but is only documented in the manual 1.18.â AndréC
2 hours ago
@vonbrand It is still official, though with a slightly different syntax. See page 118 (instead of section 1.18) of the pgfmanual. Try
draw (0,0) coordinate(A) -- (1,2) coordinate(B); draw (3.5,0) coordinate(C)-- (3,2) coordinate(D); coordinate (X) at (intersection cs:first line=(A)--(B), second line=(C)--(D)); fill[red] (X) circle (1pt);
.â marmot
1 hour ago
@vonbrand It is still official, though with a slightly different syntax. See page 118 (instead of section 1.18) of the pgfmanual. Try
draw (0,0) coordinate(A) -- (1,2) coordinate(B); draw (3.5,0) coordinate(C)-- (3,2) coordinate(D); coordinate (X) at (intersection cs:first line=(A)--(B), second line=(C)--(D)); fill[red] (X) circle (1pt);
.â marmot
1 hour ago
add a comment |Â
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
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f450697%2fintersection-between-two-straight-lines%23new-answer', 'question_page');
);
Post as a guest
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
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
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
see (tex.stackexchange.com/questions/31398/â¦)
â Denis
5 hours ago
5
Pleasssse add a minimal working example! With 3.5k rep how can you not know the drill?
â Andrew
5 hours ago
@Denis, there the intersection is inside both segments.
â vonbrand
5 hours ago
@vonbrand, in the answer is inside too if you read it carefully.
â koleygr
5 hours ago
@koleygr, I did try to decypher the answers, they mostly handle just the case (no interest to me) when the intersection is inside both segments, or perpendicular lines (in my case, they intersect outside the segments,at any angle)-
â vonbrand
2 hours ago