请指导我如何在给定的图中为 ODBE 区域着色....
\begin{tikzpicture}
\tikzset{dot/.style={circle,inner sep=1pt,fill,label={#1},name=#1}}
\draw (0,5)--(0,0)node{O}--(5,0);
\draw [name path=P1] (2,0)node(b){D} -- (0,4)node{A};
\draw [name path=P2] (3,0)node(b){C} -- (0,2)node(b){E};
\path [name intersections={of=P1 and P2,by=B}];
\node [dot=B] at (B) {};
\end{tikzpicture}
请指导,非常感谢,这将有很大的帮助...
答案1
以下代码将创建您在附图中看到的内容。您需要声明一个背景层,将填充的多边形放在后面,这样它就不会覆盖节点的标签。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{intersections}
\pgfdeclarelayer{bg} % declare background
\pgfsetlayers{bg,main} % order of layers (main = standard layer)
\begin{document}
\begin{tikzpicture}
\tikzset{dot/.style={circle,inner sep=1pt,fill,label={#1},name=#1}}
\draw (0,5)-- (0,0)node(o){O} --(5,0);
\draw [name path=P1] (2,0)node(d){D} -- (0,4)node(a){A};
\draw [name path=P2] (3,0)node(c){C} -- (0,2)node(e){E};
\path [name intersections={of=P1 and P2,by=b}];
\node [dot=B] at (b) {};
\begin{pgfonlayer}{bg} % select background
\path [fill=green!50] (o.center) -- (d.center) -- (b) -- (e.center) -- cycle;
\end{pgfonlayer}
\end{tikzpicture}
\end{document}