/* cexpinvplot.c: plots e^(1/z) on the unit square */
#include <complex.h>
#include "complot.h"
#define DIM 256
complex double
cexpinv(complex double z)
{
return cexp(1 / z);
}
int
main()
{
/* plot cexpinv on the unit square to stdout */
complot(cexpinv, DIM, BANDED_CONTOUR, stdout);
}
Compile to cexpinvplot
and in a shell redirect its output to
an image of farbfeld format.
$ ./cexpinvplot > cexpinv.ff
Optionally one can of course convert this to png or other formats.
$ ff2png < cexpinv.ff > cexpinv.png
Or directly pipe it through.
$ ./cexpinvplot | ff2png > cexpinv.png
BANDED
, CONTOUR
, SMOOTH
,
or RIEMANN
to get banded, banded with black contours, smooth,
and the canonical coloring described above, respectively. So for a smooth image
with infinity mapped to black and zero mapped to white, one would call the function
as
complot(vals, width, height, SMOOTH_RIEMANN, stream);