[pstricks] more on computed coordinates
Zbigniew Nitecki
zbigniew.nitecki at tufts.edu
Fri Aug 8 20:40:48 CEST 2008
Thanks, Juergen and Michael. I don't know what was going on, but
somehow things seemed to work in the end. But now trying a more
complicated but analogous version of this, I run into trouble. I now
want to draw arrows from the plane tangent at (0,1,1) to z=x^2+y^2,
which has the
equation z=2y-1, to the graph. Here is my code, including some
function definitions (I will comment on the comments (:-) below):
*********************************************
\begin{pspicture}(-2.5,-3)(2.5,3.5)
\psset{Alpha=30}
% \psset{xunit=2cm, yunit=2cm}
\pstThreeDCoor[xMax=2,yMax=2,zMax=3]
\psplotThreeD[linecolor=gray,
drawStyle=xyLines,xPlotpoints=50,yPlotpoints=50]%
(-1.5,1.5)(0,1.5){x 2 exp y 2 exp add}
\newcommand{\zgraph}[2]{#1\space dup mul #2\space dup mul add}
\newcommand{\zplane}[2]{#2\space 2 mul 1 sub}
\newcommand{\thit}[2]%
{#2\space 2.5 #2\space mul 0.0625 add %
#1\space dup mul sub 1 sub 0.5 exp sub %
0.5 mul 0.125 add}
\newcommand{\yhit}[2]{#2\space \thit{#1}{#2}\space 2 mul sub}
\newcommand{\zhit}[2]{\zgraph{#1}{\yhit{#1}{#2}}}
\multido{\rx=-0.9+0.4}{6}{%
\multido{\ry=0.1+0.5}{3}{%
% \pstThreeDDot(\rx\space,\ry\space,\zplane{\rs}{\ry})
% \pstThreeDDot(\rx\space,\yhit{\rx}{\ry},\zhit{\rx}{\ry})
% \pstThreeDLine[linestyle=dashed, arrows=->]%
% (\rx\space,\ry\space,\zplane{\rs}{\ry})%
% (\rx\space,\yhit{\rx}{\ry},\zhit{\rx}{\ry})
}
}
% \pstThreeDDot(1,\yhit{1}{1},\zhit{1}{1})
% \pstThreeDLine[arrows=->](0.8,1,1)(0.8,0.62,1.18)
% \pstThreeDLine[arrows=->](1,1.5,2)(1,1.1,2.2)
% \pstThreeDLine[arrows=->](1,1.3,1.6)(1,0.9,1.8)
% \pstThreeDLine[arrows=->](1,1,1)(1,0.5,1.25)
\psplotThreeD[linecolor=lightgray, drawStyle=xyLines](-1,1)(0,2){y 2
mul 1 sub}
\pstThreeDDot(0,1,1)
\end{pspicture}
****************************************************************************************************
1. When the first line inside the multido is uncommented, it works fine.
2. When the second line inside the multido is uncommented, I get
*************************************************************************
Error: /undefinedresult in --exp--
Operand stack:
-0.9 0.1 0.1 -1.4975 0.5
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --
nostringval-- 2 %stopped_push --nostringval-- --
nostringval-- --nostringval-- false 1 %stopped_push 1813
1 3 %oparray_pop 1812 1 3 %oparray_pop 1808 1 3
%oparray_pop 1691 1 3 %oparray_pop --nostringval--
%errorexec_pop .runexec2 --nostringval-- --nostringval-- --
nostringval-- 2 %stopped_push --nostringval-- --
nostringval-- --nostringval--
Dictionary stack:
--dict:1084/1123(ro)(G)-- --dict:0/20(G)-- --dict:
113/200(L)-- --dict:179/300(L)-- --dict:102/200(L)-- --dict:56/400(L)--
--dict:0/10(L)-- --dict:102/200(L)-- --dict:95/200(L)--
Current allocation mode is local
Last OS error: 2
Current file position is 187224
GPL Ghostscript 8.57: Unrecoverable error, exit code 1
### FAILED to generate /tmp/altpdflatex.1535-1218220543/
picturetest.pdf ()
*************************************************************************************
I had initially thought that trying to square \ry=-0.9 via 2 exp could
hang up because of the exp of a negative, so I replaced 2 exp with dup
mul. This didn't help. However, the function definitions do seem to
work: when I put in explicit numbers (eg, commented line immediately
following the multido) it works fine.
I am of course not interested in placing these dots, but rather want
the arrows given by the third to fifth lines inside the multido. But
the dot placement commands tell me that the problem is with computing
the coordinates from parameters \rx and \ry.
Any suggestions?
Zbigniew Nitecki
Department of Mathematics
Tufts University
Medford, MA 02155
telephones:
Office (617)627-3843
Dept. (617)627-3234
Dept. fax (617)627-3966
http://www.tufts.edu/~znitecki/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://tug.org/pipermail/pstricks/attachments/20080808/226cb08d/attachment.html
More information about the PSTricks
mailing list