%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -*- Mode: Latex -*- %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% pst-eucl.tex --- Generation of geometric figures in euclidean geometry
%% Copyright 2000-2002 Dominique RODRIGUEZ
%%
%% Author          : Dominique RODRIGUEZ (EN) <dominique.rodriguez@waika9.com>
%% Created the     : Mon Oct 16 21:15:11 CEST 2000
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% HISTORY
%%
%% 2000-10-16 : creation of the file from a first LaTeX protype sty file
%%
%% 2001-05-7  : distribution of the beta version
%%
%% 2002-03-21 : distribution of the beta version
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\fileversion{0.beta.5}
\def\filedate{2002/03/21}%
%% This program can be redistributed and/or modified under the terms
%% of the LaTeX Project Public License Distributed from CTAN
%% archives in directory macros/latex/base/lppl.txt.
\message{`PST-Euclide v\fileversion, \filedate\space (Dominique RODRIGUEZ)}%
\message{  BEWARE this is a BETA version, things can and will change}%
\message{  without conserving upward compatibilities}%
\csname PSTEuclideLoaded\endcsname
\let\PSTEuclideLoaded\endinput
% Require PSTricks and pst-node packages
\ifx\PSTricksLoaded\endinput\else\input pstricks.tex\fi
\ifx\PSTnodesLoaded\endinput\else\input pst-node.tex\fi
\ifx\MultidoLoaded\endinput\else\input multido.tex\fi
%% prologue for postcript
\pstheader{pst-eucl.pro}%
% DPC interface to the `keyval' package (until keyval based version of PSTricks)
\input pst-key.tex
\edef\PstAtCode{\the\catcode`\@}%
\catcode`\@=11\relax
% Definition of the parameters
% ----------------------------
% symbol used for the point
\define@key{psset}{PointSymbol}{\edef\psk@PointSymbol{#1}}%
\define@key{psset}{PointSymbolA}{\edef\psk@PointSymbolA{#1}}%
\define@key{psset}{PointSymbolB}{\edef\psk@PointSymbolB{#1}}%
\define@key{psset}{PointSymbolC}{\edef\psk@PointSymbolC{#1}}%
% name used for the point
\define@key{psset}{PointName}{\edef\psk@PointName{#1}}%
\define@key{psset}{PointNameA}{\edef\psk@PointNameA{#1}}%
\define@key{psset}{PointNameB}{\edef\psk@PointNameB{#1}}%
\define@key{psset}{PointNameC}{\edef\psk@PointNameC{#1}}%
% use math mode in point name
\newif\ifPst@PtNameMath%
\define@key{psset}{PtNameMath}[false]{\@nameuse{Pst@PtNameMath#1}}%
% symbol used for marking equal length segment
\define@key{psset}{SegmentSymbol}{\edef\psk@SegmentSymbol{#1}}%
% position angle for positionning a point name
\define@key{psset}{PosAngle}{\edef\psk@PosAngle{#1}}%
\define@key{psset}{PosAngleA}{\edef\psk@PosAngleA{#1}}%
\define@key{psset}{PosAngleB}{\edef\psk@PosAngleB{#1}}%
\define@key{psset}{PosAngleC}{\edef\psk@PosAngleC{#1}}%
% dimension of the right angle mark
\define@key{psset}{RightAngleSize}{\edef\psk@RightAngleSize{#1}}%
% radius of an angle mark
\define@key{psset}{MarkAngleRadius}{\edef\psk@MarkAngleRadius{#1}}%
% angular offset position of the label for marking an angle
\define@key{psset}{LabelAngleOffset}{\edef\psk@LabelAngleOffset{#1}}%
% position radius of the label for marking an angle
\define@key{psset}{LabelSep}{\edef\psk@LabelSep{#1}}%
% ref point of the label
\define@key{psset}{LabelRefPt}{\edef\psk@LabelRefPt{#1}}%
% coefficient of homothetie
\define@key{psset}{HomCoef}{\edef\psk@HomCoef{#1}}%
% angle of rotation
\define@key{psset}{RotAngle}{\edef\psk@RotAngle{#1}}%
% for drawing the circum-circle
\newif\ifPst@DrawCirABC
\define@key{psset}{DrawCirABC}[true]{\@nameuse{Pst@DrawCirABC#1}}%
% for coding a construction
\newif\ifPst@CodeFig
\define@key{psset}{CodeFig}[false]{\@nameuse{Pst@CodeFig#1}}%
\define@key{psset}{CodeFigA}{\edef\psk@CodeFigA{#1}}%
\define@key{psset}{CodeFigB}{\edef\psk@CodeFigB{#1}}%
\define@key{psset}{CodeFigColor}{\edef\psk@CodeFigColor{#1}}%
\define@key{psset}{CodeFigStyle}{\edef\psk@CodeFigStyle{#1}}%
\newif\ifPst@CodeFigAarc%
\define@key{psset}{CodeFigAarc}[true]{\@nameuse{Pst@CodeFigAarc#1}}
\newif\ifPst@CodeFigBarc%
\define@key{psset}{CodeFigBarc}[true]{\@nameuse{Pst@CodeFigBarc#1}}
%% for specifying a distance for the circle
\define@key{psset}{Radius}{\edef\psk@Radius{#1}}%
\define@key{psset}{RadiusA}{\edef\psk@RadiusA{#1}}%
\define@key{psset}{RadiusB}{\edef\psk@RadiusB{#1}}%
\define@key{psset}{Diameter}{\edef\psk@Diameter{#1}}%
\define@key{psset}{DiameterA}{\edef\psk@DiameterA{#1}}%
\define@key{psset}{DiameterB}{\edef\psk@DiameterB{#1}}%
% for specifying a distance for the circle
\define@key{psset}{DistCoef}{\edef\psk@DistCoef{#1}}%
\define@key{psset}{AngleCoef}{\edef\psk@AngleCoef{#1}}%
% for curvilign abscissa placement
\newif\ifPst@CurvAbsNeg%
\define@key{psset}{CurvAbsNeg}[false]{\@nameuse{Pst@CurvAbsNeg#1}}%
% first and last point of a generic curve
\define@key{psset}{GenCurvFirst}{\edef\psk@GenCurvFirst{#1}}%
\define@key{psset}{GenCurvLast}{\edef\psk@GenCurvLast{#1}}%
% increment of a generic curve
\define@key{psset}{GenCurvInc}{\edef\psk@GenCurvInc{#1}}%
%% Default values
% --------------
\setkeys{psset}{%
  PointSymbol=*, PointSymbolA=undef, PointSymbolB=undef,
  PointSymbolC=undef, PointName=undef, PointNameA=undef,
  PointNameB=undef, PointNameC=undef, PtNameMath=true, PosAngle=0,
  PosAngleA=undef, PosAngleB=undef, PosAngleC=undef,
  SegmentSymbol=pstslashslash, RightAngleSize=.28, LabelAngleOffset=0,
  LabelSep=1, LabelRefPt=c, MarkAngleRadius=.4, HomCoef=.5,
  RotAngle=60, DrawCirABC=true, CodeFig=false, CodeFigColor=cyan,
  CodeFigStyle=dashed, CodeFigA=undef, CodeFigB=undef,
  CodeFigAarc=true, CodeFigBarc=true, Radius=none, RadiusA=undef,
  RadiusB=undef, Diameter=none, DiameterA=undef, DiameterB=undef,
  DistCoef=none, AngleCoef=none, CurvAbsNeg=false,
  GenCurvFirst=none, GenCurvLast=none, GenCurvInc=1}%
\SpecialCoor                 %% for using polar coordinates, node
                             %% position, ...
\psset{dimen=middle}% remark of ML
\def\@undef{undef}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% CORRECTION OF BUG
\def\pst@newnode#1#2#3#4{%
% DG/SR modification begin - Nov.  9, 2000 - Patch 11
  \pst@killglue
% DG/SR modification end
\leavevmode
\pst@getnode{#1}\pst@thenode
\pst@Verb{%
\pst@nodedict
{#3}
\ifx\psk@name\relax false \else \psk@name true \fi
\pst@thenode
#2
{#4}
\tx@NewNode
end}%
\global\let\psk@name\relax
\pstree@nodehook
\global\let\pstree@nodehook\relax}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% create a point with an associated node,
%% #1 -> options
%% #2 -> coordinates
%% #3 -> node name
%\def\pstGeonode{\@ifnextchar[\Pst@Geonode{\Pst@Geonode[]}}%
%\def\Pst@Geonode[#1](#2)#3{%
  %\begingroup\setkeys{psset}{#1}%            % Affectation of local parameters
%    \pnode(#2){#3}%
%    \ifx\psk@PointSymbol\@none\else\Pst@geonodelabel{#3}\fi%
  %\endgroup%
%}%
% \def\pstGeonode{\@ifnextchar[\PstGeonode@i{\PstGeonode@i[]}}%
% \def\PstGeonode@i[#1]{%NEW DR 14112001 (for default (0,0) ccordinates)
%   \def\pst@par{#1}%
%   \@ifnextchar(\PstGeonode@ii{\PstGeonode@ii(0,0)}}%
% \def\PstGeonode@ii(#1)#2{%
%   \bgroup\use@par%            % Affectation of local parameters
%   \pnode(#1){#2}%
%   \ifx\psk@PointSymbol\@none\else\Pst@geonodelabel{#2}\fi%
%   \egroup%
% }%
\def\pstGeonode{\@ifnextchar[\Pst@Geonode{\Pst@Geonode[]}}
\def\Pst@Geonode[#1]{%
  \@ifnextchar({\Pst@Geonode@i[#1]}{\Pst@Geonode[#1](0,0)}}
\def\Pst@Geonode@i[#1](#2)#3{%
  \begingroup
    \setkeys{psset}{#1}%            % Affectation of local parameters
    \pnode(#2){#3}
    \ifx\psk@PointSymbol\@none\else\Pst@geonodelabel{#3}\fi
  \endgroup
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% create a point with an associated node, in a new
%% landmark
%% #1 -> options
%% #2 -> coordinates
%% #3 -> node name
%% #4 -> O: new center of the landmark
%% #5 -> I: abscissa reference
%% #6 -> J: ordinate reference
\def\pstOIJGeonode{\@ifnextchar[\Pst@OIJGeonode{\Pst@OIJGeonode[]}}%
\def\Pst@OIJGeonode[#1]{%NEW DR 14112001 (for default (0,0) ccordinates)
  \@ifnextchar({\Pst@OIJGeonode@i[#1]}{\Pst@OIJGeonode[#1](0,0)}}%
\def\Pst@OIJGeonode@i[#1](#2)#3#4#5#6{%
  \begingroup
    \setkeys{psset}{#1}%            % Affectation of local parameters
    \rput(#4){%
      \pst@@getcoor{#2}%
      \rput(!
        \pst@coor\space
        tx@EcldDict begin /N@#5 GetNode /N@#6 GetNode end
        4 index mul 3 -1 roll 5 index mul add
        \pst@number\psyunit dup mul div  exch
        4 -1 roll mul 3 -1 roll 4 -1 roll mul add
        \pst@number\psxunit dup mul div exch
        )%
        {\pnode{#3}}%
      }
    \ifx\psk@PointSymbol\@none\else\Pst@geonodelabel{#3}\fi%
  \endgroup%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% #1 -> point coordinates
\def\Pst@geonodelabel#1{%% {nodename}
  \psdot[dotstyle=\psk@PointSymbol](#1)%NEW DR 28092001
  \rput{*0}([nodesep=1em,angle=\psk@PosAngle]#1)%
    {\ifPst@PtNameMath$\Pst@WhichLabel{#1}$\else\Pst@WhichLabel{#1}\fi}%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\Pst@WhichLabel#1{%
  \ifx\psk@PointName\@none\else
    \ifx\psk@PointName\@undef#1\else\psk@PointName\fi
  \fi}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% #2 #3 -> nodes defining the segment to mark
\def\pstSegmentMark{\@ifnextchar[\Pst@SegmentMark{\Pst@SegmentMark[]}}%
\def\Pst@SegmentMark[#1]#2#3{%
  \bgroup\setkeys{psset}{#1}%            % Affectation of local parameters
  \ncline[nodesep=0]{#2}{#3}
  \ncput[nrot=:U]{$\csname\psk@SegmentSymbol\endcsname$}%
  \egroup%
}%
\def\pstslash{/}%
\def\pstslashslash{/\!\!/}%
\def\pstslashslashslash{/\!\!/\!\!/}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% #2 #3 #4 -> 3 nodes for defining the right angle
\def\pstRightAngle{\@ifnextchar[\Pst@RightAngle{\Pst@RightAngle[]}}%
\def\Pst@RightAngle[#1]#2#3#4{%
  \bgroup\setkeys{psset}{#1}%            % Affectation of local parameters
  %% not good at all, but \rput{0}(#3){\rput{(#2)}{stuff}} doesn't work...
  \rput(#3){%
    \pscustom{%
      \rotate{(#2)}%
      \psframe(0,0)(\psk@RightAngleSize,\psk@RightAngleSize)%
      }%
    }%
  \egroup%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% #2 #3 #4 -> 3 node for defining the angle
%% #5 -> label
\def\pstMarkAngle{\@ifnextchar[\Pst@MarkAngle{\Pst@MarkAngle[]}}%
\def\Pst@MarkAngle[#1]#2#3#4#5{%
  \bgroup\setkeys{psset}{#1}%            % Affectation of local parameters
  %\rput(#3){\psarc(0,0){\psk@MarkAngleRadius}{(#2)}{(#4)}}%
  %\rput[\psk@LabelRefPt]%
  %  {*0}([nodesep=\psk@LabelSep, angle= \psk@LabelAngle]#3){#5}%
  \rput(#3){%
    \psarc(0,0){\psk@MarkAngleRadius}{(#2)}{(#4)}%
    \rput[\psk@LabelRefPt]{*0}%
      (!tx@EcldDict begin /N@#4 GetNode exch Atan /N@#2 GetNode end
      exch Atan dup 3 1 roll 2 copy lt { exch 360 sub exch } if sub
      2 div add \psk@LabelAngleOffset\space add dup cos \psk@LabelSep\space
      mul exch sin \psk@LabelSep\space mul){#5}}
  \egroup%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% #2 #4 #6 -> coordinates for nodes
%% #3 #5 #7 -> nodes name
\def\pstTriangle{\@ifnextchar[\Pst@Triangle{\Pst@Triangle[]}}%
\def\Pst@Triangle[#1]{%NEW DR 14112001 (for default (0,0) ccordinates)
  \def\pst@par{#1}%
  \@ifnextchar(\Pst@Trianglei{\Pst@Trianglei(0,0)}}%
\def\Pst@Trianglei(#1)#2(#3)#4(#5)#6{%
  \bgroup\use@par%            % Affectation of local parameters
  \bgroup\ifx\psk@PosAngleA\@undef\else\psset{PosAngle=\psk@PosAngleA}\fi
  \ifx\psk@PointSymbolA\@undef\else\psset{PointSymbol=\psk@PointSymbolA}\fi
  \ifx\psk@PointNameA\@undef\else\psset{PointName=\psk@PointNameA}\fi
  \Pst@Geonode@i[](#1){#2}\egroup%%NEW DR 15112001
  \bgroup\ifx\psk@PosAngleB\@undef\else\psset{PosAngle=\psk@PosAngleB}\fi
  \ifx\psk@PointSymbolB\@undef\else\psset{PointSymbol=\psk@PointSymbolB}\fi
  \ifx\psk@PointNameB\@undef\else\psset{PointName=\psk@PointNameB}\fi
  \Pst@Geonode@i[](#3){#4}\egroup%%NEW DR 15112001
  \ifx\psk@PosAngleC\@undef\else\psset{PosAngle=\psk@PosAngleC}\fi
  \ifx\psk@PointSymbolC\@undef\else\psset{PointSymbol=\psk@PointSymbolC}\fi
  \ifx\psk@PointNameC\@undef\else\psset{PointName=\psk@PointNameC}\fi
  \Pst@Geonode@i[](#5){#6}%%NEW DR 15112001
  \pst@TraceTriangle{#2}{#4}{#6}%
  \egroup%
}%
\def\pst@TraceTriangle#1#2#3{\pspolygon(#1)(#2)(#3)}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%            Line, circle, Arc
%% #2 #3 -> 2 nodes defining the line
\def\pstLineAB{\ncline}%@ifnextchar[\Pst@LineAB{\Pst@LineAB[]}}%
%\def\Pst@LineAB[#1]#2#3{\ncline[#1]{#2}{#3}}%
%% #2 #3 -> 2 nodes defining the center and a point on the circle
\def\pstCircleOA{\pst@object{pstCircleOA}}%
\def\pstCircleOA@i#1#2{%
  \bgroup\use@par%
  \rput(#1){%
    \begin@ClosedObj
      \def\pst@linetype{4}%
      \addto@pscode{%
        tx@EcldDict begin
          /N@#1 GetNode
          \ifx\psk@Radius\@none
            \ifx\psk@Diameter\@none
              2 copy /N@#2 GetNode ABDist
            \else\psk@Diameter 2 div
            \fi
          \else\psk@Radius\space
          \fi
        end
        \psk@dimen CLW mul sub 0 360 arc closepath}%
      \showpointsfalse
    \end@ClosedObj
  }%
  \egroup%
}%
%% #2 #3 -> 2 nodes defining a diameter of the circle
\def\pstCircleAB{\pst@object{pstCircleAB}}%
\def\pstCircleAB@i#1#2{%
  \bgroup\use@par%
    \Pst@MiddleAB[PointSymbol=none]{#2}{#1}{@MAB}{}
    \rput(#1){%
      \begin@ClosedObj
        \def\pst@linetype{4}%
        \addto@pscode{%
          tx@NodeDict begin
            tx@NodeDict /N@@MAB load GetCenter
          end
          2 copy
          tx@EcldDict begin /N@#2 GetNode ABDist end
          \psk@dimen CLW mul sub 0 360 arc closepath}%
        \showpointsfalse
      \end@ClosedObj
    }%
  \egroup%
}%
%% #2 #3 #4 -> 3 nodes defining the center and two points on the circle
\def\pstArcOAB{\pst@object{pstArcOAB}}%
\def\pstArcnOAB{\pst@object{pstArcnOAB}}%
\def\pstArcnOAB@i{\def\psarc@type{1}\pstArcOAB@i}%
\def\pstArcOAB@i{\pstArcOAB@ii}%\@ifnextchar[\pstArcOAB@ii{\pstArcOAB@ii[]}}%
\def\pstArcOAB@ii#1#2#3{%[#1]#2#3#4{%
  \bgroup\use@par%
  \rput(#1){\pstArcOAB@iii{#2}{#3}}%
  \egroup%
}%
\def\pstArcOAB@iii#1#2{%
  \begin@OpenObj%
    \addto@pscode{\pstArcOAB@iv{#1}{#2} \pstArcOAB@v}%
    \gdef\psarc@type{0}%
    \showpointsfalse
  \end@OpenObj%
}%% end \pstArcOAB@iii
\def\pstArcOAB@iv#1#2{%
  \pst@coor /y ED /x ED /r
  tx@EcldDict begin /N@#1 GetNode end
  Pyth  def /c 57.2957 r \tx@Div def /angleA
  tx@EcldDict begin /N@#1 GetNode end
  exch Atan \psk@arcsepA c mul 2 div
  \ifcase \psarc@type add \or sub \fi def
  /angleB
  tx@EcldDict begin /N@#2 GetNode end
  exch Atan \psk@arcsepB c mul 2 div
  \ifcase \psarc@type sub \or add \fi def
  %ifshowpoints\psarc@showpoints\fi
  \ifx\psk@arrowA\@empty
    \ifnum\psk@liftpen=2 r angleA \tx@PtoC
      y add exch x add exch
      moveto
    \fi
  \fi%
}%% end \pstArcOAB@iv
\def\pstArcOAB@v{%
  x y r angleA
  \ifx\psk@arrowA\@empty\else
    { ArrowA CP } { \ifcase\psarc@type add \or sub \fi }%
    \tx@ArcArrow
  \fi
  angleB
  \ifx\psk@arrowB\@empty\else
    { ArrowB } { \ifcase\psarc@type sub \or add \fi }%
    \tx@ArcArrow
  \fi
  \ifcase\psarc@type arc \or arcn \fi%
}%% end \pstArcOAB@v
\def\pstArcOAB@showpoints{%
  gsave newpath x y moveto x y r \pst@tempa \pst@tempb
  \ifcase\psarc@type arc \or arcn \fi
  closepath CLW 2 div SLW [ \psk@dash\space ] 0 setdash stroke
  grestore %
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                     HOMOTETHIE
%% #2 -> centre
%% #3 -> antecedent
%% #4 -> node name of the homothetic of #1
\def\pstHomO{\@ifnextchar[\Pst@HomO{\Pst@HomO[]}}%
\def\Pst@HomO[#1]#2#3#4{%
  \bgroup\setkeys{psset}{#1}%            % Affectation of local parameters
  \Pst@@HomO{#2}{#3}{#4}%
  \ifx\psk@PointSymbol\@none\else{\Pst@geonodelabel{#4}}\fi%
  \egroup%
}%
\def\Pst@@HomO#1#2#3{%
%  \ncline[linestyle=none]{#1}{#2}\ncput[npos=\psk@HomCoef]{\pnode{#3}}%
  \rput(#1){%
    \rput(!
      tx@EcldDict begin /N@#2 GetNode end
      \psk@HomCoef\space mul exch \psk@HomCoef\space mul exch
      \pst@number\psyunit div exch \pst@number\psxunit div
      exch){\pnode{#3}}%
      }
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                   Central Symmetry
%% #2 -> centre
%% #3 -> antecedent
%% #4 -> node name of the symmetrical point of #3
\def\pstSymO{\@ifnextchar[\Pst@SymO{\Pst@SymO[]}}%
\def\Pst@SymO[#1]#2#3#4{%
  \bgroup\setkeys{psset}{#1, HomCoef=-1}% % Affectation of local parameters
  \Pst@HomO[]{#2}{#3}{#4}%
  \ifPst@CodeFig%
    \psset{linecolor=\psk@CodeFigColor, linestyle=\psk@CodeFigStyle}%
    \pstSegmentMark{#4}{#2}%
    \pstSegmentMark{#2}{#3}%
  \fi%
  \egroup
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                   Middle of a Segment
%% #2 #3 -> 2 nodes defining the segment
%% #4    -> node name of the middle of [#2 #3]
\def\pstMiddleAB{\@ifnextchar[\Pst@MiddleAB{\Pst@MiddleAB[]}}%
\def\Pst@MiddleAB[#1]#2#3#4{%
  \bgroup\setkeys{psset}{#1, HomCoef=.5}% % Affectation of local parameters
  \Pst@HomO[]{#2}{#3}{#4}%
  \ifPst@CodeFig%
    \psset{linecolor=\psk@CodeFigColor, linestyle=\psk@CodeFigStyle}%
    \pstSegmentMark{#2}{#4}%
    \pstSegmentMark{#4}{#3}%
  \fi%
  \egroup
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%           Centre of Gravity of a Triangle
%% #2 #3 #4 -> 3 nodes defining the triangle
%% #5       -> node name of the centre of gravity of #2 #3 #4
\def\pstCGravABC{\@ifnextchar[\Pst@CGravABC{\Pst@CGravABC[]}}%
\def\Pst@CGravABC[#1]#2#3#4#5{%
  \bgroup\setkeys{psset}{#1}% % Affectation of local parameters
  \Pst@HomO[PointSymbol=none,HomCoef=.5]{#2}{#3}{@Milieu#2#3}%
  \Pst@HomO[HomCoef=1 3 div]{@Milieu#2#3}{#4}{#5}%
  \egroup
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%           Centre of the circoncrit circle
%% #2 #3 #4 -> 3 nodes defining the triangle
%% #5       -> node name of the centre of the circle
\def\pstCircleABC{\@ifnextchar[\Pst@CircleABC{\Pst@CircleABC[]}}%
\def\Pst@CircleABC[#1]#2#3#4#5{%
  \bgroup\setkeys{psset}{#1}% % Affectation of local parameters
  \bgroup
  \psset{PointSymbol=none}%
  \Pst@HomO[HomCoef=.5]{#2}{#3}{@Middle#2#3}{}%
  \Pst@Rotation[RotAngle=90]{@Middle#2#3}{#2}{@Middle#2#3P}{}%
  \Pst@HomO[HomCoef=.5]{#2}{#4}{@Middle#2#4}{}%
  \Pst@Rotation[RotAngle=90]{@Middle#2#4}{#2}{@Middle#2#4P}{}%
  \egroup
  \Pst@InterLL[]{@Middle#2#3}{@Middle#2#3P}{@Middle#2#4}{@Middle#2#4P}{#5}%
  \ifPst@DrawCirABC\pstCircleOA{#5}{#2}\fi
  \ifPst@CodeFig
    \psset{linecolor=\psk@CodeFigColor, linestyle=\psk@CodeFigStyle, nodesep=-1}%
    \Pst@HomO[HomCoef=.5, PointSymbol=none]{#4}{#3}{@Middle#4#3}{}%
    \ncline{#5}{@Middle#4#3}%
    \ncline{#5}{@Middle#2#3}%
    \ncline{#5}{@Middle#2#4}%
    \psset{linestyle=solid}%
    \Pst@RightAngle[]{#5}{@Middle#4#3}{#4}%
    \Pst@RightAngle[]{#5}{@Middle#2#3}{#2}%
    \Pst@RightAngle[]{#5}{@Middle#2#4}{#3}%
  \fi
  \egroup
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                     TRANSLATION
%% #2 #3 -> 2 nodes defining the translation vector
%% #4 -> antecedent
%% #5 -> node name of the image
%% #6 -> label
\def\pstTranslation{\@ifnextchar[\Pst@Translation{\Pst@Translation[]}}%
\def\Pst@Translation[#1]#2#3#4#5{%
  \bgroup\setkeys{psset}{#1}%
  \rput(#2){%
    \rput(!
      tx@EcldDict begin /N@#3 GetNode /N@#4 GetNode end
      3 -1 roll
      \ifx\psk@DistCoef\@none\else\psk@DistCoef\space mul \fi
      add exch 3 -1 roll
      \ifx\psk@DistCoef\@none\else\psk@DistCoef\space mul \fi
      add exch
      \pst@number\psyunit div exch \pst@number\psxunit div exch)%
    {\pnode{#5}}%
    }%
  \ifx\psk@PointSymbol\@none\else{\Pst@geonodelabel{#5}}\fi%
  \egroup%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                     ROTATION
%% #2 -> centre of rotation
%% #3 -> antecedent
%% #4 -> node name of the image
%% #5 -> label
\def\pstRotation{\@ifnextchar[\Pst@Rotation{\Pst@Rotation[]}}%
\def\Pst@Rotation[#1]#2#3#4{%
  \bgroup\setkeys{psset}{#1}%
  \Pst@@Rotation{#2}{#3}{#4}%
  \ifx\psk@PointSymbol\@none\else{\Pst@geonodelabel{#4}}\fi%
  \egroup%
  %% AJOUTER LE MARQUAGE CodeFig
}%
\def\Pst@@Rotation#1#2#3{%
  \rput(#1){%
    \rput(!
      tx@EcldDict begin /N@#2 GetNode \psk@RotAngle\space Rotate end
      \pst@number\psyunit div exch \pst@number\psxunit div exch)%
    {\pnode{#3}}%
    }%% end \rput
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%        Intersection between two lines
%% #2 #3 -> nodes defining the first line
%% #4 #5 -> nodes defining the second line
%% #6 -> node name of the image
%% #7 -> label
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\pstInterLL{\@ifnextchar[\Pst@InterLL{\Pst@InterLL[]}}%
\def\Pst@InterLL[#1]#2#3#4#5#6{%
  \bgroup\setkeys{psset}{#1}%             % Affectation of local parameters
  \rput(!
    tx@EcldDict begin
      /N@#2 GetNode /N@#3 GetNode /N@#4 GetNode /N@#5 GetNode InterLines
    end
    \pst@number\psyunit div exch \pst@number\psxunit div exch){\pnode{#6}}%
  \ifx\psk@PointSymbol\@none\else{\Pst@geonodelabel{#6}}\fi%
  \egroup%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%   Intersection between one line and one circle
%% #2 #3 -> nodes defining the first line
%% #4 #5 -> nodes defining the center and a point onto C
%% #6 -> node name of the first point
%% #7 -> label
%% #8 -> node name of the second point
%% #9 -> label
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\pstInterLC{\@ifnextchar[\Pst@InterLC{\Pst@InterLC[]}}%
\def\Pst@InterLC[#1]#2#3#4#5#6#7{%
  \bgroup\setkeys{psset}{#1}%             % Affectation of local parameters
  \rput(#4){%
    \rput(!
    tx@EcldDict begin
      /N@#2 GetNode /N@#3 GetNode EqDr
      \ifx\psk@Radius\@none
        \ifx\psk@Diameter\@none
          /N@#4 GetNode /N@#5 GetNode ABDist
        \else\psk@Diameter 2 div
        \fi
      \else\psk@Radius
      \fi
    InterLineCircle /Glby exch def /Glbx exch def
      \pst@number\psyunit div exch \pst@number\psxunit div exch
    end){\pnode{#6}}%
  \rput(!
    tx@EcldDict begin
      Glbx \pst@number\psxunit div Glby \pst@number\psyunit div
    end){\pnode{#7}}}%
  \bgroup\ifx\psk@PosAngleA\@undef\else\psset{PosAngle=\psk@PosAngleA}\fi
  \ifx\psk@PointSymbolA\@undef\else\psset{PointSymbol=\psk@PointSymbolA}\fi
  \ifx\psk@PointNameA\@undef\else\psset{PointName=\psk@PointNameA}\fi
  \ifx\psk@PointSymbol\@none\else{\Pst@geonodelabel{#6}}\fi\egroup%
  \ifx\psk@PosAngleB\@undef\else\psset{PosAngle=\psk@PosAngleB}\fi
  \ifx\psk@PointSymbolB\@undef\else\psset{PointSymbol=\psk@PointSymbolB}\fi
  \ifx\psk@PointNameB\@undef\else\psset{PointName=\psk@PointNameB}\fi
  \ifx\psk@PointSymbol\@none\else{\Pst@geonodelabel{#7}}\fi%
  \egroup%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%   Intersection between two circles
%% #2 #3 -> nodes defining the first circle
%% #4 #5 -> nodes defining the second circle
%% #6 -> node name of the first point
%% #7 -> node name of the second point
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\pstInterCC{\@ifnextchar[\Pst@InterCC{\Pst@InterCC[]}}%
\def\Pst@InterCC[#1]#2#3#4#5#6#7{%
  \bgroup\setkeys{psset}{#1}%        % Affectation of local parameters
  \rput(#2){%
    \rput(!
      tx@EcldDict begin
        \ifx\psk@RadiusA\@undef
          \ifx\psk@DiameterA\@undef
            /N@#3 GetNode Pyth
          \else\psk@DiameterA 2 div
          \fi
        \else\psk@RadiusA\space
        \fi
        \ifx\psk@RadiusB\@undef
          \ifx\psk@DiameterB\@undef
            /N@#4 GetNode /N@#5 GetNode ABDist
          \else\psk@DiameterB 2 div
          \fi
        \else\psk@RadiusB\space
        \fi
        /N@#4 GetNode Pyth InterCircles /N@#4 GetNode
        exch Atan dup /xoC exch def Rotate /Glby exch def /Glbx exch def
        xoC Rotate
      end
      \pst@number\psyunit div exch \pst@number\psxunit div exch)
    {\pnode{#6}}%
    \rput(!
      tx@EcldDict begin
        Glbx \pst@number\psxunit div Glby \pst@number\psyunit div
      end)%
    {\pnode{#7}}%
    }%
  \bgroup\ifx\psk@PosAngleA\@undef\else\psset{PosAngle=\psk@PosAngleA}\fi
  \ifx\psk@PointSymbolA\@undef\else\psset{PointSymbol=\psk@PointSymbolA}\fi
  \ifx\psk@PointNameA\@undef\else\psset{PointName=\psk@PointNameA}\fi
  \ifx\psk@PointSymbol\@none\else{\Pst@geonodelabel{#6}}\fi\egroup%
  \bgroup\ifx\psk@PosAngleB\@undef\else\psset{PosAngle=\psk@PosAngleB}\fi
  \ifx\psk@PointSymbolB\@undef\else\psset{PointSymbol=\psk@PointSymbolB}\fi
  \ifx\psk@PointNameB\@undef\else\psset{PointName=\psk@PointNameB}\fi
  \ifx\psk@PointSymbol\@none\else{\Pst@geonodelabel{#7}}\fi\egroup%
  \psset{linecolor=\psk@CodeFigColor, linestyle=\psk@CodeFigStyle, arcsep=-1}%
  \ifx\psk@CodeFigA\@undef%
    \ifx\psk@CodeFigB\@undef\ifPst@CodeFig\pstArcOAB{#2}{#6}{#7}\fi\fi
  \else%
    \ifPst@CodeFigAarc\pstArcOAB{#2}{#6}{#7}\else\pstArcnOAB{#2}{#6}{#7}\fi%
  \fi
  \ifx\psk@CodeFigB\@undef%
    \ifx\psk@CodeFigA\@undef\ifPst@CodeFig\pstArcOAB{#4}{#6}{#7}\fi\fi
  \else%
    \ifPst@CodeFigAarc\pstArcOAB{#4}{#6}{#7}\else\pstArcnOAB{#2}{#6}{#7}\fi%
  \fi
  \egroup%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%              Orthogonal projection
%% #2 #3 -> nodes defining the line where to project
%% #4 -> antecedent
%% #5 -> node name of the image
%% #6 -> label
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\pstProjection{\@ifnextchar[\Pst@Projection{\Pst@Projection[]}}%
\def\Pst@Projection[#1]#2#3#4#5{%
  \bgroup\setkeys{psset}{#1}%             % Affectation of local parameters
  \rput(#2){% translation onto #1
    \rput(!
      tx@EcldDict begin /N@#4 GetNode /N@#3 GetNode Project end
      \pst@number\psyunit div exch \pst@number\psxunit div exch)%
      {\pnode{#5}}%
    }%
  \ifx\psk@PointSymbol\@none\else{\Pst@geonodelabel{#5}}\fi%
  \ifPst@CodeFig%
    \psset{linecolor=\psk@CodeFigColor, linestyle=\psk@CodeFigStyle}%
    \pstRightAngle[linestyle=solid]{#4}{#5}{#3}%
    \ncline{#4}{#5}%
  \fi%
  \egroup%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%              Orthogonal symmetry
%% #2 #3 -> nodes defining the symmetrical axis
%% #4 -> antecedent node
%% #5 -> node name of the symmetrical point
%% #6 -> label
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\pstOrtSym{\@ifnextchar[\Pst@OrtSym{\Pst@OrtSym[]}}%
\def\Pst@OrtSym[#1]#2#3#4#5{%
  \bgroup\setkeys{psset}{#1}%             % Affectation of local parameters
  \Pst@Projection[PointSymbol=none, CodeFig=false]%
    {#2}{#3}{#4}{@ProjOrth#4on#2#3}{}%
  \Pst@HomO[HomCoef=-1]{@ProjOrth#4on#2#3}{#4}{#5}%
  \ifPst@CodeFig%
    \psset{linecolor=\psk@CodeFigColor, linestyle=\psk@CodeFigStyle}%
    \Pst@RightAngle[linestyle=solid]{#2}{@ProjOrth#4on#2#3}{#4}%
    \Pst@SegmentMark[]{#5}{@ProjOrth#4on#2#3}%
    \Pst@SegmentMark[]{@ProjOrth#4on#2#3}{#4}%
  \fi%
  \egroup%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%              mediator line
%% #2 #3 -> nodes defining the segment
%% #4 -> middle of the segment
%% #5 -> node belonging to the mediator line
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\pstMediatorAB{\@ifnextchar[\Pst@MediatorAB{\Pst@MediatorAB[]}}%
\def\Pst@MediatorAB[#1]#2#3#4#5{%
  \bgroup\setkeys{psset}{#1}%             % Affectation of local parameters
  \bgroup
    \ifx\psk@PointSymbolA\@undef\else\psset{PointSymbol=\psk@PointSymbolA}\fi
    \ifx\psk@PointNameA\@undef\else\psset{PointName=\psk@PointNameA}\fi
  \Pst@HomO[HomCoef=.5]{#2}{#3}{#4}
  \egroup
  \bgroup
    \ifx\psk@PointSymbolB\@undef\else\psset{PointSymbol=\psk@PointSymbolB}\fi
    \ifx\psk@PointNameB\@undef\else\psset{PointName=\psk@PointNameB}\fi
  \Pst@Rotation[RotAngle=90]{#4}{#3}{#5}%
  \egroup
  \ifPst@CodeFig
    \psset{linecolor=\psk@CodeFigColor}
    \Pst@RightAngle[]{B}{#4}{#5}
    \Pst@SegmentMark[]{#2}{#4}%
    \Pst@SegmentMark[]{#4}{#3}%
  \fi
  \ncline{#4}{#5}
  \egroup
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%              bissectrice
%% #2 #3 #4 -> nodes defining the angle in #3 anti-clockwise
%% #5 -> node belonging to the bissectrice
%% #6 -> label
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\pstBissectBAC{\@ifnextchar[\Pst@BissectBAC{\Pst@BissectBAC[]}}%
\def\Pst@BissectBAC[#1]#2#3#4#5{%
  \bgroup\setkeys{psset}{#1}%             % Affectation of local parameters
  \rput(#3){%
    \rput(!
      tx@EcldDict begin /N@#4 GetNode exch Atan /N@#2 GetNode end
      2 copy 5 2 roll exch Atan 2 copy lt { exch 360 sub exch } if sub
      2 div tx@EcldDict begin Rotate end
      \pst@number\psyunit div exch \pst@number\psxunit div exch)%
      {\pnode{#5}}%
    \ifx\psk@PointSymbol\@none\else{\Pst@geonodelabel{#5}}\fi%
    \ncline{#3}{#5}%
    }%% end \rput
  \egroup%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%              outside bissectrice
%% #2 #3 #4 -> nodes defining the angle in #3 anti-clockwise
%% #5 -> node belonging to the bissectrice
%% #6 -> label
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\pstOutBissectBAC{\@ifnextchar[\Pst@OutBisBAC{\Pst@OutBisBAC[]}}%
\def\Pst@OutBisBAC[#1]#2#3#4#5{%
  \bgroup\setkeys{psset}{#1}%             % Affectation of local parameters
  \rput(#3){%
    \rput(!
      tx@EcldDict begin /N@#4 GetNode exch Atan /N@#2 GetNode end
      2 copy 5 2 roll exch Atan 2 copy lt { exch 360 sub exch } if sub
      2 div 90 add tx@EcldDict begin Rotate end
      \pst@number\psyunit div exch \pst@number\psxunit div exch)%
      {\pnode{#5}}%
    \ifx\psk@PointSymbol\@none\else{\Pst@geonodelabel{#5}}\fi%
    \ncline{#3}{#5}%
    }%% end \rput
  \egroup%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Creation of a point according to a curvilign abscissa
%% #2 -> center of the circle
%% #3 -> point origin of the circle
%% #4 -> point to be placed
\def\pstCurvAbsNode{\@ifnextchar[\Pst@CurvAbsNode{\Pst@CurvAbsNode[]}}%
\def\Pst@CurvAbsNode[#1]#2#3#4#5{%
  \bgroup\setkeys{psset}{#1}%             % Affectation of local parameters
  \Pst@@CurvAbsNode{#2}{#3}{#4}{#5}%
  \ifx\psk@PointSymbol\@none\else{\Pst@geonodelabel{#4}}\fi%
  \egroup%
  %% AJOUTER LE MARQUAGE CodeFig
}%
\def\Pst@@CurvAbsNode#1#2#3#4{%
  \rput(#1){%
    \rput(!
      tx@EcldDict begin
        /N@#2 GetNode 2 copy 0 0 ABDist #4 exch div Pi div 180 mul
        \ifPst@CurvAbsNeg neg \fi Rotate
      end
      \pst@number\psyunit div exch \pst@number\psxunit div exch)%
    {\pnode{#3}}%
    }%% end \rput
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%        GENERIC CURVES
%% #2 -> Radical name
%% #3 -> initial counter value
%% #4 -> maximal counter value
\def\pstGenericCurve{\@ifnextchar[\Pst@GenericCurve{\Pst@GenericCurve[]}}%
\def\Pst@GenericCurve[#1]#2#3#4{%
  \bgroup\setkeys{psset}{#1}%       % Affectation of local parameters
    \edef\@@GenCourbe{\ifx\psk@GenCurvFirst\@none\else(\psk@GenCurvFirst)\fi}%
    \pst@cnth=#4
    \advance\pst@cnth by -#3%\@GenCurve% del DR
    \advance\pst@cnth by \psk@GenCurvInc%1 modif DR 020225
    \divide\pst@cnth by \psk@GenCurvInc
    \multido{\i@GenCurve=#3+\psk@GenCurvInc}{\pst@cnth}{%
      \xdef\@@GenCourbe{\@@GenCourbe(#2\i@GenCurve)}}
    \edef\@@GenCourbe{%
      \@@GenCourbe%
      \ifx\psk@GenCurvLast\@none\else(\psk@GenCurvLast)\fi}%
    \psset{showpoints=true}
    \expandafter\pscurve\@@GenCourbe
  \egroup%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%              Parallel line
%% #2 #3 -> nodes defining the line
%% #3 -> antecedent node
%% #4 -> node name of the image
%% #5 -> label
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%              Orthogonal line
%% #2 #3 -> nodes defining the line
%% #3 -> antecedent node
%% #4 -> node name of the image
%% #5 -> label
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Special macros for parameters
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Distance between two points
\def\pstDistAB#1#2{
  tx@EcldDict begin /N@#1 GetNode /N@#2 GetNode ABDist end
  \ifx\psk@DistCoef\@none\else
    \psk@DistCoef\space mul
  \fi
}
%% Distance specified with a number
\def\pstDistVal#1{
  #1 \pst@number\psxunit mul
  \ifx\psk@DistCoef\@none\else
    \psk@DistCoef\space mul
  \fi
}
%% angle defined by three points
\def\pstAngleAOB#1#2#3{
  tx@EcldDict begin /N@#3 GetNode /N@#2 GetNode end
  2 copy 6 2 roll
  tx@EcldDict begin ABVect end exch Atan
  dup 0 lt { 360 add } if
  tx@EcldDict begin /N@#1 GetNode end
  5 -2 roll tx@EcldDict begin ABVect end exch Atan
  dup 0 lt { 360 add } if
%   2 copy lt { exch 360 sub exch } if
  sub
  \ifx\psk@AngleCoef\@none\else
    \psk@AngleCoef\space mul
  \fi
}
%% END: pst-euclide.tex
%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 
