This question is similar to How to improve my PSTricks code to construct a triangle number diagram?.
Consider the following example.
Code
% pdflatex -shell-escape test.tex
\documentclass{article}
\usepackage{
auto-pst-pdf,
pstricks-add
}
\begin{document}
\begin{figure}
\def\laengde{6}
\def\startX{3}
\def\startY{0}
\pstFPdiv\konstA{\laengde}{2}
\pstFPsub\Bmin{\startX}{\konstA}
\pstFPadd\Bmaks{\startX}{\konstA}
\pstFPadd\Hmin{\startY}{0}
\pstFPdiv\konstB{3 sqrt}{2}
\pstFPmul\Hmaks{\konstB}{\laengde}
\centering
\psset{
radius=0.2
}
\begin{pspicture}(\Bmin,\Hmin)(\Bmaks,\Hmaks)
\Cnode*(\startX,\startY){A}
\Cnode*(!\startX\space \laengde\space 8 div sub \startY\space 3 sqrt 8 div \laengde\space mul add){B}
\Cnode*(!\startX\space \laengde\space 8 div add \startY\space 3 sqrt 8 div \laengde\space mul add){C}
\Cnode*(!\startX\space \laengde\space 4 div sub \startY\space 3 sqrt 4 div \laengde\space mul add){D}
\Cnode*(!\startX\space \startY\space 3 sqrt 4 div \laengde\space mul add){E}
\Cnode*(!\startX\space \laengde\space 4 div add \startY\space 3 sqrt 4 div \laengde\space mul add){F}
\Cnode*(!\startX\space \laengde\space 3 8 div mul sub \startY\space 3 3 sqrt mul 8 div \laengde\space mul add){G}
\Cnode*(!\startX\space \laengde\space 8 div sub \startY\space 3 3 sqrt mul 8 div \laengde\space mul add){H}
\Cnode*(!\startX\space \laengde\space 8 div add \startY\space 3 3 sqrt mul 8 div \laengde\space mul add){I}
\Cnode*(!\startX\space \laengde\space 3 8 div mul add \startY\space 3 3 sqrt mul 8 div \laengde\space mul add){J}
\Cnode*(!\startX\space \laengde\space 2 div sub \startY\space 3 sqrt 2 div \laengde\space mul add){K}
\Cnode*(!\startX\space \laengde\space 4 div sub \startY\space 3 sqrt 2 div \laengde\space mul add){L}
\Cnode*(!\startX\space \startY\space 3 sqrt 2 div \laengde\space mul add){M}
\Cnode*(!\startX\space \laengde\space 4 div add \startY\space 3 sqrt 2 div \laengde\space mul add){N}
\Cnode*(!\startX\space \laengde\space 2 div add \startY\space 3 sqrt 2 div \laengde\space mul add){O}
\pspolygon(A)(K)(O)
\ncline{B}{N}
\ncline{D}{M}
\ncline{G}{L}
\ncline{B}{C}
\ncline{D}{F}
\ncline{G}{J}
\ncline{C}{L}
\ncline{F}{M}
\ncline{J}{N}
\pnode(!\startX\space \laengde\space 3 8 div mul add \startY\space 3 sqrt 8 div \laengde\space mul add){S}
\rput(S){\footnotesize{$15$~prikker}}
\end{pspicture}
\end{figure}
\end{document}
Output
Question
I have the desired output but the code is rather messy; can anyone help me simplify if? (The code can probably be made even 'simpler' than in the other post.)
Update
Using the second method of @Herbert in the other post, I now have the following:
\documentclass{article}
\usepackage[pdf]{pstricks}
\usepackage{pst-eucl}
\newcounter{No}
\setcounter{No}{0}
\def\trekanttal#1#2{%
\psset{
radius=#2,
yunit=0.8660254
}
\begin{pspicture}(#1,#1)
\pspolygon[
linecolor=black,
linewidth=1.5pt
](0,#1)(#1,#1)(!#1 2 div 0)
\multido{\iRow=0+2,\iStep=1+1}{\numexpr#1/2+1}{%
\multido{\iCol=0+2}{\iStep}{%
\stepcounter{No}%
\pnode(!#1 2 div \iStep\space sub 1 add \iCol\space add \iRow){N\theNo}
\rput(N\theNo){
\pscircle[
fillstyle=solid,
fillcolor=black
]{#2mm}
}
}
}
\end{pspicture}
}
\begin{document}
\begin{figure}[htbp]
\trekanttal{10}{3}
\end{figure}
\end{document}
but the lines between all the dots are missing.