连续的正三角形

连续的正三角形

我怎样才能正确对齐这些三角形? 中间三角形未对齐

我的 MWE:

\documentclass{standalone} 
\usepackage{tikz}
\usetikzlibrary{positioning,shapes}
\begin{document}
\begin{tikzpicture}[border rotated/.style = {shape border rotate=180},triangle/.style={draw, shape=regular polygon, regular polygon
sides=3,draw,thick,inner sep=0pt,minimum size=2cm,inner sep=0pt,outer
sep=0pt}]  
\node [triangle,fill=yellow!15](1) {}; 
\node [triangle,fill=red!25,border rotated,right=0pt of 1](2)  {}; 
\node [triangle,fill=blue!15,right=0pt of 2](3) {}; 
\end{tikzpicture}
\end{document}

答案1

喜欢这个吗?(positioning这个没用。)

\documentclass{standalone} 
\usepackage{tikz}
\usetikzlibrary{positioning,shapes}
\begin{document}
\begin{tikzpicture}[border rotated/.style = {shape border rotate=180},triangle/.style={draw, shape=regular polygon, regular polygon
sides=3,draw,thick,inner sep=0pt,minimum size=2cm,inner sep=0pt,outer
sep=0pt}]  
\node [triangle,fill=yellow!15](1) {}; 
\node [triangle,fill=red!25,border rotated,anchor=corner 3] at (1.corner 1) (2)  {}; 
\node [triangle,fill=blue!15,right=0pt of 2,anchor=corner 1] at (2.corner 2)(3) {}; 
\end{tikzpicture}
\end{document}

在此处输入图片描述

使用合适的 后角落看起来会更好line join

\documentclass{standalone} 
\usepackage{tikz}
\usetikzlibrary{positioning,shapes}
\begin{document}
\begin{tikzpicture}[border rotated/.style = {shape border rotate=180},triangle/.style={draw, shape=regular polygon, regular polygon
sides=3,draw,thick,inner sep=0pt,minimum size=2cm,inner sep=0pt,outer
sep=0pt},line join=round]  
\node [triangle,fill=yellow!15](1) {}; 
\node [triangle,fill=red!25,border rotated,anchor=corner 3] at (1.corner 1) (2)  {}; 
\node [triangle,fill=blue!15,right=0pt of 2,anchor=corner 1] at (2.corner 2)(3) {}; 
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容