如何绘制所示圆的周长(我画两个相交的圆)

如何绘制所示圆的周长(我画两个相交的圆)

我想要获得这个:

1

我迄今已努力并实现了这一 MWE:

\documentclass[12pt]{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}
\usetikzlibrary {calc}

\newcommand{\MarkRightAngle}[4][.3cm]% #1=size (optional), #2-#4 three points: \angle #2#3#4
{\coordinate (tempa) at ($(#3)!#1!(#2)$);
    \coordinate (tempb) at ($(#3)!#1!(#4)$);
    \coordinate (tempc) at ($(tempa)!0.5!(tempb)$);%midpoint
    \draw (tempa) -- ($(#3)!2!(tempc)$) -- (tempb);
}

\begin{document}
    \begin{tikzpicture}[scale=1,>=latex,x=1cm,y=0.8cm]
        
        \draw[fill=blue!7] (0,0) ellipse (4 and 4);% a circle 
        \draw[fill=blue!7] (-4,0) arc (180:360:4 and 4);% left half of the circle starting at (-4,0) from 180 to 360
        \draw[fill=white!7] (0,-3) ellipse (3 and 3);% a circle 
        
        \draw (0,0.2) node {$A$};
        \draw (0,-3.6) node {$C$};
        \draw (-3.5,-3.1) node {$D$};   
        \draw (3.5,-3.1) node {$B$};
        \draw (1.5,-3.2) node {$a$};    
        
        % Create right angle
        \coordinate (A) at (0,0);
        \coordinate (E) at (1.6,-1.4);
        \coordinate (C) at (0,-3);
        \MarkRightAngle{A}{E}{C}
        
        \draw[dashed] (0,-3) -- (1.6,-1.4);
        \draw[-,thick] (0,0) -- (-3,-2.7) node[left, midway]  {\footnotesize $b$};
        \draw[-,thick] (0,0) -- (3,-2.7) node[right, midway]  {\footnotesize $E$};
        \draw[-,thick] (0,0) -- (0,-3) node[left, midway]  {\footnotesize $a$};
        \draw[-,thick] (-3,-2.7) -- (0,-3);
        \draw[-,thick] (3,-2.7) -- (0,-3);
        
    \end{tikzpicture}
\end{document}

2

我想显示大圆的下部周长,可以做到吗?还是我需要添加新行?就像arc?我想知道一个更好的解决方案,除了我已经使用的包之外,不需要复杂的包。谢谢。

答案1

如果您用以下方法填充较小的圆圈,则只需重新绘制大圆圈即可:

\path[fill=blue!7] (0, 0) circle[radius=4];
\draw[fill=white]  (0,-3) circle[radius=3];
\draw              (0, 0) circle[radius=4];

您还可以在较大的圆圈上安装一个夹子,然后用以下内容填充两个圆圈even odd rule

\begin{scope}
\clip                        (0, 0) circle[radius=4];
\fill[blue!7, even odd rule] (0, 0) circle[radius=4]
                             (0,-3) circle[radius=3];
\end{scope}
\draw (0, 0) circle[radius=4]
      (0,-3) circle[radius=3];

它们都将导致
在此处输入图片描述


答案的其余部分包含两种绘制图表的不同方法。

第一个使用intersections库来查找点,第二个使用数学来找到它们。

因为我喜欢用小点来表示点,所以它们都在其位置上放置了小圆圈。

代码

\documentclass[tikz]{standalone}
\usetikzlibrary{angles, intersections, quotes}
\begin{document}
\begin{tikzpicture}[
  declare function={a = 3; b = 4;},
  bigC/.style  ={insert path={(A) circle[radius=b]}},
  smallC/.style={insert path={(C) circle[radius=a]}},
]
%%% Specify all coordinates
\coordinate (A) at (0,0)
 coordinate (C) at ([shift=(down:a)] A);
\path[name path=  big,   bigC];
\path[name path=small, smallC];
\tikzset{name intersections={of=big and small, sort by=big, by={D, B}}}
\path (A) -- coordinate (E) (B);

%%% Fill the big circle minus the small one
\begin{scope}
\clip[bigC];
\fill[even odd rule, gray!50, bigC, smallC];
\end{scope}

%%% Right angle
\pic[draw] {right angle=A--E--C};

%%% All lines
\draw[bigC, smallC, auto=right,
  every edge quotes/.append style={execute at begin node=$, execute at end node=$}]
  (A) to["b"] (D) -- (C) to["a"] (B) -- cycle
  (A) to["a"] (C) edge[dashed, "h"] (E);

%%% Dots and labels
\foreach \p/\l in {A/above, B/below right, C/below, D/below left, E/above right}
  \node[circle, fill, inner sep=+0pt, minimum size=+3pt, "$\p$"\l] at (\p) {};
\end{tikzpicture}
\begin{tikzpicture}[
  declare function={
    a = 3; b = 4;
    h = .5*sqrt(4*a*a-b*b);
    alpha = asin(h/a);
  },
  bigC/.style  ={insert path={(A) circle[radius=b]}},
  smallC/.style={insert path={(C) circle[radius=a]}},
]
%%% Specify all coordinates
\coordinate (A) at (0,0)
 coordinate (C) at ([shift=(down:a)] A)
 coordinate (B) at ([shift=(-90+alpha:b)] A)
 coordinate (D) at ([shift=(-90-alpha:b)] A);
\path (A) -- coordinate (E) (B);

%%% Fill the big circle minus the small one
\begin{scope}
\clip[bigC];
\fill[even odd rule, gray!50, bigC, smallC];
\end{scope}

%%% Right angle
\pic[draw] {right angle=A--E--C};

%%% All lines
\draw[bigC, smallC, auto=right,
  every edge quotes/.append style={execute at begin node=$, execute at end node=$}]
  (A) to["b"] (D) -- (C) to["a"] (B) -- cycle
  (A) to["a"] (C) edge[dashed, "h"] (E);

%%% Dots and labels
\foreach \p/\l in {A/above, B/below right, C/below, D/below left, E/above right}
  \node[circle, draw, fill=white, inner sep=+0pt, minimum size=+3pt, "$\p$"\l] at (\p) {};
\end{tikzpicture}
\end{document}

输出

在此处输入图片描述

答案2

在此处输入图片描述

使用let ... in和具有较少硬定义点。

** 代码**

\documentclass[11pt, border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{math, calc}
\begin{document}



\begin{tikzpicture}[evaluate={\a = 2; \t = 7;}, every node/.style={scale=.8}]
  % points
  \path (0, 0) coordinate (C)
  (90: \a) coordinate (A)
  (\t : \a) coordinate (B)
  (180 -\t: \a) coordinate (D);
  % circles
  \draw[fill=red!10] (A) let
    \p1 = ($(B)-(A)$),
    \n1 = {veclen(\x1, \y1)}
  in circle (\n1);
  \draw[fill=white] (C) circle (\a);
  % segments
  \draw (C) -- node[left] {$a$} (A) -- (B) -- cycle;
  \draw (C) -- (D) -- node[above left] {$b$} (A);
  \draw[dashed] (C) -- ($(A)!(C)!(B)$) coordinate (E);
  % angle
  \draw[ultra thin] (E) -- ($(E)!.3!(A)$) coordinate (T) let
    \p1 = ($(T)-(E)$),
    \n1 = {veclen(\x1, \y1)}
  in  -- ([turn]90: \n1) -- ([turn]90: \n1); 

  \foreach \P/\pos in {C/below, A/above, B/below right, D/below left,
    E/above right%
  }{
    \draw[fill=white] (\P) node[\pos] {$\P$} circle (1.2pt);
  }
\end{tikzpicture}

\end{document}

答案3

您的代码是几乎正确的:

\documentclass[12pt]{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}
\usetikzlibrary {calc}

\newcommand{\MarkRightAngle}[4][.3cm]% #1=size (optional), #2-#4 three points: \angle #2#3#4
{\coordinate (tempa) at ($(#3)!#1!(#2)$);
    \coordinate (tempb) at ($(#3)!#1!(#4)$);
    \coordinate (tempc) at ($(tempa)!0.5!(tempb)$);%midpoint
    \draw (tempa) -- ($(#3)!2!(tempc)$) -- (tempb);
}

\begin{document}
    \begin{tikzpicture}[scale=1,>=latex,x=1cm,y=1cm] %<-- change
        
        \draw[fill=blue!7] (0,0) circle(4);% <-- change 
    %   \draw[fill=blue!7] (-4,0) arc (180:360:4);% left half of the circle starting at (-4,0) from 180 to 360
        \draw[fill=white!7] (0,-3) circle(3);% <-- change
        
        \draw (0,0.2) node {$A$};
        \draw (0,-3.6) node {$C$};
        \draw (-3.5,-3.1) node {$D$};   
        \draw (3.5,-3.1) node {$B$};
        \draw (1.5,-3.2) node {$a$};    
        
        % Create right angle
        \coordinate (A) at (0,0);
        \coordinate (E) at (1.6,-1.4);
        \coordinate (C) at (0,-3);
        \MarkRightAngle{A}{E}{C}
        
        \draw[dashed] (0,-3) -- (1.6,-1.4);
        \draw[-,thick] (0,0) -- (-3,-2.7) node[left, midway]  {\footnotesize $b$};
        \draw[-,thick] (0,0) -- (3,-2.7) node[right, midway]  {\footnotesize $E$};
        \draw[-,thick] (0,0) -- (0,-3) node[left, midway]  {\footnotesize $a$};
        \draw[-,thick] (-3,-2.7) -- (0,-3);
        \draw[-,thick] (3,-2.7) -- (0,-3);
        
    \end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容