找回密码
 快速注册
搜索
查看: 1503|回复: 5

很久没用TiKZ画了,尽洪荒之力了

[复制链接]

830

主题

4862

回帖

3万

积分

积分
36159

显示全部楼层

isee 发表于 2017-10-17 19:47 |阅读模式
就是为了画初等数学讨论区的 平凡但较难证明的几何题:中点+等线段

尽洪荒之力了,用TiKZ画图的,还更简单的画法么?哦,注意,需加 \usetikzlibrary{calc}。
  1.                 \begin{tikzpicture}[line width=0.75pt]
  2.                         \coordinate [label=right:{$A$}] (a) at (0,0);
  3.                         \coordinate [label=left:{$B$}] (b) at (-2,0);
  4.                         \coordinate [label=right:{$C$}] (c) at (0,4);
  5.                         \draw (a)--(b)--(c)--cycle;
  6.                         \pgfmathsetmacro{\x}{-3}
  7.                         \pgfmathsetmacro{\y}{3}
  8.                         \draw (\x,\y) coordinate[label=left:{$D$}] (d)--(c);
  9.                         \path ($(c)!1!-26.57:(d)$) coordinate (d1);
  10.                         \draw (d)--($(c)!(d)!(d1)$) coordinate [label=above:{$E$}] (e)--(c)--cycle;
  11.                         \draw (d)--(b);
  12.                         \draw[red,fill] ($(d)!0.5!(b)$) coordinate [label=left:{$F$}] (f) circle (1pt);
  13.                         \draw (a)--(f)--(e);
  14.                         \draw[dashed,line width=0.5,blue](a)--(e);
  15.                         \draw[dashed,line width=0.5,blue](f)--($(a)!0.5!(e)$) node[right]{$G$};
  16. \end{tikzpicture}
复制代码
sampe.png

52

主题

403

回帖

2896

积分

积分
2896
QQ

显示全部楼层

zhcosin 发表于 2017-10-17 22:58
果然还是 Asymptote 更适合画数学图,这种图 Asymptote 就三五行代码就完事了,而且语法简单。

730

主题

1万

回帖

9万

积分

积分
93623
QQ

显示全部楼层

kuing 发表于 2017-10-17 23:01
回复 2# zhcosin

写来瞧瞧

830

主题

4862

回帖

3万

积分

积分
36159

显示全部楼层

 楼主| isee 发表于 2017-10-17 23:06
回复 2# zhcosin


    画数学几何图,几何画板,,,

830

主题

4862

回帖

3万

积分

积分
36159

显示全部楼层

 楼主| isee 发表于 2017-10-17 23:26
回复 2# zhcosin


    当然,TiKZ的语言是丰富的,我用的仅仅只是最浅层的。理论有对称,旋转命令,只是我不知,我可不能代表TiKZ的“层次”。

   其次,特意找了  Asymptote 作图实例,我个感觉,大体与TiKZ类似,至少语言与用法上。

某个实例的节选如下

//三角形ABC
paira=(2cm,1cm),b=(7cm,3cm),c=(3cm,7cm);
draw(a--b--c--cycle);
//中垂线、外心、外接圆
paird=0.5(a+b),e=0.5(b+c),f=0.5(c+a);
pairo=extension(d,rotate(90,d)*b,e,rotate(90,e)*b);
draw(circle(o,abs(o-a)),red);
draw(o--d,blue);
draw(o--e,blue)
draw(o--f,blue);

830

主题

4862

回帖

3万

积分

积分
36159

显示全部楼层

 楼主| isee 发表于 2017-10-18 08:24
回复 5# isee


    改进,利用几何变换作图——整体画图,部分核心代码
  1.             \begin{tikzpicture}[line width=0.75pt]
  2.                         \draw (0,0)--(0,-4)--(-2,-4) coordinate [label=left:{$B$}] (b) --cycle;
  3.                         \draw[xscale=-1,rotate=86,scale=0.8,red](0,0)--(0,-4)--(-2,-4) coordinate[label=left:{$D$}] (d)--cycle;
  4.                         \draw (d)--(b);
  5.         \end{tikzpicture}
复制代码
sampe2.png

手机版|悠闲数学娱乐论坛(第3版)

GMT+8, 2025-3-4 16:38

Powered by Discuz!

× 快速回复 返回顶部 返回列表