但我无法完成最后的细节。
\documentclass{article}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{tikzpicture}[scale=1]
\tkzDefPoint(0,0){A}
\tkzDefPoint(6,0){B}
\tkzDefPoint(6,5){C}
\tkzDefPoint(0,5){D}
\tkzDefPoint (3,3){E}
\tkzDrawPolygon[ultra thick](A,B,C,D)
\tkzDrawPoints(A,B,C,D)
\tkzLabelPoints[above right](B,C)
\tkzLabelPoints[above left](A,D)
\tkzDefMidPoint(A,B) \tkzGetPoint{O}
\tkzDefMidPoint(D,C) \tkzGetPoint{F}
\tkzDrawArc[ultra thick](O,B)(A)
\tkzDrawArc[ultra thick](F,D)(C)
\begin{scope}
\tkzClipCircle(A,B)
\end{scope}
\end{tikzpicture}
\end{document}
我只能做以下事情:
答案1
ultra
我无法编译您的代码 -无法找到其中的命令(尽管这可能是我的问题;我只有 TeXLive 2016)。我改用了tikz
以下代码的包。
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
% Bounding rectangle
\draw (0,0) rectangle (6,5);
% Middle fill
\begin{scope}
\clip (0,0) arc (180:0:3);
\clip (0,5) arc (180:360:3);
\fill[gray] (0,0) rectangle (6,5);
\end{scope}
% Half circles
\draw (0,0) arc (180:0:3);
\draw (0,5) arc (180:360:3);
% Labels
\node[anchor=west] at (6,2.5) {8 cm};
\node[anchor=south] at (3,5) {10 cm};
\draw[|<->|] (1.3,3.3) to node[fill=white,midway] {?} (4.7,3.3);
\end{tikzpicture}
\end{document}
注意,fill
在绘制半圆之前调用,否则填充边界上的半圆部分会略窄。结果如下:
答案2
\documentclass{article}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{tikzpicture}[>=stealth]
\tkzDefPoint(0,0){A}
\tkzDefPoint(6,0){B}
\tkzDefPoint(6,5){C}
\tkzDefPoint(0,5){D}
\tkzDefPoint (3,3){E}
\tkzDrawPolygon[ultra thick](A,B,C,D)
\tkzDrawPoints(A,B,C,D)
\tkzLabelPoints[below left](A)
\tkzLabelPoints[below right](B)
\tkzLabelPoints[above right](C)
\tkzLabelPoints[above left](D)
\tkzDefMidPoint(A,B) \tkzGetPoint{O}
\tkzDefMidPoint(D,C) \tkzGetPoint{F}
\begin{scope}
\tkzClipCircle(O,A)
\tkzDrawCircle[fill=gray!50, opacity=.5](F,C)
\end{scope}
\tkzDrawArc[ultra thick](O,B)(A)
\tkzDrawArc[ultra thick](F,D)(C)
\tkzInterCC(O,B)(F,D) \tkzGetPoints{I}{J}
\draw[|<->|] ($(I)+(0,1)$) to node[fill=white] {?} ($(J)+(0,1)$);
\tkzLabelSegment[right](B,C){8 cm}
\tkzLabelSegment[above](C,D){10 cm}
\end{tikzpicture}
\end{document}
答案3
在等待tkz-euclide
支持时,这里有一个版本元帖子使用luamplib
。用 编译lualatex
。
\RequirePackage{luatex85}
\documentclass[border=5mm]{standalone}
\usepackage{luamplib}
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1);
numeric u; u = 8mm;
numeric a,b; a = 10u; b = 8u;
path box, arc[], union, question;
box = unitsquare xscaled a yscaled b;
arc1 = halfcircle scaled arclength subpath(0,1) of box
shifted point 1/2 of box;
arc2 = halfcircle rotated 180
scaled arclength subpath(2,3) of box
shifted point 5/2 of box;
union = buildcycle(arc1,arc2);
question = (point 0 of union -- point 1/2 length(union) of union) shifted (0,1/2u+1/2*abs(a-b));
fill union withcolor 3/4[blue,white];
draw arc1; draw arc2;
draw box withpen pencircle scaled 1;
draw (up--down) scaled 2 shifted point 0 of question;
draw (up--down) scaled 2 shifted point 1 of question;
drawdblarrow question;
label.top(decimal round(arclength(subpath(2,3) of box)/u) & " cm", point 5/2 of box);
label.rt (decimal round(arclength(subpath(1,2) of box)/u) & " cm", point 3/2 of box);
picture q;
q = thelabel("?", point 1/2 of question);
unfill bbox q;
draw q;
% uncomment this to show the answer instead of the ?
% picture a;
% a = thelabel(decimal round(arclength(question)/u) & " cm", point 1/2 of question);
% unfill bbox a;
% draw a;
endfig;
\end{mplibcode}
\end{document}