I guess this must be quite simple, but all I've tried didn't work so far.
All I want is to get some triangles on the edge of a framework.
Something like this:
My code looks like this:
\documentclass[tikz]{standalone}
\usetikzlibrary{calc,decorations.markings}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[scale=1,inner sep=0pt,thick,dot/.style={draw,circle,minimum size=4pt},
put coord sys/.style={
decoration={markings,
mark= at position 0.5
with
{
\draw[-latex,ultra thin,blue!80!black] (2pt,2pt) -- ++(5mm,0) node[above right,rotate=\pgfdecoratedangle] {$\scriptstyle x$};
\draw[-latex,ultra thin,green!80!black] (2pt,2pt) -- ++(0,5mm) node[above right,rotate=\pgfdecoratedangle] {$\scriptstyle y$};
}
},
postaction=decorate}]
%\draw [help lines] (0,0) grid (3,4);
\node[dot] (2) at (0,0) [label={[label distance=1mm]270:2}] {};
\node[dot] (3) at (0,2) [label={[label distance=1mm]180:3}] {};
\node[dot] (1) at (0,4) [label={[label distance=1mm]90:1}] {};
\node[dot] (4) at (3,2) [label={[label distance=1mm]0:4}] {};
\node[dot] (5) at (2.5,4) [label={[label distance=1mm]45:5}] {};
%\draw[gray] ++(150:0.3) -- (0,0);
%\draw[gray] ++(-150:0.3) -- (0,0);
%\draw[gray] ++(180:0.3) -- (-.3,0);
%\draw[gray] ++(0,4) -- (150:1);
%\draw[gray] ++(-150:0.3) -- (0,4);
%\draw[gray] ++(180:0.3) -- (-.3,4);
%\draw (2) -- (3) node [midway,sloped,above] {3};
%\draw (3) -- (4) node [midway,above,sloped] {4};
%\draw (2) -- (4) node [midway,above,sloped] {6};
%\draw (3) -- (1) node [midway,above,sloped] {2};
%\draw (1) -- (5) node [midway,above,sloped] {1};
%\draw (3) -- (5) node [midway,above,sloped] {5};
%\draw (4) -- (5) node [midway,above,sloped] {7};
\draw[put coord sys] (2) -- (3);
\draw[put coord sys] (3) -- (4);
\draw[put coord sys] (2) -- (4);
\draw[put coord sys] (1) -- (3);
\draw[put coord sys] (1) -- (5);
\draw[put coord sys] (4) -- (5);
\draw[put coord sys] (3) -- (5);
\end{tikzpicture}
\end{document}
The "trick" with the \draw[gray] ++(150:0.3) -- (0,0);
command doesn't work very well. In fact it doesn't work at all in this way 🙂
Does anyone have any ideas how to get these triangles?
Best Answer
The solution with the library
tikz-mec
(documentation only in Italian, but the examples and the shape details make it quite easy to be used):The result:
A foreach loop has been implemented to avoid writing some paths and it has been introduced a background to resemble the picture posted.