%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% bsp105.tex ---
%% Autor           : Herbert Voss <voss@perce.de>
%% Datum           : 2004-04-25 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[12pt]{article}
\usepackage{pstricks}
\usepackage{multido}
\usepackage{pst-node}
\usepackage{pst-key}
\SpecialCoor

\makeatletter
\newif\ifPST@zeigeSP              % Schwerpunkt markieren?
\define@key{psset}{zeigeSP}[true]{% zeigeSP" entspricht true
        \@nameuse{PST@zeigeSP#1}%   benutze \ifPST@zeigeSP
}
\psset{zeigeSP=true}                    % Vorgabe
%
\def\Schwerpunkt{\@ifnextchar[{\Schwerpunkt@i}{\Schwerpunkt@i[]}}
\def\Schwerpunkt@i[#1](#2)(#3)(#4)#5{{   % {{ damit alles lokal bleibt
  \setkeys{psset}{#1}                    % Parameter setzen
  \pst@getcoor{#2}\pst@tempa% Punkt A    % hole Kordinaten als x y
  \pst@getcoor{#3}\pst@tempb% Punkt B    %  "
  \pst@getcoor{#4}\pst@tempc% Punkt C    %  "
  \pnode(!%                              % setze Knoten
     \pst@tempa /YA exch \pst@number\psyunit div def
     /XA exch \pst@number\psxunit div def % x y in user Koordinaten
     \pst@tempb /YB exch \pst@number\psyunit div def
     /XB exch \pst@number\psxunit div def
     \pst@tempc /YC exch \pst@number\psyunit div def
     /XC exch \pst@number\psxunit div def
     XA XB XC add add 3.0 div            % xSP
     YA YB YC add add 3.0 div            % ySP
  ){#5}                                  % #5 = Knotenname
  \ifPST@zeigeSP                         % markieren?
     \qdisk(#5){2pt}
  \fi
}}
\makeatother
\pagestyle{empty}

\begin{document}

\begin{pspicture}(-5,-5)(5,5)
  \multido{\rA=-5+0.5,\rB=0+0.5,\rC=5+-0.5}{10}{%
    \pnode(-5,\rA){A}\pnode(\rB,5){B}\pnode(\rC,-5){C}%
    \pspolygon[linecolor=blue](A)(B)(C)%
    \Schwerpunkt(A)(B)(C){SP}%
  }  
  \multido{\rA=0+0.5,\rB=5+-0.5,\rC=0+-0.5}{10}{%
    \pnode(-5,\rA){A}\pnode(5,\rB){B}\pnode(\rC,-5){C}%
    \pspolygon[linecolor=red](A)(B)(C)%
    \Schwerpunkt(A)(B)(C){SP}%
  }  
  \multido{\rA=-5+0.5,\rB=0+-0.5,\rC=-5+0.5}{10}{%
    \pnode(\rA,5){A}\pnode(5,\rB){B}\pnode(-5,\rC){C}%
    \pspolygon[linecolor=cyan](A)(B)(C)%
    \Schwerpunkt(A)(B)(C){SP}%
  }  
  \multido{\rA=0+0.5,\rB=5+-0.5,\rC=0+0.5}{10}{%
    \pnode(\rA,5){A}\pnode(\rB,-5){B}\pnode(-5,\rC){C}%
    \pspolygon[linecolor=magenta](A)(B)(C)%
    \Schwerpunkt(A)(B)(C){SP}%
  }  
  \multido{\rA=5+-0.5,\rB=0+-0.5,\rC=-5+0.5}{10}{%
    \pnode(5,\rA){A}\pnode(\rB,-5){B}\pnode(\rC,5){C}%
    \pspolygon[linecolor=blue](A)(B)(C)%
    \Schwerpunkt(A)(B)(C){SP}%
  }  
  \multido{\rA=0+-0.5,\rB=-5+0.5,\rC=0+0.5}{10}{%
    \pnode(5,\rA){A}\pnode(-5,\rB){B}\pnode(\rC,5){C}%
    \pspolygon[linecolor=red](A)(B)(C)%
    \Schwerpunkt(A)(B)(C){SP}%
  }  
  \multido{\rA=5+-0.5,\rB=0+0.5,\rC=5+-0.5}{10}{%
    \pnode(\rA,-5){A}\pnode(-5,\rB){B}\pnode(5,\rC){C}%
    \pspolygon[linecolor=cyan](A)(B)(C)%
    \Schwerpunkt(A)(B)(C){SP}%
  }  
  \multido{\rA=0+-0.5,\rB=-5+0.5,\rC=0+-0.5}{10}{%
    \pnode(\rA,-5){A}\pnode(\rB,5){B}\pnode(5,\rC){C}%
    \pspolygon[linecolor=magenta](A)(B)(C)%
    \Schwerpunkt(A)(B)(C){SP}%
  }  
\end{pspicture}

\end{document}
