做法
- 为圆的直径;
- 把直径等分成所求的多边形边数(例如图中分成七边形);
- 分别以为圆心,长为半径作圆弧交于点;
- 连接, 并延长交圆周于点(作任意正多边形都要通过点);
- 即为所求正多边形的边长.
图形
代码
\documentclass[tikz,border=3pt]{standalone}
\usetikzlibrary{calc}
\usetikzlibrary{intersections,through}
\begin{document}
\begin{tikzpicture}[]
% 标记点A,B,C,D,O
\coordinate [label=above left:$A$] (A) at (0,0);
\coordinate [label=above right:$B$] (B) at (4,0);
\coordinate [] (O) at (2,0);
% 圆o
\draw [name path=o] (O) circle (2);
% AB为圆的直径
\draw [densely dashed,-latex,name path=AB] ($(A)!-.1!(B)$) -- ($(A)!1.1!(B)$);
% 等分直径AB
\coordinate [label=below right:$2$] (2) at ($(A)!2/7!(B)$);
\foreach \i in {1,3,4,5,6}
\coordinate [label=below:$\i$] (\i) at ($(A)!\i/7!(B)$);
\coordinate [label=below right:$7$] (7) at ($(A)!7/7!(B)$);
\foreach \j in {1,2,...,7}
\fill (\j) ellipse [x radius=.5pt,y radius=1pt];
% 分别以A,B为圆心, AB长度为半径作圆弧交于E点
\path [name path=oAE]
let
\p1=($(B)-(A)$),
\n1={veclen(\x1,\y1)}
in
(B) circle (\n1);
\path [name path=oBE]
let
\p1=($(B)-(A)$),
\n1={veclen(\x1,\y1)}
in
(A) circle (\n1);
% 标记两圆弧的交点E
\path [name intersections={of=oAE and oBE}]
coordinate [label=above right:$E$] (E) at (intersection-1);
% 绘制弧段
\draw [red]
let
\p1=($(B)-(A)$),
\n1={veclen(\x1,\y1)}
in
(A) arc (180:117:\n1)
(B) arc (0:65:\n1);
% 连接E2
\path [name path=E2] (E) -- ($(E)!1.5!(2)$);
\path [name intersections={of=E2 and o}]
coordinate [label=below left:$F$] (F) at (intersection-2);
\draw (E) -- (F);
% 找到其他点
\path [name path=o2]
let
\p2=($ (A) - (F) $),
\n2={veclen(\x2,\y2)}
in
(F) circle (\n2);
\path [name intersections={of=o2 and o}]
coordinate [] (F1) at (intersection-2);
\path [name path=o3]
let
\p2=($ (A) - (F) $),
\n2={veclen(\x2,\y2)}
in
(F1) circle (\n2);
\path [name intersections={of=o3 and o}]
coordinate [] (F2) at (intersection-1);
\path [name path=o4]
let
\p2=($ (A) - (F) $),
\n2={veclen(\x2,\y2)}
in
(F2) circle (\n2);
\path [name intersections={of=o4 and o}]
coordinate [] (F3) at (intersection-1);
\path [name path=o5]
let
\p2=($ (A) - (F) $),
\n2={veclen(\x2,\y2)}
in
(F3) circle (\n2);
\path [name intersections={of=o5 and o}]
coordinate [] (F4) at (intersection-1);
\path [name path=o6]
let
\p2=($ (A) - (F) $),
\n2={veclen(\x2,\y2)}
in
(F4) circle (\n2);
\path [name intersections={of=o6 and o}]
coordinate [] (F5) at (intersection-1);
% 绘制正七边形
\draw [thick] (F) -- (F1) -- (F2) -- (F3) -- (F4) -- (F5) -- (A) -- cycle;
\end{tikzpicture}
\end{document}