summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/pstricks-examples-en/14-05-1.ltx
blob: cde803ac279ebf37bff063879a1eaaec4ed2f897 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
%% 
%%  A DANTE-Edition example
%% 
%%  Example 14-05-1 on page 164.
%% 
%%  Copyright (C) 2011 Herbert Voss
%% 
%%  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.
%% 
%% 
%% ==== 
% Show page(s) 1
%% 
\documentclass[]{article}
\pagestyle{empty}
\setlength\textwidth{415.41023pt}
\setlength\parindent{0pt}

\usepackage{pst-node,multido,pst-xkey}
\SpecialCoor
\makeatletter
\define@boolkey[psset]{}[Pst@]{showFP}[true]{}% mark focal point?
\psset{showFP=true}                     % default
\def\focalPoint{\pst@object{focalPoint}}
\def\focalPoint@i(#1)(#2)(#3)#4{{   % keep everything local
  \use@par%                              % set parameters
  \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 nodes
     \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            % xSP
     YA YB YC add add 3.0 div            % ySP
  ){#4}%                                 % #5 = node name
  \ifPst@showFP\qdisk(#4){2pt}\fi}%
  \ignorespaces}     % mark?
\makeatother

\begin{document}
\psset{unit=0.7}
\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)%
    \focalPoint(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)%
    \focalPoint(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)%
    \focalPoint(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)%
    \focalPoint(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)%
    \focalPoint(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)%
    \focalPoint(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)%
    \focalPoint(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)%
    \focalPoint(A)(B)(C){SP}%
  }
\end{pspicture}
\end{document}