Problem with intersection of two paths

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite












I can not get the attached figure.



enter image description here



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


enter image description here










share|improve this question





















  • Off-topic but anchors have no meaning if the node is just a coordinate.
    – marmot
    30 mins ago






  • 2




    You only need path (C) -- (B)coordinate[pos=0.6](N) ; draw[fill=green] (A) rectangle (N);
    – marmot
    22 mins ago










  • @marmot, your solution is much easier using rectangle.
    – Sigur
    18 mins ago











  • @sigur but you were much faster +1 (my internet is really slow these days... )
    – marmot
    15 mins ago














up vote
2
down vote

favorite












I can not get the attached figure.



enter image description here



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


enter image description here










share|improve this question





















  • Off-topic but anchors have no meaning if the node is just a coordinate.
    – marmot
    30 mins ago






  • 2




    You only need path (C) -- (B)coordinate[pos=0.6](N) ; draw[fill=green] (A) rectangle (N);
    – marmot
    22 mins ago










  • @marmot, your solution is much easier using rectangle.
    – Sigur
    18 mins ago











  • @sigur but you were much faster +1 (my internet is really slow these days... )
    – marmot
    15 mins ago












up vote
2
down vote

favorite









up vote
2
down vote

favorite











I can not get the attached figure.



enter image description here



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


enter image description here










share|improve this question













I can not get the attached figure.



enter image description here



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


enter image description here







tikz-pgf






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 50 mins ago









Fabrice

1,3411822




1,3411822











  • Off-topic but anchors have no meaning if the node is just a coordinate.
    – marmot
    30 mins ago






  • 2




    You only need path (C) -- (B)coordinate[pos=0.6](N) ; draw[fill=green] (A) rectangle (N);
    – marmot
    22 mins ago










  • @marmot, your solution is much easier using rectangle.
    – Sigur
    18 mins ago











  • @sigur but you were much faster +1 (my internet is really slow these days... )
    – marmot
    15 mins ago
















  • Off-topic but anchors have no meaning if the node is just a coordinate.
    – marmot
    30 mins ago






  • 2




    You only need path (C) -- (B)coordinate[pos=0.6](N) ; draw[fill=green] (A) rectangle (N);
    – marmot
    22 mins ago










  • @marmot, your solution is much easier using rectangle.
    – Sigur
    18 mins ago











  • @sigur but you were much faster +1 (my internet is really slow these days... )
    – marmot
    15 mins ago















Off-topic but anchors have no meaning if the node is just a coordinate.
– marmot
30 mins ago




Off-topic but anchors have no meaning if the node is just a coordinate.
– marmot
30 mins ago




2




2




You only need path (C) -- (B)coordinate[pos=0.6](N) ; draw[fill=green] (A) rectangle (N);
– marmot
22 mins ago




You only need path (C) -- (B)coordinate[pos=0.6](N) ; draw[fill=green] (A) rectangle (N);
– marmot
22 mins ago












@marmot, your solution is much easier using rectangle.
– Sigur
18 mins ago





@marmot, your solution is much easier using rectangle.
– Sigur
18 mins ago













@sigur but you were much faster +1 (my internet is really slow these days... )
– marmot
15 mins ago




@sigur but you were much faster +1 (my internet is really slow these days... )
– marmot
15 mins ago










2 Answers
2






active

oldest

votes

















up vote
4
down vote



accepted










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


enter image description here






share|improve this answer


















  • 1




    You could also fix begintikzpicture... to begintikzpicture[...].
    – Torbjørn T.
    22 mins ago










  • @TorbjørnT. good point. Done!
    – Sigur
    19 mins ago

















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.



enter image description here






share|improve this answer


















  • 1




    @manooooh added (really slow internet in Mexico.. )
    – marmot
    12 mins ago






  • 2




    Not too slow. I was preparing the output for you, but you were faster... lol
    – Sigur
    12 mins ago






  • 1




    @Sigur Thanks a lot!
    – marmot
    9 mins ago










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',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
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%2f455327%2fproblem-with-intersection-of-two-paths%23new-answer', 'question_page');

);

Post as a guest






























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
4
down vote



accepted










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


enter image description here






share|improve this answer


















  • 1




    You could also fix begintikzpicture... to begintikzpicture[...].
    – Torbjørn T.
    22 mins ago










  • @TorbjørnT. good point. Done!
    – Sigur
    19 mins ago














up vote
4
down vote



accepted










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


enter image description here






share|improve this answer


















  • 1




    You could also fix begintikzpicture... to begintikzpicture[...].
    – Torbjørn T.
    22 mins ago










  • @TorbjørnT. good point. Done!
    – Sigur
    19 mins ago












up vote
4
down vote



accepted







up vote
4
down vote



accepted






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


enter image description here






share|improve this answer














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


enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








edited 20 mins ago

























answered 26 mins ago









Sigur

22.3k350132




22.3k350132







  • 1




    You could also fix begintikzpicture... to begintikzpicture[...].
    – Torbjørn T.
    22 mins ago










  • @TorbjørnT. good point. Done!
    – Sigur
    19 mins ago












  • 1




    You could also fix begintikzpicture... to begintikzpicture[...].
    – Torbjørn T.
    22 mins ago










  • @TorbjørnT. good point. Done!
    – Sigur
    19 mins ago







1




1




You could also fix begintikzpicture... to begintikzpicture[...].
– Torbjørn T.
22 mins ago




You could also fix begintikzpicture... to begintikzpicture[...].
– Torbjørn T.
22 mins ago












@TorbjørnT. good point. Done!
– Sigur
19 mins ago




@TorbjørnT. good point. Done!
– Sigur
19 mins ago










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.



enter image description here






share|improve this answer


















  • 1




    @manooooh added (really slow internet in Mexico.. )
    – marmot
    12 mins ago






  • 2




    Not too slow. I was preparing the output for you, but you were faster... lol
    – Sigur
    12 mins ago






  • 1




    @Sigur Thanks a lot!
    – marmot
    9 mins ago














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.



enter image description here






share|improve this answer


















  • 1




    @manooooh added (really slow internet in Mexico.. )
    – marmot
    12 mins ago






  • 2




    Not too slow. I was preparing the output for you, but you were faster... lol
    – Sigur
    12 mins ago






  • 1




    @Sigur Thanks a lot!
    – marmot
    9 mins ago












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.



enter image description here






share|improve this answer














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.



enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








edited 13 mins ago

























answered 16 mins ago









marmot

65.4k471141




65.4k471141







  • 1




    @manooooh added (really slow internet in Mexico.. )
    – marmot
    12 mins ago






  • 2




    Not too slow. I was preparing the output for you, but you were faster... lol
    – Sigur
    12 mins ago






  • 1




    @Sigur Thanks a lot!
    – marmot
    9 mins ago












  • 1




    @manooooh added (really slow internet in Mexico.. )
    – marmot
    12 mins ago






  • 2




    Not too slow. I was preparing the output for you, but you were faster... lol
    – Sigur
    12 mins ago






  • 1




    @Sigur Thanks a lot!
    – marmot
    9 mins ago







1




1




@manooooh added (really slow internet in Mexico.. )
– marmot
12 mins ago




@manooooh added (really slow internet in Mexico.. )
– marmot
12 mins ago




2




2




Not too slow. I was preparing the output for you, but you were faster... lol
– Sigur
12 mins ago




Not too slow. I was preparing the output for you, but you were faster... lol
– Sigur
12 mins ago




1




1




@Sigur Thanks a lot!
– marmot
9 mins ago




@Sigur Thanks a lot!
– marmot
9 mins ago

















 

draft saved


draft discarded















































 


draft saved


draft discarded














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













































































Comments

Popular posts from this blog

Long meetings (6-7 hours a day): Being “babysat” by supervisor

Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

Confectionery