如何压缩以下示例中的两个抛物线命令?

如何压缩以下示例中的两个抛物线命令?
\documentclass[border=15pt,pstricks,12pt]{standalone}
\usepackage{pstricks-add}
\begin{document}
\begin{pspicture}[showgrid](-3,-3)(3,3)
\psframe[dimen=m](-3,-3)(3,3)
%%%
\psclip{\parabola(3,3)(0,0)}%
\psrotate(0,0){-90}{\parabola[fillstyle=hlines](3,3)(0,0)}
\psrotate(0,0){90}{\parabola[fillstyle=hlines](3,3)(0,0)}
\endpsclip
\psclip{\parabola(-3,-3)(0,0)}%
\psrotate(0,0){-90}{\parabola[fillstyle=hlines](3,3)(0,0)}
\psrotate(0,0){90}{\parabola[fillstyle=hlines](3,3)(0,0)}%%
\endpsclip%%
\end{pspicture}
\end{document}

在此处输入图片描述

嗯,好像 %% 和 %% 不见了!

答案1

\psrotate适用于更复杂的物体,不适用于围绕原点的简单旋转:

\documentclass[border=15pt,pstricks,12pt]{standalone}
\usepackage{pstricks-add}
\begin{document}
\begin{pspicture}[showgrid](-3,-3)(3,3)
    \psframe[dimen=m](-3,-3)(3,3)
    %%%
    \psclip{\parabola(3,3)(0,0)}%
    \rput{-90}(0,0){\parabola[fillstyle=hlines](3,3)(0,0)}
    \rput{90}(0,0){\parabola[fillstyle=hlines](3,3)(0,0)}
    \endpsclip
    \psclip{\parabola(-3,-3)(0,0)}%
    \rput{-90}(0,0){\parabola[fillstyle=hlines](3,3)(0,0)}
    \rput{90}(0,0){\parabola[fillstyle=hlines](3,3)(0,0)}
    \endpsclip
\end{pspicture}
\end{document}

或者更短的版本

\documentclass[border=15pt,pstricks,12pt]{standalone}
\usepackage{pstricks-add}
\def\Object{\psclip{\parabola(3,3)(0,0)}%
    \rput{-90}(0,0){\parabola[fillstyle=hlines](3,3)(0,0)}
    \rput{90}(0,0){\parabola[fillstyle=hlines](3,3)(0,0)}
    \endpsclip}
\begin{document}

\begin{pspicture}[showgrid](-3,-3)(3,3)
\psframe[dimen=m](-3,-3)(3,3)
\Object\rput{180}(0,0){\Object}
\end{pspicture}
\end{document}

或不进行剪辑:

\pscustom[fillstyle=hlines]{%
    \psplot{-3}{3}{-x^2/3}
    \psplot{3}{0}{-sqrt(3*x)}\psplot{0}{3}{sqrt(3*x)}
    \psplot{3}{-3}{x^2/3}
    \psplot{-3}{0}{sqrt(3*(-x))}\psplot{0}{-3}{-sqrt(3*(-x))}
}

或者

\pscustom[fillstyle=hlines]{%
    \psplot{-3}{3}{-x^2/3}
    \psparametricplot{-3}{3}{t^2/3 | t}
    \psplot{3}{-3}{x^2/3}
    \psparametricplot{3}{-3}{-t^2/3 | t}
}

答案2

使用以下方式绘图更简单swapaxes

\documentclass[border=15pt, pstricks, svgnames, 12pt]{standalone}
\usepackage{pstricks-add}

\begin{document}

\begin{pspicture}[showgrid](-3,-3)(3,3)
\psframe[dimen=m](-3,-3)(3,3)
%%%
\psset{linecolor=LightSlateGrey, hatchwidth=0.5pt, hatchsep=3pt, hatchcolor=LightSteelBlue}
\psclip{\parabola[](3, 3)(0, 0)}%
     \psset{swapaxes=true, fillstyle=vlines}
     \parabola(3,3)(0,0)
     \parabola(3,-3)(0,0)
\endpsclip
     %
\psclip{\parabola(-3, -3)(0, 0)}%
         \psset{swapaxes=true, fillstyle=vlines}
         \parabola(3,3)(0,0)
         \parabola(3,-3)(0,0)
\endpsclip
\end{pspicture}

\end{document} 

在此处输入图片描述

答案3

只是为了好玩:一个 TiZ 版本。

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{patterns}
\begin{document}
\begin{tikzpicture}
 \begin{scope}[every path/.append style={pattern=north west lines}]
  \draw (0,0) parabola (3,3)[rotate=90] parabola[bend pos=1] (0,6);
  \draw (0,0) parabola (-3,-3)[rotate=90] parabola[bend pos=1] (0,-6);
  \draw (0,0) parabola (-3,3)[rotate=-90] parabola[bend pos=1] (0,6);
  \draw (0,0) parabola (3,-3)[rotate=-90] parabola[bend pos=1] (0,-6);
 \end{scope}
 \draw (-3,-3) rectangle (3,3);
\end{tikzpicture}
\end{document}

在此处输入图片描述

人们也可以通过一条路径来完成这一任务,但随后旋转和移动就会开始累积。

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{patterns}
\begin{document}
\begin{tikzpicture}
  \draw[pattern=north west lines] (0,0) coordinate (O) parabola (3,3)
  [rotate=90] parabola[bend pos=1] (0,6) [rotate=0]
  parabola (-3,3) [rotate=90] parabola[bend pos=1] (O) [rotate=0]
  parabola (3,3) [rotate=-90] parabola[bend pos=1] (6,0) [rotate=0]
  parabola (9,3)[rotate=-90] parabola[bend pos=1] (12,0);
 \draw (-3,-3) rectangle (3,3);
\end{tikzpicture}
\end{document}

相关内容