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

该博客介绍了如何利用LaTeX的TikZ库来绘制一个圆内接的正七边形。首先,作圆的垂直中心线,并以圆上的点为圆心画弧,找到与圆的两个交点,接着通过这些点构造出正七边形的边。文章详细展示了代码实现过程,包括各个步骤的解释和图形的绘制。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

做法

  1. 作圆的垂直中心线AB, CDAB,\,CDAB,CD;
  2. DDD为圆心, DODODO为半径作圆弧交圆周于E, FE,\,FE,F点, 连接EFEFEFCDCDCDGGG, GFGFGF即为圆内接正七边形的边长.

图形

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=above right:$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)$);
        % 绘制弧段EOF
        \draw [red] (O) arc (90:170:2)
                    (O) arc (90:10:2);
        % 标记弧段
        \path [name path=o1] 
        let 
            \p1=($ (O) - (D) $), 
            \n2={veclen(\x1, \y1)}
        in 
            (D) circle (\n2);
        % 找到交点E,F,G
        \path [name intersections={of=o1 and o}] 
            coordinate [label=left:$E$] (E) at (intersection-2)
            coordinate [label=right:$F$] (F) at (intersection-1);
        \draw [name path=EF] (E) -- (F);
        \path [name intersections={of=EF and CD}] coordinate [label=above right:$G$] (G) at (intersection-1);
        % 找到其他点
        \path [name path=o2]
        let
            \p2=($ (G) - (F) $),
            \n2={veclen(\x2,\y2)}
        in 
            (C) circle (\n2);
        \path [name intersections={of=o2 and o}]
            coordinate [] (C1) at (intersection-1)
            coordinate [] (C6) at (intersection-2);

        \path [name path=o3]
        let
            \p2=($ (G) - (F) $),
            \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=($ (G) - (F) $),
            \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=($ (G) - (F) $),
            \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=($ (G) - (F) $),
            \n2={veclen(\x2,\y2)}
        in 
            (C4) circle (\n2);
        \path [name intersections={of=o6 and o}]
            coordinate [] (C5) at (intersection-1);
        % 绘制正七边形
        \draw [thick] (C) -- (C1) -- (C2) -- (C3) -- (C4) -- (C5) -- (C6) -- 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、付费专栏及课程。

余额充值