考虑下面的图画:
\documentclass[
a4paper,
12pt
]{article}
\usepackage[utf8]{inputenc}
\usepackage[
hmargin=2.4cm,
vmargin=3cm
]{geometry}
\usepackage{rotating}
\usepackage{pstricks-add}
\newcommand*\forskel{350 140 div }
\newcommand*\udtag[2]{\rput(!10 249 140 div #1 \forskel mul add){\small #2}}
\newcommand*\pil[1]{ \rput(!11.5 249 140 div #1 \forskel mul add){\small $\rightarrow$}}
\newcommand*\destillering[1]{%
% Ventiler og udtag.
\psline(!4 2.8 #1 \forskel mul add)%
(!4 1.8 #1 \forskel mul add)%
(!4 2.3 #1 \forskel mul add)%
(!5.3 2.3 #1 \forskel mul add)%
(!5.3 2.65 #1 \forskel mul add)
\psline(!5.15 2.5 #1 \forskel mul add)%
(!5.15 2.8 #1 \forskel mul add)%
(!5.95 2.8 #1 \forskel mul add)%
(!5.95 2.5 #1 \forskel mul add)
\psline(!5.8 2.65 #1 \forskel mul add)%
(!5.8 2.3 #1 \forskel mul add)%
(!6.3 2.3 #1 \forskel mul add)%
(!6.3 2.65 #1 \forskel mul add)
\psline(!6.15 2.5 #1 \forskel mul add)%
(!6.15 2.8 #1 \forskel mul add)%
(!6.95 2.8 #1 \forskel mul add)%
(!6.95 2.5 #1 \forskel mul add)
\psline(!6.8 2.65 #1 \forskel mul add)%
(!6.8 2.3 #1 \forskel mul add)%
(!7.4 2.3 #1 \forskel mul add)
\psline(! 8.5 284 140 div #1 \forskel mul add)%
(! 8.5 214 140 div #1 1 add \forskel mul add)
\psarc(! 1144 140 div 2.3 #1 \forskel mul add){0.27142857}{180}{270}
\psarc(! 1144 140 div 2.3 #1 \forskel mul add){0.77142857}{180}{270}
\psline(! 7.9 2.3 #1 \forskel mul add)%
(! 8.5 2.3 #1 \forskel mul add)
\psline(!1144 140 div 284 140 div #1 \forskel mul add)%
(! 12 284 140 div #1 \forskel mul add)
\psline(! 12 214 140 div #1 \forskel mul add)%
(!2861 350 div 214 140 div #1 \forskel mul add)
% `Mellemventiler'.
\psline(!3.5 470 140 div #1 \forskel mul add)%
(!5.3 470 140 div #1 \forskel mul add)%
(!5.3 519 140 div #1 \forskel mul add)
\psline(!5.15 498 140 div #1 \forskel mul add)%
(!5.15 540 140 div #1 \forskel mul add)%
(!5.95 540 140 div #1 \forskel mul add)%
(!5.95 498 140 div #1 \forskel mul add)
\psline(!5.8 519 140 div #1 \forskel mul add)%
(!5.8 470 140 div #1 \forskel mul add)%
(!6.3 470 140 div #1 \forskel mul add)%
(!6.3 519 140 div #1 \forskel mul add)
\psline(!6.15 498 140 div #1 \forskel mul add)%
(!6.15 540 140 div #1 \forskel mul add)%
(!6.95 540 140 div #1 \forskel mul add)%
(!6.95 498 140 div #1 \forskel mul add)
\psline(!6.8 519 140 div #1 \forskel mul add)%
(!6.8 470 140 div #1 \forskel mul add)%
(!8.1 470 140 div #1 \forskel mul add)%
(!8.1 392 140 div #1 \forskel mul add)%
}
\pagestyle{empty}
\begin{document}
\vfill
\begin{figure}[htbp]
\centering
\psset{unit=1cm}
\begin{pspicture}(-1.02,0.3)(12,17)
% Opvarmningsovn.
\psline(0.7,4.7)(0.7,5)(3.3,5)(3.3,2.9)
\psline(3.3,2.4)(3.3,2)(0.7,2)(0.7,4.2)
\psline(-0.8,4.7)(2.3,4.7)
\psline(-0.8,4.2)(2.3,4.2)
\psarc(2.3,4){0.2}{270}{90}
\psarc(2.3,4){0.7}{270}{90}
\psline(2.3,3.8)(1.7,3.8)
\psline(2.3,3.3)(1.7,3.3)
\psarc(1.7,3.1){0.2}{90}{270}
\psarc(1.7,3.1){0.7}{90}{270}
\psline(1.7,2.9)(3.5,2.9)
\psline(1.7,2.4)(3.5,2.4)
\rput(2,1.75){\small Ovn}
\rput(1.15,4.45){\small `Kold' råolie}
\rput(-0.4,4.45){\small $\rightarrow$}
% Tårnets indre samt udtag.
\multido{\i=0+1}{5}{%
\destillering{\i}%
\pil{\i}%
}
\pil{6}
\udtag{0}{Brændselsolie}
\udtag{1}{Smøreolie}
\udtag{2}{Dieselolie}
\udtag{3}{Petroleum}
\udtag{4}{Nafta}
\udtag{6}{Gasser}
% Tårnets ydre.
\psline( 3.5, 2.9)%
(! 3.5 179 140 div 6 \forskel mul add)%
(! 5.75 179 140 div 6 \forskel mul add)
\psarc(! 6.5 179 140 div 6 \forskel mul add){0.25}{90}{180}
\psline(! 6.5 214 140 div 6 \forskel mul add)%
(!12 214 140 div 6 \forskel mul add)
\psarc(! 6.5 179 140 div 6 \forskel mul add){0.75}{90}{180}
\psline(! 6.5 284 140 div 6 \forskel mul add)%
(!12 284 140 div 6 \forskel mul add)
\psline(! 6.25 179 140 div 6 \forskel mul add)%
(! 8.5 179 140 div 6 \forskel mul add)%
(! 8.5 284 140 div 5 \forskel mul add)%
% (!12 284 140 div 5 \forskel mul add)
% \psline(! 8.5 214 140 div 5 \forskel mul add)%
% (!12 214 140 div 5 \forskel mul add)
\psline(!8.5 284 140 div 5 \forskel mul add)%
(!8.5 214 140 div 5 \forskel mul add)
\psarc(6.5,1){0.25}{180}{270}
\psline(6.5,0.75)(12,0.75)
\psarc(6.5,1){0.75}{180}{270}
\psline(6.5,0.25)(12,0.25)
\psline(!8.5 214 140 div)(8.5,1)(6.25,1)
\rput(9,0.5){\small Destillationsrester}
\rput(11.5,0.5){\small $\rightarrow$}
\psline(5.75,1)(3.5,1)(3.5,2.4)
\end{pspicture}
\end{figure}
\vfill
\end{document}
我怎样才能逐渐给塔和管道上色,从底部的深红色开始,到顶部的浅黄色结束?
更新
在 Werner 的帮助下,我得到了以下结果:
\documentclass[
a4paper,
12pt
]{article}
\usepackage[utf8]{inputenc}
\usepackage[
hmargin=2.4cm,
vmargin=3cm
]{geometry}
\usepackage{rotating}
\usepackage{
pst-slpe,
pstricks-add
}
\newcommand*\forskel{350 140 div }
\newcommand*\udtag[2]{\rput(!10 249 140 div #1 \forskel mul add){\small #2}}
\newcommand*\pil[1]{ \rput(!11.5 249 140 div #1 \forskel mul add){\small $\rightarrow$}}
\newcommand*\destillering[1]{%
% Ventiler.
\psline(!4 2.8 #1 \forskel mul add)%
(!4 1.8 #1 \forskel mul add)%
(!4 2.3 #1 \forskel mul add)%
(!5.3 2.3 #1 \forskel mul add)%
(!5.3 2.65 #1 \forskel mul add)
\psline(!5.15 2.5 #1 \forskel mul add)%
(!5.15 2.8 #1 \forskel mul add)%
(!5.95 2.8 #1 \forskel mul add)%
(!5.95 2.5 #1 \forskel mul add)
\psline(!5.8 2.65 #1 \forskel mul add)%
(!5.8 2.3 #1 \forskel mul add)%
(!6.3 2.3 #1 \forskel mul add)%
(!6.3 2.65 #1 \forskel mul add)
\psline(!6.15 2.5 #1 \forskel mul add)%
(!6.15 2.8 #1 \forskel mul add)%
(!6.95 2.8 #1 \forskel mul add)%
(!6.95 2.5 #1 \forskel mul add)
\psline(!6.8 2.65 #1 \forskel mul add)%
(!6.8 2.3 #1 \forskel mul add)%
(!7.4 2.3 #1 \forskel mul add)
\psline(! 8.5 284 140 div #1 \forskel mul add)%
(! 8.5 214 140 div #1 1 add \forskel mul add)
% `Mellemventiler'.
\psline(!3.5 470 140 div #1 \forskel mul add)%
(!5.3 470 140 div #1 \forskel mul add)%
(!5.3 519 140 div #1 \forskel mul add)
\psline(!5.15 498 140 div #1 \forskel mul add)%
(!5.15 540 140 div #1 \forskel mul add)%
(!5.95 540 140 div #1 \forskel mul add)%
(!5.95 498 140 div #1 \forskel mul add)
\psline(!5.8 519 140 div #1 \forskel mul add)%
(!5.8 470 140 div #1 \forskel mul add)%
(!6.3 470 140 div #1 \forskel mul add)%
(!6.3 519 140 div #1 \forskel mul add)
\psline(!6.15 498 140 div #1 \forskel mul add)%
(!6.15 540 140 div #1 \forskel mul add)%
(!6.95 540 140 div #1 \forskel mul add)%
(!6.95 498 140 div #1 \forskel mul add)
\psline(!6.8 519 140 div #1 \forskel mul add)%
(!6.8 470 140 div #1 \forskel mul add)%
(!8.1 470 140 div #1 \forskel mul add)%
(!8.1 392 140 div #1 \forskel mul add)%
% Udtag.
\psarc(! 1144 140 div 2.3 #1 \forskel mul add){0.27142857}{180}{270}
\psarc(! 1144 140 div 2.3 #1 \forskel mul add){0.77142857}{180}{270}
\psline(! 7.9 2.3 #1 \forskel mul add)%
(! 8.5 2.3 #1 \forskel mul add)
\psline(!1144 140 div 284 140 div #1 \forskel mul add)%
(! 12 284 140 div #1 \forskel mul add)
\psline(! 12 214 140 div #1 \forskel mul add)%
(!2861 350 div 214 140 div #1 \forskel mul add)
}
\pagestyle{empty}
\begin{document}
\vfill
\begin{center}
\psset{
unit=1cm
}
\begin{pspicture}(-0.8,0.25)(12,17)
% Farvegraduering.
{\psset{
linestyle = none,
slopeangle = 90,
fillstyle = slope,
slopebegin = red!90!black,
slopeend = yellow
}
\psframe[
slopesteps = 50
](0.7,2)(3.3,5)
\pscustom[
slopesteps = 200
]{
\multido{\iA = 0+1}{5}{%
\psline(! 8.5 284 140 div \iA\space \forskel mul add)%
(!12 284 140 div \iA\space \forskel mul add)%
(!12 214 140 div \iA\space \forskel mul add)%
(! 8.5 214 140 div \iA\space \forskel mul add)%
}
\psline(8.5,1)(6.3,1)
\psarc(6.5,1){0.25}{180}{270}
\psline(6.5,0.75)(12,0.75)(12,0.25)(6.5,0.25)
\psarcn(6.5,1){0.75}{270}{180}
\psline(5.75,1)(3.5,1)(3.5,2.4)(3.5,16.3)(5.75,16.3)
\psarc(6.5,16.3){0.75}{90}{180}
\psline(6.5,17.05)(12,17.05)(12,16.55)(6.5,16.55)
\psarc(6.5,16.3){0.25}{90}{180}
\psline(6.5,16.3)(8.5,16.3)
}
}
{\psset{
linestyle = none,
slopeangle = 90,
fillstyle = slope,
slopebegin = red!80!yellow,
slopeend = blue!50!black
}
\pscustom[
slopesteps = 50
]{
\psline(-0.8,4.2)(2.3,4.2)
\psarc(2.3,4){0.2}{-90}{90}
\psline(2.3,3.8)(1.7,3.8)
\psarcn(1.7,3.1){0.7}{-90}{90}
\psline(1.7,2.4)(3.5,2.4)(3.5,2.9)(1.7,2.9)
\psarc(1.7,3.1){0.2}{90}{-90}
\psline(1.7,3.3)(2.3,3.3)
\psarcn(2.3,4){0.7}{90}{-90}
\psline(2.3,4.7)(-0.8,4.7)
}
}
% Opvarmningsovn.
\psline(0.7,4.7)(0.7,5)(3.3,5)(3.3,2.9)
\psline(3.3,2.4)(3.3,2)(0.7,2)(0.7,4.2)
\psline(-0.8,4.7)(2.3,4.7)
\psline(-0.8,4.2)(2.3,4.2)
\psarc(2.3,4){0.2}{270}{90}
\psarc(2.3,4){0.7}{270}{90}
\psline(2.3,3.8)(1.7,3.8)
\psline(2.3,3.3)(1.7,3.3)
\psarc(1.7,3.1){0.2}{90}{270}
\psarc(1.7,3.1){0.7}{90}{270}
\psline(1.7,2.9)(3.5,2.9)
\psline(1.7,2.4)(3.5,2.4)
\rput(2,1.75){\small Ovn}
\rput(1.15,4.45){\small `Kold' råolie}
\rput(-0.4,4.45){\small $\rightarrow$}
% Tårnets indre samt udtag.
\multido{\iB = 0+1}{5}{%
\destillering{\iB}%
\pil{\iB}%
}
\pil{6}
\udtag{0}{Brændselsolie}
\udtag{1}{Smøreolie}
\udtag{2}{Dieselolie}
\udtag{3}{Petroleum}
\udtag{4}{Nafta}
\udtag{6}{Gasser}
% Tårnets ydre.
\psline( 3.5, 2.9)%
(! 3.5 179 140 div 6 \forskel mul add)%
(! 5.75 179 140 div 6 \forskel mul add)
\psarc(! 6.5 179 140 div 6 \forskel mul add){0.25}{90}{180}
\psline(! 6.5 214 140 div 6 \forskel mul add)%
(!12 214 140 div 6 \forskel mul add)
\psarc(! 6.5 179 140 div 6 \forskel mul add){0.75}{90}{180}
\psline(! 6.5 284 140 div 6 \forskel mul add)%
(!12 284 140 div 6 \forskel mul add)
\psline(! 6.25 179 140 div 6 \forskel mul add)%
(! 8.5 179 140 div 6 \forskel mul add)%
(! 8.5 284 140 div 5 \forskel mul add)%
% (!12 284 140 div 5 \forskel mul add)
% \psline(! 8.5 214 140 div 5 \forskel mul add)%
% (!12 214 140 div 5 \forskel mul add)
\psline(!8.5 284 140 div 5 \forskel mul add)%
(!8.5 214 140 div 5 \forskel mul add)
% Nederste udtag.
\psarc(6.5,1){0.25}{180}{270}
\psline(6.5,0.75)(12,0.75)
\psline(12,0.25)(6.5,0.25)
\psarc(6.5,1){0.75}{180}{270}
\psline(!8.5 214 140 div)(8.5,1)(6.25,1)
\rput(9,0.5){\small Destillationsrester}
\rput(11.5,0.5){\small $\rightarrow$}
\psline(5.75,1)(3.5,1)(3.5,2.4)
\end{pspicture}
\end{center}
\vfill
\end{document}
答案1
“最简单”的方法是创建一个\pscustom
包含整个塔+管道结构的路径,并使用pst-slpe
的slope
填充。
下面我仅显示自定义路径的一部分,省略了一些管道。但是,过程是相同的。此外,填充实际上是纯红色,并以 90 度角应用了淡入淡出:
\documentclass[
a4paper,
12pt
]{article}
\usepackage[utf8]{inputenc}
\usepackage[
hmargin=2.4cm,
vmargin=3cm
]{geometry}
\usepackage{rotating}
\usepackage{pstricks-add,pst-slpe}
\newcommand*\forskel{350 140 div }
\newcommand*\udtag[2]{\rput(!10 249 140 div #1 \forskel mul add){\small #2}}
\newcommand*\pil[1]{ \rput(!11.5 249 140 div #1 \forskel mul add){\small $\rightarrow$}}
\newcommand*\destillering[1]{%
% Ventiler og udtag.
\psline(!4 2.8 #1 \forskel mul add)%
(!4 1.8 #1 \forskel mul add)%
(!4 2.3 #1 \forskel mul add)%
(!5.3 2.3 #1 \forskel mul add)%
(!5.3 2.65 #1 \forskel mul add)
\psline(!5.15 2.5 #1 \forskel mul add)%
(!5.15 2.8 #1 \forskel mul add)%
(!5.95 2.8 #1 \forskel mul add)%
(!5.95 2.5 #1 \forskel mul add)
\psline(!5.8 2.65 #1 \forskel mul add)%
(!5.8 2.3 #1 \forskel mul add)%
(!6.3 2.3 #1 \forskel mul add)%
(!6.3 2.65 #1 \forskel mul add)
\psline(!6.15 2.5 #1 \forskel mul add)%
(!6.15 2.8 #1 \forskel mul add)%
(!6.95 2.8 #1 \forskel mul add)%
(!6.95 2.5 #1 \forskel mul add)
\psline(!6.8 2.65 #1 \forskel mul add)%
(!6.8 2.3 #1 \forskel mul add)%
(!7.4 2.3 #1 \forskel mul add)
\psline(! 8.5 284 140 div #1 \forskel mul add)%
(! 8.5 214 140 div #1 1 add \forskel mul add)
\psarc(! 1144 140 div 2.3 #1 \forskel mul add){0.27142857}{180}{270}
\psarc(! 1144 140 div 2.3 #1 \forskel mul add){0.77142857}{180}{270}
\psline(! 7.9 2.3 #1 \forskel mul add)%
(! 8.5 2.3 #1 \forskel mul add)
\psline(!1144 140 div 284 140 div #1 \forskel mul add)%
(! 12 284 140 div #1 \forskel mul add)
\psline(! 12 214 140 div #1 \forskel mul add)%
(!2861 350 div 214 140 div #1 \forskel mul add)
% `Mellemventiler'.
\psline(!3.5 470 140 div #1 \forskel mul add)%
(!5.3 470 140 div #1 \forskel mul add)%
(!5.3 519 140 div #1 \forskel mul add)
\psline(!5.15 498 140 div #1 \forskel mul add)%
(!5.15 540 140 div #1 \forskel mul add)%
(!5.95 540 140 div #1 \forskel mul add)%
(!5.95 498 140 div #1 \forskel mul add)
\psline(!5.8 519 140 div #1 \forskel mul add)%
(!5.8 470 140 div #1 \forskel mul add)%
(!6.3 470 140 div #1 \forskel mul add)%
(!6.3 519 140 div #1 \forskel mul add)
\psline(!6.15 498 140 div #1 \forskel mul add)%
(!6.15 540 140 div #1 \forskel mul add)%
(!6.95 540 140 div #1 \forskel mul add)%
(!6.95 498 140 div #1 \forskel mul add)
\psline(!6.8 519 140 div #1 \forskel mul add)%
(!6.8 470 140 div #1 \forskel mul add)%
(!8.1 470 140 div #1 \forskel mul add)%
(!8.1 392 140 div #1 \forskel mul add)%
}
\pagestyle{empty}
\begin{document}
\vfill
\begin{figure}[htbp]
\centering
\psset{unit=1cm}
\begin{pspicture}(-1.02,0.3)(12,17)
% Opvarmningsovn.
%\psgrid
\psframe[linestyle=none,slopeangle=90,slopesteps=50,
fillstyle=slope,slopebegin=red,slopeend=yellow
](0.7,2)(3.3,5)% Ovn
\pscustom[linestyle=none,slopeangle=90,slopesteps=200,
fillstyle=slope,slopebegin=red,slopeend=yellow
]{
\psline(12,0.25)(6.5,0.25)
\psarcn(6.5,1){0.75}{270}{180}
\psline(5.8,1)(3.5,1)(3.5,2.4)(1.7,2.4)
\psarcn(1.7,3.1){0.7}{-90}{90}
\psline(1.7,3.8)(2.3,3.8)
\psarc(2.3,4){0.2}{-90}{90}
\psline(2.3,4.2)(-0.8,4.2)(-0.8,4.7)(2.3,4.7)
\psarcn(2.3,4){0.7}{90}{-90}
\psline(2.3,3.3)(1.7,3.3)
\psarc(1.7,3.1){0.2}{90}{-90}
\psline(1.7,2.9)(3.5,2.9)(3.5,16.3)(8.5,16.3)
(8.5,12)(12,12)(12,11.5)(8.5,11.5)% Nafta
(8.5,9.5)(12,9.5)(12,9)(8.5,9)% Petroleum
(8.5,7)(12,7)(12,6.5)(8.5,6.5)% Dieselolie
(8.5,4.5)(12,4.5)(12,4)(8.5,4)% Smoreolie
(8.5,2)(12,2)(12,1.5)(8.5,1.5)% Braendselolie
(8.5,1)(6.3,1)
\psarc(6.5,1){0.25}{180}{270}
\psline(6.5,0.75)(12,0.75)(12,0.25)
}
\psline(0.7,4.7)(0.7,5)(3.3,5)(3.3,2.9)
\psline(3.3,2.4)(3.3,2)(0.7,2)(0.7,4.2)
\psline(-0.8,4.7)(2.3,4.7)
\psline(-0.8,4.2)(2.3,4.2)
\psarc(2.3,4){0.2}{270}{90}
\psarc(2.3,4){0.7}{270}{90}
\psline(2.3,3.8)(1.7,3.8)
\psline(2.3,3.3)(1.7,3.3)
\psarc(1.7,3.1){0.2}{90}{270}
\psarc(1.7,3.1){0.7}{90}{270}
\psline(1.7,2.9)(3.5,2.9)
\psline(1.7,2.4)(3.5,2.4)
\rput(2,1.75){\small Ovn}
\rput(1.15,4.45){\small `Kold' råolie}
\rput(-0.4,4.45){\small $\rightarrow$}
% Tårnets indre samt udtag.
\multido{\i=0+1}{5}{%
\destillering{\i}%
\pil{\i}%
}
\pil{6}
\udtag{0}{Brændselsolie}
\udtag{1}{Smøreolie}
\udtag{2}{Dieselolie}
\udtag{3}{Petroleum}
\udtag{4}{Nafta}
\udtag{6}{Gasser}
% Tårnets ydre.
\psline( 3.5, 2.9)%
(! 3.5 179 140 div 6 \forskel mul add)%
(! 5.75 179 140 div 6 \forskel mul add)
\psarc(! 6.5 179 140 div 6 \forskel mul add){0.25}{90}{180}
\psline(! 6.5 214 140 div 6 \forskel mul add)%
(!12 214 140 div 6 \forskel mul add)
\psarc(! 6.5 179 140 div 6 \forskel mul add){0.75}{90}{180}
\psline(! 6.5 284 140 div 6 \forskel mul add)%
(!12 284 140 div 6 \forskel mul add)
\psline(! 6.25 179 140 div 6 \forskel mul add)%
(! 8.5 179 140 div 6 \forskel mul add)%
(! 8.5 284 140 div 5 \forskel mul add)%
% (!12 284 140 div 5 \forskel mul add)
% \psline(! 8.5 214 140 div 5 \forskel mul add)%
% (!12 214 140 div 5 \forskel mul add)
\psline(!8.5 284 140 div 5 \forskel mul add)%
(!8.5 214 140 div 5 \forskel mul add)
\psarc(6.5,1){0.25}{180}{270}
\psline(6.5,0.75)(12,0.75)
\psarc(6.5,1){0.75}{180}{270}
\psline(6.5,0.25)(12,0.25)
\psline(!8.5 214 140 div)(8.5,1)(6.25,1)
\rput(9,0.5){\small Destillationsrester}
\rput(11.5,0.5){\small $\rightarrow$}
\psline(5.75,1)(3.5,1)(3.5,2.4)
\end{pspicture}
\end{figure}
\vfill
\end{document}
您首先绘制填充,然后按原样覆盖其余结构。 沿侧管的对齐不是 100%,但那是因为我不完全了解它们在混合坐标中绘制的位置。
我增加了用于定义斜率颜色的步数。