[pstricks] Need help with pst-3d

Alan Ristow ristow at ece.gatech.edu
Thu Feb 6 21:12:23 CET 2003


Hi all,

I'm attempting to draw a pseudo-3D diagram using pst-3d. The diagram
requires that I display several sets of orthogonal vectors on a 3D
coordinate system. I've tried several methods of getting the result that I
want, to no avail. Ideally, I would define my orthogonal set of vectors like
so:

    \newcommand{\orthovectors}{%
      \begin{pspicture}(0in,0in)(1in,1in)
        \psset{linewidth=2pt}%
        \ThreeDput[normal=0 0 1]{%
          \psline{->}(0,0)(1,0)%
          \psline{->}(0,0)(1,0)%
        }%
        \ThreeDput[normal=0 1 0]{%
          \psline{->}(0,0)(0,1)%
        }%
      \end{pspicture}
    }

then simply call \orthovectors when I wish to place my vectors. This works
well, provided I keep my vectors at the origin, but thus far I haven't been
able to find a way to translate and/or rotate the set of vectors together.
Putting the \orthovectors command into a \pscustom command so I can use
\translate doesn't work; \pstilt looks promising, but I haven't been able to
work out the syntax. Other non-3D commands like \rput don't seem to be able
to handle pseudo-3D graphics properly.

Even if there's no good way to define my vectors using \newcommand, I'm
still having trouble getting all three vectors to use the same origin when I
want them to intersect at a point other than (x,y,z)=(0,0,0). I use normal=0
0 1 to define my xy plane, for example, then draw two of the vectors. Then I
use normal=0 1 0 to define my xz plane and draw the third vector. Here is a
code snippet:

    \begin{pspicture}[-0.2](-2in,-1in)(2in,2in)
      \psset{viewpoint=1 1 1}%

	% Draw coordinate axes

      \ThreeDput[normal=0 0 1]{%
        \psline{->}(-3,0)(3,0)%
        \psline{->}(0,0)(0,3)%
      }%
      \ThreeDput[normal=0 1 0]{%
        \psline{->}(0,0)(0,3)%
      }%

	% Draw orthogonal vectors

	\ThreeDput[normal=0 0 1]{%
        \psline[linewidth=1.5pt]{->}(1.5,2.5)(1,2.1)%
        \psline[linewidth=1.5pt]{->}(1.5,2.5)(1.9,2)%
	}%
	\ThreeDput[normal=0 1 0]{%
        \psline[linewidth=1.5pt]{->}(1.5,2.5)(0,1)%
	}%
    \end{pspicture}

I've separated the drawing of the coordinate axes and the orthogonal vectors
for clarity. What I would like here is three orthogonal vectors with an
origin at (x,y,z)=(1.5,2.5,0). Clearly the final \psline command does not
give me this. I've tried messing with the location of the origin and such,
to no avail.

I have noticed that \ThreeDput can take an (x,y,z) argument as well, and
from the code in pst-3d it appears that this sets the dimensions of the 3D
object; however, I get the same results whether I include this information
or not. What am I missing? What would I use this set of arguments for?

I understand the mathematics involved here, and I am currently attempting to
understand the relevant TeX/LaTeX code, but at this point I'm still having
difficulty understanding how to use the package and whether it can do what I
am asking. Any pointers anybody might be able to give me would be greatly
appreciated.

Alan Ristow



More information about the PSTricks mailing list