我正在尝试绘制下面的主要部分:
我已经通过以下代码取得了一些进展,但并不完全是我想要的,因为我无法填充该部门的最后一点。
\documentclass[]{article}
\usepackage[margin=0.5in]{geometry}
\usepackage{pgfplots}
\renewcommand{\thesection}{\arabic{section}}
\usepackage{booktabs, makecell, multirow}
\usepackage{stackengine,graphicx,xcolor}
\usepackage{lscape}
\usetikzlibrary{arrows}
\usepackage{flexisym}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{decorations.markings}
\newenvironment{tightcenter}{
\setlength\topsep{0pt}
\setlength\parskip{0pt}
\begin{center}}{\end{center}}
\begin{document}
\begin{tikzpicture}[scale=1.2]
%cylinder
\draw[black,thick,dotted] (0,0) circle (1.3cm);
\fill[fill=black,opacity=0.8] (-0.2,0.2) circle (0.8mm);
%\fill[fill=black,opacity=0.8] (+0.2,0.2) circle (0.8mm);
\fill[fill=black,opacity=0.8] (-0.2,-0.2) circle (0.8mm);
\fill[fill=black,opacity=0.8] (+0.2,-0.2) circle (0.8mm);
%\draw [thick,dashed] (7,1) -- (8.2,1);
%\draw[thick,<->](3.4,-1.52) to node[fill=white] {$3.5$ cm} (3.4,-3.22);
\draw [thick,domain=95:355] plot ({1.3*cos(\x)}, {1.3*sin(\x)});
%
\draw [thick,domain=94:270,fill=gray,opacity=0.5] plot ({1.3*cos(\x)}, {1.3*sin(\x)});
%\draw [thick,domain=270:300,fill=red,opacity=0.5] plot ({1.3*cos(\x)}, {1.3*sin(\x)});
\draw [thick] (1.3,-0.15) -- (0,0) -- (-0.15,1.3);
%\\
\draw [thick](0,0)++(0:0.25) arc (0:79:0.3);
\node[above] at (0.4,0.2) {$50^{\circ}$};
\end{tikzpicture}
\end{document}
答案1
您可以绘制轮廓并用一行代码填充它\draw [thick, fill=gray, fill opacity=0.5] (0,0) -- (95:1.3) arc (95:355:1.3) -- cycle;
。
\documentclass[]{article}
\usepackage[margin=0.5in]{geometry}
\usepackage{pgfplots}
\renewcommand{\thesection}{\arabic{section}}
\usepackage{booktabs, makecell, multirow}
\usepackage{stackengine,graphicx,xcolor}
\usepackage{lscape}
\usetikzlibrary{arrows}
\usepackage{flexisym}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{decorations.markings}
\newenvironment{tightcenter}{
\setlength\topsep{0pt}
\setlength\parskip{0pt}
\begin{center}}{\end{center}}
\begin{document}
\begin{tikzpicture}[scale=1.2]
%cylinder
\draw[black,thick,dotted] (0,0) circle (1.3cm);
\fill[fill=black,opacity=0.8] (-0.2,0.2) circle (0.8mm);
\fill[fill=black,opacity=0.8] (-0.2,-0.2) circle (0.8mm);
\fill[fill=black,opacity=0.8] (+0.2,-0.2) circle (0.8mm);
\draw [thick, fill=gray, fill opacity=0.5] (0,0) -- (95:1.3) arc (95:355:1.3) -- cycle;
\draw [thick](0,0)++(0:0.25) arc (0:79:0.3);
\node[above] at (0.4,0.2) {$50^{\circ}$};
\end{tikzpicture}
\end{document}
它(95:1.3)
会将您移动到外围的起点,然后绘制arc (95:355:1.3)
起始角为 95 度、终止角为 355 度、半径为 1.3 度的圆弧。这样您就不必摆弄正弦和余弦了。
我希望我没有误解你想要实现的目标!
此致! 弗里德
编辑:我改成opacity=...
了fill opacity=...
。否则虚线会透出来。