%%
%%  The LaTeX Graphics Companion, 2ed (first printing May 2007)
%%
%%  Example 5-15-7 on page 310.
%%
%%  Copyright (C) 2007 Michel Goossens, Frank Mittelbach, Denis Roegel, Sebastian Rahtz, Herbert Vo\ss
%%
%%  It may be distributed and/or modified under the conditions
%%  of the LaTeX Project Public License, either version 1.3
%%  of this license or (at your option) any later version.
%%
%%  See http://www.latex-project.org/lppl.txt for details.
%%

\documentclass{ttctexa}
\pagestyle{empty}
\setcounter{page}{6}
\setlength\textwidth{135.83385pt}

\usepackage{pst-xkey,pstricks,pst-node}
\SpecialCoor
\makeatletter
\newif\ifPST@showFP              % mark focal point?
\define@key[psset]{}{showFP}[true]{% "showFP" equals true
       \@nameuse{PST@showFP#1}%   use \ifPST@showFP
}
\psset{showFP=true}                    % default
%
\def\focalPoint{\pst@object{focalPoint}}
\def\focalPoint@i(#1)(#2)(#3)#4{{        % to keep everything local
 \pst@killglue                          %
 \begingroup
 \use@par
 \pst@getcoor{#1}\pst@tempa% point A    % get coordinates as x y
 \pst@getcoor{#2}\pst@tempb% point B    %  "
 \pst@getcoor{#3}\pst@tempc% point C    %  "
 \pnode(!%                              % set node
    \pst@tempa /YA exch \pst@number\psyunit div def
    /XA exch \pst@number\psxunit div def % x y in user coordinates
    \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            % xFP
    YA YB YC add add 3.0 div            % yFP
 ){#4}                                  % #5 = node name
 \ifPST@showFP\qdisk(#4){2pt}\fi
 \endgroup
}\ignorespaces}
\makeatother

\StartShownPreambleCommands
\usepackage{pstricks,pst-node,pst-xkey}
% \focalPoint as defined above
\StopShownPreambleCommands
\begin{document}
\begin{pspicture}(4,4)
 \psset{linewidth=2pt}
 \pspolygon[linecolor=red](0,0)(2,4)(4,0)%
 \focalPoint[showFP=true,linecolor=red](0,0)(2,4)(4,0){FP1}%
 \pnode(0,0){A}\pnode(0,4){B}\pnode(4,2){C}%
 \pspolygon[linecolor=blue](A)(B)(C)%
 \focalPoint(A)(B)(C){FP2}%
 {\psset{linecolor=blue}%
 \qdisk(FP2){2pt}}%
 \ncline[linewidth=1pt]{<->}{FP1}{FP2}%
\end{pspicture}
\end{document}