0
点赞
收藏
分享

微信扫一扫

TikZ绘图示例——尺规作图:任意等分半圆弧

郝春妮 2022-08-26 阅读 95


做法

将一个半圆五等分, 做法如下:

  1. 把半圆的直径分为等分;
  2. 分别以为圆心,长为半径, 作圆弧交于点;
  3. 与各分点的连线并延长交半圆于, 即把半圆弧分成等分.

图形

TikZ绘图示例——尺规作图:任意等分半圆弧_连线_09

TikZ代码

\documentclass[tikz, border=5pt]{standalone}
% 用于计算点的坐标
\usetikzlibrary{calc}
% 用于计算交点
\usetikzlibrary{intersections,through}

\begin{document}
\begin{tikzpicture}

% \draw[step=1cm,very thin, gray] (-2,0) grid (3,-4);
\coordinate[label=above right:$A$] (A) at (1,0);
\coordinate[label=below right:$B$] (B) at (1,-4);

% 绘制半圆
\draw (A) arc (90:270:2);
% 标记半圆为H
\coordinate [name path=H,circle through=(A)] (H) at ($(A)!.5!(B)$);

% 绘制线段AB
\path [draw] (A) -- (B);
% 以A,B为圆心, AB长为半径做圆弧
\draw let \p1=($ (A) - (B) $), \n2={veclen(\x1, \y1)}
in (A) arc (90:20:\n2)
(B) arc (-90:-20:\n2);
% 标记两个圆弧段的位置
\node (D) [name path=D,circle through=(B)] at (A) {};
\node (E) [name path=E,circle through=(A)] at (B) {};
\path [name intersections={of=D and E}];
% 标记第二个交点为O
\coordinate [label=right:$O$] (O) at (intersection-2);

% 循环绘制各交点:这里需要分成两部分进行绘制
\foreach \i in {1,2}{
% 等分直径AB并做标记
\coordinate[label=above right:$\i$] (\i) at ($(A)!\i/5!(B)$);
% 作延长线(不绘制)
\path [name path=O--\i] (O) -- ($(O)!2!(\i)$);
% 标记交点
\path [name intersections={of=H and O--\i,by={\i'}}]
coordinate[label=above left:$\i'$] (\i') at (intersection-2);
\draw (O) -- (\i');
}
\foreach \i in {3,4}{
% 等分直径AB并做标记
\coordinate[label=below right:$\i$] (\i) at ($(A)!\i/5!(B)$);
% 作延长线(不绘制)
\path [name path=O--\i] (O) -- ($(O)!2!(\i)$);
% 标记交点
\path [name intersections={of=H and O--\i,by={\i'}}]
coordinate[label=below left:$\i'$] (\i') at (intersection-1);
\draw (O) -- (\i');
}
\end{tikzpicture}
\end{document}


举报

相关推荐

0 条评论