[pstricks] Calculating curves in PsTricks

Chris Sangwin sangwinc at for.mat.bham.ac.uk
Wed Jun 27 14:10:36 CEST 2001

Dear all,

If this issue has been previously addressed then I apologize - I cannot
find solution posted on the web.

This is a problem I often encounter and the LaTeX file below is only a
typical example.

I wish to typeset a smooth curve using 

To use this I need to calculate a list of co-ordinates 


Typically I might have a complicated curve that needs many such points.  I
often typeset mathematical diagrams and need to *calculate* this list of
points - using something like the fp package.  This is what I've done
below.  I believe this sort of calculated typesetting of diagrams is very
much in the spirit of PST.

I'd like LaTeX to perform the calculations (rather than generating a list
of points with external C code and importing them) to keep the file self
contained.  I don't find the speed of the fp package too slow.

How do I connect the dots in the example below with a smooth curve (which
in this example happens to be an ellipse - but that would be cheating as
this is only an example of a more general problem!)

I would be very grateful for any suggestions.

Please note - if you've not used the multido and fp packages together
before you'll need to read the fp documentation first before it will


Dr C. J. Sangwin 
School of Mathematics and Statistics
University of Birmingham
Birmingham, B15 2TT
United Kingdom
+44 121 414 6197


\usepackage{graphicx}     % From LaTeX distribution
\usepackage{pst-all}      % From PSTricks
\usepackage{multido}      % From PSTricks



\FPeval\iY{\Ypsz * \iy / (\iy + 1.0)} % calculates Y-coodinate
\FPeval\iX{(\Ypsz - \iY)* \ix / \Xpsz} % calculates X-coodinate
}% end perspective calculate

% The horizontal perspective grid
\FPmul\iXX\iX{-1.0} % Exploits symmetry 
} % end of the horizontal grid

% some dots - I WANT TO CONNECT THESE!!!
\FPeval\Ry{ (\Rx * \Rx) / 30.0 }  % Defines the quadratic
\FPmul\iXX\iX{-1.0} % Exploits symmetry - so we'll have to loose this...


More information about the PSTricks mailing list