如何表示给定图中的交点

如何表示给定图中的交点

我想用 Q 表示直线 CD 和 AB 的交点,然后想遮蔽特定区域 PBQF,但以下代码出现错误,请帮忙...

    \begin{tikzpicture}
    \draw (0,5)--(0,0)--(4,0)node(f){F} %(2,0)node(a){A}--(0,4)node(b){B}
     %(3,0)node(c){C}--(0,2.4)node(d){D} 
     (4,0)--(0,2)node(e){E} (0,5)node(p){P};

        \draw[name path=P3]  (2,0)node(a){A}--(0,4)node(b){B};

        \draw[name path=P4]  (3,0)node(c){C}--(0,2.4)node(d){D};


        \path [name intersections={of=P3 and P4,by=Q}]; 

    \node [dot=Q]  at (Q) {};


        \begin{pgfonlayer}{bg}    % select background
    \path [fill=orange!50] (p.center)--(b.center) --  (p.center) -- (f.center) --(Q.center)-- cycle;

    \end{pgfonlayer}
    \end{tikzpicture}

答案1

您的代码片段没有用。它包含错误和一些混乱,因此几乎不可能弄清楚您喜欢绘制什么。根据我的猜测和我之前对您问题的回答,看看以下 MWE 是否给出了您想要的内容:

\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{backgrounds,
                intersections,
                positioning}

\begin{document}
    \begin{tikzpicture}[auto=right,
        dot/.style = {circle, fill, inner sep=1pt},
 every edge/.style = {draw, shorten >=-12mm},
every label/.style = {inner sep=1.5pt}
                        ]
\coordinate (o);
\coordinate[label=below:A,right=2 of o] (a);
\coordinate[label=below:C,right=1 of a] (c);
\coordinate[label=below:F,right=1 of c] (f);
%
\coordinate[label=left: E,above=2 of o] (e);
\coordinate[label=left: D,above=1 of e] (d);
\coordinate[label=left: B,above=2 of d] (b);
\coordinate[label=left: P,above=2 of b] (p);
%

\draw  (p) |- (f);
\draw[name path=AB]  (a) -- (b);
\draw[name path=CD]  (c) -- (d);
\path [name intersections={of=AB and CD,by=q}] node[dot, label=above right:Q]  at (q) {};
%
\scoped[on background layer]
\fill[orange!50] (b) -- (d) -- (q) -- (a) -- (c) -- (q); % it is not clear, what you like to fill ... so two options
\fill[green!20,semitransparent] (p) -- (b) -- (q) -- (c) -- (f) -- (q);
     \end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容