TikZ绘图示例——尺规作图: 圆内接正九边形的近似画法

做法

  1. 作圆的垂直中心线 A B ,   C D AB,\,CD AB,CD;
  2. B B B为圆心, B C BC BC为半径作圆弧与 A B AB AB交于点 G G G;
  3. G G G为圆心, G C GC GC为半径作圆弧交 A B AB AB F F F点;
  4. B B B为圆心, B F BF BF为半径作圆弧交圆周于 E E E点;
  5. 连接 A E AE AE交圆弧 C F ^ \widehat{CF} CF H H H点;
  6. 连接 O H OH OH, O H OH OH即为内接正九边形的边长.

图形

1

代码

\documentclass[tikz,border=3pt]{standalone}
\usetikzlibrary{calc}
\usetikzlibrary{intersections,through}

\begin{document}
    \begin{tikzpicture}[]
        % 标记点A,B,C,D,O
        \coordinate [label=below left:$A$] (A) at (0,0);
        \coordinate [label=below right:$B$] (B) at (4,0);
        \coordinate [label=above left:$C$] (C) at (2,2);
        \coordinate [label=below right:$D$] (D) at (2,-2);
        \coordinate [label=below left:$O$] (O) at (2,0);
        % 圆o
        \draw [name path=o] (O) circle (2);
        % AB, CD为圆的垂直中心线
        \draw [densely dashed,-latex,name path=AB] ($(A)!-.1!(B)$) -- ($(A)!1.1!(B)$);
        \draw [densely dashed,latex-,name path=CD] ($(C)!-.1!(D)$) -- ($(C)!1.1!(D)$);
        % 以B为圆心, BC为半径
        \path [name path=oCG]
        let 
            \p1=($(B)-(C)$),
            \n1={veclen(\x1,\y1)}
        in 
            (B) circle (\n1);
        % 标记圆弧与AB的交点G
        \path [name intersections={of=oCG and AB}]
            coordinate [label=below left:$G$] (G) at (intersection-1);
        % 绘制弧段
        \draw [red]
        let 
            \p1=($(B)-(C)$),
            \n1={veclen(\x1,\y1)}
        in 
            (G) arc (180:120:\n1)
            (G) arc (180:185:\n1);

        % 以G为圆心, GC为半径
        \path [name path=oCF]
        let 
            \p1=($(G)-(C)$),
            \n1={veclen(\x1,\y1)}
        in 
            (G) circle (\n1);
        \path [name intersections={of=AB and oCF}]
            coordinate [label=below left:$F$] (F) at (intersection-1);
        \draw [red] 
        let 
            \p1=($(G)-(C)$),
            \n1={veclen(\x1,\y1)}
        in 
            (F) arc (0:75:\n1)
            (F) arc (0:-5:\n1);

        % 以B为圆心, BF为半径
        \path [name path=oEF]
        let 
            \p1=($(B)-(F)$),
            \n1={veclen(\x1,\y1)}
        in 
            (B) circle (\n1);
        \path [name intersections={of=o and oEF}]
            coordinate [label=right:$E$] (E) at (intersection-1);
        \draw [red] 
        let 
            \p1=($(B)-(F)$),
            \n1={veclen(\x1,\y1)}
        in 
            (F) arc (180:90:\n1)
            (F) arc (180:190:\n1);

        % 连接AE交圆弧CF
        \draw [name path=AE] (A) -- (E);
        \path [name intersections={of=oCF and AE}]
            coordinate [label=above right:$H$] (H) at (intersection-1);
        % 连接OH
        \draw [thick] (O) -- (H);

        % 找到其他点
        \path [name path=o2]
        let
            \p2=($ (O) - (H) $),
            \n2={veclen(\x2,\y2)}
        in 
            (C) circle (\n2);
        \path [name intersections={of=o2 and o}]
            coordinate [] (C1) at (intersection-1)
            coordinate [] (C8) at (intersection-2);

        \path [name path=o3]
        let
            \p2=($ (O) - (H) $),
            \n2={veclen(\x2,\y2)}
        in 
            (C1) circle (\n2);
        \path [name intersections={of=o3 and o}]
            coordinate [] (C2) at (intersection-2);

        \path [name path=o4]
        let
            \p2=($ (O) - (H) $),
            \n2={veclen(\x2,\y2)}
        in 
            (C2) circle (\n2);
        \path [name intersections={of=o4 and o}]
            coordinate [] (C3) at (intersection-2);

        \path [name path=o5]
        let
            \p2=($ (O) - (H) $),
            \n2={veclen(\x2,\y2)}
        in 
            (C3) circle (\n2);
        \path [name intersections={of=o5 and o}]
            coordinate [] (C4) at (intersection-2);

        \path [name path=o6]
        let
            \p2=($ (O) - (H) $),
            \n2={veclen(\x2,\y2)}
        in 
            (C4) circle (\n2);
        \path [name intersections={of=o6 and o}]
            coordinate [] (C5) at (intersection-1);

        \path [name path=o7]
        let
            \p2=($ (O) - (H) $),
            \n2={veclen(\x2,\y2)}
        in 
            (C5) circle (\n2);
        \path [name intersections={of=o7 and o}]
            coordinate [] (C6) at (intersection-1);

        \path [name path=o8]
        let
            \p2=($ (O) - (H) $),
            \n2={veclen(\x2,\y2)}
        in 
            (C6) circle (\n2);
        \path [name intersections={of=o8 and o}]
            coordinate [] (C7) at (intersection-1);
        % 绘制正九边形
        \draw [thick] (C) -- (C1) -- (C2) -- (C3) -- (C4) -- (C5) -- (C6) -- (C7) -- (C8) -- cycle;
    \end{tikzpicture}
\end{document}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

zorchp

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值