填充形状的一部分

填充形状的一部分

你能告诉我如何用灰色填充突出显示的区域吗?60?非常感谢!

电流输出

\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}
\newenvironment{tightcenter}{
\setlength\topsep{0pt}
\setlength\parskip{0pt}
\begin{center}}{\end{center}}
\begin{document}
\begin{tikzpicture}
%\draw[thick,fill=gray!30](0,0) circle (2);
\draw[thick] (0,0) circle (2.2);
%
%
\draw[thick](-0.3,-3.2) -- (2.8,-0.5);
%\draw[thick](-2,0) -- (2,0);
\draw[thick](1.4,-1.7) -- (0.9,2) -- (-1.94,1.02) -- cycle;
%
\node[left] at (-1.93,1.02) {\large $P$};
\node[right] at (0.81,2.2) {\large $R$};
\node[left] at (-0.25,-3.3) {\large $S$};
\node[right] at (2.7,-0.3) {\large $T$};
\node[below] at (1.55,-1.65) {\large $Q$};
%
\draw[thick] (0,0) circle (2.2);
\end{tikzpicture}
\end{document}

答案1

不用摆弄那么多手动坐标。

您可以使用极坐标(<angle>:<distance>),然后您就知道具体的角度并将它们与arc操作员一起使用。

turn钥匙有助于非常轻松地找到切线Q。它基本上建立了一个坐标系,其原点位于最后一个点,X轴指向前一个路径段的方向。在我们的例子中,这只是从中心
移动到。Q

我也使用label坐标直接放置标签。


有了ext.paths.arcto我的图书馆tikz-ext包裹你甚至可以简单地说

\fill[gray!60] (Q) arcto (R) -- cycle;

但是请注意,我将其radius = 2.2作为图片的一个选项,以便设置任何半径circlearcarcto,并且不必指定多个——除了极坐标。

否则你就需要说(Q) arcto[radius=2.2] (R)

代码

\documentclass[tikz]{standalone}
\usetikzlibrary{ext.paths.arcto}% for the arcto path operation
\begin{document}
\begin{tikzpicture}[radius=2.2]
\path[font=\Large]
 coordinate[label=above:$R$]           (R) at ( 68:2.2)
 coordinate[label=left:$P$]            (P) at (150:2.2)
 coordinate[label=below right:$Q$]     (Q) at (-53:2.2)
 (Q) coordinate[label=below left:$S$]  (S) at ([turn]-90:2)
     coordinate[label=above right:$T$] (T) at ([turn] 90:2)
;

%\fill[gray!60] (Q) arc[start angle=-53, end angle=68] -- cycle; % arc
\fill[gray!60] (Q) arcto (R)-- cycle; % arcto
\draw[thick, line join=round]
  (R) -- (P) -- (Q) -- cycle
  (S) -- (T)
  (0,0) circle[];
\end{tikzpicture}
\end{document}

输出

在此处输入图片描述

答案2

我可能会使用极坐标并预先定义它们。这样,以后向现有绘图添加内容就容易得多。以下代码中的度数值是近似值,这就是为什么结果与您的结果略有不同。

\documentclass[border=10mm]{standalone}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[thick, font=\large]

% define coordinates for origin as well as for P, Q and R
\coordinate (o) at (0:0);
\coordinate (p) at (155:2.2);
\coordinate (q) at (-50.5:2.2);
\coordinate (r) at (65:2.2);

% draw the section to be filled first in order to place it in the background
\fill[gray!60] (r) arc[start angle=65, end angle=-50, radius=2.2] -- cycle;

% draw the circle
\draw (o) circle (2.2);

% draw the tangential line in two steps using the coordinate for Q and attach labels to it
\draw[blue] (q) -- ([turn]90:2) node[above right] {$T$};
\draw[blue] (q) -- ([turn]-90:2) node[below left] {$S$};

% draw the triangle using the above defined coordinates and attach labels to it
\draw[red] (p) node[left] {$P$} -- (q) node[below right] {$Q$} -- (r) node[above right] {$R$} -- cycle;

\end{tikzpicture}

\end{document}

在此处输入图片描述

相关内容