我尝试填充一个圆弧段,但遇到了麻烦。这是我的 MWE:
\documentclass[10pt]{scrartcl}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usetikzlibrary{calc,backgrounds}
\usetkzobj{all}
\begin{document}
\begin{tikzpicture}
\tkzDefPoints{0/0/C, 4/0/B}
\tkzDrawTriangle[pythagore](C,B)
\tkzGetPoint{A}
\tkzDefCircle[circum](A,B,C)
\tkzGetPoint{O}
\tkzGetLength{cr}
\tkzDrawCircle[R](O,\cr pt)
\tkzDrawPoints(O)
\tkzLabelPoints[left](A)
\tkzLabelPoints[right](C)
\tkzLabelPoints[above left](B)
\tkzLabelPoints[below](O)
\tkzLabelSegment[above left](A,B){\Large 6 cm}
\tkzLabelSegment[above right](B,C){\Large 8 cm}
\begin{scope}[fill=gray, opacity=0.5]
\fill[clip] (B) -- (A) arc (90:-90:1.5cm) -- cycle;
\end{scope}
\end{tikzpicture}
\end{document}
我将把图片旋转 143 度。
答案1
使用库确实很容易calc
。使用tkz-euclide
如果你会说法语,而我不会。
\documentclass[10pt]{scrartcl}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usetikzlibrary{calc,backgrounds}
\usetkzobj{all}
\begin{document}
\begin{tikzpicture}
\tkzDefPoints{0/0/C, 4/0/B}
\tkzDrawTriangle[pythagore](C,B)
\tkzGetPoint{A}
\tkzDefCircle[circum](A,B,C)
\tkzGetPoint{O}
\tkzGetLength{cr}
\tkzDrawCircle[R](O,\cr pt)
\tkzDrawPoints(O)
\tkzLabelPoints[left](A)
\tkzLabelPoints[right](C)
\tkzLabelPoints[above left](B)
\tkzLabelPoints[below](O)
\tkzLabelSegment[above left](A,B){\Large 6 cm}
\tkzLabelSegment[above right](B,C){\Large 8 cm}
\begin{scope}[fill=gray, opacity=0.5]
\fill let \p1=($(A)-(O)$),\p2=($(B)-(O)$),
\n1={atan2(\y1,\x1)},\n2={atan2(\y2,\x2)},\n3={veclen(\x1,\y1)} in
(B) -- (A) arc (\n1:\n2:\n3) -- cycle;
\end{scope}
\end{tikzpicture}
\end{document}
解释:\p1=($(A)-(O)$)
表示 的坐标\p1
、\x1
和\y1
分别为向量 的 x 和 y 坐标O-A
,和\p2
亦然B
。相应地,\n1
和分别为和\n2
的角度以及圆的半径。这些是绘制圆弧所需的量。A
B
\n3
答案2
另提供元帖子;这里包裹在内luamplib
,因此请使用进行编译lualatex
。
[我希望我正确理解了楼主的“将图片旋转 143 度”。]
\documentclass[border=5mm]{standalone}
\usepackage{luatex85}
\usepackage{luamplib}
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1);
path o;
o = fullcircle scaled 10 cm;
% "time" around the circle, 360° = 8 points
numeric a, b, c;
c = 0; % = 0°
b = 2/45 angle (3,4); % = 106.26°
a = 4; % = 180°
pair A, B, C;
C = point c of o;
B = point b of o;
A = point a of o;
fill subpath (b,a) of o -- cycle withcolor 3/4 white;
draw o;
draw A--B--C--cycle;
dotlabel.lft("$A$", A);
dotlabel.top("$B$", B);
dotlabel.rt ("$C$", C);
dotlabel.bot("$O$", origin);
label.lrt (decimal round(abs(A-B)/cm) & "\thinspace cm", 1/2[A,B]);
label.llft(decimal round(abs(B-C)/cm) & "\thinspace cm", 1/2[B,C]);
endfig;
\end{mplibcode}
\end{document}
答案3
它只是角度 AOB 一半的计算误差,其测量值为反正弦(3/5)或约为 36.8699 度,半径为 2.5 厘米。
这给出:
\fill[clip] (B) -- (A) arc (36.8699:-36.8699:2.5cm) -- cycle;
完整代码:
\documentclass[10pt]{scrartcl}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usetikzlibrary{calc,backgrounds}
\usetkzobj{all}
\begin{document}
\begin{tikzpicture}
\tkzDefPoints{0/0/C, 4/0/B}
\tkzDrawTriangle[pythagore](C,B)
\tkzGetPoint{A}
\tkzDefCircle[circum](A,B,C)
\tkzGetPoint{O}
\tkzGetLength{cr}
\tkzDrawCircle[R](O,\cr pt)
\tkzDrawPoints(O)
\tkzLabelPoints[left](A)
\tkzLabelPoints[right](C)
\tkzLabelPoints[above left](B)
\tkzLabelPoints[below](O)
\tkzLabelSegment[above left](A,B){\Large 6 cm}
\tkzLabelSegment[above right](B,C){\Large 8 cm}
\draw[fill=gray!50] (B) -- (A) arc (asin(3/5:-asin(3/5):2.5cm) -- cycle;
\end{tikzpicture}
\end{document}