[pstricks] Möbius Strip

Herbert Voss Herbert.Voss at fu-berlin.de
Mon Nov 19 16:31:16 CET 2007


Hensh, Richard schrieb:
> Can one use PStricks to render a Möbius Strip? Has this been done?

here is another one, Idea is from Juergen and the HSB stuff
from Manuel ...

Herbert


\documentclass{article}
\usepackage{pst-3dplot}
\makeatletter
\define at key[psset]{pst-3dplot}{HueBegin}{% Between 0 and 1
   \def\PstHSB at HueBegin{#1}}
\define at key[psset]{pst-3dplot}{HueEnd}{% Between 0 and 1
   \def\PstHSB at HueEnd{#1}}
\define at boolkey[psset]{pst-3dplot}[Pst@]{HSB}[true]{}
% Default values
\psset[pst-3dplot]{HueBegin=0,HueEnd=1,HSB=false}
\psset{dimen=outer}
\def\parametricPlotThreeD at iii{%   without arrows (quickplot)
   \addto at pscode{%
     \psk at ThreeDplot@yPlotpoints {
       /Counter 0 def
       /t tMin def
       xyz \@nameuse{beginqp@\psplotstyle}
       /t t dt add def
       \psk at ThreeDplot@xPlotpoints\space 1 sub {
         xyz
         /Counter Counter 1 add def
         1 Counter eq { moveto currentpoint /OldY ED /OldX ED }
         {\ifPst at HSB % Other points than the first one
          /PointY exch def
          /PointX exch def
          Counter \psk at ThreeDplot@xPlotpoints\space div
          \PstHSB at HueEnd\space
          \PstHSB at HueBegin\space sub mul
          \PstHSB at HueBegin\space add
          1 1 sethsbcolor
          OldX OldY PointX PointY lineto lineto
          stroke
          PointX PointY moveto
      /OldX PointX def /OldY PointY def
        \else lineto \fi } ifelse
         /t t dt add def
       } repeat
       /t t dt sub def
       /u u du add def
     } repeat
   }%
   \@nameuse{endqp@\psplotstyle}%
}
\makeatother

\begin{document}
\psset{Beta=20}
\begin{pspicture}(-4,-4)(4,4)
\def\Radius{5 }
\parametricplotThreeD[plotstyle=line,xPlotpoints=100,
   yPlotpoints=100,drawStyle=xyLines,HSB](0,365)(-1,1){
   t 2 div cos u mul \Radius add t cos mul
   t 2 div cos u mul \Radius add t sin mul
   t 2 div sin u mul }
%\pstThreeDCoor[xMin=-1,yMin=-1,zMin=-1]
\parametricplotThreeD[plotstyle=line,xPlotpoints=100,yPlotpoints=1,
    linecolor=red,linewidth=2pt](180,-180){
   t 2 div cos \Radius add t cos mul
   t 2 div cos \Radius add t sin mul
   t 2 div sin }
\end{pspicture}
\end{document}



More information about the PSTricks mailing list