答案1
不用绘制内部三角形,只需沿原始三角形的三条线等距绘制线条即可。<pct>
从节点(a)
到节点的点的语法(b)
使用calc
库:($ (a) !<pct>! (b) $)
。通过放入<pct>
循环\foreach
,您可以绘制所有内部三角形。
这可以放入宏中以便\tritri{3}\qquad\tritri{6}\qquad\tritri{8}
产生:
我添加了一个可选参数来更改大小。默认情况下,三角形内接于半径为 1cm 的圆中。
\tritri{3}\tritri[2]{3}
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\newcommand{\tritri}[2][1]{\begin{tikzpicture}
\draw(90:#1)node(a){}--(210:#1)node(b){}--(330:#1)node(c){}--cycle;
\foreach \t[evaluate=\t as \r using (\t-1)/#2] in {2,...,#2}{
\draw($ (a) !\r! (b) $)--($ (a) !\r! (c) $);
\draw($ (a) !\r! (c) $)--($ (b) !\r! (c) $);
\draw($ (b) !\r! (c) $)--($ (b) !\r! (a) $);
}
\end{tikzpicture}}
\begin{document}
\tritri{3}\qquad\tritri{6}\qquad\tritri{8}
\end{document}
答案2
我认为你可以尝试类似的程序
为了原型目的,我使用以下代码制作了一个示例乳胶代码tikz 帮助站点:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\title{test}
\author{pentagon}
\begin{document}
\maketitle
\tikzset{every picture/.style={line width=0.75pt}} %set default line width to 0.75pt
\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
%uncomment if require: \path (0,278); %set diagram left start at 0, and has height of 278
%Shape: Triangle [id:dp09631185098075057]
\draw (179.5,49) -- (282,225.16) -- (77,225.16) -- cycle ;
%Shape: Triangle [id:dp13133055426437013]
\draw (179.5,224.61) -- (128,139.08) -- (231,139.08) -- cycle ;
%Shape: Triangle [id:dp001433677293123603]
\draw (179.78,109.33) -- (161.57,80.61) -- (198,80.61) -- cycle ;
%Shape: Triangle [id:dp6685327837402839]
\draw (163.07,138.04) -- (146,109.33) -- (180.14,109.33) -- cycle ;
%Shape: Triangle [id:dp34409029718729367]
\draw (197.07,138.04) -- (180.14,109.33) -- (214,109.33) -- cycle ;
%Shape: Triangle [id:dp23743278322396422]
\draw (128.5,196.33) -- (111.75,167.61) -- (145.25,167.61) -- cycle ;
%Shape: Triangle [id:dp7667441724383255]
\draw (111.75,225.04) -- (95,196.33) -- (128.5,196.33) -- cycle ;
%Shape: Triangle [id:dp605210826932941]
\draw (145.25,225.04) -- (128.5,196.33) -- (162,196.33) -- cycle ;
%Shape: Triangle [id:dp41616631919835156]
\draw (231.5,196.33) -- (214.75,167.61) -- (248.25,167.61) -- cycle ;
%Shape: Triangle [id:dp2871078395494677]
\draw (214.75,225.04) -- (198,196.33) -- (231.5,196.33) -- cycle ;
%Shape: Triangle [id:dp9503992575833584]
\draw (248.25,225.04) -- (231.5,196.33) -- (265,196.33) -- cycle ;
%Shape: Triangle [id:dp582528994709189]
\draw (180.3,167.22) -- (198,196.33) -- (162,196.33) -- cycle ;
%Shape: Triangle [id:dp3999733874796747]
\draw (196.82,138.72) -- (213.75,167.61) -- (179.5,167.37) -- cycle ;
%Shape: Triangle [id:dp030508632093482424]
\draw (163.45,138.5) -- (180.5,167.33) -- (146,167.09) -- cycle ;
\end{tikzpicture}
\end{document}
生成的 pdf 如下所示。
抱歉,我不太熟练,但我认为这个工具对于初学者来说既灵活又强大。对于其他数量的三角形,您还可以通过拖放、添加新三角形、复制和粘贴三角形、调整其大小等方式调整图形。希望我的回答对您有所帮助 :)