Telegraphics home

Sine waves in PostScript

Originally posted to comp.lang.ghostscript and ghostscript.com on 18 March 2001: PostScript snippet which demonstrates a simple but accurate method for plotting a (differentiable) function - e.g. f(x) = sin(x) - by breaking it into smooth Bezier curve segments. It requires that the function's derivative is defined analytically - e.g. f'(x) = cos(x).

Note that both Photoshop and Illustrator can parse the PostScript code (to respectively rasterise, or convert to artwork).

Sine wave

Back to software index (and download links)