免費論壇 繁體 | 簡體
Sclub交友聊天~加入聊天室當版主
分享
Board logo

标题: 很久没用TiKZ画了,尽洪荒之力了 [打印本页]

作者: isee    时间: 2017-10-17 19:47     标题: 很久没用TiKZ画了,尽洪荒之力了

就是为了画初等数学讨论区的 平凡但较难证明的几何题:中点+等线段

尽洪荒之力了,用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 (2017-10-17 19:50, 5.33 KB) / 下载次数 389
http://kuing.orzweb.net/attachment.php?aid=5470&k=1233865bac8337ffa89bc9ae6172df52&t=1711708132&sid=g2h1gn


作者: zhcosin    时间: 2017-10-17 22:58

果然还是 Asymptote 更适合画数学图,这种图 Asymptote 就三五行代码就完事了,而且语法简单。
作者: kuing    时间: 2017-10-17 23:01

回复 2# zhcosin

写来瞧瞧
作者: isee    时间: 2017-10-17 23:06

回复 2# zhcosin


    画数学几何图,几何画板,,,
作者: 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);
作者: 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 (2017-10-18 08:27, 3.5 KB) / 下载次数 431
http://kuing.orzweb.net/attachment.php?aid=5471&k=f3a88dc04c4272e3189d9963663b74e7&t=1711708132&sid=g2h1gn






欢迎光临 悠闲数学娱乐论坛(第2版) (http://kuing.orzweb.net/) Powered by Discuz! 7.2