%% COPYRIGHT 2014 by Thomas Soell
%
% This work 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.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2003/12/01 or later.
%
% This work consists of the file pstricks.tex, PostScript macros
% for Generic TeX.
% See the PSTricks User's Guide for description.
%
\csname PSTperspectiveLoaded\endcsname
\let\PSTperspectiveLoaded\endinput
%\ifx\PSTEuclideLoaded\endinput \else\input pst-eucl     \fi
%\ifx\PSTricksAddLoaded\endinput\else\input pstricks-add \fi
%
\def\fileversion{0.01}
\def\filedate{2014/02/21}
\message{ v\fileversion, \filedate (ts)}
\message{ v\fileversion, \filedate}
\edef\TheAtCode{\the\catcode`\@}
\catcode`\@=11
\pst@addfams{pst-perspective}
\define@boolkey[psset]{pst-perspective}[Pst@]{translineA}[false]{} % showtransline
\define@boolkey[psset]{pst-perspective}[Pst@]{translineB}[false]{} % showtransline
\define@boolkey[psset]{pst-perspective}[Pst@]{translineK}[true]{} % show transline
\define@boolkey[psset]{pst-perspective}[Pst@]{hideline}[false]{} % showhideline
\define@boolkey[psset]{pst-perspective}[Pst@]{LowPoint}[false]{} % Basis durch z.B. tief liegenden Pkt
\define@boolkey[psset]{pst-perspective}[Pst@]{symX}[true]{} % Symmetrieachse bei spiegelverkehrten Bildern
\define@key[psset]{pst-perspective}{hidecolor}[black!80]{\def\psk@transTS@hidecolor{#1}}
\define@key[psset]{pst-perspective}{hidelinestyle}[solid]{\def\psk@transTS@hidelinestyle{#1}}
\define@key[psset]{pst-perspective}{hidelinewidth}[0.7pt]{\def\psk@transTS@hidelinewidth{#1}}
\define@key[psset]{pst-perspective}{transcolor}[blue]{\def\psk@transTS@transcolor{#1}}
\define@key[psset]{pst-perspective}{transAcolor}[green]{\def\psk@transTS@transAcolor{#1}}
\define@key[psset]{pst-perspective}{transBcolor}[blue]{\def\psk@transTS@transBcolor{#1}}
\define@key[psset]{pst-perspective}{translinestyle}[solid]{\def\psk@transTS@translinestyle{#1}}
\define@key[psset]{pst-perspective}{transAlinestyle}[dashed]{\def\psk@transTS@transAlinestyle{#1}}
\define@key[psset]{pst-perspective}{transBlinestyle}[dashed]{\def\psk@transTS@transBlinestyle{#1}}
\define@key[psset]{pst-perspective}{translinewidth}[0.8pt]{\def\psk@transTS@translinewidth{#1}}
\define@key[psset]{pst-perspective}{transAlinewidth}[0.7pt]{\def\psk@transTS@transAlinewidth{#1}}
\define@key[psset]{pst-perspective}{transBlinewidth}[0.7pt]{\def\psk@transTS@transBlinewidth{#1}}
\define@key[psset]{pst-perspective}{LowP}[{0|0}]{\def\psk@transTS@LowP{#1 }}
\define@key[psset]{pst-perspective}{originT}[{0|0}]{\def\psk@transTS@originT{#1 }}
\define@key[psset]{pst-perspective}{base}[0]{\def\psk@transTS@base{#1 }} % y-Wert der Basis f\"{u}r die Transformation
\define@key[psset]{pst-perspective}{symline}[0]{\def\psk@transTS@symline{#1 }} % Symmetrieachse
\define@key[psset]{pst-perspective}{phi}[45]{\def\psk@transTS@phi{#1 }}% Winkel f\"{u}r das Schr\"{a}gbild
\define@key[psset]{pst-perspective}{deltaphi}[0]{\def\psk@transTS@deltaphi{#1 }}% zus\"{a}tzlicher Winkel f\"{u}r das Schr\"{a}gbild
\define@key[psset]{pst-perspective}{vkf}[0.5]{\def\psk@transTS@vkf{#1 }} % Verk\"{u}rzungsfaktor
\psset[pst-perspective]{phi=45,vkf=0.5,base=0,translineA=false,translineB=false,transAcolor=green,transBcolor=blue,%
transAlinewidth=0.7pt,transBlinewidth=0.7pt,transAlinestyle=dashed,transBlinestyle=dashed,deltaphi=0,symline=0,symX=true,hidecolor=black!80,%
translineK=true,transcolor=blue,translinewidth=0.8pt,translinestyle=solid,LowPoint=false,LowP={0,0},originT={0,0},hideline=false,hidelinewidth=0.7pt,hidelinestyle=dashed}%
\SpecialCoor%
\def\ba{\psk@transTS@base}
\def\pstransTS{\pst@object{pstpstransTS}}%
%
\def\pstpstransTS@i(#1)#2#3{%
\begingroup%
% (#1) Punkt 1
% #2 Node-Name des Startpunktes % #3 Node-Name des transformierten Punktes
\pst@killglue
\use@par
\rput(\psk@transTS@originT){\pnode(#1){#2}}%
\pst@getcoor{#1}\pst@tempA%
\pst@getcoor{\psk@transTS@LowP}\pst@tempB
\rput(\psk@transTS@originT){\pnode(! %
\pst@tempA \tx@UserCoor /y1 ED /x1 ED
\ifPst@LowPoint
\pst@tempB \tx@UserCoor /y2 ED /x2 ED
\else
/y2 \psk@transTS@base def \fi
/lang y2 y1 sub abs \psk@transTS@vkf mul def
/lang2 y2 y1 sub def
lang2 0 ge {/alph2 \psk@transTS@phi \psk@transTS@deltaphi add 180 sub def} {/alph2 \psk@transTS@phi \psk@transTS@deltaphi add def} ifelse
lang alph2 PtoC exch x1 add exch y2 add){#3}
\ifPst@translineA
\ifPst@LowPoint
\pcline[linecolor=\psk@transTS@transAcolor,linestyle=\psk@transTS@transAlinestyle,linewidth=\psk@transTS@transAlinewidth](! \pst@tempA \tx@UserCoor pop \pst@tempB \tx@UserCoor exch pop)(#2)
\else
\pcline[linecolor=\psk@transTS@transAcolor,linestyle=\psk@transTS@transAlinestyle,linewidth=\psk@transTS@transAlinewidth](! \pst@tempA \tx@UserCoor pop \psk@transTS@base)(#2)
\fi
\else \fi%
\ifPst@translineB
\ifPst@LowPoint
\pcline[linecolor=\psk@transTS@transBcolor,linestyle=\psk@transTS@transBlinestyle,linewidth=\psk@transTS@transBlinewidth](! \pst@tempA \tx@UserCoor pop \pst@tempB \tx@UserCoor exch pop)(#3)
\else
\pcline[linecolor=\psk@transTS@transBcolor,linestyle=\psk@transTS@transBlinestyle,linewidth=\psk@transTS@transBlinewidth](! \pst@tempA \tx@UserCoor pop \psk@transTS@base)(#3)
\fi
\else \fi%
}%
\endgroup
\ignorespaces
}
\def\pstransTSX{\pst@object{pstpstransTSX}}%
%
\def\pstpstransTSX@i(#1)#2#3{%
\begingroup%
% (#1) Punkt 1
% #2 Node-Name des Startpunktes % #3 Node-Name des transformierten Punktes
\pst@killglue
\use@par
\rput(\psk@transTS@originT){\pnode(#1){#2}}%
\pst@getcoor{#1}\pst@tempA%
\pst@getcoor{\psk@transTS@LowP}\pst@tempB
\rput(\psk@transTS@originT){\pnode(! %
\pst@tempA \tx@UserCoor /y1 ED /x1 ED
\ifPst@LowPoint
\pst@tempB \tx@UserCoor /y2 ED /x2 ED
\else
/x2 \psk@transTS@base def \fi
/x3 \psk@transTS@symline def
\ifPst@symX
/lang x2 x1 sub x1 x3 sub 2 mul add abs \psk@transTS@vkf mul def
\else
/lang x2 x1 sub abs \psk@transTS@vkf mul def \fi
/lang2 x2 x1 sub def
x2 x1 ge {/alph2 \psk@transTS@phi \psk@transTS@deltaphi add def} {/alph2 \psk@transTS@phi \psk@transTS@deltaphi add 180 sub def} ifelse
lang alph2 PtoC exch x2 add exch y1 add){#3}
\ifPst@translineA
\ifPst@LowPoint
\pcline[linecolor=\psk@transTS@transAcolor,linestyle=\psk@transTS@transAlinestyle,linewidth=\psk@transTS@transAlinewidth](! \pst@tempB \tx@UserCoor pop \pst@tempA \tx@UserCoor exch pop)(#2)
\else
\pcline[linecolor=\psk@transTS@transAcolor,linestyle=\psk@transTS@transAlinestyle,linewidth=\psk@transTS@transAlinewidth](! \psk@transTS@base \pst@tempA \tx@UserCoor exch pop)(#2)
\fi
\else \fi%
\ifPst@translineB
\ifPst@LowPoint
\pcline[linecolor=\psk@transTS@transBcolor,linestyle=\psk@transTS@transBlinestyle,linewidth=\psk@transTS@transBlinewidth](! \pst@tempB \tx@UserCoor pop \pst@tempA \tx@UserCoor exch pop)(#3)
\else
\pcline[linecolor=\psk@transTS@transBcolor,linestyle=\psk@transTS@transBlinestyle,linewidth=\psk@transTS@transBlinewidth](! \psk@transTS@base \pst@tempA \tx@UserCoor exch pop )(#3)
\fi
\else \fi%
}%
\endgroup
\ignorespaces
}
%------------------------------------------------------------------
\def\pstransTSK{\pst@object{pstpstransTSK}}%
\def\pstpstransTSK@i(#1)#2#3#4{%
\begingroup%
% (#1) Koordinaten des Punktes (kartesisch oder Polarkoordinaten)
%  #2  Originall\"{a}nge #3  Node-Name des Startpunktes %  #4   Node-Name des transformierten Punktes
\pst@killglue
\use@par
\rput(#1){\pnode(0,0){#3}}
\rput(#1){\pnode(! %
/l1 #2 def
/l2 l1 \psk@transTS@vkf mul def
l2 \psk@transTS@phi PtoC){#4}}
\ifPst@translineK
\pcline[linecolor=\psk@transTS@transcolor,linestyle=\psk@transTS@translinestyle,linewidth=\psk@transTS@translinewidth](#3)(#4)
\else \fi%
\endgroup
\ignorespaces
}
%--------------------------------------------------------------------------------
%--------------------------------------------------------------------------------
\def\psboxTS{\pst@object{pstpsboxTS}}%
\def\pstpsboxTS@i(#1,#2,#3)#4#5#6#7{%
\begingroup%
% (#1) Koordinaten des Punktes (kartesisch oder Polarkoordinaten)
%  #2  Originall\"{a}nge #3  Node-Name des Startpunktes %  #4   Node-Name des transformierten Punktes
\pst@killglue
\use@par
%-------------------------------------------------
\pspolygon[fillstyle=solid,fillcolor=#7!60]%
(!/l1 #1 #4 add def
/l2 l1 \psk@transTS@vkf mul def
l2 \psk@transTS@phi 180 add PtoC #3 add exch #2 add exch)%
%-------------------------------------------------
(!/l1 #1 #4 add def
/l2 l1 \psk@transTS@vkf mul def
l2 \psk@transTS@phi 180 add PtoC #3 add exch #2 #5 add add exch)%
%-------------------------------------------------
(!/l1 #1 #4 add def
/l2 l1 \psk@transTS@vkf mul def
l2 \psk@transTS@phi 180 add PtoC #3 #6 add add exch #2 #5 add add exch)%
%-------------------------------------------------
(!/l1 #1 #4 add def
/l2 l1 \psk@transTS@vkf mul def
l2 \psk@transTS@phi 180 add PtoC #3 #6 add add exch #2 add exch)%
%-------------------------------------------------
\pspolygon[fillstyle=solid,fillcolor=#7!90]%
(!/l1 #1 #4 add def
/l2 l1 \psk@transTS@vkf mul def
l2 \psk@transTS@phi 180 add PtoC #3 add exch #2 #5 add add exch)%
%-------------------------------------------------
(!/l1 #1 def
/l2 l1 \psk@transTS@vkf mul def
l2 \psk@transTS@phi 180 add PtoC #3 add exch #2 #5 add add exch)%
%-------------------------------------------------
(!/l1 #1 def
/l2 l1 \psk@transTS@vkf mul def
l2 \psk@transTS@phi 180 add PtoC #3 #6 add add exch #2 #5 add add exch)%
%-------------------------------------------------
(!/l1 #1 #4 add def
/l2 l1 \psk@transTS@vkf mul def
l2 \psk@transTS@phi 180 add PtoC #3 #6 add add exch #2 #5 add add exch)%

%%-------------------------------------------------
\pspolygon[fillstyle=solid,fillcolor=#7!40]%
(!/l1 #1 #4 add def
/l2 l1 \psk@transTS@vkf mul def
l2 \psk@transTS@phi 180 add PtoC #3 #6 add add exch #2 #5 add add exch)%
%-------------------------------------------------
(!/l1 #1 def
/l2 l1 \psk@transTS@vkf mul def
l2 \psk@transTS@phi 180 add PtoC #3 #6 add add exch #2 #5 add add exch)%
%-------------------------------------------------
(!/l1 #1 def
/l2 l1 \psk@transTS@vkf mul def
l2 \psk@transTS@phi 180 add PtoC #3 #6 add add exch #2 add exch)%
%-------------------------------------------------
(!/l1 #1 #4 add def
/l2 l1 \psk@transTS@vkf mul def
l2 \psk@transTS@phi 180 add PtoC #3 #6 add add exch #2 add exch)%
%-------------------------------------------------
\ifPst@hideline
\psline[linecolor=\psk@transTS@hidecolor,linestyle=\psk@transTS@hidelinestyle,linewidth=\psk@transTS@hidelinewidth]%
(!/l1 #1 def
/l2 l1 \psk@transTS@vkf mul def
l2 \psk@transTS@phi 180 add PtoC #3 add exch #2 add exch)%
(!/l1 #1 #4 add def
/l2 l1 \psk@transTS@vkf mul def
l2 \psk@transTS@phi 180 add PtoC #3 add exch #2 add exch)%
%-------------------------------------------------
\psline[linecolor=\psk@transTS@hidecolor,linestyle=\psk@transTS@hidelinestyle,linewidth=\psk@transTS@hidelinewidth]%
(!/l1 #1 def
/l2 l1 \psk@transTS@vkf mul def
l2 \psk@transTS@phi 180 add PtoC #3 add exch #2 add exch)%
(!/l1 #1 def
/l2 l1 \psk@transTS@vkf mul def
l2 \psk@transTS@phi 180 add PtoC #3 #6 add add exch #2 add exch)%
%-------------------------------------------------
\psline[linecolor=\psk@transTS@hidecolor,linestyle=\psk@transTS@hidelinestyle,linewidth=\psk@transTS@hidelinewidth]%
(!/l1 #1 def
/l2 l1 \psk@transTS@vkf mul def
l2 \psk@transTS@phi 180 add PtoC #3 add exch #2 add exch)%
(!/l1 #1 def
/l2 l1 \psk@transTS@vkf mul def
l2 \psk@transTS@phi 180 add PtoC #3 add exch #2 #5 add add exch)%
\else \fi%
\endgroup
\ignorespaces
}
\catcode`\@=\TheAtCode\relax
\endinput
%%
%% END pst-perspective.tex 