blob: 9d4a132402519f3015afa2d9f3f7e0717430cfd5 (
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
% Copyright 2006 by Till Tantau
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
\RequirePackage{pgfrcs}
\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/latex/pgf/compatibility/pgfheaps.sty,v 1.3 2006/10/11 15:22:27 tantau Exp $
\RequirePackage{pgf}
\PackageWarning{pgfheaps}{This package is obsolete.}
\ProcessOptions
%
% Package for drawing heap diagrams.
%
\newdimen\pgf@heapx
\newdimen\pgf@heapy
% Construct the path of a heap.
%
% #1 = Position of heap label.
% #2 = Position of left base
% #3 = Position of right base
%
% Example:
%
% \pgfheappath{\pgfxy(1,0)}{\pgfxy(-1,0)}{\pgfxy(1,0)}
% \pgffill
\def\pgfheappath#1#2#3{%
\pgfdiff{#2}{#3}%
\pgf@heapx=-.25\pgf@x%
\pgf@heapy=-.25\pgf@y%
\pgfmoveto{#2}%
\pgfbezier%
{\pgfpartway{0.5}{#2}{\pgfrelative{#1}{\pgfpoint{\pgf@heapx}{\pgf@heapy}}}}%
{\pgfrelative{#1}{\pgfpoint{\pgf@heapx}{\pgf@heapy}}}%
{#1}%
\pgf@heapx=-\pgf@heapx%
\pgf@heapy=-\pgf@heapy%
\pgfbezier%
{\pgfrelative{#1}{\pgfpoint{\pgf@heapx}{\pgf@heapy}}}%
{\pgfpartway{0.5}{#3}{\pgfrelative{#1}{\pgfpoint{\pgf@heapx}{\pgf@heapy}}}}%
{#3}%
\ignorespaces}
% Draw a heap label.
%
% #1 = Position of heap label.
% #2 = Label text.
%
% Example:
%
% \pgfheaplabel{\pgfxy(1,0)}{Class P}
\def\pgfheaplabel#1#2{%
\setbox\pgf@hbox=\hbox{\pgfinterruptpicture#2\endpgfinterruptpicture}%
\pgf@heapy=\ht\pgf@hbox%
\pgfputat{\pgfrelative{#1}{\pgfpoint{0pt}{-2\pgf@heapy}}}{\pgfbox[center,base]{#2}}%
\ignorespaces}
% Draw a labeled heap.
%
% #1 = Position of heap label.
% #2 = Position of left base
% #3 = Position of right base
% #4 = Label text.
%
% Example:
%
% \pgfheaplabeled{\pgfxy(1,0)}{\pgfxy(-1,0)}{\pgfxy(1,0)}{Class P}
\def\pgfheaplabeled#1#2#3#4{%
\pgfheaplabel{#1}{#4}%
\pgfheappath{#1}{#2}{#3}%
\pgfstroke%
\ignorespaces}
% Draw a labeled heap.
%
% #1 = Height of the label
% #2 = Left and right extension of the base.
% #3 = Label text.
%
% Example:
%
% \pgfheaplabeledcentered{1cm}{1cm}{Class P}
\def\pgfheaplabeledcentered#1#2#3{%
\pgfheaplabeled{\pgfpoint{0pt}{#1}}{\pgfpoint{-#2}{0pt}}{\pgfpoint{#2}{0pt}}{#3}\ignorespaces}
\endinput
|