阴影重叠的半圆

阴影重叠的半圆

有人能建议如何在下图中突出显示的区域(红色)上添加阴影吗?

期望输出

\documentclass[]{article}
\usepackage[margin=0.5in]{geometry}
\usepackage{pgfplots}
\renewcommand{\thesection}{\arabic{section}}
\usepackage{mathtools}
\usepackage{cancel}
\usepackage{pgfplots}
\usepackage{amsmath}
\newtheorem{theorem}{THEOREM}
\newtheorem{proof}{PROOF}
\usepackage{tikz}
\usepackage{amssymb}
\usetikzlibrary{patterns}
\usepackage{fancyhdr}
\usepackage{bigints}
\usepackage{color}
\usepackage{tcolorbox}
\usepackage{color,xcolor}
\usepackage{booktabs,array}
\usepackage{hyperref}
\usepackage{graphicx}
\usetikzlibrary{arrows}
\usepackage{polynom}
\usepackage{flexisym}
\usepackage{wallpaper}
\usepackage{blkarray}
\usepackage{caption}
\usepackage{lscape}
\usepgfplotslibrary{fillbetween}
\usepgfplotslibrary{statistics}
\usetikzlibrary{shapes.misc}
\usetikzlibrary{arrows.meta}
\newenvironment{tightcenter}{
\setlength\topsep{0pt}
\setlength\parskip{0pt}
\begin{center}}{\end{center}}
\begin{document}
\begin{tikzpicture}
\newdimen\R
\R=3.0cm
%
\draw[thick] (-3,0) -- (0,0) -- (0,3);
\draw[thick] (0,3) arc(90:180:\R);
%
\draw[thick] (0,0) arc(0:180:0.5*\R);
\draw[thick] (0,3) arc(90:270:0.5*\R);
%
\draw[thick] (0,0) rectangle (-0.25,0.25);
%
\draw [thick,dashed,{Latex[width=3mm]}-{Latex[width=3mm]}] (-3,-0.4) -- node[fill=white] {$4$ \text{cm}} (0,-0.4);
%
\draw [thick,dashed,{Latex[width=3mm]}-{Latex[width=3mm]}] (0.6,0) -- node[fill=white] {$4$ \text{cm}} (0.6,3);
%
%\draw[thick,red] (0,3) arc(90:180:\R) -- arc(0:180:0.5*\R);
\end{tikzpicture}
\end{document}

答案1

像这样?

\documentclass[tikz,border=5]{standalone}
\def\first{(0,4) arc(90:180:4)}
  \def\second{(0,0) arc(0:180:2)}
  \def\third{(0,4) arc(90:270:2)}
\begin{document}
\begin{tikzpicture}[line cap=rect] 

   \fill[red]\first;
   \fill[white]\second; 
   \fill[white]\third;
 
\begin{scope}
    \clip \second ;
    \fill[red]\third;
\end{scope}
      
\draw [thick] (0,0)--(0,4);
\draw [thick] (0,0)--(-4,0);

\draw [thick](0,4) arc(90:180:4);
\draw [thick](0,0) arc(0:180:2);
\draw [thick](0,4) arc(90:270:2);
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

奇偶规则允许您为路径着色。为此,我将 3 条路径合并为一条。

\draw[thick,fill=red,even odd rule] (0,3) arc(90:180:\R) arc(180:0:0.5*\R) arc(270:90:0.5*\R);%<-- Even odd rule

我还稍微简化了你的代码。代码被注释掉了% <--

截屏

\documentclass[tikz,border=5mm]{standalone}

\usepackage{amsmath}
\usetikzlibrary{arrows}
\usetikzlibrary{shapes.misc}
\usetikzlibrary{arrows.meta}

\begin{document}
\begin{tikzpicture}[>={Latex[width=3mm]}]%<-- arrow style
\newdimen\R
\R=3.0cm
%
\draw[thick] (-3,0) -- (0,0) -- (0,3);
\draw[thick,fill=red,even odd rule] (0,3) arc(90:180:\R) arc(180:0:0.5*\R) arc(270:90:0.5*\R);%<-- Even odd rule 
\draw[thick] (0,0) rectangle (-0.25,0.25);
\draw [thick,dashed,<->] (-3,-0.4) -- node[fill=white] {$4$ \text{cm}} (0,-0.4);
\draw [thick,dashed,<->] (0.6,0) -- node[fill=white] {$4$ \text{cm}} (0.6,3);
\end{tikzpicture}
\end{document}

相关内容