我无法得到附图。
\documentclass[tikz,11pt,border=5mm]{standalone}
\usepackage{tikz}
\usepackage{geometry}
\usetikzlibrary{positioning,calc,intersections}
\begin{document}
\begin{tikzpicture}{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[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$};
\end{tikzpicture}
\end{document}
答案1
只要控制和P
之间的位置就可以了。我用了60%。A
B
\documentclass[tikz,11pt]{standalone}
\usetikzlibrary{positioning,calc,intersections}
\begin{document}
\begin{tikzpicture}[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$};
\end{tikzpicture}
\end{document}
答案2
与@Sigur 类似,但没有使用交点(因为不需要)。
\documentclass[tikz,11pt,border=5mm]{standalone}
\usetikzlibrary{positioning,calc}
\begin{document}
\begin{tikzpicture}[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;
\end{tikzpicture}
\end{document}
输出您想要的屏幕截图。