Problem with intersection of two paths
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
I can not get the attached figure.
documentclass[tikz,11pt,border=5mm]standalone
usepackagetikz
usepackagegeometry
usetikzlibrarypositioning,calc,intersections
begindocument
begintikzpicturethick,x=0.5cm,y=0.5cm
coordinate [label=below left : $A$](A) at (0,0);
coordinate [label=below right : $B$](B) at (10,0);
coordinate [label=above left : $C$] (C) at (0,5);
path[name path=line1] (C.east) -- (C.east-|B.west)coordinate[pos=0.6](N) ;
path[name path=line2] (A) -- (B);
path[name path=line3]($(A)!(N)!(B)$) -- (N);
path[name path=line4]($(C)!(N)!(A)$) -- (N);
path[name path=line5] (A) -- (C);
path[name intersections=of=line1 and line3,by=P];
path[name intersections=of=line1 and line5,by=M];
draw[fill=green] (A-|P) --(N) -- (C-|M) -- (A) --cycle;
draw (A)--(B)--(C)--cycle;
node[above] at (N)$N$;
node[below] at (P)$P$;
endtikzpicture
enddocument
tikz-pgf
add a comment |Â
up vote
2
down vote
favorite
I can not get the attached figure.
documentclass[tikz,11pt,border=5mm]standalone
usepackagetikz
usepackagegeometry
usetikzlibrarypositioning,calc,intersections
begindocument
begintikzpicturethick,x=0.5cm,y=0.5cm
coordinate [label=below left : $A$](A) at (0,0);
coordinate [label=below right : $B$](B) at (10,0);
coordinate [label=above left : $C$] (C) at (0,5);
path[name path=line1] (C.east) -- (C.east-|B.west)coordinate[pos=0.6](N) ;
path[name path=line2] (A) -- (B);
path[name path=line3]($(A)!(N)!(B)$) -- (N);
path[name path=line4]($(C)!(N)!(A)$) -- (N);
path[name path=line5] (A) -- (C);
path[name intersections=of=line1 and line3,by=P];
path[name intersections=of=line1 and line5,by=M];
draw[fill=green] (A-|P) --(N) -- (C-|M) -- (A) --cycle;
draw (A)--(B)--(C)--cycle;
node[above] at (N)$N$;
node[below] at (P)$P$;
endtikzpicture
enddocument
tikz-pgf
Off-topic but anchors have no meaning if the node is just a coordinate.
â marmot
26 mins ago
1
You only needpath (C) -- (B)coordinate[pos=0.6](N) ; draw[fill=green] (A) rectangle (N);
â marmot
17 mins ago
@marmot, your solution is much easier usingrectangle
.
â Sigur
13 mins ago
@sigur but you were much faster +1 (my internet is really slow these days... )
â marmot
10 mins ago
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I can not get the attached figure.
documentclass[tikz,11pt,border=5mm]standalone
usepackagetikz
usepackagegeometry
usetikzlibrarypositioning,calc,intersections
begindocument
begintikzpicturethick,x=0.5cm,y=0.5cm
coordinate [label=below left : $A$](A) at (0,0);
coordinate [label=below right : $B$](B) at (10,0);
coordinate [label=above left : $C$] (C) at (0,5);
path[name path=line1] (C.east) -- (C.east-|B.west)coordinate[pos=0.6](N) ;
path[name path=line2] (A) -- (B);
path[name path=line3]($(A)!(N)!(B)$) -- (N);
path[name path=line4]($(C)!(N)!(A)$) -- (N);
path[name path=line5] (A) -- (C);
path[name intersections=of=line1 and line3,by=P];
path[name intersections=of=line1 and line5,by=M];
draw[fill=green] (A-|P) --(N) -- (C-|M) -- (A) --cycle;
draw (A)--(B)--(C)--cycle;
node[above] at (N)$N$;
node[below] at (P)$P$;
endtikzpicture
enddocument
tikz-pgf
I can not get the attached figure.
documentclass[tikz,11pt,border=5mm]standalone
usepackagetikz
usepackagegeometry
usetikzlibrarypositioning,calc,intersections
begindocument
begintikzpicturethick,x=0.5cm,y=0.5cm
coordinate [label=below left : $A$](A) at (0,0);
coordinate [label=below right : $B$](B) at (10,0);
coordinate [label=above left : $C$] (C) at (0,5);
path[name path=line1] (C.east) -- (C.east-|B.west)coordinate[pos=0.6](N) ;
path[name path=line2] (A) -- (B);
path[name path=line3]($(A)!(N)!(B)$) -- (N);
path[name path=line4]($(C)!(N)!(A)$) -- (N);
path[name path=line5] (A) -- (C);
path[name intersections=of=line1 and line3,by=P];
path[name intersections=of=line1 and line5,by=M];
draw[fill=green] (A-|P) --(N) -- (C-|M) -- (A) --cycle;
draw (A)--(B)--(C)--cycle;
node[above] at (N)$N$;
node[below] at (P)$P$;
endtikzpicture
enddocument
tikz-pgf
tikz-pgf
asked 45 mins ago
Fabrice
1,3391822
1,3391822
Off-topic but anchors have no meaning if the node is just a coordinate.
â marmot
26 mins ago
1
You only needpath (C) -- (B)coordinate[pos=0.6](N) ; draw[fill=green] (A) rectangle (N);
â marmot
17 mins ago
@marmot, your solution is much easier usingrectangle
.
â Sigur
13 mins ago
@sigur but you were much faster +1 (my internet is really slow these days... )
â marmot
10 mins ago
add a comment |Â
Off-topic but anchors have no meaning if the node is just a coordinate.
â marmot
26 mins ago
1
You only needpath (C) -- (B)coordinate[pos=0.6](N) ; draw[fill=green] (A) rectangle (N);
â marmot
17 mins ago
@marmot, your solution is much easier usingrectangle
.
â Sigur
13 mins ago
@sigur but you were much faster +1 (my internet is really slow these days... )
â marmot
10 mins ago
Off-topic but anchors have no meaning if the node is just a coordinate.
â marmot
26 mins ago
Off-topic but anchors have no meaning if the node is just a coordinate.
â marmot
26 mins ago
1
1
You only need
path (C) -- (B)coordinate[pos=0.6](N) ; draw[fill=green] (A) rectangle (N);
â marmot
17 mins ago
You only need
path (C) -- (B)coordinate[pos=0.6](N) ; draw[fill=green] (A) rectangle (N);
â marmot
17 mins ago
@marmot, your solution is much easier using
rectangle
.â Sigur
13 mins ago
@marmot, your solution is much easier using
rectangle
.â Sigur
13 mins ago
@sigur but you were much faster +1 (my internet is really slow these days... )
â marmot
10 mins ago
@sigur but you were much faster +1 (my internet is really slow these days... )
â marmot
10 mins ago
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
4
down vote
Similar to @Sigur but there are no intersections used (as not needed).
documentclass[tikz,11pt,border=5mm]standalone
usetikzlibrarypositioning,calc
begindocument
begintikzpicture[thick,x=0.5cm,y=0.5cm]
coordinate [label=below left : $A$](A) at (0,0);
coordinate [label=below right : $B$](B) at (10,0);
coordinate [label=above left : $C$] (C) at (0,5);
path (C) -- (B)coordinate[pos=0.6,label=above right:$N$](N) ;
draw[fill=green] (A) rectangle (N);
coordinate[label=above left:$M$] (M) at (A|-N);
draw (A) -- (B) -- (C) -- cycle;
endtikzpicture
enddocument
Output as your desired screen shot.
1
@manooooh added (really slow internet in Mexico.. )
â marmot
7 mins ago
2
Not too slow. I was preparing the output for you, but you were faster... lol
â Sigur
7 mins ago
1
@Sigur Thanks a lot!
â marmot
4 mins ago
add a comment |Â
up vote
3
down vote
Just control the position of P
between A
and B
. I used 60%.
documentclass[tikz,11pt]standalone
usetikzlibrarypositioning,calc,intersections
begindocument
begintikzpicture[thick,x=0.5cm,y=0.5cm]
coordinate [label=below left : $A$](A) at (0,0);
coordinate [label=below right : $B$](B) at (10,0);
coordinate [label=left : $C$](C) at (0,5);
coordinate [label=below : $P$](P) at ($(A)!.6!(B)$);
path[name path=hipo] (C) -- (B);
path[name path=rightVertical] (P) -- (P|-C) ;
path[name path=leftVertical] (A) -- (C);
path[name intersections=of=rightVertical and hipo,by=N];
path[name path=horizontal] (N) -- (N-|C) ;
path[name intersections=of=horizontal and leftVertical,by=M];
draw[fill=green] (P)--(N)--(M)--(A)--cycle;
draw (A)--(B)--(C)--cycle;
node[above] at (N)$N$;
node[left] at (M)$M$;
endtikzpicture
enddocument
1
You could also fixbegintikzpicture...
tobegintikzpicture[...]
.
â Torbjørn T.
17 mins ago
@TorbjørnT. good point. Done!
â Sigur
15 mins ago
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
Similar to @Sigur but there are no intersections used (as not needed).
documentclass[tikz,11pt,border=5mm]standalone
usetikzlibrarypositioning,calc
begindocument
begintikzpicture[thick,x=0.5cm,y=0.5cm]
coordinate [label=below left : $A$](A) at (0,0);
coordinate [label=below right : $B$](B) at (10,0);
coordinate [label=above left : $C$] (C) at (0,5);
path (C) -- (B)coordinate[pos=0.6,label=above right:$N$](N) ;
draw[fill=green] (A) rectangle (N);
coordinate[label=above left:$M$] (M) at (A|-N);
draw (A) -- (B) -- (C) -- cycle;
endtikzpicture
enddocument
Output as your desired screen shot.
1
@manooooh added (really slow internet in Mexico.. )
â marmot
7 mins ago
2
Not too slow. I was preparing the output for you, but you were faster... lol
â Sigur
7 mins ago
1
@Sigur Thanks a lot!
â marmot
4 mins ago
add a comment |Â
up vote
4
down vote
Similar to @Sigur but there are no intersections used (as not needed).
documentclass[tikz,11pt,border=5mm]standalone
usetikzlibrarypositioning,calc
begindocument
begintikzpicture[thick,x=0.5cm,y=0.5cm]
coordinate [label=below left : $A$](A) at (0,0);
coordinate [label=below right : $B$](B) at (10,0);
coordinate [label=above left : $C$] (C) at (0,5);
path (C) -- (B)coordinate[pos=0.6,label=above right:$N$](N) ;
draw[fill=green] (A) rectangle (N);
coordinate[label=above left:$M$] (M) at (A|-N);
draw (A) -- (B) -- (C) -- cycle;
endtikzpicture
enddocument
Output as your desired screen shot.
1
@manooooh added (really slow internet in Mexico.. )
â marmot
7 mins ago
2
Not too slow. I was preparing the output for you, but you were faster... lol
â Sigur
7 mins ago
1
@Sigur Thanks a lot!
â marmot
4 mins ago
add a comment |Â
up vote
4
down vote
up vote
4
down vote
Similar to @Sigur but there are no intersections used (as not needed).
documentclass[tikz,11pt,border=5mm]standalone
usetikzlibrarypositioning,calc
begindocument
begintikzpicture[thick,x=0.5cm,y=0.5cm]
coordinate [label=below left : $A$](A) at (0,0);
coordinate [label=below right : $B$](B) at (10,0);
coordinate [label=above left : $C$] (C) at (0,5);
path (C) -- (B)coordinate[pos=0.6,label=above right:$N$](N) ;
draw[fill=green] (A) rectangle (N);
coordinate[label=above left:$M$] (M) at (A|-N);
draw (A) -- (B) -- (C) -- cycle;
endtikzpicture
enddocument
Output as your desired screen shot.
Similar to @Sigur but there are no intersections used (as not needed).
documentclass[tikz,11pt,border=5mm]standalone
usetikzlibrarypositioning,calc
begindocument
begintikzpicture[thick,x=0.5cm,y=0.5cm]
coordinate [label=below left : $A$](A) at (0,0);
coordinate [label=below right : $B$](B) at (10,0);
coordinate [label=above left : $C$] (C) at (0,5);
path (C) -- (B)coordinate[pos=0.6,label=above right:$N$](N) ;
draw[fill=green] (A) rectangle (N);
coordinate[label=above left:$M$] (M) at (A|-N);
draw (A) -- (B) -- (C) -- cycle;
endtikzpicture
enddocument
Output as your desired screen shot.
edited 8 mins ago
answered 12 mins ago
marmot
65.4k471141
65.4k471141
1
@manooooh added (really slow internet in Mexico.. )
â marmot
7 mins ago
2
Not too slow. I was preparing the output for you, but you were faster... lol
â Sigur
7 mins ago
1
@Sigur Thanks a lot!
â marmot
4 mins ago
add a comment |Â
1
@manooooh added (really slow internet in Mexico.. )
â marmot
7 mins ago
2
Not too slow. I was preparing the output for you, but you were faster... lol
â Sigur
7 mins ago
1
@Sigur Thanks a lot!
â marmot
4 mins ago
1
1
@manooooh added (really slow internet in Mexico.. )
â marmot
7 mins ago
@manooooh added (really slow internet in Mexico.. )
â marmot
7 mins ago
2
2
Not too slow. I was preparing the output for you, but you were faster... lol
â Sigur
7 mins ago
Not too slow. I was preparing the output for you, but you were faster... lol
â Sigur
7 mins ago
1
1
@Sigur Thanks a lot!
â marmot
4 mins ago
@Sigur Thanks a lot!
â marmot
4 mins ago
add a comment |Â
up vote
3
down vote
Just control the position of P
between A
and B
. I used 60%.
documentclass[tikz,11pt]standalone
usetikzlibrarypositioning,calc,intersections
begindocument
begintikzpicture[thick,x=0.5cm,y=0.5cm]
coordinate [label=below left : $A$](A) at (0,0);
coordinate [label=below right : $B$](B) at (10,0);
coordinate [label=left : $C$](C) at (0,5);
coordinate [label=below : $P$](P) at ($(A)!.6!(B)$);
path[name path=hipo] (C) -- (B);
path[name path=rightVertical] (P) -- (P|-C) ;
path[name path=leftVertical] (A) -- (C);
path[name intersections=of=rightVertical and hipo,by=N];
path[name path=horizontal] (N) -- (N-|C) ;
path[name intersections=of=horizontal and leftVertical,by=M];
draw[fill=green] (P)--(N)--(M)--(A)--cycle;
draw (A)--(B)--(C)--cycle;
node[above] at (N)$N$;
node[left] at (M)$M$;
endtikzpicture
enddocument
1
You could also fixbegintikzpicture...
tobegintikzpicture[...]
.
â Torbjørn T.
17 mins ago
@TorbjørnT. good point. Done!
â Sigur
15 mins ago
add a comment |Â
up vote
3
down vote
Just control the position of P
between A
and B
. I used 60%.
documentclass[tikz,11pt]standalone
usetikzlibrarypositioning,calc,intersections
begindocument
begintikzpicture[thick,x=0.5cm,y=0.5cm]
coordinate [label=below left : $A$](A) at (0,0);
coordinate [label=below right : $B$](B) at (10,0);
coordinate [label=left : $C$](C) at (0,5);
coordinate [label=below : $P$](P) at ($(A)!.6!(B)$);
path[name path=hipo] (C) -- (B);
path[name path=rightVertical] (P) -- (P|-C) ;
path[name path=leftVertical] (A) -- (C);
path[name intersections=of=rightVertical and hipo,by=N];
path[name path=horizontal] (N) -- (N-|C) ;
path[name intersections=of=horizontal and leftVertical,by=M];
draw[fill=green] (P)--(N)--(M)--(A)--cycle;
draw (A)--(B)--(C)--cycle;
node[above] at (N)$N$;
node[left] at (M)$M$;
endtikzpicture
enddocument
1
You could also fixbegintikzpicture...
tobegintikzpicture[...]
.
â Torbjørn T.
17 mins ago
@TorbjørnT. good point. Done!
â Sigur
15 mins ago
add a comment |Â
up vote
3
down vote
up vote
3
down vote
Just control the position of P
between A
and B
. I used 60%.
documentclass[tikz,11pt]standalone
usetikzlibrarypositioning,calc,intersections
begindocument
begintikzpicture[thick,x=0.5cm,y=0.5cm]
coordinate [label=below left : $A$](A) at (0,0);
coordinate [label=below right : $B$](B) at (10,0);
coordinate [label=left : $C$](C) at (0,5);
coordinate [label=below : $P$](P) at ($(A)!.6!(B)$);
path[name path=hipo] (C) -- (B);
path[name path=rightVertical] (P) -- (P|-C) ;
path[name path=leftVertical] (A) -- (C);
path[name intersections=of=rightVertical and hipo,by=N];
path[name path=horizontal] (N) -- (N-|C) ;
path[name intersections=of=horizontal and leftVertical,by=M];
draw[fill=green] (P)--(N)--(M)--(A)--cycle;
draw (A)--(B)--(C)--cycle;
node[above] at (N)$N$;
node[left] at (M)$M$;
endtikzpicture
enddocument
Just control the position of P
between A
and B
. I used 60%.
documentclass[tikz,11pt]standalone
usetikzlibrarypositioning,calc,intersections
begindocument
begintikzpicture[thick,x=0.5cm,y=0.5cm]
coordinate [label=below left : $A$](A) at (0,0);
coordinate [label=below right : $B$](B) at (10,0);
coordinate [label=left : $C$](C) at (0,5);
coordinate [label=below : $P$](P) at ($(A)!.6!(B)$);
path[name path=hipo] (C) -- (B);
path[name path=rightVertical] (P) -- (P|-C) ;
path[name path=leftVertical] (A) -- (C);
path[name intersections=of=rightVertical and hipo,by=N];
path[name path=horizontal] (N) -- (N-|C) ;
path[name intersections=of=horizontal and leftVertical,by=M];
draw[fill=green] (P)--(N)--(M)--(A)--cycle;
draw (A)--(B)--(C)--cycle;
node[above] at (N)$N$;
node[left] at (M)$M$;
endtikzpicture
enddocument
edited 15 mins ago
answered 21 mins ago
Sigur
22.3k350132
22.3k350132
1
You could also fixbegintikzpicture...
tobegintikzpicture[...]
.
â Torbjørn T.
17 mins ago
@TorbjørnT. good point. Done!
â Sigur
15 mins ago
add a comment |Â
1
You could also fixbegintikzpicture...
tobegintikzpicture[...]
.
â Torbjørn T.
17 mins ago
@TorbjørnT. good point. Done!
â Sigur
15 mins ago
1
1
You could also fix
begintikzpicture...
to begintikzpicture[...]
.â Torbjørn T.
17 mins ago
You could also fix
begintikzpicture...
to begintikzpicture[...]
.â Torbjørn T.
17 mins ago
@TorbjørnT. good point. Done!
â Sigur
15 mins ago
@TorbjørnT. good point. Done!
â Sigur
15 mins 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%2f455327%2fproblem-with-intersection-of-two-paths%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
Off-topic but anchors have no meaning if the node is just a coordinate.
â marmot
26 mins ago
1
You only need
path (C) -- (B)coordinate[pos=0.6](N) ; draw[fill=green] (A) rectangle (N);
â marmot
17 mins ago
@marmot, your solution is much easier using
rectangle
.â Sigur
13 mins ago
@sigur but you were much faster +1 (my internet is really slow these days... )
â marmot
10 mins ago